"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateActionFields = exports.FieldsValidationSchema = exports.fields = void 0;
const zod_1 = require("zod");
const extensions_core_1 = require("@awell-health/extensions-core");
exports.fields = {
    stringArray: {
        id: 'stringArray',
        label: 'String Array',
        description: 'Select a data point or enter comma separated strings.',
        type: extensions_core_1.FieldType.STRING_ARRAY,
        required: true,
        options: {
            dropdownOptions: [
                {
                    value: 'one',
                    label: 'One',
                },
                {
                    value: 'two',
                    label: 'Two',
                },
                {
                    value: 'three',
                    label: 'Three',
                },
            ],
        },
    },
    numericArray: {
        id: 'numericArray',
        label: 'Numeric Array',
        description: 'Select a data point or enter comma separated numbers.',
        type: extensions_core_1.FieldType.NUMERIC_ARRAY,
        required: true,
        options: {
            dropdownOptions: [
                { label: 'One', value: 1 },
                { label: 'Two', value: 2 },
                { label: 'Three', value: 3 },
            ],
        },
    },
    anotherStringArray: {
        id: 'anotherStringArray',
        label: 'String Array',
        description: 'Select a data point or enter comma separated strings.',
        type: extensions_core_1.FieldType.STRING_ARRAY,
        required: true,
        options: {
            dropdownOptions: [
                { label: 'Option 1', value: 'option1' },
                { label: 'Option 2', value: 'option2' },
            ],
        },
    },
    anotherNumericArray: {
        id: 'anotherNumericArray',
        label: 'Numeric Array',
        description: 'Select a data point or enter comma separated numbers.',
        type: extensions_core_1.FieldType.NUMERIC_ARRAY,
        required: true,
        options: {
            dropdownOptions: [
                { label: 'Option 1', value: 50 },
                { label: 'Option 2', value: 51 },
            ],
        },
    },
};
// the string array is received as a string, so we need to parse it to an array
// the numeric array is received as a string, so we need to parse it to an array
exports.FieldsValidationSchema = zod_1.z.object({
    stringArray: zod_1.z.string().transform((str) => str.split(',').map((s) => s.trim())),
    numericArray: zod_1.z.string().transform((str) => str.split(',').map((s) => Number(s.trim()))),
    anotherStringArray: zod_1.z.string().transform((str) => str.split(',').map((s) => s.trim())),
    anotherNumericArray: zod_1.z.string().transform((str) => str.split(',').map((s) => Number(s.trim()))),
});
const validateActionFields = (fields) => {
    const parsedData = exports.FieldsValidationSchema.parse(fields);
    return parsedData;
};
exports.validateActionFields = validateActionFields;
//# sourceMappingURL=fields.js.map