package TodoListApp.GUI_UserInterface;


import java.awt.*;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;

import TodoListApp.Domain.*;

public class GUI_addTask extends JFrame {

    private JPanel contentPane;
    private JTextField tasktitle;
    private JTextField taskBeschreibung;
    private ButtonGroup priorityGroup;
    private JButton submitTask;
    private JRadioButton hoch, mittel,niedrig ;
    
    public GUI_addTask() {
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE );
        setBounds(100, 100, 515, 618);
        contentPane = new JPanel();
        contentPane.setBackground(new Color(255, 255, 255));
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

        setContentPane(contentPane);
        contentPane.setLayout(null);
        
        JPanel panel = new JPanel();
        panel.setBorder(new LineBorder(new Color(255, 255, 255), 3));
        panel.setBackground(new Color(0, 128, 255));
        panel.setForeground(new Color(255, 255, 255));
        panel.setBounds(31, 26, 441, 517);
        contentPane.add(panel);
        panel.setLayout(null);
        
        JLabel lblNewLabel = new JLabel("Füge Task hinzu");
        lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18));
        lblNewLabel.setForeground(new Color(255, 255, 255));
        lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
        lblNewLabel.setBounds(76, 11, 289, 58);
        panel.add(lblNewLabel);
        
        JLabel lblNewLabel_1 = new JLabel("Title:");
        lblNewLabel_1.setForeground(new Color(255, 255, 255));
        lblNewLabel_1.setHorizontalAlignment(SwingConstants.LEFT);
        lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 14));
        lblNewLabel_1.setBounds(24, 79, 103, 14);
        panel.add(lblNewLabel_1);
        
        JLabel lblNewLabel_1_1 = new JLabel("Beschreibung: ");
        lblNewLabel_1_1.setHorizontalAlignment(SwingConstants.LEFT);
        lblNewLabel_1_1.setForeground(Color.WHITE);
        lblNewLabel_1_1.setFont(new Font("Tahoma", Font.BOLD, 14));
        lblNewLabel_1_1.setBounds(24, 121, 103, 14);
        panel.add(lblNewLabel_1_1);
        
        JLabel lblNewLabel_1_3 = new JLabel("Priorität:");
        lblNewLabel_1_3.setHorizontalAlignment(SwingConstants.LEFT);
        lblNewLabel_1_3.setForeground(Color.WHITE);
        lblNewLabel_1_3.setFont(new Font("Tahoma", Font.BOLD, 14));
        lblNewLabel_1_3.setBounds(24, 203, 103, 14);
        panel.add(lblNewLabel_1_3);
        
        tasktitle = new JTextField();
        tasktitle.setBounds(142, 77, 133, 20);
        panel.add(tasktitle);
        tasktitle.setColumns(10);
        
        taskBeschreibung = new JTextField();
        taskBeschreibung.setColumns(10);
        taskBeschreibung.setBounds(142, 119, 133, 20);
        panel.add(taskBeschreibung);
        
        // RadioButtons erstellen
        hoch = new JRadioButton("Hoch");
        hoch.setSelected(true);
        hoch.setBounds(142, 165, 89, 23);
        panel.add(hoch);
        
        mittel = new JRadioButton("Mittel");
        mittel.setBounds(142, 201, 89, 23);
        panel.add(mittel);
        
        niedrig = new JRadioButton("Niedrig");
        niedrig.setBounds(142, 240, 89, 23);
        panel.add(niedrig);
        
        // ButtonGroup erstellen, um die RadioButtons zu gruppieren
        priorityGroup = new ButtonGroup();
        priorityGroup.add(hoch);
        priorityGroup.add(mittel);
        priorityGroup.add(niedrig);
        
        submitTask = new JButton("Submit");
        submitTask.setBounds(24, 323, 123, 23);
        panel.add(submitTask);
        setLocationRelativeTo(null); 
    }
    
    public void zeigeFensterAddTask() {
    	this.setVisible(true);
    }
    
    public void closeFensterAddTask() {
    	this.setVisible(false);
    }

	public JTextField getTasktitle() {
		return tasktitle;
	}

	public void setTasktitle(JTextField tasktitle) {
		this.tasktitle = tasktitle;
	}

	public JTextField getTaskBeschreibung() {
		return taskBeschreibung;
	}

	public void setTaskBeschreibung(JTextField taskBeschreibung) {
		this.taskBeschreibung = taskBeschreibung;
	}

	public ButtonGroup getPriorityGroup() {
		return priorityGroup;
	}

	public JButton getSubmitTask() {
		return submitTask;
	}

	public JRadioButton getHoch() {
		return hoch;
	}

	public JRadioButton getMittel() {
		return mittel;
	}

	public JRadioButton getNiedrig() {
		return niedrig;
	}
	
	public void resetButtons() {
		tasktitle.setText("");
		taskBeschreibung.setText("");
		hoch.setSelected(true);
	}
	
	public void showInfo(String message) {
		  JOptionPane.showMessageDialog(null, message, "Studen angemeldet", JOptionPane.INFORMATION_MESSAGE);
	}
}

