package be.iminds.ilabt.jfed.experimenter_gui.slice;

import be.iminds.ilabt.jfed.experiment.ExperimentController;
import be.iminds.ilabt.jfed.experimenter_gui.config.JFedGuiConfig;
import be.iminds.ilabt.jfed.experimenter_gui.canvas.rspec.CanvasNodeFactory;
import be.iminds.ilabt.jfed.experimenter_gui.slice.actions.ExperimentActionsFactory;
import be.iminds.ilabt.jfed.experimenter_gui.util.SSHTerminalUtil;

import be.iminds.ilabt.jfed.highlevel.tasks.HighLevelTaskFactory;
import be.iminds.ilabt.jfed.highlevel.util.AggregateManagerWrapperFactory;
import be.iminds.ilabt.jfed.lowlevel.GeniUserProvider;
import be.iminds.ilabt.jfed.lowlevel.TestbedInfoSource;
import be.iminds.ilabt.jfed.lowlevel.authority.AuthorityFinder;
import be.iminds.ilabt.jfed.rspec.model.javafx_impl.FXModelRspec;

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

/**
 * User: twalcari
 * Date: 12/8/2014
 * Time: 14:15
 */
@Singleton
public class SliceExperimentCanvasFactory {


    private final JFedGuiConfig config;
    private final CanvasNodeFactory canvasNodeFactory;
    private final GeniUserProvider geniUserProvider;
    private final TestbedInfoSource testbedInfoSource;
    private final AuthorityFinder authorityFinder;
    private final HighLevelTaskFactory hltf;
    private final NodePropertiesDialogFactory nodePropertiesDialogFactory;
    private final ExperimentActionsFactory experimentActionsFactory;
    private final SSHTerminalUtil sshTerminalUtil;
    private final AggregateManagerWrapperFactory aggregateManagerWrapperFactory;

    @Inject
    public SliceExperimentCanvasFactory(JFedGuiConfig config, CanvasNodeFactory canvasNodeFactory,
                                        GeniUserProvider geniUserProvider, TestbedInfoSource testbedInfoSource, AuthorityFinder authorityFinder,
                                        HighLevelTaskFactory hltf, NodePropertiesDialogFactory nodePropertiesDialogFactory,
                                        ExperimentActionsFactory experimentActionsFactory, SSHTerminalUtil sshTerminalUtil,
                                        AggregateManagerWrapperFactory aggregateManagerWrapperFactory) {
        this.config = config;
        this.canvasNodeFactory = canvasNodeFactory;
        this.geniUserProvider = geniUserProvider;
        this.testbedInfoSource = testbedInfoSource;
        this.authorityFinder = authorityFinder;
        this.hltf = hltf;
        this.nodePropertiesDialogFactory = nodePropertiesDialogFactory;
        this.experimentActionsFactory = experimentActionsFactory;
        this.sshTerminalUtil = sshTerminalUtil;
        this.aggregateManagerWrapperFactory = aggregateManagerWrapperFactory;
    }

    public SliceExperimentCanvas createSliceExperimentCanvas(ExperimentController experimentController, FXModelRspec model) {
        return new SliceExperimentCanvas(experimentController, model, config, canvasNodeFactory, experimentActionsFactory, geniUserProvider,
                testbedInfoSource, authorityFinder, hltf, nodePropertiesDialogFactory, sshTerminalUtil, aggregateManagerWrapperFactory);
    }
}
