import { LifecycleComponent } from './lifecycle-component.js';
/**
 * Interface for pooled connection
 */
export interface IPooledConnection<T> {
    id: string;
    connection: T;
    createdAt: number;
    lastUsedAt: number;
    useCount: number;
    inUse: boolean;
    metadata?: any;
}
/**
 * Configuration options for the connection pool
 */
export interface IConnectionPoolOptions<T> {
    minSize?: number;
    maxSize?: number;
    acquireTimeout?: number;
    idleTimeout?: number;
    maxUseCount?: number;
    validateOnAcquire?: boolean;
    validateOnReturn?: boolean;
    queueTimeout?: number;
    connectionFactory: () => Promise<T>;
    connectionValidator?: (connection: T) => Promise<boolean>;
    connectionDestroyer?: (connection: T) => Promise<void>;
    onConnectionError?: (error: Error, connection?: T) => void;
}
/**
 * Enhanced connection pool with priority queue, backpressure, and lifecycle management
 */
export declare class EnhancedConnectionPool<T> extends LifecycleComponent {
    private readonly options;
    private readonly availableConnections;
    private readonly activeConnections;
    private readonly waitQueue;
    private readonly mutex;
    private readonly eventEmitter;
    private connectionIdCounter;
    private requestIdCounter;
    private isClosing;
    private metrics;
    constructor(options: IConnectionPoolOptions<T>);
    /**
     * Initialize minimum number of connections
     */
    private initializeMinConnections;
    /**
     * Start maintenance timer for idle connection cleanup
     */
    private startMaintenance;
    /**
     * Perform maintenance tasks
     */
    private performMaintenance;
    /**
     * Acquire a connection from the pool
     */
    acquire(priority?: number, timeout?: number): Promise<IPooledConnection<T>>;
    /**
     * Try to acquire an available connection
     */
    private tryAcquireConnection;
    /**
     * Checkout a connection for use
     */
    private checkoutConnection;
    /**
     * Queue an acquire request
     */
    private queueAcquireRequest;
    /**
     * Release a connection back to the pool
     */
    release(connection: IPooledConnection<T>): Promise<void>;
    /**
     * Create a new connection
     */
    private createConnection;
    /**
     * Destroy a connection
     */
    private destroyConnection;
    /**
     * Get current pool statistics
     */
    getStats(): {
        connectionsCreated: number;
        connectionsDestroyed: number;
        connectionsAcquired: number;
        connectionsReleased: number;
        acquireTimeouts: number;
        validationFailures: number;
        queueHighWaterMark: number;
        available: number;
        active: number;
        waiting: number;
        total: number;
    };
    /**
     * Subscribe to pool events
     */
    on(event: string, listener: Function): void;
    /**
     * Close the pool and cleanup resources
     */
    protected onCleanup(): Promise<void>;
}
