import type { ActionContext } from '../actions.js';
import type { FormWebhookConfig, FormWebhookEvent } from './types.js';
export declare const FORM_WEBHOOK_EVENTS: readonly FormWebhookEvent[];
export declare class FormWebhookError extends Error {
    status: number;
    constructor(message: string, status?: number);
}
export interface CreateFormWebhookInput {
    url: string;
    events?: FormWebhookEvent[];
    secret?: string;
    enabled?: boolean;
    retryCount?: number;
}
export declare function createFormWebhook(ctx: ActionContext, formId: string, input: CreateFormWebhookInput): Promise<FormWebhookConfig & {
    secret: string;
}>;
export declare function listFormWebhooks(formId: string): Promise<FormWebhookConfig[]>;
export declare function getFormWebhook(id: string): Promise<FormWebhookConfig | null>;
export interface UpdateFormWebhookInput {
    url?: string;
    events?: FormWebhookEvent[];
    secret?: string;
    enabled?: boolean;
    retryCount?: number;
}
export declare function updateFormWebhook(ctx: ActionContext, id: string, patch: UpdateFormWebhookInput): Promise<FormWebhookConfig>;
export declare function deleteFormWebhook(ctx: ActionContext, id: string): Promise<void>;
export interface FormWebhookPayload {
    event: FormWebhookEvent;
    timestamp: string;
    formId: string;
    formSlug?: string;
    submissionId?: string;
    entryNumber?: number | null;
    data?: Record<string, unknown>;
}
export interface WebhookDeliveryResult {
    ok: boolean;
    status: number;
    attempts: number;
    error?: string;
}
/**
 * Dispatch an event to all enabled webhooks for a form that subscribe to it.
 * Best-effort and non-throwing — intended to run in the request's async tail.
 */
export declare function dispatchFormWebhooks(formId: string, payload: Omit<FormWebhookPayload, 'timestamp'>): Promise<{
    matched: number;
    delivered: number;
}>;
/** Send a sample payload to a single webhook to verify configuration. */
export declare function testFormWebhook(ctx: ActionContext, id: string): Promise<WebhookDeliveryResult>;
//# sourceMappingURL=webhooks.d.ts.map