import type { BlockBookingPaymentTerms } from "../../blocks/shared/bookingPaymentTerms";
import type { AppointmentBookingStatusResponse } from "../api/types";
export type BookingFormFieldOption = Readonly<{
    value: string;
    label: string;
}>;
export type BookingFormField = Readonly<{
    id: string;
    label: string;
    type: "text" | "email" | "textarea" | "select" | "radio" | "checkbox" | "booking_requirement_consent" | "tel" | "url" | "number" | "date" | "time";
    required?: boolean;
    placeholder?: string;
    helpText?: string;
    options?: readonly BookingFormFieldOption[];
    multiple?: boolean;
    minLength?: number;
    maxLength?: number;
    pattern?: string;
    min?: number;
    max?: number;
}>;
export type BookingFormSettings = Readonly<{
    type: "booking";
    serviceId?: string;
    serviceIds?: readonly string[];
    resourceId?: string;
    requiresApproval?: boolean;
    successMessage?: string;
}>;
export type BookingFormConfig = Readonly<{
    id: string;
    name: string;
    slug: string;
    settings?: BookingFormSettings;
    schema?: Readonly<{
        version?: string;
        fields: readonly BookingFormField[];
    }>;
}>;
export type BookingFormSourceRecord = Readonly<{
    id: string;
    siteId: string;
    userId: string;
    name: string;
    schemaJson?: Readonly<{
        version?: string;
        fields?: readonly BookingFormField[];
    }>;
    settingsJson?: BookingFormSettings;
    createdAt: string;
    updatedAt: string;
}>;
type BlockBookingPaymentTermsAvailability = Readonly<{
    kind: "available";
    paymentTerms: BlockBookingPaymentTerms;
}> | Readonly<{
    kind: "pending_stripe_setup";
    paymentTerms: BlockBookingPaymentTerms;
    reason: "online_payment_configured_before_launch";
}>;
export type BookingFormService = Readonly<{
    id: string;
    siteId: string;
    title: string;
    description?: string;
    durationMinutes?: number;
    priceAmount?: number | null;
    priceCurrency?: string | null;
    paymentTerms?: BlockBookingPaymentTerms;
    paymentTermsAvailability?: BlockBookingPaymentTermsAvailability;
}>;
export type BookingFormServicesSource = readonly BookingFormService[] | Readonly<{
    services?: readonly BookingFormService[];
}> | Readonly<Record<string, BookingFormService>>;
export type BookingSelectedCollectionOptionKind = "upfront" | "deferred_manual" | "instalment_plan" | "flexible_balance";
export type BookingFormData = Readonly<{
    serviceId?: string;
    resourceId?: string;
    selectedDate?: string;
    selectedSlot?: string;
    discountCode?: string;
    selectedCollectionOptionKind?: BookingSelectedCollectionOptionKind;
    selectedAppointmentPackageId?: string;
}> & Readonly<Record<string, unknown>>;
type BookingSubmissionCommon = Readonly<{
    formId: string;
    serviceId: string;
    resourceId?: string;
    startAt: string;
    endAt: string;
    customFields: Readonly<Record<string, unknown>>;
    timezone: string;
}>;
export type BookingSubmissionData = (BookingSubmissionCommon & Readonly<{
    kind: "standard";
    discountCode?: string;
    selectedCollectionOptionKind?: BookingSelectedCollectionOptionKind;
    altchaSolution?: string | null;
    successUrl?: string;
    cancelUrl?: string;
}>) | (BookingSubmissionCommon & Readonly<{
    kind: "appointment_package";
    customerPassId: string;
}>);
export type BookingPaymentStepMode = "hidden" | "disclosure_only" | "choice_required" | "unsupported";
type BookingPaymentSelectionMode = "implicit_upfront" | "implicit_deferred_manual" | "implicit_instalment_plan" | "implicit_flexible_balance" | "choice_required" | "pending_stripe_setup" | "unsupported";
export type BookingPaymentStepResolution = Readonly<{
    mode: BookingPaymentStepMode;
    service: BookingFormService | null;
    errorMessage?: string;
    shouldClearSelectedCollectionOptionKind: boolean;
}>;
export type BookingRedirectState = Readonly<{
    kind: "none";
}> | Readonly<{
    kind: "cancelled";
}> | Readonly<{
    kind: "success";
    sessionId: string;
}>;
export type AppointmentCheckoutVerificationState = Readonly<{
    tag: "idle";
}> | Readonly<{
    tag: "verifying";
    sessionId: string;
}> | Readonly<{
    tag: "confirmed";
    sessionId: string;
    appointmentId: string;
    resourceName: string | null;
    paymentStatus: "completed" | "not_required";
}> | Readonly<{
    tag: "failed";
    sessionId: string;
    reason: "payment_failed" | "checkout_cancelled" | "payment_refunded" | "appointment_cancelled" | "unknown";
    message: string;
    appointmentId: string | null;
}> | Readonly<{
    tag: "timeout";
    sessionId: string;
    message: string;
    appointmentId: string | null;
}>;
export type BookingFormViewState = Readonly<{
    kind: "form";
}> | Readonly<{
    kind: "success";
    resourceName: string | null;
}> | Readonly<{
    kind: "verifying";
    message: string;
}> | Readonly<{
    kind: "error";
    message: string;
}>;
export type BookingSubmissionPreparationError = Readonly<{
    tag: "missing-required-booking-information";
}> | Readonly<{
    tag: "service-not-found";
    serviceId: string;
}> | Readonly<{
    tag: "payment-option-required";
    serviceId: string;
    serviceTitle: string;
}> | Readonly<{
    tag: "payment-option-unsupported";
    serviceId: string;
    serviceTitle: string;
}> | Readonly<{
    tag: "service-missing-duration";
    serviceId: string;
    serviceTitle: string;
}>;
export type BookingSubmissionPreparationResult = Readonly<{
    ok: true;
    value: BookingSubmissionData;
}> | Readonly<{
    ok: false;
    error: BookingSubmissionPreparationError;
}>;
export declare function getBookingRedirectStateFromLocation(location: Readonly<{
    search: string;
    hash: string;
}>): BookingRedirectState;
export declare function resolveAppointmentCheckoutVerificationState(input: Readonly<{
    config: Readonly<{
        sessionId: string;
    }> | null;
    pollingStatus: "idle" | "polling" | "completed" | "failed" | "timeout";
    result: AppointmentBookingStatusResponse | null;
    error: Error | null;
}>): AppointmentCheckoutVerificationState;
export declare function deriveBookingFormViewState(input: Readonly<{
    localSuccessResourceName: string | null | undefined;
    redirectState: BookingRedirectState;
    verificationState: AppointmentCheckoutVerificationState;
}>): BookingFormViewState;
export declare function resolveBookingSiteId(siteId: string | undefined, form: BookingFormSourceRecord | null | undefined): string;
export declare function normalizeBookingFormConfig(form: BookingFormSourceRecord | null | undefined): BookingFormConfig | null;
export declare function normalizeBookingServices(services: BookingFormServicesSource | null | undefined): readonly BookingFormService[];
export declare function getBookingServicePaymentSelectionMode(service: BookingFormService | undefined): BookingPaymentSelectionMode;
export declare function resolveDefaultBookingServiceId(formConfig: BookingFormConfig | null | undefined, services: readonly BookingFormService[]): string | null;
export declare function resolveBookingSelectedService(input: Readonly<{
    data: Partial<BookingFormData>;
    services: readonly BookingFormService[];
    defaultServiceId?: string | null;
}>): BookingFormService | null;
export declare function resolveBookingPaymentStep(input: Readonly<{
    data: Partial<BookingFormData>;
    services: readonly BookingFormService[];
    defaultServiceId?: string | null;
}>): BookingPaymentStepResolution;
export declare function prepareBookingSubmission(input: Readonly<{
    formId: string;
    data: BookingFormData;
    services: readonly BookingFormService[];
    defaultServiceId?: string | null;
    defaultResourceId?: string | null;
    altchaSolution?: string | null;
    viewerTimeZone?: string | null;
}>): BookingSubmissionPreparationResult;
export declare function formatBookingSubmissionPreparationError(error: BookingSubmissionPreparationError): string;
export declare function getBookingSuccessMessage(successMessage: string | null | undefined): string;
export {};
