/**
 * Correlation ID Middleware for Request Tracking
 *
 * This middleware ensures that every request has a unique correlation ID
 * that can be used for tracking requests across the application, logs,
 * and external services. This is essential for distributed tracing and
 * debugging in microservices architectures.
 *
 * @package be-core
 * @since 1.0.0
 */
import { Request, Response, NextFunction } from 'express';
import { Logger } from '../logging/Logger';
export interface CorrelationIdOptions {
    logger?: Logger;
    headerName?: string;
    propertyName?: string;
    generateId?: () => string;
    enforceHeader?: boolean;
    logRequests?: boolean;
}
export interface RequestWithCorrelationId extends Request {
    correlationId: string;
    requestId: string;
    [key: string]: any;
}
/**
 * Correlation ID Middleware for tracking requests across distributed systems
 */
export declare class CorrelationIdMiddleware {
    private logger;
    private options;
    constructor(options?: CorrelationIdOptions);
    /**
     * Main correlation ID middleware
     */
    handle(): (req: Request, res: Response, next: NextFunction) => void;
    /**
     * Extract correlation ID from request or generate new one
     */
    private extractOrGenerateCorrelationId;
    /**
     * Validate correlation ID format
     */
    private isValidCorrelationId;
    /**
     * Log incoming request with correlation ID
     */
    private logRequest;
    /**
     * Get correlation ID from request
     */
    static getCorrelationId(req: Request): string | undefined;
    /**
     * Get correlation ID from request with fallback
     */
    static getCorrelationIdSafe(req: Request): string;
    /**
     * Health check for correlation ID middleware
     */
    healthCheck(): {
        name: string;
        status: "healthy";
        timestamp: string;
        details: {
            headerName: string;
            propertyName: string;
            enforceHeader: boolean;
            logRequests: boolean;
        };
    };
}
/**
 * Factory function to create correlation ID middleware
 */
export declare function createCorrelationIdMiddleware(options?: CorrelationIdOptions): CorrelationIdMiddleware;
/**
 * Express middleware function for correlation ID
 */
export declare function correlationId(options?: CorrelationIdOptions): (req: Request, res: Response, next: NextFunction) => void;
//# sourceMappingURL=CorrelationIdMiddleware.d.ts.map