import { BooleanDataDefinition } from "../../../../Common/Data/Definitions/BooleanDataDefinition";
import { DateDataDefinition } from "../../../../Common/Data/Definitions/DateDataDefinition";
import { NumberDataDefinition } from "../../../../Common/Data/Definitions/NumberDataDefinition";
import { StringDataDefinition } from "../../../../Common/Data/Definitions/StringDataDefinition";
import { XDataDefinition } from "../../../../Common/Data/XDataDefinition";
import { getFilledDataDefinition } from "../../../../CommonUI/DataDesigner/Testing/DataTestData";
import { getEmptyDataDefinition } from "../../../../CommonUI/DataEditing/Testing/TestData";
import { DateGreaterThanExpression } from "../../../../Expressions/ExpressionElements/Date/DateGreaterThanExpression";
import { GreaterThanExpression } from "../../../../Expressions/ExpressionElements/Logic/GreaterThan";
import { StringEndWithExpression } from "../../../../Expressions/ExpressionElements/String/StringEndWithExpression";
import { ValueTableDefinition } from "../ValueTableDefinition";
export const getEmptyValueTable = () => {
    return new ValueTableDefinition();
};
export const getValueTableString = (readonly) => {
    const ruleDefinition = new ValueTableDefinition();
    const dataDefinition = getEmptyDataDefinition();
    ruleDefinition.inputData = readonly
        ? () => {
            return dataDefinition;
        }
        : dataDefinition;
    ruleDefinition.columns[0].columnName = "firstName";
    ruleDefinition.columns[0].cellData = new StringDataDefinition("cellValue");
    dataDefinition.fields.push(new StringDataDefinition("firstName"));
    ruleDefinition.addRow();
    ruleDefinition.rows[0].cells[0].values = "Bruno";
    return ruleDefinition;
};
export const getValueTableStringList = (readonly) => {
    const ruleDefinition = new ValueTableDefinition();
    const dataDefinition = getEmptyDataDefinition();
    ruleDefinition.inputData = readonly
        ? () => {
            return dataDefinition;
        }
        : dataDefinition;
    ruleDefinition.columns[0].columnName = "firstName";
    ruleDefinition.columns[0].cellData = new StringDataDefinition("cellValue");
    dataDefinition.fields.push(new StringDataDefinition("firstName"));
    ruleDefinition.addRow();
    ruleDefinition.rows[0].cells[0].values = ["Bruno", "James", "Martin", "Cristiano"];
    return ruleDefinition;
};
export const getValueTableDate = (rule, readonly) => {
    const ruleDefinition = new ValueTableDefinition();
    const dataDefinition = getEmptyDataDefinition();
    ruleDefinition.inputData = readonly
        ? () => {
            return dataDefinition;
        }
        : dataDefinition;
    ruleDefinition.columns[0].columnName = "birthday";
    ruleDefinition.columns[0].cellData = new DateDataDefinition("cellValue");
    dataDefinition.fields.push(new DateDataDefinition("birthday"));
    ruleDefinition.addRow();
    return ruleDefinition;
};
export const getValueTableNumber = (rule, readonly) => {
    const ruleDefinition = new ValueTableDefinition();
    const dataDefinition = getEmptyDataDefinition();
    ruleDefinition.inputData = readonly
        ? () => {
            return dataDefinition;
        }
        : dataDefinition;
    ruleDefinition.columns[0].columnName = "age";
    ruleDefinition.columns[0].cellData = new NumberDataDefinition("cellValue");
    dataDefinition.fields.push(new NumberDataDefinition("age"));
    ruleDefinition.addRow();
    return ruleDefinition;
};
export const getValueTableBoolean = (rule, readonly) => {
    const ruleDefinition = new ValueTableDefinition();
    const dataDefinition = getEmptyDataDefinition();
    ruleDefinition.inputData = readonly
        ? () => {
            return dataDefinition;
        }
        : dataDefinition;
    dataDefinition.fields.push(new BooleanDataDefinition("married"));
    ruleDefinition.columns[0].columnName = "married";
    ruleDefinition.columns[0].cellData = new BooleanDataDefinition("cellValue");
    ruleDefinition.addRow();
    return ruleDefinition;
};
export const getValueTableWithDeferentType = (readonly) => {
    const ruleDefinition = new ValueTableDefinition();
    const dataDefinition = getFilledDataDefinition();
    ruleDefinition.inputData = readonly
        ? () => {
            return dataDefinition;
        }
        : dataDefinition;
    dataDefinition.fields.push(new NumberDataDefinition("age"));
    ruleDefinition.columns[0].columnName = "stringfield";
    ruleDefinition.columns[0].cellData = new StringDataDefinition("cellValue");
    let strendwith = new StringEndWithExpression();
    strendwith.value1.variableName = "cellValue";
    strendwith.value2.value = "Chachin";
    ruleDefinition.columns[0].expression.expression = strendwith;
    ruleDefinition.addColumn();
    ruleDefinition.columns[1].columnName = "isMarried";
    ruleDefinition.columns[1].cellData = new BooleanDataDefinition("cellValue");
    ruleDefinition.columns[1].expression.variableName = "cellValue";
    let birthday = new DateDataDefinition("birthday");
    dataDefinition.fields.push(birthday);
    let dategreaterthan = new DateGreaterThanExpression();
    dategreaterthan.value1.variableName = "cellValue";
    dategreaterthan.value2.value = "1980-01-01";
    ruleDefinition.addColumn();
    ruleDefinition.columns[2].columnName = "birthday";
    ruleDefinition.columns[2].cellData = new DateDataDefinition("cellValue");
    ruleDefinition.columns[2].expression.expression = dategreaterthan;
    let greaterthan = new GreaterThanExpression();
    greaterthan.value1.variableName = "cellValue";
    greaterthan.value2.variableName = "age";
    ruleDefinition.addColumn();
    ruleDefinition.columns[3].columnName = "age";
    ruleDefinition.columns[3].cellData = new NumberDataDefinition("cellValue");
    ruleDefinition.columns[3].expression.expression = greaterthan;
    ruleDefinition.addRow();
    ruleDefinition.rows[0].cells[0].values = "Bruno Pereira";
    ruleDefinition.rows[0].cells[1].values = true;
    ruleDefinition.rows[0].cells[2].values = "1992-02-01";
    ruleDefinition.rows[0].cells[3].values = 42;
    ruleDefinition.rows[1].cells[0].values = "Jose Chachin";
    ruleDefinition.rows[1].cells[1].values = true;
    ruleDefinition.rows[1].cells[2].values = "1990-02-01";
    ruleDefinition.rows[1].cells[3].values = 31;
    ruleDefinition.syncAllRows();
    let outdef = new XDataDefinition();
    outdef.fields.push(new StringDataDefinition("name"));
    outdef.fields.push(new NumberDataDefinition("income"));
    ruleDefinition.executionResult = outdef;
    ruleDefinition.rows[0].resultCells[0].value = "Bruno Pereira";
    ruleDefinition.rows[0].resultCells[1].value = 5000;
    ruleDefinition.rows[1].resultCells[0].value = "Jose Chachin";
    ruleDefinition.rows[1].resultCells[1].value = 10000;
    ruleDefinition.defaultResult[ruleDefinition.resultColumns[0]._id].value = "James";
    ruleDefinition.defaultResult[ruleDefinition.resultColumns[1]._id].value = 100;
    return ruleDefinition;
};
//# sourceMappingURL=TestDataSetup.js.map