import { type EntityClass, EntityMetadata, type EntityName } from '../typings.js';
import type { Configuration } from '../utils/Configuration.js';
import { MetadataStorage } from './MetadataStorage.js';
import { EntitySchema } from './EntitySchema.js';
import type { Platform } from '../platforms/Platform.js';
/** Discovers, validates, and processes entity metadata from configured sources. */
export declare class MetadataDiscovery {
  #private;
  constructor(metadata: MetadataStorage, platform: Platform, config: Configuration);
  /** Discovers all entities asynchronously and returns the populated MetadataStorage. */
  discover(preferTs?: boolean): Promise<MetadataStorage>;
  /** Discovers all entities synchronously and returns the populated MetadataStorage. */
  discoverSync(): MetadataStorage;
  private mapDiscoveredEntities;
  private initAccessors;
  /** Processes discovered entities: initializes relations, embeddables, indexes, and inheritance. */
  processDiscoveredEntities(discovered: EntityMetadata[]): EntityMetadata[];
  private findEntities;
  private discoverMissingTargets;
  private tryDiscoverTargets;
  discoverReferences<T>(refs: Iterable<EntityClass<T> | EntitySchema<T>>, validate?: boolean): EntityMetadata<T>[];
  reset<T>(entityName: EntityName<T>): void;
  private getSchema;
  private getRootEntity;
  private discoverEntity;
  private initNullability;
  private applyNamingStrategy;
  private initOwnColumns;
  private initFieldName;
  private initManyToOneFieldName;
  private initManyToManyFieldName;
  private initManyToManyFields;
  private isExplicitTableName;
  private initManyToOneFields;
  private initOneToManyFields;
  private processEntity;
  private findReferencingProperties;
  private initFactoryField;
  private ensureCorrectFKOrderInPivotEntity;
  private definePivotTableEntity;
  /**
   * Create a scalar property for a pivot table column.
   */
  private createPivotScalarProperty;
  /**
   * Get column types for an entity's primary keys, initializing them if needed.
   */
  private getPrimaryKeyColumnTypes;
  /**
   * Add missing FK columns for a polymorphic entity to an existing pivot table.
   */
  private addPolymorphicPivotColumns;
  /**
   * Define properties for a polymorphic pivot table.
   */
  private definePolymorphicPivotProperties;
  /**
   * Create a virtual M:1 relation from pivot to a polymorphic owner entity.
   * This enables single-query join loading for inverse-side polymorphic M:N.
   */
  private definePolymorphicOwnerRelation;
  private defineFixedOrderProperty;
  private definePivotProperty;
  private autoWireBidirectionalProperties;
  private defineBaseEntityProperties;
  private initPolyEmbeddables;
  private initPolymorphicRelation;
  private initEmbeddables;
  private initSingleTableInheritance;
  /**
   * First pass of TPT initialization: sets up hierarchy relationships
   * (inheritanceType, tptParent, tptChildren) before properties have fieldNames.
   */
  private initTPTRelationships;
  /**
   * Second pass of TPT initialization: re-resolves metadata references after fieldNames
   * are set, syncs to registry metadata, and sets up discriminators.
   */
  private finalizeTPTInheritance;
  /**
   * Initialize TPT discriminator map and virtual discriminator property.
   * Unlike STI where the discriminator is a persisted column, TPT discriminator is computed
   * at query time using CASE WHEN expressions based on which child table has data.
   */
  private initTPTDiscriminator;
  /**
   * Recursively collect all TPT descendants (children, grandchildren, etc.)
   */
  private collectAllTPTDescendants;
  /**
   * Computes ownProps for TPT entities - only properties defined in THIS entity,
   * not inherited from parent. Also creates synthetic join properties for parent/child relationships.
   *
   * Called multiple times during discovery as metadata is progressively built.
   * Each pass overwrites earlier results to reflect the final state of properties.
   */
  private computeTPTOwnProps;
  /** Returns the depth of a TPT entity in its hierarchy (0 for root). */
  private getTPTDepth;
  /**
   * Find the direct TPT parent entity for the given entity.
   */
  private getTPTParent;
  private createDiscriminatorProperty;
  private initAutoincrement;
  private createSchemaTable;
  private initCheckConstraints;
  private initGeneratedColumn;
  private getDefaultVersionValue;
  private inferDefaultValue;
  private initDefaultValue;
  private inferTypeFromDefault;
  private initVersionProperty;
  private initCustomType;
  private initRelation;
  private initColumnType;
  private getMappedType;
  private getPrefix;
  private initUnsigned;
  private initIndexes;
  private shouldForceConstructorUsage;
}
