"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStatementRuleExample = exports.getStatementRuleEmpty = void 0;
const BooleanDataDefinition_1 = require("@appglue/common/dist/Common/Data/Definitions/BooleanDataDefinition");
const IfThenExpression_1 = require("@appglue/common/dist/Expressions/Expressions/Logic/IfThenExpression");
const DataDefinition_1 = require("../DataDefinition");
const StringIsNotEmptyExpression_1 = require("@appglue/common/dist/Expressions/Expressions/String/StringIsNotEmptyExpression");
const ExpressionConfiguration_1 = require("@appglue/common/dist/Expressions/ExpressionConfiguration");
const StringIsValidEmailExpression_1 = require("@appglue/common/dist/Expressions/Expressions/String/StringIsValidEmailExpression");
const Exists_1 = require("@appglue/common/dist/Expressions/Expressions/Logic/Exists");
const IsTrue_1 = require("@appglue/common/dist/Expressions/Expressions/Logic/IsTrue");
const IsFalse_1 = require("@appglue/common/dist/Expressions/Expressions/Logic/IsFalse");
const StatementRuleConfiguration_1 = require("@appglue/common/dist/Rule/Statement/StatementRuleConfiguration");
const getStatementRuleEmpty = () => {
    const rule = new StatementRuleConfiguration_1.StatementRuleConfiguration();
    rule.inputData = (0, DataDefinition_1.getTestInputDataDefinition)();
    return rule;
};
exports.getStatementRuleEmpty = getStatementRuleEmpty;
const getStatementRuleExample = () => {
    const rule = new StatementRuleConfiguration_1.StatementRuleConfiguration();
    let exp1 = new ExpressionConfiguration_1.ExpressionConfiguration();
    let baseExpression = new IfThenExpression_1.IfThenExpression();
    let textNotEmpty = new StringIsNotEmptyExpression_1.StringIsNotEmptyExpression();
    textNotEmpty.value1.variableName = "emergencyContactName";
    baseExpression.ifBranches[0].ifExpression.elements[0].subExpression = textNotEmpty;
    baseExpression.ifBranches[0].ifExpression.add();
    textNotEmpty = new StringIsNotEmptyExpression_1.StringIsNotEmptyExpression();
    baseExpression.ifBranches[0].ifExpression.elements[1].subExpression = textNotEmpty;
    textNotEmpty.value1.variableName = "emergencyContactPhoneNumber";
    baseExpression.ifBranches[0].ifExpression.add();
    textNotEmpty = new StringIsNotEmptyExpression_1.StringIsNotEmptyExpression();
    baseExpression.ifBranches[0].ifExpression.elements[2].subExpression = textNotEmpty;
    textNotEmpty.value1.variableName = "emergencyContactRelationship";
    baseExpression.ifBranches[0].ifExpression.add();
    let exp = new StringIsValidEmailExpression_1.StringIsValidEmailExpression();
    exp.value1.variableName = "emailAddress";
    baseExpression.ifBranches[0].ifExpression.elements[3].subExpression = exp;
    baseExpression.ifBranches[0].ifExpression.add();
    let exists = new Exists_1.ExistsExpression();
    exists.dataPath = "dateOfHire";
    baseExpression.ifBranches[0].ifExpression.elements[4].subExpression = exists;
    baseExpression.ifBranches[0].ifExpression.add();
    let isTrue = new IsTrue_1.IsTrueExpression();
    isTrue.value1.variableName = "fullTime";
    baseExpression.ifBranches[0].ifExpression.elements[5].subExpression = isTrue;
    let second = baseExpression.addIfBranch();
    exp = new StringIsValidEmailExpression_1.StringIsValidEmailExpression();
    exp.value1.variableName = "emailAddress";
    second.ifExpression.elements[0].subExpression = exp;
    second.ifExpression.add();
    exists = new Exists_1.ExistsExpression();
    exists.dataPath = "dateOfHire";
    second.ifExpression.elements[1].subExpression = exists;
    second.ifExpression.add();
    let isFalse = new IsFalse_1.IsFalseExpression();
    isFalse.value1.variableName = "fullTime";
    second.ifExpression.elements[2].subExpression = isFalse;
    isTrue = new IsTrue_1.IsTrueExpression();
    isTrue.value1.variableName = "onboarded";
    baseExpression.defaultOutput.subExpression = isTrue;
    isFalse = new IsFalse_1.IsFalseExpression();
    isFalse.value1.variableName = "onboarded";
    baseExpression.trueOutput.subExpression = isFalse;
    exp1.expression = baseExpression;
    rule.inputData = (0, DataDefinition_1.getTestInputDataDefinition)();
    exp1.inputData = (0, DataDefinition_1.getTestInputDataDefinition)();
    rule.expression = exp1;
    rule.executionResult = new BooleanDataDefinition_1.BooleanDataDefinition();
    return rule;
};
exports.getStatementRuleExample = getStatementRuleExample;
//# sourceMappingURL=Statement.js.map