import type { KeyRef, KmsProvider } from "@voyant-travel/utils/kms"; import type { PostgresJsDatabase } from "drizzle-orm/postgres-js"; import { type BookingTravelerBedPreference, type BookingTravelerIdentity, type DecryptedBookingTravelerTravelDetail, type TravelerAllocationMap } from "./schema/travel-details.js"; export interface UpsertBookingTravelerTravelDetailInput { nationality?: string | null; documentType?: BookingTravelerIdentity["documentType"]; documentNumber?: string | null; documentExpiry?: string | null; documentIssuingCountry?: string | null; documentIssuingAuthority?: string | null; /** Provenance of the snapshot (id of the `crm.person_documents` row that seeded it). */ documentPersonDocumentId?: string | null; dateOfBirth?: string | null; dietaryRequirements?: string | null; accessibilityNeeds?: string | null; isLeadTraveler?: boolean | null; sharingGroupId?: string | null; roomTypeId?: string | null; bedPreference?: BookingTravelerBedPreference | null; allocations?: TravelerAllocationMap; } /** * Plaintext fields a booking-traveler can pre-fill from the * traveler's Relationships person record on creation. Mirrors * `PersonTravelSnapshot` in `@voyant-travel/relationships` so the two stay in sync. */ export interface BookingTravelerSnapshot { dateOfBirth?: string | null; dietaryRequirements?: string | null; accessibilityNeeds?: string | null; documentType?: BookingTravelerIdentity["documentType"]; documentNumber?: string | null; documentExpiry?: string | null; documentIssuingCountry?: string | null; documentIssuingAuthority?: string | null; documentPersonDocumentId?: string | null; } /** * Apply a person-derived snapshot to a booking-traveler input, * preserving the snapshot semantic: explicit input always wins, * snapshot only fills the gaps. Pure (no I/O) so callers can compose * it freely. */ export declare function applyTravelDetailSnapshot(input: UpsertBookingTravelerTravelDetailInput, snapshot: BookingTravelerSnapshot | null | undefined): UpsertBookingTravelerTravelDetailInput; export interface BookingPiiAuditEvent { action: "encrypt" | "decrypt" | "delete"; travelerId: string; actorId?: string | null; } export interface BookingPiiServiceOptions { kms: KmsProvider; keyRef?: KeyRef; onAudit?: (event: BookingPiiAuditEvent) => void | Promise; } export interface BookingPiiService { getTravelerTravelDetails(db: PostgresJsDatabase, travelerId: string, actorId?: string | null): Promise; upsertTravelerTravelDetails(db: PostgresJsDatabase, travelerId: string, input: UpsertBookingTravelerTravelDetailInput, actorId?: string | null): Promise; deleteTravelerTravelDetails(db: PostgresJsDatabase, travelerId: string, actorId?: string | null): Promise<{ travelerId: string; } | null>; } export declare function createBookingPiiService(options: BookingPiiServiceOptions): BookingPiiService;