import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { ExpressionValue } from "../../ExpressionValue";
import { ExpressionValueRenderer } from "../../ExpressionValueRenderer";
import { BracketedDiv, ExpressionPiece } from "../../ExpressionStyles";
import { ObserveMultiState } from "../../../CommonUI/StateManagement/ObserveMultiState";
import { DateDataDefinition } from "../../../Common/Data/Definitions/DateDataDefinition";
import { BaseLogicExpression } from "../Logic/BaseLogic";
export class DateLessThanExpression extends BaseLogicExpression {
    constructor() {
        super();
        this.__type = "Date Less Than";
        this.value1 = ExpressionValue.createExpressionValue(this, "value1", new DateDataDefinition());
        this.value2 = ExpressionValue.createExpressionValue(this, "value2", new DateDataDefinition());
    }
    render() {
        return (_jsx(ObserveMultiState, { listenTo: [this.value1, this.value2], control: () => (_jsxs(BracketedDiv, Object.assign({ hasChild: !!this.value1.subExpression || !!this.value2.subExpression }, { children: [_jsx(ExpressionPiece, Object.assign({ hasChild: !!this.value1.subExpression }, { children: _jsx(ExpressionValueRenderer, { el: this.value1 }, void 0) }), void 0),
                    _jsxs(ExpressionPiece, { children: [" ", "<", " "] }, void 0),
                    _jsx(ExpressionPiece, Object.assign({ hasChild: !!this.value2.subExpression }, { children: _jsx(ExpressionValueRenderer, { el: this.value2 }, void 0) }), void 0)] }), void 0)) }, void 0));
    }
    evaluate(data, testContext) {
        return this.value1.evaluate(data, testContext).getTime() < this.value2.evaluate(data, testContext).getTime();
    }
}
//# sourceMappingURL=DateLessThanExpression.js.map