package be.iminds.ilabt.jfed.experimenter_gui.canvas.rspec;

import be.iminds.ilabt.jfed.experimenter_gui.config.JFedGuiConfig;

import be.iminds.ilabt.jfed.lowlevel.TestbedInfoSource;
import be.iminds.ilabt.jfed.rspec.model.javafx_impl.*;

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

/**
 * User: twalcari
 * Date: 12/2/2014
 * Time: 16:18
 */
@Singleton
public class CanvasNodeFactory {

    private final TestbedInfoSource testbedInfoSource;
    private final JFedGuiConfig config;

    @Inject
    public CanvasNodeFactory(TestbedInfoSource testbedInfoSource, JFedGuiConfig config) {
        this.testbedInfoSource = testbedInfoSource;
        this.config = config;
    }

    public RspecCanvasNode createRspecCanvasNode(FXRspecNode node){
        if (node instanceof DelayRspecNode)
            return new DelayRspecCanvasNode((DelayRspecNode) node, testbedInfoSource, config);
        else
            return new RspecCanvasNode(node, testbedInfoSource, config);
    }


    public RspecChannelCanvasNode createRspecChannelCanvasNode(FXRspecChannel rspecChannel) {
        return new RspecChannelCanvasNode(rspecChannel, testbedInfoSource, config);
    }

    public RspecGTSNode createRspecGTSNode(FXGeantTestbedType gtt) {
        return new RspecGTSNode(gtt);

    }

    public AddressPoolCanvasNode createAddressPoolCanvasNode(FXAddressPool addressPool){
        return new AddressPoolCanvasNode(addressPool, testbedInfoSource,config);
    }
}
