import { SchedulingConfirmedBooking, SchedulingState, SchedulingService, SchedulingResource, SchedulingSlot, SchedulingBookingDetails } from '../types/scheduling.mjs'; interface UseSchedulingOptions { /** Override the API base path. Default: auto-detect via resolveSchedulingBasePath(). */ apiBase?: string; /** Called once a booking is confirmed (use this to redirect, fire analytics, etc.). */ onConfirmed?: (booking: SchedulingConfirmedBooking) => void; /** * If true, the hook will not auto-load services on mount — the consumer * calls `loadServices()` explicitly. Useful if the booking flow is gated * behind a CTA and the initial fetch shouldn't happen until the user opens it. */ skipInitialLoad?: boolean; /** * Allow the customer to pick "Any available" instead of a specific resource. * Defaults to false — most templates want explicit resource selection. When * true, `pickResource(null)` is permitted and availability fans out across * all eligible resources. */ allowAnyResource?: boolean; /** * When the resources list for a chosen service has exactly one entry, skip * the resource picker and go straight to the date/time step. Defaults to * false — surprising-skip is bad UX, and the picker still adds a useful * confirmation step ("yes, this stylist") even when there's only one. * Templates that genuinely want the skip can opt back in. */ autoSkipSingleResource?: boolean; } interface UseSchedulingResult { basePath: string; state: SchedulingState; services: SchedulingService[]; resources: SchedulingResource[]; slots: SchedulingSlot[]; /** Catalog or availability fetch in flight. Submission has its own state status. */ loading: boolean; /** Last error string (catalog/availability/submit). Cleared on next successful op. */ error: string | null; loadServices: () => Promise; pickService: (service: SchedulingService) => Promise; pickResource: (resource: SchedulingResource | null) => Promise; loadAvailability: (from: string, to: string) => Promise; pickSlot: (slot: SchedulingSlot) => void; setDetails: (details: SchedulingBookingDetails) => void; submit: () => Promise; /** Reset to idle, preserving the cached `services` list so the picker stays warm. */ reset: () => void; /** Step back one stage of the flow without nuking caches. */ back: () => void; } declare function useScheduling(opts?: UseSchedulingOptions): UseSchedulingResult; export { type UseSchedulingOptions, type UseSchedulingResult, useScheduling };