import * as SRD from "storm-react-diagrams";
import { LightInformationNodeWidget } from "./lightInformationNodeWidget";
import { LightInformationNodeModel } from "./lightInformationNodeModel";
import * as React from "react";
import { GlobalState } from '../../../globalState';

/**
 * Node factory which creates editor nodes
 */
export class LightInformationNodeFactory extends SRD.AbstractNodeFactory {
    private _globalState: GlobalState;

	/**
	 * Constructs a LightNodeFactory
	 */
    constructor(globalState: GlobalState) {
        super("light-information");

        this._globalState = globalState;
    }

	/**
	 * Generates a node widget
	 * @param diagramEngine diagram engine
	 * @param node node to generate
	 * @returns node widget jsx
	 */
    generateReactWidget(diagramEngine: SRD.DiagramEngine, node: LightInformationNodeModel): JSX.Element {
        return <LightInformationNodeWidget node={node} globalState={this._globalState} />;
    }

	/**
	 * Gets a new instance of a node model
	 * @returns light node model
	 */
    getNewInstance() {
        return new LightInformationNodeModel();
    }
}