/**
 * WebhookDelivery -- HTTP POST delivery for EventBus events.
 *
 * Forwards governance events to external SIEM/webhook endpoints
 * with retry logic, HMAC signing, and dead-letter queue.
 *
 * Supports:
 *   - Splunk HEC, Datadog, Elastic SIEM, generic webhook
 *   - HMAC-SHA256 request signing
 *   - Exponential backoff retry (3 attempts)
 *   - Dead-letter queue for failed deliveries
 *   - Event filtering by type
 *
 * @connexum/ai-governance
 */
import type { EventPayload, EventType } from './event-bus';
export interface WebhookEndpoint {
    /** Unique name for this endpoint */
    name: string;
    /** Destination URL (HTTPS required in production) */
    url: string;
    /** HMAC secret for request signing */
    secret?: string;
    /** Event types to forward (empty = all) */
    eventTypes?: EventType[];
    /** Custom headers to include */
    headers?: Record<string, string>;
    /** Format: 'json' (default), 'splunk-hec', 'syslog' (RFC 5424), or 'elastic' (NDJSON _bulk). */
    format?: 'json' | 'splunk-hec' | 'syslog' | 'elastic';
    /** Whether this endpoint is active */
    enabled?: boolean;
    /**
     * F-NEW-CRIT-6 (2026-05-02): for `format: 'elastic'`, the
     * Elasticsearch index to write into. Required when format is
     * 'elastic'; ignored otherwise. Defaults to 'connexum-governance'
     * if omitted to make typical deployments work without extra config.
     */
    elasticIndex?: string;
}
export interface WebhookDeliveryConfig {
    /** Registered webhook endpoints */
    endpoints: WebhookEndpoint[];
    /** Directory for dead-letter queue */
    dlqDir: string;
    /** Max retry attempts (default: 3) */
    maxRetries?: number;
    /** Base retry delay in ms (default: 1000, doubles each retry) */
    retryDelayMs?: number;
    /** Request timeout in ms (default: 10000) */
    timeoutMs?: number;
    /** Allow HTTP (non-TLS) endpoints (default: false, for testing only) */
    allowInsecure?: boolean;
}
export interface DeliveryResult {
    endpoint: string;
    success: boolean;
    statusCode?: number;
    attempts: number;
    error?: string;
    deliveredAt?: string;
}
export interface DeadLetterEntry {
    event: EventPayload;
    endpoint: string;
    error: string;
    attempts: number;
    failedAt: string;
}
export declare class WebhookDelivery {
    private config;
    private dlqFile;
    private statsDelivered;
    private statsFailed;
    constructor(config: WebhookDeliveryConfig);
    /**
     * Deliver an event to all matching endpoints.
     */
    deliver(event: EventPayload): Promise<DeliveryResult[]>;
    /**
     * Get dead-letter queue entries.
     */
    getDLQ(limit?: number): DeadLetterEntry[];
    /**
     * Retry all dead-letter queue entries.
     */
    retryDLQ(): Promise<DeliveryResult[]>;
    /**
     * Get delivery statistics.
     */
    getStats(): {
        delivered: number;
        failed: number;
        dlqSize: number;
        endpoints: number;
    };
    /**
     * Add an endpoint at runtime.
     */
    addEndpoint(endpoint: WebhookEndpoint): void;
    /**
     * Remove an endpoint by name.
     */
    removeEndpoint(name: string): boolean;
    private deliverToEndpoint;
    private formatBody;
    /**
     * T-066: Format event as RFC 5424 syslog message.
     *
     * Format: <PRI>VERSION TIMESTAMP HOSTNAME APP-NAME PROCID MSGID [SD-ID SD-PARAMS] MSG
     *
     * Facility: 16 (local0), Severity mapped from event type.
     */
    private formatSyslog;
    private syslogSeverity;
    private escapeSyslog;
    private sendRequest;
    private writeDLQ;
}
//# sourceMappingURL=webhook-delivery.d.ts.map