/**
 * Health Check module for API endpoints
 *
 * Provides:
 * - Endpoint health monitoring
 * - Latency tracking
 * - Automatic failover support
 * - Health status reporting
 */
import { EventEmitter } from 'events';
export type HealthStatus = 'healthy' | 'degraded' | 'unhealthy' | 'unknown';
export interface HealthCheckResult {
    status: HealthStatus;
    latency: number;
    timestamp: Date;
    error?: string;
}
export interface EndpointHealth {
    url: string;
    status: HealthStatus;
    lastCheck: Date | null;
    lastSuccess: Date | null;
    latency: number;
    failureCount: number;
    successCount: number;
    history: HealthCheckResult[];
}
export interface HealthCheckOptions {
    /** Check interval in ms (default: 30000) */
    interval?: number;
    /** Request timeout in ms (default: 5000) */
    timeout?: number;
    /** Number of failures before marking unhealthy (default: 3) */
    failureThreshold?: number;
    /** Latency threshold for degraded status in ms (default: 2000) */
    degradedThreshold?: number;
    /** Maximum history entries to keep (default: 100) */
    maxHistory?: number;
    /** Custom health check function */
    checkFn?: (url: string) => Promise<boolean>;
}
/**
 * Health Check Manager
 */
export declare class HealthCheckManager extends EventEmitter {
    private options;
    private customCheckFn?;
    private endpoints;
    private intervals;
    constructor(options?: HealthCheckOptions);
    /**
     * Add an endpoint to monitor
     */
    addEndpoint(url: string): void;
    /**
     * Remove an endpoint from monitoring
     */
    removeEndpoint(url: string): void;
    /**
     * Start continuous monitoring for an endpoint
     */
    startMonitoring(url: string): void;
    /**
     * Stop monitoring an endpoint
     */
    stopMonitoring(url: string): void;
    /**
     * Perform a health check on an endpoint
     */
    checkEndpoint(url: string): Promise<HealthCheckResult>;
    /**
     * Perform the actual health check
     */
    private performCheck;
    /**
     * Get health status for an endpoint
     */
    getHealth(url: string): EndpointHealth | undefined;
    /**
     * Get all endpoint health statuses
     */
    getAllHealth(): EndpointHealth[];
    /**
     * Get the healthiest endpoint from a list
     */
    getHealthiestEndpoint(urls: string[]): string | null;
    /**
     * Get summary statistics
     */
    getSummary(): {
        total: number;
        healthy: number;
        degraded: number;
        unhealthy: number;
        unknown: number;
    };
    /**
     * Format health status for display
     */
    formatHealth(): string;
    /**
     * Stop all monitoring and cleanup
     */
    dispose(): void;
}
/**
 * Get or create the health check manager
 */
export declare function getHealthCheckManager(options?: HealthCheckOptions): HealthCheckManager;
/**
 * Reset the health check manager
 */
export declare function resetHealthCheckManager(): void;
