package ch.zhaw.gartenverwaltung;

import ch.zhaw.gartenverwaltung.types.HardinessZone;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;

import java.net.URL;
import java.util.ResourceBundle;

public class SettingsController implements Initializable {
    Settings settings = Settings.getInstance();

    @FXML
    private ComboBox<HardinessZone> selectHardinessZone_comboBox;

    @FXML
    private CheckBox showTutorial_checkBox;

    /**
     * save selected values to {@link Settings}
     */
    public void saveSettings() {
        settings.setShowTutorial(showTutorial_checkBox.isSelected());
        settings.setCurrentHardinessZone(selectHardinessZone_comboBox.getValue());
    }

    /**
     * save default values form {@link Settings}
     * @param location location
     * @param resources resources
     */
    @Override
    public void initialize(URL location, ResourceBundle resources) {
        showTutorial_checkBox.setSelected(settings.getShowTutorial());
        selectHardinessZone_comboBox.getItems().addAll(HardinessZone.values());
        selectHardinessZone_comboBox.setValue(settings.getCurrentHardinessZone());
    }
}
