"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FieldsValidationSchema = exports.fields = void 0;
const lodash_1 = require("lodash");
const zod_1 = require("zod");
const extensions_core_1 = require("@awell-health/extensions-core");
const awell_sdk_1 = require("@awell-health/awell-sdk");
exports.fields = {
    pathwayStatus: {
        id: 'pathwayStatus',
        label: 'Pathway status',
        description: `A comma-separated string of care flow statuses that will be used when looking for care flows the patient is already enrolled in. By default, we only look at active care flows. Possible values are: ${Object.values(awell_sdk_1.enumPathwayStatus).join(', ')}.`,
        type: extensions_core_1.FieldType.STRING,
        required: false,
        /**
         * We currently do not support multi-select options for dropdown fields.
         * Hence why we're not using this and rely on the user to enter a comma-separated string of statuses.
         * This is a temporary solution and we should revisit this when we have multi-select options for dropdown fields.
         * See ET-602 and ET-603 for more information.
         */
        // options: {
        //   dropdownOptions: Object.values(PathwayStatus).map((status) => ({
        //     label: capitalize(status.replace('_', ' ')),
        //     value: status,
        //   })),
        // },
    },
    careFlowDefinitionIds: {
        id: 'careFlowDefinitionIds',
        label: 'Care flow definition IDs',
        description: 'A comma-separated string of care flow definition ids that will be used when looking for care flows the patient is already enrolled in. By default, we only search for care flows that match the current care flow definition id (i.e. is the patient already included in the current care flow?).',
        type: extensions_core_1.FieldType.STRING,
        required: false,
    },
    dayRange: {
        id: 'dayRange',
        label: 'Past day range',
        description: 'The number of days to look back for care flows that were started in the past, e.g last 30 days.',
        type: extensions_core_1.FieldType.NUMERIC,
        required: false,
    },
};
exports.FieldsValidationSchema = zod_1.z.object({
    pathwayStatus: zod_1.z.optional(zod_1.z
        .string()
        .transform((chars) => chars.replace(/[\s"]/g, '')) // Strip whitespace and quotation marks
        .transform((chars) => chars.split(','))
        .transform((strArray) => {
        const possibleStatuses = Object.values(awell_sdk_1.enumPathwayStatus);
        return strArray.filter((str) => possibleStatuses.includes(str));
    })),
    careFlowDefinitionIds: zod_1.z.optional(zod_1.z
        .string()
        .transform((chars) => chars.replace(/\s/g, '')) // Make sure all white spaces are stripped
        .transform((chars) => chars.split(','))
        .transform((strArray) => strArray.filter((str) => !(0, lodash_1.isNil)(str) && !(0, lodash_1.isEmpty)(str)))),
    dayRange: zod_1.z.optional(zod_1.z.number()),
});
//# sourceMappingURL=fields.js.map