"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RUMObjectSchema = exports.ZASectionSchema = void 0;
var zod_1 = require("zod");
var rum_enums_1 = require("./rum.enums");
exports.ZASectionSchema = zod_1.z.object({
    date: zod_1.z.string().length(8), // DDMMYYYY
    code: zod_1.z.string().length(8),
    ext: zod_1.z.string().length(3).optional(),
    phase: zod_1.z.string().length(1).optional(),
    act: zod_1.z.string().length(1).optional(),
    diag: zod_1.z.string().length(2).optional(),
    mod: zod_1.z.string().length(4).optional(),
    RE: zod_1.z.string().length(1).optional(),
    AN: zod_1.z.string().length(1).optional(),
    qty: zod_1.z.string().length(2).optional()
});
exports.RUMObjectSchema = zod_1.z.object({
    // Identification
    FINESS: zod_1.z.string().length(9).optional(),
    RSS: zod_1.z.string().length(20).optional(),
    // Données administratives
    ADM: zod_1.z.string().length(8).optional(),
    RUM: zod_1.z.string().length(8).optional(),
    birthDate: zod_1.z.string().length(8).optional(),
    sex: zod_1.z.nativeEnum(rum_enums_1.SEX).optional(), // 1 = Male, 2 = Female
    uMed: zod_1.z.string().length(8).optional(),
    authorisation: zod_1.z.string().length(2).optional(),
    // Dates et modes
    entryDate: zod_1.z.string().length(8).optional(),
    entryMode: zod_1.z.nativeEnum(rum_enums_1.RUM_ENTRY_MODE).optional(), // Selon modalités du document
    provenance: zod_1.z.nativeEnum(rum_enums_1.RUM_PROVENANCE).optional(), // Selon modalités du document
    exitDate: zod_1.z.string().length(8).optional(),
    exitMode: zod_1.z.nativeEnum(rum_enums_1.RUM_EXIT_MODE).optional(),
    destination: zod_1.z.nativeEnum(rum_enums_1.RUM_DESTINATION).optional(),
    // Données géographiques et cliniques
    cpRes: zod_1.z.string().length(5).optional(),
    weight: zod_1.z.string().length(4).optional(), // Decimal format 0000
    ageGestation: zod_1.z.string().length(2).optional(),
    lastMensDate: zod_1.z.string().length(8).optional(),
    session: zod_1.z.number().min(0).max(99).optional(),
    // Compteurs
    nDA: zod_1.z.number().min(0).max(99).optional(), // 2 caractères selon document
    nDAD: zod_1.z.number().min(0).max(99).optional(), // 2 caractères selon document
    nZA: zod_1.z.number().min(0).max(999).optional(), // 3 caractères selon document
    // Diagnostics
    DP: zod_1.z.string().length(8).optional(),
    DR: zod_1.z.string().length(8).optional(),
    // Scores et codes
    IGS: zod_1.z.string().optional(),
    conf: zod_1.z.nativeEnum(rum_enums_1.CONFIRMATION_OVERRIDE).optional(),
    // Codes de radiothérapie
    rtM: zod_1.z.nativeEnum(rum_enums_1.RADIO_THERAPY_MACHINE_TYPE).optional(),
    rtD: zod_1.z.nativeEnum(rum_enums_1.RADIO_THERAPY_DOSIMETRY_TYPE).optional(),
    // Codes spéciaux
    innov: zod_1.z.nativeEnum(rum_enums_1.INNOVATION_NUMBER).optional(),
    conv: zod_1.z.nativeEnum(rum_enums_1.COMPLETE_HOSPITALIZATION_CONVERSION).optional(),
    raac: zod_1.z.nativeEnum(rum_enums_1.RAAC_CARE).optional(),
    spec: zod_1.z.nativeEnum(rum_enums_1.SPECIAL_PATIENT_MONITORING).optional(),
    RH: zod_1.z.nativeEnum(rum_enums_1.HOSPITAL_RESTRICTED_RESERVE_CARE).optional(),
    tarif: zod_1.z.nativeEnum(rum_enums_1.TARIFFICATION_RESTRICTION).optional(),
    cat: zod_1.z.nativeEnum(rum_enums_1.TOTAL_INTERVENTIONS_CATEGORY).optional(),
    // Urgences
    NP: zod_1.z.nativeEnum(rum_enums_1.NON_PROGRAMMED).optional(),
    ER: zod_1.z.nativeEnum(rum_enums_1.EMERGENCY_PASSAGE).optional(),
    // Champs texte
    FILL: zod_1.z.string().optional(),
    RES: zod_1.z.string().optional(),
    // Tableaux
    DAs: zod_1.z.array(zod_1.z.string().length(8)).optional(),
    DADs: zod_1.z.array(zod_1.z.string().length(8)).optional(),
    ZAs: zod_1.z.array(exports.ZASectionSchema).optional()
});
