"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StatementRuleEditContext = void 0;
const tslib_1 = require("tslib");
const StateManager_1 = require("@appglue/common/dist/Common/StateManager");
const AutoBind_1 = require("@appglue/common/dist/Common/AutoBind");
const RuleBuilderPage_1 = require("@appglue/common/dist/Rule/RuleBuilderPage");
class StatementRuleEditContext {
    designConfig;
    runtimeConfig;
    clipboardElement;
    lastSelectionElement;
    mode = RuleBuilderPage_1.RuleBuilderPage.Rule;
    definition;
    title;
    onRuleSave;
    onRuleCancel;
    _openLinkingDialog = false;
    constructor(rule) {
        this.definition = rule;
    }
    _notification;
    get notification() {
        return this._notification;
    }
    set notification(notification) {
        this._notification = notification;
        StateManager_1.StateManager.propertyChanged(this, "notification");
    }
    get openLinkDialog() {
        return this._openLinkingDialog;
    }
    set openLinkDialog(open) {
        this._openLinkingDialog = open;
        StateManager_1.StateManager.propertyChanged(this, "openLinkDialog");
    }
    _linkData = {
        period: "every_day",
        periodData: {
            period: "day",
            times: 0,
            onWeekDays: [],
            at: "1",
            value: 1,
        },
        storeData: true,
        serviceSetting: false,
        format: "csv",
    };
    get linkData() {
        return this._linkData;
    }
    set linkData(data) {
        this._linkData = data;
        StateManager_1.StateManager.propertyChanged(this, "linkData");
    }
    onSave() {
        if (this.title) {
            this.definition.title = this.title;
        }
        if (this.onRuleSave) {
            this.onRuleSave();
        }
    }
    onCancel() {
        this.title = this.definition.title;
        if (this.onRuleCancel) {
            this.onRuleCancel();
        }
    }
    // eslint-disable-next-line
    onCopy(id) { }
    // eslint-disable-next-line
    onCut(id) { }
    // eslint-disable-next-line
    onDelete(id) { }
    // eslint-disable-next-line
    onPaste(id) { }
}
tslib_1.__decorate([
    AutoBind_1.AutoBind
], StatementRuleEditContext.prototype, "onSave", null);
tslib_1.__decorate([
    AutoBind_1.AutoBind
], StatementRuleEditContext.prototype, "onCancel", null);
exports.StatementRuleEditContext = StatementRuleEditContext;
//# sourceMappingURL=StatementRuleEditContext.js.map