import type { PlzContext } from './context';
/** Metodos HTTP soportados */
export type WebhookMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
/** Request entrante del webhook */
export interface WebhookRequest {
    method: WebhookMethod;
    headers: Record<string, string>;
    query: Record<string, string>;
    body: unknown;
    /** IP del cliente */
    ip?: string;
    /** URL completa del request */
    url: string;
}
/** Respuesta que retorna el handler del webhook */
export interface WebhookResponse {
    status: number;
    headers?: Record<string, string>;
    body?: unknown;
}
/** Configuracion completa de un webhook */
export interface WebhookConfig {
    /** Nombre unico del webhook (slug). Genera la URL: workers.plazbot.com/<workspaceId>/<name> */
    name: string;
    /** Referencia del webhook — describe que recibe y procesa */
    reference: string;
    /** Metodo HTTP aceptado */
    method: WebhookMethod;
    /** Handler que procesa el request entrante */
    handler(request: WebhookRequest, plz: PlzContext): Promise<WebhookResponse>;
}
/** Webhook definido y listo para desplegar */
export interface WebhookDefinition {
    __type: 'webhook';
    config: WebhookConfig;
}
