import { z } from 'zod'; import { REQUEST_STATUSES } from '../exploitation'; /** * Portail public (QR cabine) — AUCUN compte, AUCUN jargon (charte §7). * Le suivi se fait par jeton opaque gardé sur le téléphone du gardien. */ export const PortalAssetSchema = z.object({ reference: z.string(), siteName: z.string(), locationName: z.string(), }); export type PortalAsset = z.infer; export const PortalRequestCreateSchema = z.object({ assetReference: z.string().min(1).max(30), description: z.string().min(3).max(1000), isPersonTrapped: z.boolean().optional(), requesterName: z.string().max(120).optional(), }); export type PortalRequestCreate = z.infer; /** Étapes lisibles par tous : Reçu → Intervention → Résolu. */ export const PORTAL_STEPS = ['RECEIVED', 'IN_PROGRESS', 'RESOLVED'] as const; export type PortalStep = (typeof PORTAL_STEPS)[number]; export const PortalRequestStatusSchema = z.object({ reference: z.string(), description: z.string(), isPersonTrapped: z.boolean(), status: z.enum(REQUEST_STATUSES), step: z.enum(PORTAL_STEPS), rejectionReason: z.string().nullable(), createdAt: z.iso.datetime(), }); export type PortalRequestStatus = z.infer; export const PortalRequestCreatedSchema = PortalRequestStatusSchema.extend({ publicToken: z.string(), // à conserver côté téléphone — seul accès au suivi }); export type PortalRequestCreated = z.infer;