/**
 * Minimal interfaces for PostgreSQL to avoid direct dependency on 'pg' types
 */
export interface PostgresPool {
    connect(): Promise<PostgresClient>;
    query(sql: string, params?: unknown[]): Promise<{
        rows: unknown[];
        rowCount?: number;
    }>;
    end(): Promise<void>;
    on(event: string, listener: (...args: unknown[]) => void): this;
    totalCount: number;
    idleCount: number;
    waitingCount: number;
}
export interface PostgresClient {
    query(sql: string, params?: unknown[]): Promise<{
        rows: unknown[];
        rowCount?: number;
    }>;
    release(): void;
}
export type PoolClient = PostgresClient;
/**
 * PostgreSQL Connection Pool Configuration
 */
export interface PostgresPoolConfig {
    host: string;
    port: number;
    database: string;
    user: string;
    password: string;
    max?: number;
    idleTimeoutMillis?: number;
    connectionTimeoutMillis?: number;
    serviceName?: string;
    isolation?: 'shared' | 'isolated';
}
export interface IPostgresAdapter {
    getPoolKey(): string;
    connect(): Promise<void>;
    getPool(): PostgresPool;
    query<T = unknown>(sql: string, params?: unknown[]): Promise<T[]>;
    execute<T = unknown>(sql: string, params?: unknown[]): Promise<{
        rows: T[];
        rowCount: number;
    }>;
    transaction<T>(callback: (client: PoolClient) => Promise<T>): Promise<T>;
    getPoolStats(): {
        totalConnections: number;
        idleConnections: number;
        waitingRequests: number;
    };
    disconnect(): Promise<void>;
    disconnectAll(): Promise<void>;
    createServiceSchema(schemaName: string): Promise<void>;
    runMigrations(migrations: Array<{
        up: (client: PoolClient) => Promise<void>;
    }>): Promise<void>;
    healthCheck(): Promise<boolean>;
}
/**
 * PostgreSQL Adapter with Connection Pooling
 * Supports both shared (multi-service) and isolated (per-service) database modes
 */
type PostgresAdapterConstructor = {
    new (config: PostgresPoolConfig): IPostgresAdapter;
    create(config: PostgresPoolConfig): IPostgresAdapter;
    prototype: IPostgresAdapter;
};
export declare const PostgresAdapter: PostgresAdapterConstructor;
/**
 * Get or create adapter instance
 */
export declare function getInstance(config: PostgresPoolConfig, key?: string): IPostgresAdapter;
/**
 * Get all instances
 */
export declare function getAllInstances(): IPostgresAdapter[];
/**
 * Disconnect all instances
 */
export declare function disconnectAll(): Promise<void>;
export declare const PostgresAdapterManager: Readonly<{
    getInstance: typeof getInstance;
    getAllInstances: typeof getAllInstances;
    disconnectAll: typeof disconnectAll;
}>;
export default PostgresAdapter;
//# sourceMappingURL=PostgresAdapter.d.ts.map