package be.iminds.ilabt.jfed.experimenter_gui.editor.actions;

import be.iminds.ilabt.jfed.experimenter_gui.config.JFedGuiConfig;
import be.iminds.ilabt.jfed.experimenter_gui.dialogs.DialogsFactory;
import be.iminds.ilabt.jfed.experimenter_gui.editor.EditableRspec;
import be.iminds.ilabt.jfed.experimenter_gui.ui.progressbar.TaskService;

import be.iminds.ilabt.jfed.lowlevel.TestbedInfoSource;
import be.iminds.ilabt.jfed.lowlevel.authority.AuthorityFinder;
import be.iminds.ilabt.jfed.preferences.JFedPreferences;
import javafx.stage.Window;

import javax.inject.Inject;
import javax.inject.Singleton;

/**
 * User: twalcari
 * Date: 5/20/2015
 * Time: 09:43
 */
@Singleton
public class EditorActionsFactory {

    private final TaskService taskService;
    private final JFedPreferences jFedPreferences;
    private final TestbedInfoSource testbedInfoSource;
    private final AuthorityFinder authorityFinder;
    private final JFedGuiConfig conf;
    private final DialogsFactory dialogsFactory;

    @Inject
    public EditorActionsFactory(TaskService taskService, JFedPreferences jFedPreferences,
                                TestbedInfoSource testbedInfoSource, AuthorityFinder authorityFinder,
                                JFedGuiConfig conf, DialogsFactory dialogsFactory) {
        this.taskService = taskService;
        this.jFedPreferences = jFedPreferences;
        this.testbedInfoSource = testbedInfoSource;
        this.authorityFinder = authorityFinder;
        this.conf = conf;
        this.dialogsFactory = dialogsFactory;
    }

    public SaveRspecAction createSaveRspecAction(EditableRspec editableRspec, Window parentWindow) {
        return new SaveRspecAction(editableRspec, parentWindow, taskService, jFedPreferences);
    }

    public ProcessUnboundNodesAction createProcessUnboundNodesAction(EditableRspec editableRspec, Window parentWindow) {
        return new ProcessUnboundNodesAction(editableRspec, parentWindow, testbedInfoSource, conf);
    }

    public StartExperimentAction createStartExperimentAction(EditableRspec editableRspec, Window parentWindow) {
        return new StartExperimentAction(editableRspec, parentWindow, this, testbedInfoSource, authorityFinder, dialogsFactory);
    }

    public CreateReservationAction createCreateReservationAction(EditableRspec editableRspec, Window parentWindow) {
        return new CreateReservationAction(editableRspec, parentWindow, this, testbedInfoSource, authorityFinder, dialogsFactory);
    }
}
