"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 validation_1 = require("../../../validation");
exports.fields = {
    order: {
        id: 'order',
        label: 'Order',
        description: 'A numerical value from 1 to 5, representing the order in which insurance coverages should be used when processing claims.',
        type: extensions_core_1.FieldType.NUMERIC,
        required: true,
    },
    status: {
        id: 'status',
        label: 'Status',
        description: 'The status of the coverage.',
        type: extensions_core_1.FieldType.STRING,
        required: true,
    },
    type: {
        id: 'type',
        label: 'Type',
        description: `The Insurance Coverage Code Category, such as medical or accident, using values from http://hl7.org/fhir/ValueSet/coverage-type.`,
        type: extensions_core_1.FieldType.JSON,
        required: false,
    },
    subscriber: {
        id: 'subscriber',
        label: 'Subscriber',
        description: `The resource for the subscriber of the coverage, formatted as a standard identifier "Patient/5350cd20de8a470aa570a852859ac87e".`,
        type: extensions_core_1.FieldType.STRING,
        required: true,
    },
    subscriberId: {
        id: 'subscriberId',
        label: 'Subscriber ID',
        description: `The patient's unique ID.`,
        type: extensions_core_1.FieldType.STRING,
        required: false,
    },
    beneficiary: {
        id: 'beneficiary',
        label: 'Beneficiary',
        description: `The patient the coverage is intended for, formatted as a standard identifier "Patient/5350cd20de8a470aa570a852859ac87e".`,
        type: extensions_core_1.FieldType.STRING,
        required: true,
    },
    relationship: {
        id: 'relationship',
        label: 'Relationship',
        description: `The beneficiary's relationship to the subscriber, as defined in http://hl7.org/fhir/ValueSet/subscriber-relationship.`,
        type: extensions_core_1.FieldType.JSON,
        required: true,
    },
    periodStart: {
        id: 'periodStart',
        label: 'periodStart',
        description: `When the coverage became active for the patient, expressed in FHIR Date format (YYYY-MM-DD).`,
        type: extensions_core_1.FieldType.STRING,
        required: true,
    },
    periodEnd: {
        id: 'periodEnd',
        label: 'periodEnd',
        description: `When the coverage was no longer active for the patient, expressed in FHIR Date format (YYYY-MM-DD).`,
        type: extensions_core_1.FieldType.STRING,
        required: false,
    },
    payor: {
        id: 'payor',
        label: 'Payor',
        description: `Details of the payor, as definded in https://docs.canvasmedical.com/reference/coverage-create`,
        type: extensions_core_1.FieldType.JSON,
        required: true,
    },
    classCoverage: {
        id: 'classCoverage',
        label: 'Class',
        description: `Definition of the plan, subplan, group, and subgroup, as definded in https://docs.canvasmedical.com/reference/coverage-create`,
        type: extensions_core_1.FieldType.JSON,
        required: false,
    },
};
exports.fieldsValidationSchema = zod_1.z.object({
    order: zod_1.z.coerce.number().min(1).max(5),
    status: zod_1.z.string(),
    type: validation_1.JsonSchema.optional(),
    subscriber: (0, validation_1.createReferenceSchema)('Patient'),
    subscriberId: zod_1.z.string().optional(),
    beneficiary: (0, validation_1.createReferenceSchema)('Patient'),
    relationship: validation_1.JsonSchema,
    periodStart: extensions_core_1.DateOnlySchema,
    periodEnd: extensions_core_1.DateOnlySchema.optional(),
    payor: validation_1.JsonArraySchema,
    classCoverage: validation_1.JsonArraySchema.optional(),
});
//# sourceMappingURL=fields.js.map