import { FMODataLayer } from '../services.js';
import { BatchResult, ExecutableBuilder, ExecuteMethodOptions, ExecuteOptions, Result } from '../types.js';
/**
 * Helper type to extract result types from a tuple of ExecutableBuilders.
 * Uses a mapped type which TypeScript 4.1+ can handle for tuples.
 */
type ExtractTupleTypes<T extends readonly ExecutableBuilder<any>[]> = {
    [K in keyof T]: T[K] extends {
        processResponse(response: Response, options?: ExecuteOptions): Promise<Result<infer U>>;
    } ? U : never;
};
/**
 * Builder for batch operations that allows multiple queries to be executed together
 * in a single transactional request.
 *
 * Note: BatchBuilder does not implement ExecutableBuilder because execute() returns
 * BatchResult instead of Result, which is a different return type structure.
 */
export declare class BatchBuilder<Builders extends readonly ExecutableBuilder<any>[]> {
    private readonly builders;
    private readonly layer;
    private readonly config;
    constructor(builders: Builders, layer: FMODataLayer);
    /**
     * Add a request to the batch dynamically.
     * This allows building up batch operations programmatically.
     *
     * @param builder - An executable builder to add to the batch
     * @returns A BatchBuilder typed with the appended request result
     * @example
     * ```ts
     * const batch = db.batch([]);
     * batch.addRequest(db.from('contacts').list());
     * batch.addRequest(db.from('users').list());
     * const result = await batch.execute();
     * ```
     */
    addRequest<T>(builder: ExecutableBuilder<T>): BatchBuilder<[...Builders, ExecutableBuilder<T>]>;
    /**
     * Get the request configuration for this batch operation.
     * This is used internally by the execution system.
     */
    getRequestConfig(): {
        method: string;
        url: string;
        body?: any;
    };
    toRequest(baseUrl: string, _options?: ExecuteOptions): Request;
    processResponse(_response: Response, _options?: ExecuteOptions): Promise<Result<any>>;
    /**
     * Creates a failed BatchResult where all operations are marked as failed with the given error.
     */
    private failAllResults;
    /**
     * Execute the batch operation.
     *
     * @param options - Optional fetch options and batch-specific options (includes beforeRequest hook)
     * @returns A BatchResult containing individual results for each operation
     */
    execute<EO extends ExecuteOptions>(options?: ExecuteMethodOptions<EO>): Promise<BatchResult<ExtractTupleTypes<Builders>>>;
}
export {};
