type ApiScope = 'event_types:read' | 'availability:read' | 'bookings:read' | 'bookings:write' | 'bookings:cancel' | 'webhooks:manage';
type BookingStatus = 'tentative' | 'pending_approval' | 'confirmed' | 'reschedule_pending' | 'rejected' | 'cancelled' | 'completed' | 'no_show' | 'expired';
type WebhookEvent = 'booking.confirmed' | 'booking.approval_requested' | 'booking.approved' | 'booking.rejected' | 'booking.rescheduled' | 'booking.cancelled';
type EventType = {
    id: string;
    slug: string;
    title: string;
    description: string | null;
    type: string;
    durationMinutes: number;
    bookingWindowDays: number;
    locationType: string;
    requiresApproval: boolean;
    groupCapacity: number | null;
    allowsRecurrence: boolean;
    recurrenceMaxOccurrences: number;
    host: {
        handle: string;
        name: string;
    };
    updatedAt: string;
};
type Slot = {
    startsAt: string;
    endsAt: string;
    localDate: string;
    localTime: string;
    timezone: string;
    offset: string;
};
type Booking = {
    uid: string;
    eventTypeId: string;
    status: BookingStatus;
    startsAt: string;
    endsAt: string;
    timezone: string;
    title: string;
    location: {
        type: string;
        value: string | null;
    };
    guest: {
        name: string;
        email: string;
        locale: string;
        notes: string | null;
    };
    revision: number;
    cancellationReason: string | null;
    createdAt: string;
    updatedAt: string;
};
type WebhookEndpoint = {
    id: string;
    name: string;
    url: string;
    events: WebhookEvent[];
    status: 'active' | 'disabled';
    lastDeliveredAt: string | null;
    createdAt: string;
};
type Page<T> = {
    data: T[];
    meta: {
        requestId: string;
        nextCursor: string | null;
        hasMore: boolean;
    };
};
type Result<T> = {
    data: T;
    meta: {
        requestId: string;
    };
};
type CreateBookingInput = {
    eventTypeId: string;
    startsAt: string;
    guest: {
        name: string;
        email: string;
        timezone: string;
        locale?: string;
        notes?: string;
    };
    recurrence?: {
        frequency?: 'weekly';
        intervalWeeks: number;
        count: number;
        nonexistentTime?: 'skip' | 'shift-forward';
        ambiguousTime?: 'earlier' | 'later';
    };
};
type BookingCreateResult = {
    bookingUid: string;
    status: 'pending_approval' | 'confirmed';
    startsAt: string;
    endsAt: string;
    replayed: boolean;
    series?: {
        seriesUid: string;
        frequency: 'weekly';
        intervalWeeks: number;
        count: number;
        occurrences: Array<{
            bookingUid: string;
            status: 'pending_approval' | 'confirmed';
            startsAt: string;
            endsAt: string;
        }>;
    };
};

type HoraMatchOptions = {
    apiKey: string;
    baseUrl?: string;
    fetch?: typeof globalThis.fetch;
    timeoutMs?: number;
    maxRetries?: number;
};
declare class HoraMatchApiError extends Error {
    readonly code: string;
    readonly status: number;
    readonly requestId: string | null;
    readonly details?: unknown | undefined;
    constructor(code: string, status: number, requestId: string | null, message: string, details?: unknown | undefined);
}
declare class HoraMatchNetworkError extends Error {
    constructor(message: string, options?: ErrorOptions);
}
declare class HoraMatchTimeoutError extends HoraMatchNetworkError {
    constructor(options?: ErrorOptions);
}
declare class HoraMatch {
    readonly eventTypes: {
        list: () => Promise<Result<EventType[]>>;
        retrieve: (id: string) => Promise<Result<EventType>>;
    };
    readonly availability: {
        list: (eventTypeId: string, input: {
            from: string;
            to: string;
        }) => Promise<Result<{
            eventType: EventType;
            slots: Slot[];
        }>>;
    };
    readonly bookings: {
        list: (input?: {
            status?: BookingStatus;
            cursor?: string;
            limit?: number;
        }) => Promise<Page<Booking>>;
        retrieve: (uid: string) => Promise<Result<Booking>>;
        create: (input: CreateBookingInput, options: {
            idempotencyKey: string;
        }) => Promise<Result<BookingCreateResult>>;
        cancel: (uid: string, input: {
            expectedRevision: number;
        }, options: {
            idempotencyKey: string;
        }) => Promise<Result<{
            booking: Booking;
            replayed: boolean;
        }>>;
    };
    readonly webhooks: {
        list: () => Promise<Result<WebhookEndpoint[]>>;
        create: (input: {
            name: string;
            url: string;
            events: WebhookEvent[];
        }, options: {
            idempotencyKey: string;
        }) => Promise<Result<{
            endpoint: WebhookEndpoint;
            signingSecret: string;
            replayed: boolean;
        }>>;
        remove: (id: string, options: {
            idempotencyKey: string;
        }) => Promise<Result<{
            id: string;
            status: "disabled";
            replayed: boolean;
        }>>;
    };
    private readonly apiKey;
    private readonly baseUrl;
    private readonly fetcher;
    private readonly timeoutMs;
    private readonly maxRetries;
    constructor(options: HoraMatchOptions);
    private request;
}

type VerifiedWebhookEvent<T = unknown> = {
    id: string;
    type: string;
    schemaVersion: string;
    createdAt: string;
    data: {
        object: T;
    };
};
declare function verifyWebhook<T = unknown>(input: {
    payload: string;
    headers: Headers | Record<string, string>;
    secret: string;
    toleranceSeconds?: number;
    now?: number;
}): Promise<VerifiedWebhookEvent<T>>;

export { type ApiScope, type Booking, type BookingCreateResult, type BookingStatus, type CreateBookingInput, type EventType, HoraMatch, HoraMatchApiError, HoraMatchNetworkError, HoraMatchTimeoutError, type Page, type Result, type Slot, type VerifiedWebhookEvent, type WebhookEndpoint, type WebhookEvent, verifyWebhook };
