import { type AllocationResource } from "@voyant-travel/availability/schema"; import type { PostgresJsDatabase } from "drizzle-orm/postgres-js"; import type { z } from "zod"; import { type AllocationMutationOptions } from "./service-allocation.js"; import type { allocationAutomationSchema } from "./validation.js"; export type AllocationAutomationInput = z.infer; export type { ProductOptionResourceTemplates, ResourceTemplate, UpsertResourceTemplateInput, } from "./service-allocation-templates.js"; export { deleteProductOptionResourceTemplate, listProductOptionResourceTemplates, upsertProductOptionResourceTemplate, } from "./service-allocation-templates.js"; export { parseLayoutSpecFromFlags, positionFromCells, } from "./service-allocation-vehicle-materialization.js"; export interface AllocationAutomationResult { kind: string; assigned?: number; skipped?: number; created?: number; resources?: AllocationResource[]; } export declare function autoMaterializeAllocationResources(db: PostgresJsDatabase, slotId: string, input: AllocationAutomationInput, options?: AllocationMutationOptions): Promise; export declare function autoAllocateSlotResources(db: PostgresJsDatabase, slotId: string, input: AllocationAutomationInput, options?: AllocationMutationOptions): Promise; export interface MaterializeSlotResourcesFromTemplatesOptions { /** * Restrict materialisation to a single template kind. When omitted, * all templates with a non-null `defaultCount` for the slot's option * are seeded. */ kind?: string; /** * Restrict materialisation to a single option's templates. Needed when a * product-level slot (no `optionId`) is seeded on behalf of one option — * without it, every option's templates would be materialised. */ optionId?: string; /** * Skip templates whose `kind` already has resources for the slot. * Defaults to true so the helper is safe to call repeatedly during * slot generation. */ skipExisting?: boolean; } /** * Auto-seed `allocation_resources` for a freshly-published slot from * its option's `product_option_resource_templates` rows that declare a * `default_count`. Distinct from `autoMaterializeAllocationResources`, * which derives counts from existing bookings. Templates without * `default_count` are skipped — operators handle those via the admin * materialise route once pax is known. * * Vehicle-seat layouts are out of scope here; use the existing * `autoMaterializeAllocationResources` path for those once the slot * has bookings (it knows pax-per-option). */ export declare function materializeSlotResourcesFromTemplateDefaults(db: PostgresJsDatabase, slotId: string, opts?: MaterializeSlotResourcesFromTemplatesOptions): Promise<{ created: number; resources: AllocationResource[]; }>; /** * Back-fill every open, future departure for a product (optionally scoped to a * single option) with resources from its templates' `default_count`. Reuses * the per-slot, idempotent {@link materializeSlotResourcesFromTemplateDefaults} * — slots that already have a kind's resources are skipped — so an operator can * configure departure inventory once and apply it across already-open slots. */ export declare function materializeOpenSlotsFromTemplateDefaults(db: PostgresJsDatabase, params: { productId: string; optionId?: string; }): Promise<{ slots: number; created: number; }>;