"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRuleTableWithData = exports.getRuleTableWithMultipleEmptyRows = exports.getEmptyRuleTable = void 0;
const tslib_1 = require("tslib");
const DataTestData_1 = require("@appglue/common/dist/Common/Data/DataTestData");
const RuleTableConfiguration_1 = require("@appglue/common/dist/Rule/Table/Rule/RuleTableConfiguration");
const LogicExpressions = tslib_1.__importStar(require("../../../../Expressions/Testing/LogicData"));
const BooleanDataDefinition_1 = require("@appglue/common/dist/Common/Data/Definitions/BooleanDataDefinition");
const getEmptyRuleTable = () => {
    return new RuleTableConfiguration_1.RuleTableConfiguration();
};
exports.getEmptyRuleTable = getEmptyRuleTable;
const getRuleTableWithMultipleEmptyRows = () => {
    const ruleDefinition = new RuleTableConfiguration_1.RuleTableConfiguration();
    ruleDefinition.addRuleColumn();
    ruleDefinition.addRuleColumn();
    ruleDefinition.addRuleColumn();
    ruleDefinition.addRow();
    ruleDefinition.addRow();
    ruleDefinition.addRow();
    ruleDefinition.addRow();
    return ruleDefinition;
};
exports.getRuleTableWithMultipleEmptyRows = getRuleTableWithMultipleEmptyRows;
const getRuleTableWithData = () => {
    const ruleDefinition = new RuleTableConfiguration_1.RuleTableConfiguration();
    const dataDefinition = (0, DataTestData_1.getFilledDataDefinition)();
    ruleDefinition.inputData = dataDefinition;
    for (let f of dataDefinition.fields) {
        const ruleColumn = ruleDefinition.addRuleColumn(f.name);
        ruleColumn.path = f.name;
    }
    dataDefinition.fields.push(new BooleanDataDefinition_1.BooleanDataDefinition("result"));
    ruleDefinition.resultColumns[0].name = "boolean";
    let row = ruleDefinition.addRow();
    row.cells[0].expression = LogicExpressions.getLogicExpressionElseIf();
    ruleDefinition.rows[0].cells[0].expression = LogicExpressions.getLogicExpressionElseIf();
    ruleDefinition.rows[0].cells[1].expression = LogicExpressions.getLogicExpression();
    ruleDefinition.rows[0].cells[2].expression = LogicExpressions.getIfSimpleRule();
    ruleDefinition.rows[0].cells[3].expression = LogicExpressions.getIfElseSimpleRule();
    row = ruleDefinition.addRow();
    row.cells[0].expression = LogicExpressions.getLogicExpressionElseIf();
    ruleDefinition.rows[1].cells[0].expression = LogicExpressions.getLogicExpressionResultElseIfAtEnd();
    ruleDefinition.rows[1].cells[1].expression = LogicExpressions.getLogicExpressionElseIfElseWithSubWithBlanks();
    return ruleDefinition;
};
exports.getRuleTableWithData = getRuleTableWithData;
//# sourceMappingURL=TestDataSetup.js.map