import { jsx as _jsx } from "react/jsx-runtime";
import { XDataDefinition } from "../../../Common/Data/XDataDefinition";
import { MultiExecutableOutputDefinition } from "../../../Common/Execution/MultiExecutable";
import { XFormConfiguration } from "../../../Form/XFormConfiguration";
import { BaseFlowStep } from "../BaseFlowStep";
import { FormEditUI } from "./FormEditUI";
export class FormStep extends BaseFlowStep {
    constructor() {
        super();
        this.form = new XFormConfiguration();
        this.form.inputData = () => {
            var _a, _b;
            return ((_b = (_a = this.sequence) === null || _a === void 0 ? void 0 : _a.flow) === null || _b === void 0 ? void 0 : _b.getInputDefinition()) || new XDataDefinition();
        };
    }
    run(data, complete) { }
    renderEditUI() {
        return (_jsx(FormEditUI, { form: this.form, onSave: (formConf) => {
                var _a, _b;
                this.form.setStorageData(formConf);
                this.stepUpdate();
                (_b = (_a = this.sequence) === null || _a === void 0 ? void 0 : _a.editContext) === null || _b === void 0 ? void 0 : _b.refreshSequences();
            }, onClose: () => { }, name: this.name, onFormNameUpdate: (formName) => {
                this.name = formName;
                this.stepUpdate();
            } }, void 0));
    }
    getOutcomes() {
        // todo: we need to add the link action.
        const outcomes = this.form.getOutcomes();
        if (outcomes.length) {
            return [new MultiExecutableOutputDefinition("next"), ...outcomes];
        }
        return outcomes;
    }
}
export class GetFile extends BaseFlowStep {
    renderEditUI() {
        return _jsx("div", { children: "get file step" }, void 0);
    }
    run(data, complete) { }
}
export class AssignTask extends BaseFlowStep {
    renderEditUI() {
        return _jsx("div", { children: "assign task step" }, void 0);
    }
    run(data, complete) { }
}
export class Approval extends BaseFlowStep {
    renderEditUI() {
        return _jsx("div", { children: "approval step" }, void 0);
    }
    run(data, complete) { }
}
export class GetComment extends BaseFlowStep {
    renderEditUI() {
        return _jsx("div", { children: "get comment step" }, void 0);
    }
    run(data, complete) { }
}
export class GetRating extends BaseFlowStep {
    renderEditUI() {
        return _jsx("div", { children: "get rating step" }, void 0);
    }
    run(data, complete) { }
}
export class Voting extends BaseFlowStep {
    renderEditUI() {
        return _jsx("div", { children: "voting step" }, void 0);
    }
    run(data, complete) { }
}
//# sourceMappingURL=FormStep.js.map