"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseFlowStepEditor = void 0;
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const AppGlueError_1 = require("@appglue/common/dist/AppGlueError");
const RegisterFlowEditor_1 = require("../Utilities/RegisterFlowEditor");
const AutoBind_1 = require("@appglue/common/dist/Common/AutoBind");
const StateManager_1 = require("@appglue/common/dist/Common/StateManager");
const FlowStepSequence_1 = require("@appglue/common/dist/Flow/Structure/FlowStepSequence");
class BaseFlowStepEditor extends react_1.default.Component {
    constructor() {
        super({}, {});
    }
    _editContext;
    get editContext() {
        if (!this._editContext)
            throw new AppGlueError_1.AppGlueError("edit context not set");
        return this._editContext;
    }
    set editContext(value) {
        this._editContext = value;
    }
    get shouldShowDescription() {
        return this.getFlowStepData().shouldShowDescription;
    }
    set shouldShowDescription(value) {
        this.getFlowStepData().shouldShowDescription = value;
    }
    get description() {
        return this.getFlowStepData().description;
    }
    set description(value) {
        this.getFlowStepData().description = value;
    }
    get name() {
        return this.getFlowStepData().name;
    }
    set name(value) {
        this.getFlowStepData().name = value;
    }
    get _id() {
        return this.getFlowStepData()._id;
    }
    set _id(value) {
        this.getFlowStepData()._id = value;
    }
    get icon() {
        const icon = RegisterFlowEditor_1.FlowStepEditorRegistration.getByTypeName(this.type)?.icon;
        return icon;
    }
    get type() {
        return this.getFlowStepData().__type;
    }
    stepUpdate() {
        StateManager_1.StateManager.changed(this);
        StateManager_1.StateManager.changed(this.getFlowStepData());
        if (this.getFlowStepData().sequence)
            StateManager_1.StateManager.propertyChanged(this.getFlowStepData().sequence, FlowStepSequence_1.FlowStepSequence.STEPS_CHANGED);
    }
    // forces refresh of entire designer (expensive)
    designerUpdate() {
        //        this.getFormContext()?.refreshDesigner();
    }
}
tslib_1.__decorate([
    AutoBind_1.AutoBind
], BaseFlowStepEditor.prototype, "stepUpdate", null);
tslib_1.__decorate([
    AutoBind_1.AutoBind
], BaseFlowStepEditor.prototype, "designerUpdate", null);
exports.BaseFlowStepEditor = BaseFlowStepEditor;
//# sourceMappingURL=BaseFlowStepEditor.js.map