import { Collection, Document } from 'mongodb';
import { ModelConstructor, PaginatedResult } from '../types/index.js';
import { BaseModel } from '../base_model/base_model.js';
import type { MongoTransactionClient } from '../transaction_client.js';
/**
 * QueryExecutor - Handles query execution and result processing
 *
 * This class encapsulates all the logic for executing MongoDB queries
 * and processing the results into proper model instances.
 */
export declare class QueryExecutor<T extends Document = Document, TModel extends BaseModel = BaseModel> {
    private collection;
    private modelConstructor;
    private transactionClient?;
    constructor(collection: Collection<T>, modelConstructor: ModelConstructor, transactionClient?: MongoTransactionClient | undefined);
    /**
     * Get the session for transaction operations
     */
    private getSession;
    /**
     * Execute query and return first result
     */
    first(finalFilters: any, selectFields?: Record<string, 0 | 1>, sortOptions?: Record<string, 1 | -1>, loadRelations?: Map<string, (query: any) => void>, embedRelations?: Map<string, (query: any) => void>): Promise<TModel | null>;
    /**
     * Execute query and return first result or throw exception
     */
    firstOrFail(finalFilters: any, selectFields?: Record<string, 0 | 1>, sortOptions?: Record<string, 1 | -1>, loadRelations?: Map<string, (query: any) => void>, embedRelations?: Map<string, (query: any) => void>): Promise<TModel>;
    /**
     * Execute query and return all results
     */
    fetch(finalFilters: any, selectFields?: Record<string, 0 | 1>, sortOptions?: Record<string, 1 | -1>, limitValue?: number, skipValue?: number, distinctField?: string, groupByFields?: string[], havingConditions?: any, loadRelations?: Map<string, (query: any) => void>, embedRelations?: Map<string, (query: any) => void>): Promise<TModel[]>;
    /**
     * Execute aggregation pipeline for group by queries
     */
    private executeAggregation;
    /**
     * Execute query and return paginated results
     */
    paginate(page: number, perPage: number, finalFilters: any, selectFields?: Record<string, 0 | 1>, sortOptions?: Record<string, 1 | -1>, loadRelations?: Map<string, (query: any) => void>): Promise<PaginatedResult<TModel>>;
    /**
     * Count documents matching the query
     */
    count(finalFilters: any): Promise<number>;
    /**
     * Get array of IDs for matching documents
     */
    ids(finalFilters: any): Promise<any[]>;
    /**
     * Update documents matching the query
     */
    update(finalFilters: any, updateData: Record<string, any>): Promise<number>;
    /**
     * Delete documents matching the query
     */
    delete(finalFilters: any): Promise<number>;
    /**
     * Deserialize document from MongoDB
     */
    private deserializeDocument;
    /**
     * Serialize value for MongoDB
     */
    private serializeValue;
    /**
     * Serialize a single result for API response
     */
    private serializeResult;
    /**
     * Serialize multiple results for API response
     */
    private serializeResults;
    /**
     * Load referenced documents for the given results (eager loading like Lucid's preload)
     * This implements the same functionality as AdonisJS Lucid's preload method
     *
     * FULL IMPLEMENTATION: Prevents N+1 query problems with bulk loading
     */
    private loadReferencedDocuments;
    /**
     * Load BelongsTo relationships in bulk (prevents N+1 queries)
     */
    private loadBelongsToRelationship;
    /**
     * Load HasOne relationships in bulk (prevents N+1 queries)
     */
    private loadHasOneRelationship;
    /**
     * Load HasMany relationships in bulk (prevents N+1 queries)
     */
    private loadHasManyRelationship;
    /**
     * Load embedded documents with query capabilities
     * For embedded documents, we apply the callback constraints to filter the embedded data
     */
    private loadEmbeddedDocuments;
    /**
     * Process embedded documents with query capabilities
     * This method applies the embed() callback constraints to filter embedded documents
     */
    private processEmbeddedDocuments;
    /**
     * Get the related model class by name
     * Uses the global model registry for relationship loading
     */
    private getRelatedModelClass;
}
//# sourceMappingURL=query_executor.d.ts.map