import { StateManager } from "../../../CommonUI/StateManagement/StateManager";
import { RuleBuilderPage } from "../../DesignUI/RuleBuilderPage";
export class ValueTableRuleEditContext {
    constructor(definition) {
        this.mode = RuleBuilderPage.Rule;
        this._openLinkingDialog = false;
        this._linkData = {
            period: "every_day",
            periodData: {
                period: "day",
                times: 0,
                onWeekDays: [],
                at: "1",
                value: 1,
            },
            storeData: true,
            serviceSetting: false,
            format: "csv",
        };
        this.navigate = (direction) => {
            var _a, _b, _c, _d;
            if (!this.selectedCell)
                return;
            let newCell = null;
            if (direction === "Left") {
                newCell = (_a = this.definition) === null || _a === void 0 ? void 0 : _a.getPrevCell(this.selectedCell);
            }
            else if (direction === "Right" || direction === "Tab") {
                newCell = (_b = this.definition) === null || _b === void 0 ? void 0 : _b.getNextCell(this.selectedCell);
            }
            else if (direction === "Down") {
                newCell = (_c = this.definition) === null || _c === void 0 ? void 0 : _c.getNextRowCell(this.selectedCell);
            }
            else if (direction === "Up") {
                newCell = (_d = this.definition) === null || _d === void 0 ? void 0 : _d.getPrevRowCell(this.selectedCell);
            }
            if (newCell) {
                this.selectedCell = newCell;
            }
        };
        this.definition = definition;
    }
    set selectedColumnHeader(col) {
        this._selectedColumnHeader = col;
        StateManager.propertyChanged(this, "selectedColumnHeader");
    }
    get selectedColumnHeader() {
        return this._selectedColumnHeader;
    }
    set selectedColForVariable(col) {
        this._selectedColForVariable = col;
        StateManager.propertyChanged(this, "selectedColForVariable");
    }
    get selectedColForVariable() {
        return this._selectedColForVariable;
    }
    set selectedColForRule(col) {
        this._selectedColForRule = col;
        StateManager.propertyChanged(this, "selectedColForRule");
    }
    get selectedColForRule() {
        return this._selectedColForRule;
    }
    set selectedCellForSettings(cell) {
        this._selectedCellForSettings = cell;
        StateManager.propertyChanged(this, "selectedCellForSettings");
    }
    get selectedCellForSettings() {
        return this._selectedCellForSettings;
    }
    set selectedCell(cell) {
        this._selectedCell = cell;
        StateManager.propertyChanged(this, "selectedCell");
    }
    get selectedCell() {
        return this._selectedCell;
    }
    isSelected(cell) {
        return this._selectedCell === cell;
    }
    onCopy(id) { }
    onCut(id) { }
    onDelete(id) { }
    onPaste(id) { }
    set notification(notification) {
        this._notification = notification;
        StateManager.propertyChanged(this, "notification");
    }
    get notification() {
        return this._notification;
    }
    set openLinkDialog(open) {
        this._openLinkingDialog = open;
        StateManager.propertyChanged(this, "openLinkDialog");
    }
    get openLinkDialog() {
        return this._openLinkingDialog;
    }
    set linkData(data) {
        this._linkData = data;
        StateManager.propertyChanged(this, "linkData");
    }
    get linkData() {
        return this._linkData;
    }
    setSelected(cell) {
        this.selectedCell = cell;
    }
}
//# sourceMappingURL=ValueTableRuleEditContext.js.map