"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.XTreeRuleNode = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const TreeRuleNode_1 = require("@appglue/common/dist/Rule/Tree/Structure/TreeRuleNode");
const MissingRuleNode_1 = require("./MissingRuleNode");
const EvaluationNode_1 = require("./EvaluationNode");
const ResultRuleNode_1 = require("./ResultRuleNode");
const ObserveMultiState_1 = require("../../../CommonUI/StateManagement/ObserveMultiState");
const XTreeRuleNode = (props) => {
    const { node, ruleDefinition } = props;
    return ((0, jsx_runtime_1.jsx)(ObserveMultiState_1.ObserveMultiState, { listenTo: [ruleDefinition, node], control: () => {
            if (!node)
                return null;
            switch (node.nodeType) {
                case TreeRuleNode_1.TreeRuleNodeType.EVALUATION:
                    return (0, jsx_runtime_1.jsx)(EvaluationNode_1.EvaluationNode, { ...props });
                case TreeRuleNode_1.TreeRuleNodeType.UNDEFINED:
                    return (0, jsx_runtime_1.jsx)(MissingRuleNode_1.MissingRuleNode, { ...props });
                case TreeRuleNode_1.TreeRuleNodeType.RESULT:
                    return (0, jsx_runtime_1.jsx)(ResultRuleNode_1.ResultRuleNode, { ...props });
                default:
                    return null;
            }
        } }));
};
exports.XTreeRuleNode = XTreeRuleNode;
//# sourceMappingURL=XTreeRuleNode.js.map