"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FieldsValidationSchema = exports.fields = void 0;
const extensions_core_1 = require("@awell-health/extensions-core");
const zod_1 = require("zod");
const lodash_1 = require("lodash");
exports.fields = {
    stakeholderId: {
        id: 'stakeholderId',
        label: 'Stakeholder',
        description: 'The stakeholder to create the session for. Leave empty to default to the patient.',
        type: extensions_core_1.FieldType.STRING,
        required: false,
    },
    exp: {
        id: 'exp',
        label: 'Expiration (epoch seconds)',
        description: 'When the session should expire, as a Unix timestamp in seconds. If left empty, we default to 30 days.',
        type: extensions_core_1.FieldType.STRING,
        required: false,
    },
};
exports.FieldsValidationSchema = zod_1.z.object({
    stakeholderId: zod_1.z
        .string()
        .optional()
        .transform((val) => ((0, lodash_1.isEmpty)(val) ? undefined : val)),
    exp: zod_1.z
        .string()
        .optional()
        .transform((val, ctx) => {
        if (val === undefined || (0, lodash_1.isEmpty)(val))
            return undefined;
        const parsed = Number(val);
        if (!Number.isFinite(parsed) || !Number.isInteger(parsed)) {
            ctx.addIssue({ code: 'custom', message: 'exp must be an integer' });
            return zod_1.z.NEVER;
        }
        return parsed;
    }),
});
//# sourceMappingURL=fields.js.map