import type {
  EntityData,
  EntityDictionary,
  EntityMetadata,
  EntityName,
  EntityProperty,
  IMetadataStorage,
  Primary,
} from '../typings.js';
import type { Platform } from '../platforms/Platform.js';
import type { Configuration } from './Configuration.js';
type Comparator<T> = (
  a: T,
  b: T,
  options?: {
    includeInverseSides?: boolean;
  },
) => EntityData<T>;
type ResultMapper<T> = (result: EntityData<T>) => EntityData<T> | null;
type SnapshotGenerator<T> = (entity: T) => EntityData<T>;
type PkGetter<T> = (entity: T) => Primary<T>;
type PkSerializer<T> = (entity: T) => string;
type CompositeKeyPart = string | CompositeKeyPart[];
/** @internal Generates and caches JIT-compiled functions for comparing, snapshotting, and mapping entity data. */
export declare class EntityComparator {
  #private;
  constructor(metadata: IMetadataStorage, platform: Platform, config?: Configuration);
  /**
   * Computes difference between two entities.
   */
  diffEntities<T extends object>(
    entityName: EntityName<T>,
    a: EntityData<T>,
    b: EntityData<T>,
    options?: {
      includeInverseSides?: boolean;
    },
  ): EntityData<T>;
  /** Returns true if two entity snapshots are identical (no differences). */
  matching<T extends object>(entityName: EntityName<T>, a: EntityData<T>, b: EntityData<T>): boolean;
  /**
   * Removes ORM specific code from entities and prepares it for serializing. Used before change set computation.
   * References will be mapped to primary keys, collections to arrays of primary keys.
   */
  prepareEntity<T extends object>(entity: T): EntityData<T>;
  /**
   * Maps database columns to properties.
   */
  mapResult<T>(meta: EntityMetadata<T>, result: EntityDictionary<T>): EntityData<T>;
  /**
   * @internal Highly performance-sensitive method.
   */
  getPkGetter<T>(meta: EntityMetadata<T>): PkGetter<T>;
  /**
   * @internal Highly performance-sensitive method.
   */
  getPkGetterConverted<T>(meta: EntityMetadata<T>): PkGetter<T>;
  /**
   * @internal Highly performance-sensitive method.
   */
  getPkSerializer<T>(meta: EntityMetadata<T>): PkSerializer<T>;
  /**
   * @internal Highly performance-sensitive method.
   */
  getSnapshotGenerator<T>(entityName: EntityName<T>): SnapshotGenerator<T>;
  /**
   * @internal
   */
  propName(name: string, parent?: string): string;
  /**
   * @internal respects nested composite keys, e.g. `[1, [2, 3]]`
   */
  createCompositeKeyArray(prop: EntityProperty, parents?: EntityProperty[]): string;
  /**
   * @internal
   */
  formatCompositeKeyPart(part: CompositeKeyPart): string;
  /**
   * @internal Highly performance-sensitive method.
   */
  getResultMapper<T>(meta: EntityMetadata<T>): ResultMapper<T>;
  private getPropertyCondition;
  private getEmbeddedArrayPropertySnapshot;
  /**
   * we need to serialize only object embeddables, and only the top level ones, so root object embeddable
   * properties and first child nested object embeddables with inlined parent
   */
  private shouldSerialize;
  private getEmbeddedPropertySnapshot;
  private registerCustomType;
  private getPropertySnapshot;
  /**
   * @internal Highly performance-sensitive method.
   */
  getEntityComparator<T extends object>(entityName: EntityName<T>): Comparator<T>;
  private getGenericComparator;
  private getPropertyComparator;
  private wrap;
  private safeKey;
  /**
   * Sets the toArray helper in the context if not already set.
   * Used for converting composite PKs to arrays.
   */
  private setToArrayHelper;
  /**
   * perf: used to generate list of comparable properties during discovery, so we speed up the runtime comparison
   */
  static isComparable<T>(prop: EntityProperty<T>, root: EntityMetadata): boolean;
}
export {};
