"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FieldsValidationSchema = exports.fields = void 0;
const zod_1 = require("zod");
const extensions_core_1 = require("@awell-health/extensions-core");
const extensions_core_2 = require("@awell-health/extensions-core");
const patient_zod_1 = require("../../../validation/patient.zod");
const lodash_1 = require("lodash");
exports.fields = {
    firstName: {
        id: 'firstName',
        label: 'First name',
        description: '',
        type: extensions_core_1.FieldType.STRING,
        required: true,
    },
    lastName: {
        id: 'lastName',
        label: 'Last name',
        description: '',
        type: extensions_core_1.FieldType.STRING,
        required: true,
    },
    dob: {
        id: 'dob',
        label: 'Date of Birth',
        description: '',
        type: extensions_core_1.FieldType.DATE,
        required: true,
    },
    sex: {
        id: 'sex',
        label: 'Sex',
        description: "Possible values are 'Male', 'Female', 'Other', 'Unknown'",
        type: extensions_core_1.FieldType.STRING,
        required: true,
        options: {
            dropdownOptions: Object.values(patient_zod_1.sexEnum.enum).map((sex) => ({
                label: sex,
                value: sex,
            })),
        },
    },
    primaryPhysicianId: {
        id: 'primaryPhysicianId',
        label: 'Primary Physician ID',
        description: 'The ID of the primary physician associated to the patient',
        type: extensions_core_1.FieldType.NUMERIC,
        required: true,
    },
    caregiverPracticeId: {
        id: 'caregiverPracticeId',
        label: 'Caregiver Practice ID',
        description: '',
        type: extensions_core_1.FieldType.NUMERIC,
        required: true,
    },
    email: {
        id: 'email',
        label: 'Email',
        description: '',
        type: extensions_core_1.FieldType.STRING,
        required: false,
    },
    mobilePhone: {
        id: 'mobilePhone',
        label: 'Mobile phone',
        description: 'The number will be stored in US national format in Elation',
        type: extensions_core_1.FieldType.STRING,
        stringType: extensions_core_2.StringType.PHONE,
        required: false,
    },
    middleName: {
        id: 'middleName',
        label: 'Middle Name',
        description: '',
        type: extensions_core_1.FieldType.STRING,
    },
    actualName: {
        id: 'actualName',
        label: 'Actual Name',
        description: '',
        type: extensions_core_1.FieldType.STRING,
    },
    genderIdentity: {
        id: 'genderIdentity',
        label: 'Gender identity',
        description: "Possible values are 'unknown', 'man', 'woman', 'transgender_man', 'transgender_woman', 'nonbinary', 'option_not_listed', 'prefer_not_to_say', 'two_spirit'",
        type: extensions_core_1.FieldType.STRING,
        options: {
            dropdownOptions: Object.values(patient_zod_1.genderIdentityEnum.enum).map((genderIdentity) => ({
                label: (0, lodash_1.startCase)(genderIdentity),
                value: genderIdentity,
            })),
        },
    },
    legalGenderMarker: {
        id: 'legalGenderMarker',
        label: 'Legal gender marker',
        description: "Possible values are 'M', 'F', 'X', 'U'",
        type: extensions_core_1.FieldType.STRING,
        options: {
            dropdownOptions: Object.values(patient_zod_1.legalGenderMarkerEnum.enum).map((legalGenderMarker) => ({
                label: (0, lodash_1.startCase)(legalGenderMarker),
                value: legalGenderMarker,
            })),
        },
    },
    pronouns: {
        id: 'pronouns',
        label: 'Pronouns',
        description: "Pronouns by which a patient identifies self. Possible values are 'he_him_his', 'she_her_hers', 'they_them_theirs', 'not_listed'",
        type: extensions_core_1.FieldType.STRING,
        options: {
            dropdownOptions: Object.values(patient_zod_1.pronounsEnum.enum).map((pronouns) => ({
                label: (0, lodash_1.startCase)(pronouns),
                value: pronouns,
            })),
        },
    },
    sexualOrientation: {
        id: 'sexualOrientation',
        label: 'Sexual orientation',
        description: "Possible values are 'unknown', 'straight', 'gay', 'bisexual', 'option_not_listed', 'prefer_not_to_say', 'lesbian', 'queer', 'asexual'",
        type: extensions_core_1.FieldType.STRING,
        options: {
            dropdownOptions: Object.values(patient_zod_1.sexualOrientationEnum.enum).map((sexualOrientation) => ({
                label: (0, lodash_1.startCase)(sexualOrientation),
                value: sexualOrientation,
            })),
        },
    },
    ssn: {
        id: 'ssn',
        label: 'SSN',
        description: 'The Social Security number of the patient',
        type: extensions_core_1.FieldType.STRING,
    },
    ethnicity: {
        id: 'ethnicity',
        label: 'Ethnicity',
        description: "Possible values are 'No ethnicity specified', 'Hispanic or Latino', 'Not Hispanic or Latino', 'Declined to specify'.",
        type: extensions_core_1.FieldType.STRING,
        options: {
            dropdownOptions: Object.values(patient_zod_1.ethnicityEnum.enum).map((ethnicity) => ({
                label: (0, lodash_1.startCase)(ethnicity),
                value: ethnicity,
            })),
        },
    },
    race: {
        id: 'race',
        label: 'Race',
        description: "Possible values are 'No race specified', 'American Indian or Alaska Native', 'Asian', 'Black or African American', 'Native Hawaiian or Other Pacific Islander', 'White', 'Declined to specify'.",
        type: extensions_core_1.FieldType.STRING,
        options: {
            dropdownOptions: Object.values(patient_zod_1.raceEnum.enum).map((race) => ({
                label: (0, lodash_1.startCase)(race),
                value: race,
            })),
        },
    },
    preferredLanguage: {
        id: 'preferredLanguage',
        label: 'Preferred language',
        description: "Full names e.g. 'English', 'Spanish' or 'French'.",
        type: extensions_core_1.FieldType.STRING,
    },
    notes: {
        id: 'notes',
        label: 'Notes',
        description: 'Additional notes about the patient',
        type: extensions_core_1.FieldType.STRING,
    },
    previousFirstName: {
        id: 'previousFirstName',
        label: 'Previous first name',
        description: 'The previous first name of the patient',
        type: extensions_core_1.FieldType.STRING,
    },
    previousLastName: {
        id: 'previousLastName',
        label: 'Previous last name',
        description: 'The previous last name of the patient',
        type: extensions_core_1.FieldType.STRING,
    },
    tags: {
        id: 'tags',
        label: 'Tags',
        description: 'The tags associated with the patient. Separate multiple tags with a comma (max 10 per patient).',
        type: extensions_core_1.FieldType.STRING,
    },
};
exports.FieldsValidationSchema = zod_1.z.object({
    firstName: zod_1.z.string().min(1),
    lastName: zod_1.z.string().min(1),
    dob: extensions_core_1.DateOnlySchema,
    sex: patient_zod_1.sexEnum,
    primaryPhysicianId: extensions_core_1.NumericIdSchema,
    caregiverPracticeId: extensions_core_1.NumericIdSchema,
    email: zod_1.z.string().email().optional(),
    mobilePhone: zod_1.z.string().optional(),
    middleName: zod_1.z.string().optional(),
    actualName: zod_1.z.string().optional(),
    genderIdentity: patient_zod_1.genderIdentityEnum.optional(),
    legalGenderMarker: patient_zod_1.legalGenderMarkerEnum.optional(),
    pronouns: patient_zod_1.pronounsEnum.optional(),
    sexualOrientation: patient_zod_1.sexualOrientationEnum.optional(),
    ssn: zod_1.z.string().optional(),
    ethnicity: patient_zod_1.ethnicityEnum.optional(),
    race: patient_zod_1.raceEnum.optional(),
    preferredLanguage: zod_1.z.string().optional(),
    notes: zod_1.z.string().optional(),
    previousFirstName: zod_1.z.string().optional(),
    previousLastName: zod_1.z.string().optional(),
    tags: zod_1.z
        .string()
        .optional()
        .transform((tags) => {
        if ((0, lodash_1.isNil)(tags) || (0, lodash_1.isEmpty)(tags)) {
            return undefined;
        }
        return tags
            .trim()
            .split(',')
            .map((tag) => tag.trim());
    }),
});
//# sourceMappingURL=fields.js.map