import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.stage.Stage;

public class AddController {

    private IFachkonzept fachkonzept;

    @FXML
    private ResourceBundle resources;

    @FXML
    private URL location;

    @FXML
    private Button abbrechen;

    @FXML
    private Button hinzufuegen;

    @FXML
    private TextField maschinenName;

    @FXML
    void abbrechen(ActionEvent event) {
        Stage stage = (Stage) abbrechen.getScene().getWindow();
        stage.close();
    }

    @FXML
    void hinzufuegen(ActionEvent event) {
        fachkonzept.kaffeemaschineHinzufuegen(maschinenName.getText());
        Stage stage = (Stage) hinzufuegen.getScene().getWindow();
        stage.close();
    }

    public AddController() {

        fachkonzept = new Fachkonzept1();
        // oder
        //fachkonzept = new Fachkonzept2()
    }

    @FXML
    void initialize() {
        assert abbrechen != null : "fx:id=\"abbrechen\" was not injected: check your FXML file 'Untitled'.";
        assert hinzufuegen != null : "fx:id=\"hinzufuegen\" was not injected: check your FXML file 'Untitled'.";
        assert maschinenName != null : "fx:id=\"maschinenName\" was not injected: check your FXML file 'Untitled'.";
    }
}
