import { BooleanDataDefinition } from "../Data/Definitions/BooleanDataDefinition";
import { BaseExecutable } from "./BaseExecutable";
import { ConfigStorageUtility } from "../ConfigStorageUtility";
export class RuleExecutable extends BaseExecutable {
    get executionResult() {
        return this._executionResult;
    }
    set executionResult(value) {
        this._executionResult = value;
    }
    getRuleResult() {
        if (!this._executionResult) {
            return this._executionResultCache || new BooleanDataDefinition();
        }
        if (this._executionResult instanceof Function)
            return this._executionResult();
        else
            return this._executionResult;
    }
    get canChangeOutputs() {
        return !this._executionResult || !(this._executionResult instanceof Function);
    }
    getStorageData() {
        let data = super.getStorageData();
        Reflect.set(data, "executionResultCache", this.getRuleResult().getStorageData());
        return data;
    }
    setStorageData(data) {
        super.setStorageData(data);
        let resultData = Reflect.get(data, "executionResultCache");
        if (resultData) {
            this._executionResultCache = ConfigStorageUtility.getDataDefinitionFromData(resultData);
        }
    }
}
//# sourceMappingURL=RuleExecutable.js.map