/**
 * @module health-check
 * Health check endpoint for operational monitoring and load balancer probes.
 *
 * Provides three probe types following Kubernetes health check patterns:
 * - **Startup probe**: Verify initialization complete (one-time check)
 * - **Readiness probe**: Verify dependencies ready (registry, transport)
 * - **Liveness probe**: Verify service responsive (self-check)
 *
 * @example
 * ```typescript
 * import { createHealthChecker } from '@private.me/xbind';
 *
 * const checker = createHealthChecker({
 *   registry: myTrustRegistry,
 *   transport: myTransport
 * });
 *
 * // Load balancer endpoint
 * app.get('/health', async (req, res) => {
 *   const status = await checker.check();
 *   res.status(status.healthy ? 200 : 503).json(status);
 * });
 * ```
 */
import type { TrustRegistry } from './trust-registry.js';
import type { XailTransportAdapter } from './transport.js';
/**
 * Health check probe type.
 */
export type ProbeType = 'startup' | 'readiness' | 'liveness';
/**
 * Health status for individual component.
 */
export interface ComponentHealth {
    /** Component name (e.g., 'registry', 'transport') */
    readonly name: string;
    /** Component status: 'healthy', 'degraded', 'unhealthy' */
    readonly status: 'healthy' | 'degraded' | 'unhealthy';
    /** Human-readable status message */
    readonly message?: string;
    /** Response time in milliseconds */
    readonly latencyMs?: number;
    /** Last check timestamp (ISO 8601) */
    readonly lastCheck: string;
}
/**
 * Overall health check result.
 */
export interface HealthStatus {
    /** Overall health: true if all components healthy, false otherwise */
    readonly healthy: boolean;
    /** Timestamp of health check (ISO 8601) */
    readonly timestamp: string;
    /** Uptime in seconds since checker created */
    readonly uptimeSeconds: number;
    /** Individual component health statuses */
    readonly components: ComponentHealth[];
    /** Additional metadata */
    readonly metadata?: {
        /** Service name */
        readonly service?: string;
        /** Service version */
        readonly version?: string;
        /** Environment (development, staging, production) */
        readonly environment?: string;
    };
}
/**
 * Configuration for health checker.
 */
export interface HealthCheckerOptions {
    /** Trust registry to check (optional) */
    readonly registry?: TrustRegistry;
    /** Transport adapter to check (optional) */
    readonly transport?: XailTransportAdapter;
    /** Service name for metadata */
    readonly serviceName?: string;
    /** Service version for metadata */
    readonly version?: string;
    /** Environment name for metadata */
    readonly environment?: string;
    /** Timeout for component checks in milliseconds (default: 5000) */
    readonly timeoutMs?: number;
    /** Enable startup probe tracking (default: true) */
    readonly enableStartupProbe?: boolean;
}
/**
 * Health checker instance.
 */
export interface HealthChecker {
    /**
     * Perform health check on all configured components.
     * @param probe - Probe type (defaults to 'readiness')
     */
    check(probe?: ProbeType): Promise<HealthStatus>;
    /**
     * Mark startup probe as complete.
     * Call after initialization finishes (e.g., after agent.register()).
     */
    markStartupComplete(): void;
    /**
     * Check if startup probe is complete.
     */
    isStartupComplete(): boolean;
}
/**
 * Create a health checker instance.
 *
 * @param options - Configuration options
 * @returns Health checker instance
 *
 * @example
 * ```typescript
 * const checker = createHealthChecker({
 *   registry: agent.registry,
 *   transport: agent.transport,
 *   serviceName: 'my-service',
 *   version: '1.0.0'
 * });
 *
 * // Mark startup complete after initialization
 * await agent.register();
 * checker.markStartupComplete();
 *
 * // Check health
 * const status = await checker.check('readiness');
 * console.log(status.healthy ? 'Ready' : 'Not ready');
 * ```
 */
export declare function createHealthChecker(options?: HealthCheckerOptions): HealthChecker;
/**
 * Express/Fastify middleware helper for health endpoint.
 *
 * @param checker - Health checker instance
 * @param probe - Probe type (default: 'readiness')
 * @returns Request handler
 *
 * @example
 * ```typescript
 * const checker = createHealthChecker({ registry, transport });
 *
 * // Express
 * app.get('/health', healthEndpoint(checker));
 * app.get('/health/startup', healthEndpoint(checker, 'startup'));
 * app.get('/health/liveness', healthEndpoint(checker, 'liveness'));
 * app.get('/health/readiness', healthEndpoint(checker, 'readiness'));
 * ```
 */
export declare function healthEndpoint(checker: HealthChecker, probe?: ProbeType): (req: unknown, res: {
    status: (code: number) => {
        json: (data: unknown) => void;
    };
}) => Promise<void>;
