import { Constructor } from '@adonisjs/core/types/common';
import { ModelQueryBuilderContract } from '@adonisjs/lucid/types/model';
import type { UUID } from 'node:crypto';
import { AKModel } from '../model.js';
import { AKModelServiceBaseClass } from './base.js';
import { AKEnabledRelation } from './relations.js';
export type QueryTransformer<M extends typeof AKModel> = (q: ModelQueryBuilderContract<M, InstanceType<M>>) => void;
export type ListQuery<M extends typeof AKModel> = {
    queryTranform?: QueryTransformer<M>;
    sortKey?: string;
    limit?: number;
};
export type AKModelServiceFetchClass<M extends typeof AKModel> = AKModelServiceBaseClass<M> & {
    enabledRelations: AKEnabledRelation<any>[];
    enabledFetchRelations: AKEnabledRelation<any>[];
} & Constructor<{
    modifyBaseQuery(query: ModelQueryBuilderContract<M, InstanceType<M>>): void;
    modifyListQuery(query: ModelQueryBuilderContract<M, InstanceType<M>>): void;
    modifyFindQuery(query: ModelQueryBuilderContract<M, InstanceType<M>>): void;
    enrichFetchResults(items: InstanceType<M>[]): Promise<InstanceType<M>[]>;
    list(query: ListQuery<M>): Promise<InstanceType<M>[]>;
    baseList(query: ListQuery<M>): Promise<InstanceType<M>[]>;
    count(query: ListQuery<M>): Promise<number>;
    sum(query: ListQuery<M>, column: string): Promise<number>;
    findBy(field: string, value: unknown): Promise<InstanceType<M> | undefined>;
    find(fields: Record<string, unknown>): Promise<InstanceType<M> | undefined>;
    findById(id: UUID): Promise<InstanceType<M> | undefined>;
    postFind(item: InstanceType<M> | undefined): Promise<InstanceType<M> | undefined>;
    itemForIdInPayload<ModelClass extends typeof AKModel>(payload: any, serviceClass: AKModelServiceBaseClass<ModelClass> & AKModelServiceFetchClass<ModelClass>): Promise<InstanceType<ModelClass> | undefined>;
    preloadRelations<ModelClass extends typeof AKModel, Result = InstanceType<ModelClass>>(query: ModelQueryBuilderContract<ModelClass, Result>, relations: (AKEnabledRelation<any> & {
        service: InstanceType<AKModelServiceFetchClass<any>> | undefined;
    })[]): void;
}>;
export declare const AKModelServiceFetch: <M extends typeof AKModel>(superclass: AKModelServiceBaseClass<M>) => AKModelServiceFetchClass<M>;
