"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FieldsValidationSchema = exports.fields = void 0;
const extensions_core_1 = require("@awell-health/extensions-core");
const lodash_1 = require("lodash");
const zod_1 = __importDefault(require("zod"));
exports.fields = {
    ticketId: {
        id: 'ticketId',
        label: 'Ticket ID',
        description: 'The ID of the ticket to update',
        type: extensions_core_1.FieldType.STRING,
        required: true,
    },
    body: {
        id: 'body',
        label: 'Body',
        description: 'Content of the note in HTML',
        type: extensions_core_1.FieldType.HTML,
        required: true,
    },
    incoming: {
        id: 'incoming',
        label: 'Incoming',
        description: 'Set to true if a particular note should appear as being created from outside (i.e., not through web portal). The default value is false',
        type: extensions_core_1.FieldType.BOOLEAN,
        required: false,
    },
    notifyEmails: {
        id: 'notifyEmails',
        label: 'Notify emails',
        description: `Comma separated list of email addresses of agents/users who need to be notified about this note`,
        type: extensions_core_1.FieldType.STRING,
        required: false,
    },
    private: {
        id: 'private',
        label: 'Private',
        description: `Set to true if the note is private. The default value is true.`,
        type: extensions_core_1.FieldType.BOOLEAN,
        required: false,
    },
    userId: {
        id: 'userId',
        label: 'User ID',
        description: 'ID of the agent/user who is adding the note',
        type: extensions_core_1.FieldType.STRING,
        required: false,
    },
};
exports.FieldsValidationSchema = zod_1.default.object({
    ticketId: zod_1.default.string().min(1),
    body: zod_1.default.string().min(1),
    incoming: zod_1.default.boolean().optional(),
    notifyEmails: zod_1.default
        .string()
        .optional()
        .transform((val) => {
        if ((0, lodash_1.isNil)(val) || (0, lodash_1.isEmpty)(val))
            return undefined;
        return val
            .trim()
            .split(',')
            .map((tag) => tag.trim());
    }),
    private: zod_1.default.boolean().optional(),
    userId: zod_1.default.coerce.number().optional(),
});
//# sourceMappingURL=fields.js.map