import { entityKind } from "../../entity.cjs";
import { Query } from "../../sql/sql.cjs";
import { Simplify } from "../../utils.cjs";
import { Logger } from "../../logger.cjs";
import { AnyRelations } from "../../relations.cjs";
import { WithCacheConfig } from "../../cache/core/types.cjs";
import { Cache } from "../../cache/core/cache.cjs";
import { PgDialect } from "../../pg-core/dialect.cjs";
import { PgQueryResultHKT, PgTransactionConfig, PreparedQueryConfig } from "../../pg-core/session.cjs";
import { PgAsyncPreparedQuery, PgAsyncSession, PgAsyncTransaction } from "../../pg-core/async/session.cjs";
import { BatchItem } from "../../batch.cjs";
import { QueryResult, ShapeSpec } from "@drizzle-team/minipg";

//#region src/postgres/http/session.d.ts
interface PostgresHttpClient {
  query(sql: string, params: unknown[], opts: {
    mode: 'array';
    shape?: ShapeSpec;
  }): Promise<QueryResult<any>>;
  query(sql: string, params: unknown[], opts: {
    mode: 'object';
    shape?: ShapeSpec;
  }): Promise<QueryResult<any>>;
}
interface PostgresHttpBatchQuery {
  sql: string;
  params?: unknown[];
  mode?: 'array' | 'object';
  shape?: ShapeSpec;
}
interface PostgresHttpBatchOptions {
  isolation?: 'serializable' | 'repeatable read' | 'read committed' | 'read uncommitted';
  readOnly?: boolean;
  deferrable?: boolean;
  timeout?: number;
  signal?: AbortSignal;
}
type PostgresHttpBatchRunner = (queries: PostgresHttpBatchQuery[], options?: PostgresHttpBatchOptions) => Promise<QueryResult<any>[]>;
interface PostgresHttpSessionOptions {
  logger?: Logger;
  cache?: Cache;
}
declare class PostgresHttpSession<TRelations extends AnyRelations> extends PgAsyncSession<PostgresHttpQueryResultHKT, TRelations> {
  private client;
  private runBatch;
  static readonly [entityKind]: string;
  private logger;
  private cache;
  constructor(client: PostgresHttpClient, runBatch: PostgresHttpBatchRunner, dialect: PgDialect, _relations: TRelations, options?: PostgresHttpSessionOptions);
  prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(query: Query, mode: 'arrays' | 'objects' | 'raw', _name: string | boolean, mapper: ((rows: any[]) => any) | undefined, queryMetadata?: {
    type: 'select' | 'update' | 'delete' | 'insert';
    tables: string[];
  }, cacheConfig?: WithCacheConfig, shape?: ShapeSpec): PostgresHttpPreparedQuery<T>;
  batch<U extends BatchItem<'pg'>, T extends Readonly<[U, ...U[]]>>(queries: T, options?: PostgresHttpBatchOptions): Promise<any[]>;
  transaction<T>(_transaction: (tx: PgAsyncTransaction<PostgresHttpQueryResultHKT, TRelations>) => Promise<T>, _config?: PgTransactionConfig): Promise<T>;
}
type PostgresHttpQueryResult<T> = Omit<QueryResult<T>, 'metrics' | 'debug'>;
interface PostgresHttpQueryResultHKT extends PgQueryResultHKT {
  type: Simplify<Omit<QueryResult<this['row']>, 'metrics' | 'debug'>>;
}
declare class PostgresHttpPreparedQuery<T extends PreparedQueryConfig> extends PgAsyncPreparedQuery<T> {
  readonly shape?: ShapeSpec | undefined;
  static readonly [entityKind]: string;
  constructor(executor: (params?: unknown[]) => Promise<any>, query: Query, mapper: ((rows: any[]) => any) | undefined, mode: 'arrays' | 'objects' | 'raw', logger: Logger, cache: Cache | undefined, queryMetadata: {
    type: 'select' | 'update' | 'delete' | 'insert';
    tables: string[];
  } | undefined, cacheConfig: WithCacheConfig | undefined, shape?: ShapeSpec | undefined);
}
//#endregion
export { PostgresHttpBatchOptions, PostgresHttpBatchQuery, PostgresHttpBatchRunner, PostgresHttpClient, PostgresHttpPreparedQuery, PostgresHttpQueryResult, PostgresHttpQueryResultHKT, PostgresHttpSession, PostgresHttpSessionOptions };
//# sourceMappingURL=session.d.cts.map