"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExpressionEditorStories = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const ExpressionBuilder_1 = require("../ExpressionBuilder");
const ExpressionConfiguration_1 = require("@appglue/common/dist/Expressions/ExpressionConfiguration");
const AddExpression_1 = require("@appglue/common/dist/Expressions/Expressions/Math/AddExpression");
const SumExpression_1 = require("@appglue/common/dist/Expressions/Expressions/Math/SumExpression");
const DivideExpression_1 = require("@appglue/common/dist/Expressions/Expressions/Math/DivideExpression");
const ExpressionData_1 = require("../Testing/ExpressionData");
const NumberDataDefinition_1 = require("@appglue/common/dist/Common/Data/Definitions/NumberDataDefinition");
const DataDefinition_1 = require("@appglue/common/dist/Common/Data/DataDefinition");
const ExpressionValueType_1 = require("@appglue/common/dist/Expressions/ExpressionValueType");
const StoryData_1 = require("../../CommonUI/StoryBook/StoryData");
function getMathExpression() {
    let exp = new ExpressionConfiguration_1.ExpressionConfiguration();
    exp.executionResult = new NumberDataDefinition_1.NumberDataDefinition();
    let baseExpression = new AddExpression_1.AddExpression();
    baseExpression.value1.value = 4;
    let subExpression = new AddExpression_1.AddExpression();
    subExpression.value1.variableName = "income";
    let sum = new SumExpression_1.SumExpression();
    sum.value1.variableName = "otherIncome";
    subExpression.value2.subExpression = sum;
    baseExpression.value2.subExpression = subExpression;
    exp.expression = baseExpression;
    return exp;
}
function getMathExpressionDivide() {
    let exp = new ExpressionConfiguration_1.ExpressionConfiguration();
    exp.executionResult = new NumberDataDefinition_1.NumberDataDefinition();
    let baseExpression = new AddExpression_1.AddExpression();
    baseExpression.value1.value = 4;
    baseExpression.value1.valueType = ExpressionValueType_1.ExpressionValueType.VALUE;
    let subExpression = new AddExpression_1.AddExpression();
    subExpression.value1.variableName = "income";
    subExpression.value1.valueType = ExpressionValueType_1.ExpressionValueType.VARIABLE;
    let divide = new DivideExpression_1.DivideExpression();
    divide.divideValue.variableName = "otherIncome";
    divide.divideBy.value = 20;
    subExpression.value2.subExpression = divide;
    subExpression.value2.valueType = ExpressionValueType_1.ExpressionValueType.SUBEXPRESSION;
    baseExpression.value2.subExpression = subExpression;
    baseExpression.value2.valueType = ExpressionValueType_1.ExpressionValueType.SUBEXPRESSION;
    exp.expression = baseExpression;
    return exp;
}
function getMathExpressionValid() {
    let exp = new ExpressionConfiguration_1.ExpressionConfiguration();
    exp.executionResult = new NumberDataDefinition_1.NumberDataDefinition();
    let baseExpression = new AddExpression_1.AddExpression();
    baseExpression.value1.value = "asdf";
    baseExpression.value1.valueType = ExpressionValueType_1.ExpressionValueType.VALUE;
    let subExpression = new AddExpression_1.AddExpression();
    subExpression.value1.variableName = "wrongField";
    subExpression.value1.valueType = ExpressionValueType_1.ExpressionValueType.VARIABLE;
    let divide = new DivideExpression_1.DivideExpression();
    divide.divideValue.variableName = "otherIncome";
    divide.divideValue.valueType = ExpressionValueType_1.ExpressionValueType.VARIABLE;
    divide.divideBy.value = "asdfasd";
    divide.divideBy.valueType = ExpressionValueType_1.ExpressionValueType.VALUE;
    subExpression.value2.subExpression = divide;
    subExpression.value2.valueType = ExpressionValueType_1.ExpressionValueType.SUBEXPRESSION;
    baseExpression.value2.subExpression = subExpression;
    baseExpression.value2.valueType = ExpressionValueType_1.ExpressionValueType.SUBEXPRESSION;
    exp.expression = baseExpression;
    return exp;
}
exports.ExpressionEditorStories = [
    new StoryData_1.StoryNode(() => {
        let exp = new ExpressionConfiguration_1.ExpressionConfiguration();
        exp.inputData = ExpressionData_1.expressionStoryData;
        return (0, jsx_runtime_1.jsx)(ExpressionBuilder_1.ExpressionBuilder, { expression: exp });
    }, "Expression Builder", "General", "Blank"),
    new StoryData_1.StoryNode(() => {
        let exp = new ExpressionConfiguration_1.ExpressionConfiguration();
        exp.variableName = "incomeName";
        exp.inputData = ExpressionData_1.expressionStoryData;
        return (0, jsx_runtime_1.jsx)(ExpressionBuilder_1.ExpressionBuilder, { expression: exp });
    }, "Expression Builder", "General", "Return Variable"),
    new StoryData_1.StoryNode(() => {
        let exp = new ExpressionConfiguration_1.ExpressionConfiguration();
        exp.variableName = "incomeName";
        exp.inputData = ExpressionData_1.expressionStoryData;
        return (0, jsx_runtime_1.jsx)(ExpressionBuilder_1.ExpressionBuilder, { expression: exp });
    }, "Expression Builder", "General", "Return Variable"),
    new StoryData_1.StoryNode(() => {
        let exp = new ExpressionConfiguration_1.ExpressionConfiguration();
        exp = getMathExpression();
        exp.inputData = ExpressionData_1.expressionStoryData;
        return (0, jsx_runtime_1.jsx)(ExpressionBuilder_1.ExpressionBuilder, { expression: exp });
    }, "Expression Builder", "General", "Math Expression"),
    new StoryData_1.StoryNode(() => {
        let exp = new ExpressionConfiguration_1.ExpressionConfiguration();
        exp = getMathExpressionDivide();
        exp.inputData = ExpressionData_1.expressionStoryData;
        return (0, jsx_runtime_1.jsx)(ExpressionBuilder_1.ExpressionBuilder, { expression: exp });
    }, "Expression Builder", "General", "Math Expression (Divide)"),
    new StoryData_1.StoryNode(() => {
        let exp = new ExpressionConfiguration_1.ExpressionConfiguration();
        exp = getMathExpressionValid();
        exp.inputData = new DataDefinition_1.DataDefinition();
        return (0, jsx_runtime_1.jsx)(ExpressionBuilder_1.ExpressionBuilder, { expression: exp });
    }, "Expression Builder", "General", "Math Expression (Validation)"),
];
//# sourceMappingURL=ExpressionEditor-stories.js.map