/**
 * Persistent Connection Manager for ZinTrust Framework
 * Handles database connections across different runtime environments
 * Supports: PostgreSQL, MySQL, SQL Server with connection pooling for Lambda
 */
import type { SupportedDriver } from '../migrations/enum';
import type { IDatabaseAdapter } from './DatabaseAdapter';
export interface ConnectionConfig {
    adapter: SupportedDriver;
    host?: string;
    port?: number;
    database: string;
    username?: string;
    password?: string;
    maxConnections?: number;
    idleTimeout?: number;
    connectionTimeout?: number;
    enableRdsProxy?: boolean;
    rdsProxyEndpoint?: string;
}
export interface PooledConnection {
    id: string;
    adapter: string;
    createdAt: number;
    lastUsedAt: number;
    isActive: boolean;
    queryCount: number;
}
export interface ConnectionPool {
    total: number;
    active: number;
    idle: number;
    queued: number;
}
interface ConnectionManagerInstance {
    getConnection(id?: string): Promise<IDatabaseAdapter>;
    releaseConnection(connectionId?: string): Promise<void>;
    closeAll(): Promise<void>;
    getPoolStats(): ConnectionPool;
    enableRdsProxy(endpoint: string): Promise<void>;
    getAuroraDataApiConnection(): Promise<AuroraDataApiConnection>;
}
/**
 * Manages database connections across Lambda warm invocations
 * Reuses connections to reduce cold start impact and connection overhead
 * Sealed namespace object following Pattern 2
 *
 * @see FRAMEWORK_REFACTOR_FUNCTION_PATTERN.md for Pattern 2 details
 */
export declare const ConnectionManager: Readonly<{
    /**
     * Get or create singleton instance
     */
    getInstance(config?: ConnectionConfig): ConnectionManagerInstance;
    /**
     * Shutdown connection manager if it has been initialized
     * Safe to call even if no instance exists
     */
    shutdownIfInitialized(): Promise<void>;
    /**
     * Get or create database connection
     */
    getConnection(id?: string): Promise<IDatabaseAdapter>;
    /**
     * Release connection back to pool (but keep persistent)
     */
    releaseConnection(connectionId?: string): Promise<void>;
    /**
     * Close all connections (graceful shutdown)
     */
    closeAll(): Promise<void>;
    /**
     * Get connection pool statistics
     */
    getPoolStats(): ConnectionPool;
    /**
     * Enable RDS Proxy for connection pooling
     */
    enableRdsProxy(endpoint: string): Promise<void>;
    /**
     * Use Aurora Data API for serverless queries (no persistent connection)
     */
    getAuroraDataApiConnection(): Promise<AuroraDataApiConnection>;
}>;
/**
 * Aurora Data API connection interface for serverless
 */
export interface AuroraDataApiConnection {
    execute(sql: string, params?: unknown[]): Promise<AuroraQueryResult>;
    batch(statements: Array<{
        sql: string;
        params?: unknown[];
    }>): Promise<AuroraQueryResult[]>;
}
export interface AuroraQueryResult {
    numberOfRecordsUpdated: number;
    records: Array<Record<string, unknown>>;
}
/**
 * Get database credentials from AWS Secrets Manager
 */
export declare function getDatabaseSecret(secretName: string): Promise<DatabaseSecret>;
/**
 * Get database credentials from environment variables
 */
export declare function getDatabaseCredentialsFromEnv(): DatabaseSecret;
/**
 * Secrets Manager for retrieving database credentials securely
 * Sealed namespace object following Pattern 2
 *
 * @see FRAMEWORK_REFACTOR_FUNCTION_PATTERN.md for Pattern 2 details
 */
export declare const SecretsHelper: Readonly<{
    getDatabaseSecret: typeof getDatabaseSecret;
    getDatabaseCredentialsFromEnv: typeof getDatabaseCredentialsFromEnv;
}>;
export interface DatabaseSecret {
    username: string;
    password: string;
    host: string;
    port: number;
    database: string;
}
export {};
//# sourceMappingURL=ConnectionManager.d.ts.map