import { ActiveRecord, ActiveRecordClassType, DatabaseAdapter, DatabaseSession, FilterQuery } from '@deepkit/orm';
import { EntityClassFields, EntityFields } from './common';
export declare function getDirtyDetails<T extends ActiveRecord, K extends keyof T>(entity: T): Record<K, {
    original: T[K];
    current: T[K];
}>;
export declare function revertDirtyEntity(entity: ActiveRecord): void;
export declare function getDirtyFields<T extends ActiveRecord>(entity: T): (keyof T)[];
export declare function isEntityDirty(entity: ActiveRecord): boolean;
export declare function isFieldDirty<T extends ActiveRecord>(entity: T, field: keyof T): boolean;
export declare function getFieldOriginal<T extends ActiveRecord, K extends keyof T>(entity: T, field: K): T[K] | undefined;
export declare function getEntityOriginal<T extends ActiveRecord>(entity: T): EntityFields<T>;
export declare class BaseEntity extends ActiveRecord {
}
export type EntityPick<T extends ActiveRecord, K extends keyof EntityFields<T>> = ActiveRecord & Pick<T, K>;
interface IGetEntityOptions<Schema extends ActiveRecordClassType, Field extends keyof EntityClassFields<Schema>> {
    schema: Schema;
    ids: any[];
    keyField?: Field;
    fields?: Field[];
    filter?: FilterQuery<InstanceType<Schema>>;
    txn?: DatabaseSession<DatabaseAdapter>;
}
export declare function getKeyedEntities<Schema extends ActiveRecordClassType, Fields extends keyof EntityClassFields<Schema>>(options: IGetEntityOptions<Schema, Fields>): Promise<import("lodash").Dictionary<EntityPick<InstanceType<Schema>, Fields>>>;
export declare function getKeyedGroupedEntities<Schema extends ActiveRecordClassType, Fields extends keyof EntityClassFields<Schema>>(options: IGetEntityOptions<Schema, Fields>): Promise<import("lodash").Dictionary<EntityPick<InstanceType<Schema>, Fields>[]>>;
export declare function getEntitiesById<Schema extends ActiveRecordClassType, Fields extends keyof EntityClassFields<Schema>>(options: IGetEntityOptions<Schema, Fields>): Promise<EntityPick<InstanceType<Schema>, Fields>[]>;
export declare function getEntitiesByIdWithKeyName<Schema extends ActiveRecordClassType, Fields extends keyof EntityClassFields<Schema>>({ schema, ids, keyField, fields, filter, txn }: IGetEntityOptions<Schema, Fields>): Promise<{
    keyField: string | Fields;
    entities: EntityPick<InstanceType<Schema>, Fields>[];
}>;
interface IResolveRelatedOptions<Schema extends ActiveRecord, IdKey extends keyof EntityFields<Schema>, RelatedSchema extends ActiveRecordClassType, RelatedKey extends string, RelatedFields extends keyof EntityClassFields<RelatedSchema>> {
    src: Schema[];
    srcIdField: IdKey;
    targetField: RelatedKey;
    targetSchema: RelatedSchema;
    targetFields?: RelatedFields[];
    txn?: DatabaseSession<DatabaseAdapter>;
}
export declare function resolveRelated<Schema extends ActiveRecord, IdKey extends keyof EntityFields<Schema>, RelatedSchema extends ActiveRecordClassType, RelatedKey extends string, RelatedFields extends keyof EntityClassFields<RelatedSchema>>(options: IResolveRelatedOptions<Schema, IdKey, RelatedSchema, RelatedKey, RelatedFields>): Promise<(Omit<Schema, IdKey> & (null extends Schema[IdKey] ? { [K in RelatedKey]?: EntityPick<InstanceType<RelatedSchema>, RelatedFields> | undefined; } : { [K_1 in RelatedKey]: EntityPick<InstanceType<RelatedSchema>, RelatedFields>; }))[]>;
interface IResolveRelatedByPivotOptions<Schema extends object, SrcIdField extends keyof EntityFields<Schema>, PivotSchema extends ActiveRecordClassType, PivotIdKey extends keyof EntityClassFields<PivotSchema>, PivotRelatedKey extends keyof EntityClassFields<PivotSchema>, RelatedSchema extends ActiveRecordClassType, RelatedKey extends string, RelatedFields extends keyof EntityClassFields<RelatedSchema>> {
    src: Schema[];
    srcIdField?: SrcIdField;
    pivotSchema: PivotSchema;
    pivotIdKey: PivotIdKey;
    pivotRelatedKey: PivotRelatedKey;
    pivotFilter?: FilterQuery<InstanceType<PivotSchema>>;
    targetField: RelatedKey;
    targetSchema: RelatedSchema;
    targetFields?: RelatedFields[];
    txn?: DatabaseSession<DatabaseAdapter>;
}
export declare function resolveRelatedByPivot<Schema extends object, SrcIdField extends keyof EntityFields<Schema>, PivotSchema extends ActiveRecordClassType, PivotIdKey extends keyof EntityClassFields<PivotSchema>, PivotRelatedKey extends keyof EntityClassFields<PivotSchema>, RelatedSchema extends ActiveRecordClassType, RelatedKey extends string, RelatedFields extends keyof EntityClassFields<RelatedSchema>>(options: IResolveRelatedByPivotOptions<Schema, SrcIdField, PivotSchema, PivotIdKey, PivotRelatedKey, RelatedSchema, RelatedKey, RelatedFields>): Promise<(Schema & { [K in RelatedKey]: (ActiveRecord & Pick<InstanceType<RelatedSchema>, RelatedFields> & {
    pivot: InstanceType<PivotSchema>;
})[]; })[]>;
export declare function resolveRelatedByPivotForOne<Schema extends object, SrcIdField extends keyof EntityFields<Schema>, PivotSchema extends ActiveRecordClassType, PivotIdKey extends keyof EntityClassFields<PivotSchema>, PivotRelatedKey extends keyof EntityClassFields<PivotSchema>, RelatedSchema extends ActiveRecordClassType, RelatedKey extends string, RelatedFields extends keyof EntityClassFields<RelatedSchema>>(options: Omit<IResolveRelatedByPivotOptions<Schema, SrcIdField, PivotSchema, PivotIdKey, PivotRelatedKey, RelatedSchema, RelatedKey, RelatedFields>, 'src'> & {
    src: Schema;
}): Promise<Schema & { [K in RelatedKey]: (ActiveRecord & Pick<InstanceType<RelatedSchema>, RelatedFields> & {
    pivot: InstanceType<PivotSchema>;
})[]; }>;
export {};
export declare type __ΩEntityPick = any[];
//# sourceMappingURL=entity.d.ts.map