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 { GroupedBracketedDiv } from "../Logic/Grouping";
import { ExpressionValueType } from "../../ExpressionValueType";
import { StringDataDefinition } from "../../../Common/Data/Definitions/StringDataDefinition";
import { BaseLogicExpression } from "../Logic/BaseLogic";
import { BooleanDataDefinition } from "../../../Common/Data/Definitions/BooleanDataDefinition";
export class StringListInExpression extends BaseLogicExpression {
    constructor() {
        super();
        this.__type = "String List In";
        this.expressionValueType = new BooleanDataDefinition();
        let dd = new StringDataDefinition();
        dd.list = true;
        this.value1 = ExpressionValue.createExpressionValue(this, "value1", new StringDataDefinition());
        this.value2 = ExpressionValue.createExpressionValue(this, "value2", dd);
    }
    render() {
        return (_jsxs(GroupedBracketedDiv, Object.assign({ issue: this.getValidationIssues()[0] }, { children: [_jsx(ExpressionPiece, { children: _jsx(ExpressionValueRenderer, { el: this.value1 }, void 0) }, void 0),
                _jsx(ExpressionPiece, { children: " in " }, void 0),
                this.value2.valueType === ExpressionValueType.VALUE ? (_jsx(BracketedDiv, { children: _jsx(ExpressionValueRenderer, { el: this.value2 }, void 0) }, void 0)) : (_jsx(ExpressionPiece, { children: _jsx(ExpressionValueRenderer, { el: this.value2 }, void 0) }, void 0))] }), void 0));
    }
    evaluate(data, testContext) {
        let value2 = this.value2.evaluate(data, testContext);
        return value2.includes(this.value1.evaluate(data, testContext));
    }
}
//# sourceMappingURL=StringListInExpression.js.map