"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 zod_1 = __importDefault(require("zod"));
const Patient_1 = require("../../../../../src/lib/fhir/schemas/Patient");
const lodash_1 = require("lodash");
exports.fields = {
    ssn: {
        id: 'ssn',
        label: 'SSN',
        type: extensions_core_1.FieldType.STRING,
        description: 'The patient’s Social Security Number.',
        required: true,
    },
    familyName: {
        id: 'familyName',
        label: 'Family name',
        type: extensions_core_1.FieldType.STRING,
        description: 'The patient’s family (last) name.',
        required: true,
    },
    givenName: {
        id: 'givenName',
        label: 'Given name',
        type: extensions_core_1.FieldType.STRING,
        description: "The patient's given name. May include first and middle names.",
        required: true,
    },
    birthDate: {
        id: 'birthDate',
        label: 'Birth date',
        type: extensions_core_1.FieldType.DATE,
        required: true,
    },
    gender: {
        id: 'gender',
        label: 'Gender',
        type: extensions_core_1.FieldType.STRING,
        required: true,
        options: {
            dropdownOptions: Patient_1.GenderSchema._def.values.map((value) => ({
                value,
                label: (0, lodash_1.startCase)(value),
            })),
        },
    },
    email: {
        id: 'email',
        label: 'Email',
        type: extensions_core_1.FieldType.STRING,
        required: false,
    },
};
exports.FieldsValidationSchema = zod_1.default.object({
    ssn: zod_1.default
        .string()
        .min(1)
        .regex(/^\d{3}-\d{2}-\d{4}$/, 'Invalid SSN format. Must be in the format xxx-xx-xxxx'),
    familyName: zod_1.default.string().min(1),
    givenName: zod_1.default.string().min(1),
    birthDate: zod_1.default.coerce.date(),
    gender: Patient_1.GenderSchema,
    email: zod_1.default.string().email().optional(),
});
//# sourceMappingURL=fields.js.map