/**
 * QueryBuilder - Type-Safe Query Builder
 * Build queries without raw SQL
 */
import type { PaginationQuery, Paginator } from '../database/Paginator';
import type { IDatabase } from './Database';
import type { IModel } from './Model';
export interface WhereClause {
    column: string;
    operator: string;
    value: unknown;
}
/**
 * Result returned from INSERT operations
 * Provides access to the created record ID, affected rows count, and the full record if available
 */
export interface InsertResult {
    id: string | number | bigint | null;
    affectedRows: number;
    insertedRecords?: Record<string, unknown>[];
}
export type SoftDeleteMode = 'exclude' | 'include' | 'only';
export interface QueryBuilderOptions {
    softDeleteColumn?: string;
    softDeleteMode?: SoftDeleteMode;
}
export interface PaginationOptions {
    baseUrl?: string;
    query?: PaginationQuery;
}
export type EagerLoadConstraint = (builder: IQueryBuilder) => IQueryBuilder;
export type EagerLoadConstraints = Record<string, EagerLoadConstraint>;
export interface IQueryBuilder {
    select(...columns: string[]): IQueryBuilder;
    selectAs(column: string, alias: string): IQueryBuilder;
    max(column: string, alias?: string): IQueryBuilder;
    where(column: string, operator: string | number | boolean | null, value?: unknown): IQueryBuilder;
    andWhere(column: string, operator: string, value?: unknown): IQueryBuilder;
    orWhere(column: string, operator: string, value?: unknown): IQueryBuilder;
    whereNull(column: string): IQueryBuilder;
    whereIn(column: string, values: unknown[]): IQueryBuilder;
    whereNotIn(column: string, values: unknown[]): IQueryBuilder;
    withTrashed(): IQueryBuilder;
    onlyTrashed(): IQueryBuilder;
    withoutTrashed(): IQueryBuilder;
    join(table: string, on: string): IQueryBuilder;
    leftJoin(table: string, on: string): IQueryBuilder;
    orderBy(column: string, direction?: 'ASC' | 'DESC'): IQueryBuilder;
    limit(count: number): IQueryBuilder;
    offset(count: number): IQueryBuilder;
    getWhereClauses(): WhereClause[];
    getSelectColumns(): string[];
    getTable(): string;
    getLimit(): number | undefined;
    getOffset(): number | undefined;
    getOrderBy(): {
        column: string;
        direction: 'ASC' | 'DESC';
    } | undefined;
    getJoins(): Array<{
        table: string;
        on: string;
    }>;
    isReadOperation(): boolean;
    toSQL(): string;
    getParameters(): unknown[];
    first<T>(): Promise<T | null>;
    firstOrFail<T>(message?: string): Promise<T>;
    get<T>(): Promise<T[]>;
    raw<T>(): Promise<T[]>;
    paginate<T>(page: number, perPage: number, options?: PaginationOptions): Promise<Paginator<T>>;
    with(relation: string | EagerLoadConstraints): IQueryBuilder;
    withCount(relation: string): IQueryBuilder;
    load(models: IModel[], relation: string, constraint?: EagerLoadConstraint): Promise<void>;
    loadCount(models: IModel[], relation: string): Promise<void>;
    insert(values: Record<string, unknown> | Array<Record<string, unknown>>): Promise<InsertResult>;
    update(values: Record<string, unknown>): Promise<void>;
    delete(): Promise<void>;
}
/**
 * QueryBuilder - Type-Safe Query Builder
 * Sealed namespace object following Pattern 2
 *
 * @see FRAMEWORK_REFACTOR_FUNCTION_PATTERN.md for Pattern 2 details
 */
export declare const QueryBuilder: Readonly<{
    /**
     * Create a new query builder instance
     */
    create(tableOrDb: string | IDatabase, db?: IDatabase, options?: QueryBuilderOptions): IQueryBuilder;
    /**
     * Ping the database connection.
     *
     * This is intentionally a tiny, dependency-free check that can be reused by
     * health/readiness endpoints without embedding SQL in route handlers.
     */
    ping(db: IDatabase): Promise<void>;
}>;
//# sourceMappingURL=QueryBuilder.d.ts.map