import { z } from "zod";
import type { CabinClass } from "../fare/types.ts";
import type { FlightEvent } from "./events.ts";
import type { OpsRebookingClient } from "./rebooking-client.ts";
import type { GdsResponse } from "../air-connector/adapter.ts";
export interface Logger {
    error(msg: string, fields?: Record<string, unknown>): void;
    warn(msg: string, fields?: Record<string, unknown>): void;
}
export declare const DisruptionTypeSchema: z.ZodEnum<{
    cancel: "cancel";
    weather: "weather";
    mechanical: "mechanical";
    atc: "atc";
    delay: "delay";
    divert: "divert";
    "crew-shortage": "crew-shortage";
}>;
export type DisruptionType = z.infer<typeof DisruptionTypeSchema>;
export declare const RebookingActionSchema: z.ZodEnum<{
    "rebook-next-flight": "rebook-next-flight";
    "rebook-alternate-route": "rebook-alternate-route";
    "rebook-partner-carrier": "rebook-partner-carrier";
    "offer-refund": "offer-refund";
    "offer-travel-voucher": "offer-travel-voucher";
    "hold-for-later": "hold-for-later";
}>;
export type RebookingAction = z.infer<typeof RebookingActionSchema>;
export declare const DisruptionRecordSchema: z.ZodObject<{
    disruptionId: z.ZodString;
    flightNumber: z.ZodString;
    airline: z.ZodString;
    type: z.ZodEnum<{
        cancel: "cancel";
        weather: "weather";
        mechanical: "mechanical";
        atc: "atc";
        delay: "delay";
        divert: "divert";
        "crew-shortage": "crew-shortage";
    }>;
    severity: z.ZodEnum<{
        minor: "minor";
        moderate: "moderate";
        severe: "severe";
    }>;
    affectedPassengers: z.ZodNumber;
    recommendedActions: z.ZodArray<z.ZodEnum<{
        "rebook-next-flight": "rebook-next-flight";
        "rebook-alternate-route": "rebook-alternate-route";
        "rebook-partner-carrier": "rebook-partner-carrier";
        "offer-refund": "offer-refund";
        "offer-travel-voucher": "offer-travel-voucher";
        "hold-for-later": "hold-for-later";
    }>>;
    resolved: z.ZodDefault<z.ZodBoolean>;
    resolvedAt: z.ZodOptional<z.ZodString>;
    createdAt: z.ZodString;
}, z.core.$strip>;
export type DisruptionRecord = z.infer<typeof DisruptionRecordSchema>;
export declare const RebookingOptionSchema: z.ZodObject<{
    flightNumber: z.ZodString;
    airline: z.ZodString;
    origin: z.ZodString;
    destination: z.ZodString;
    departureTimeUtc: z.ZodString;
    arrivalTimeUtc: z.ZodString;
    cabinClass: z.ZodEnum<{
        economy: "economy";
        business: "business";
        "premium-economy": "premium-economy";
        first: "first";
    }>;
    totalAmount: z.ZodNumber;
    currency: z.ZodString;
    seatsAvailable: z.ZodNumber;
}, z.core.$strip>;
export type RebookingOption = z.infer<typeof RebookingOptionSchema>;
/**
 * Interface for finding rebooking options. Inject into
 * `DisruptionHandler.findRebookingOptions()` to provide concrete
 * flight + fare results.
 *
 * The built-in `ScheduleFareRebookingProvider` wraps schedule + fare
 * modules. Custom implementations can call GDS APIs or other sources.
 */
export interface RebookingProvider {
    findOptions(params: {
        origin: string;
        destination: string;
        date: string;
        cabinClass?: CabinClass;
    }): RebookingOption[];
}
export declare const DisruptionHandlerConfigSchema: z.ZodObject<{
    autoResolveMinorMs: z.ZodNumber;
    maxPassengersPerCycle: z.ZodNumber;
    holidayCheck: z.ZodDefault<z.ZodBoolean>;
    holidayRegion: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
export type DisruptionHandlerConfig = z.infer<typeof DisruptionHandlerConfigSchema>;
export declare class DisruptionHandler {
    private readonly config;
    private readonly disruptions;
    private readonly rebookingClient?;
    logger?: Logger;
    constructor(config?: Partial<DisruptionHandlerConfig>, rebookingClient?: OpsRebookingClient, logger?: Logger);
    /** Register a disruption from a flight event. Validates input with Zod. */
    handleEvent(event: FlightEvent): DisruptionRecord | null;
    /** Generate a communications message for a disruption. Validates input with Zod. */
    generateMessage(disruption: DisruptionRecord): string;
    /** Resolve a disruption. */
    resolve(disruptionId: string): DisruptionRecord | null;
    /** Get active (unresolved) disruptions. */
    getActive(): DisruptionRecord[];
    /** Get all disruptions. */
    getAll(): DisruptionRecord[];
    /** Get a specific disruption. */
    get(disruptionId: string): DisruptionRecord | undefined;
    /** Count of disruptions by type. */
    countByType(): Record<string, number>;
    /**
     * Find concrete rebooking options for a disruption.
     *
     * Queries the given provider for available flights on the same route
     * and date as the disrupted flight, returning concrete options with
     * fares and availability.
     *
     * Only applies to disruptions where rebooking makes sense
     * (cancel, delay, mechanical, crew-shortage). Returns empty
     * for weather/atc (hold-for-later is the action there).
     */
    findRebookingOptions(disruption: DisruptionRecord, _provider: RebookingProvider, _params?: {
        cabinClass?: CabinClass;
    }): RebookingOption[];
    /**
     * Find concrete rebooking options with explicit route info.
     *
     * Use this when you have origin/destination from the original
     * flight event or external context. The DisruptionRecord itself
     * doesn't carry route info.
     */
    findRebookingOptionsForRoute(disruption: DisruptionRecord, provider: RebookingProvider, route: {
        origin: string;
        destination: string;
        date: string;
    }, params?: {
        cabinClass?: CabinClass;
    }): RebookingOption[];
    /**
     * Execute a rebooking action using the wired OpsRebookingClient.
     *
     * For "rebook-next-flight" and "rebook-alternate-route", this method
     * calls `executeRebooking()` on the client with the given option.
     * For other actions (offer-refund, offer-travel-voucher, hold-for-later),
     * it returns a descriptive result without calling the client.
     *
     * Returns the GdsResponse from the booking step, or null if no booking was made.
     */
    executeRebookingAction(disruption: DisruptionRecord, option: RebookingOption, passengers: Array<{
        paxId: string;
        ptc: "ADT" | "CHD" | "INF";
        firstName?: string;
        lastName?: string;
    }>): Promise<GdsResponse | null>;
    private eventToDisruptionType;
    private classifySeverity;
    private computeRebookingActions;
}
//# sourceMappingURL=disruption.d.ts.map