"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const zod_1 = require("zod");
const field_1 = require("../../../../types/field");
const filter_1 = require("../../../../types/filter");
const fieldId_1 = require("../fieldId");
const filterDescriptionUtils_1 = require("./filterDescriptionUtils");
const commonBooleanFilterRuleSchema = zod_1.z.object({
    fieldId: (0, fieldId_1.getFieldIdSchema)({ additionalDescription: null }),
    fieldType: zod_1.z.union([
        zod_1.z.literal(field_1.DimensionType.BOOLEAN),
        zod_1.z.literal(field_1.MetricType.BOOLEAN),
    ]),
    fieldFilterType: zod_1.z.literal(filter_1.FilterType.BOOLEAN),
});
const booleanFilterSchema = zod_1.z.union([
    commonBooleanFilterRuleSchema
        .extend({
        operator: zod_1.z
            .union([
            zod_1.z.literal(filter_1.FilterOperator.NULL),
            zod_1.z.literal(filter_1.FilterOperator.NOT_NULL),
        ])
            .describe(filterDescriptionUtils_1.valuePresenceOperatorDescription),
    })
        .describe(`Use for boolean fields when checking if a value is missing or present. Do not include values. ${(0, filterDescriptionUtils_1.filterJsonExamples)({
        fieldId: 'users_is_active',
        fieldType: field_1.DimensionType.BOOLEAN,
        fieldFilterType: filter_1.FilterType.BOOLEAN,
        operator: filter_1.FilterOperator.NULL,
    }, {
        fieldId: 'users_is_active',
        fieldType: field_1.DimensionType.BOOLEAN,
        fieldFilterType: filter_1.FilterType.BOOLEAN,
        operator: filter_1.FilterOperator.NOT_NULL,
    })}`),
    commonBooleanFilterRuleSchema
        .extend({
        operator: zod_1.z
            .union([
            zod_1.z.literal(filter_1.FilterOperator.EQUALS),
            zod_1.z.literal(filter_1.FilterOperator.NOT_EQUALS),
        ])
            .describe(`Use ${(0, filterDescriptionUtils_1.filterOperatorList)(filter_1.FilterOperator.EQUALS, filter_1.FilterOperator.NOT_EQUALS)} to match true or false.`),
        values: zod_1.z
            .array(zod_1.z.boolean())
            .length(1)
            .describe('Exactly one boolean value, e.g. [true] or [false].'),
    })
        .describe(`Use for boolean fields when matching or excluding true/false values. ${(0, filterDescriptionUtils_1.filterJsonExamples)({
        fieldId: 'users_is_active',
        fieldType: field_1.DimensionType.BOOLEAN,
        fieldFilterType: filter_1.FilterType.BOOLEAN,
        operator: filter_1.FilterOperator.EQUALS,
        values: [true],
    }, {
        fieldId: 'users_is_active',
        fieldType: field_1.DimensionType.BOOLEAN,
        fieldFilterType: filter_1.FilterType.BOOLEAN,
        operator: filter_1.FilterOperator.NOT_EQUALS,
        values: [false],
    })}`),
]);
exports.default = booleanFilterSchema;
//# sourceMappingURL=booleanFilters.js.map