import { IDelegateToSchemaOptions } from '@graphql-tools/delegate';
import DataLoader from 'dataloader';

type BatchDelegateFn<TContext = Record<string, any>, K = any> = (batchDelegateOptions: BatchDelegateOptions<TContext, K>) => any;
type BatchDelegateOptionsFn<TContext = Record<string, any>, K = any> = (batchDelegateOptions: BatchDelegateOptions<TContext, K>, keys: ReadonlyArray<K>) => IDelegateToSchemaOptions<TContext>;
interface BatchDelegateOptions<TContext = Record<string, any>, K = any, V = any, C = K> extends Omit<IDelegateToSchemaOptions<TContext>, 'args'> {
    dataLoaderOptions?: DataLoader.Options<K, V, C>;
    key: K;
    argsFromKeys?: (keys: ReadonlyArray<K>) => Record<string, any>;
    valuesFromResults?: (results: any, keys: ReadonlyArray<K>) => Array<V>;
    lazyOptionsFn?: BatchDelegateOptionsFn<TContext, K>;
}
interface CreateBatchDelegateFnOptions<TContext = Record<string, any>, K = any, V = any, C = K> extends Partial<Omit<IDelegateToSchemaOptions<TContext>, 'args' | 'info'>> {
    dataLoaderOptions?: DataLoader.Options<K, V, C>;
    argsFromKeys?: (keys: ReadonlyArray<K>) => Record<string, any>;
    valuesFromResults?: (results: any, keys: ReadonlyArray<K>) => Array<V>;
    lazyOptionsFn?: BatchDelegateOptionsFn<TContext, K>;
}

declare function batchDelegateToSchema<TContext = any, K = any, V = any, C = K>(options: BatchDelegateOptions<TContext, K, V, C>): any;

declare function createBatchDelegateFn<K = any, V = any, C = K>(optionsOrArgsFromKeys: CreateBatchDelegateFnOptions | ((keys: ReadonlyArray<K>) => Record<string, any>), lazyOptionsFn?: BatchDelegateOptionsFn, dataLoaderOptions?: DataLoader.Options<K, V, C>, valuesFromResults?: (results: any, keys: ReadonlyArray<K>) => Array<V>): BatchDelegateFn<K>;

export { type BatchDelegateFn, type BatchDelegateOptions, type BatchDelegateOptionsFn, type CreateBatchDelegateFnOptions, batchDelegateToSchema, createBatchDelegateFn };
