import {
  type Dictionary,
  EntityManager,
  type EntityMetadata,
  EntityRepository,
  type MaybePromise,
  MetadataStorage,
  MikroORM,
  type ReferenceKind,
} from '@mikro-orm/core';
/**
 * The type of context that the user intends to inject.
 */
export type ContextProvider<T> =
  | MaybePromise<MikroORM>
  | ((type: T) => MaybePromise<
      | MikroORM
      | EntityManager
      | EntityRepository<any>
      | {
          getEntityManager(): EntityManager;
        }
    >);
/**
 * Find `EntityManager` in provided context, or else in instance's `orm` or `em` properties.
 */
export declare function resolveContextProvider<T>(
  caller: T & {
    orm?: MaybePromise<MikroORM>;
    em?: MaybePromise<EntityManager>;
  },
  provider?: ContextProvider<T>,
): Promise<EntityManager | undefined>;
/**
 * Relation decorators allow using two signatures
 * - using first parameter as options object
 * - using all parameters
 *
 * This function validates those two ways are not mixed and returns the final options object.
 * If the second way is used, we always consider the last parameter as options object.
 * @internal
 */
export declare function processDecoratorParameters<T>(params: Dictionary): T;
/**
 * Validate there is only one property decorator. This disallows using `@Property()` together with e.g. `@ManyToOne()`
 * on the same property. One should use only `@ManyToOne()` in such case.
 * We allow the existence of the property in metadata if the reference kind is the same, this should allow things like HMR to work.
 */
export declare function validateSingleDecorator(meta: EntityMetadata, propertyName: string, kind: ReferenceKind): void;
/**
 * Prepares and returns a metadata context for an entity, ensuring default structure and validating proper usage of a single decorator.
 * We need to use the `Object.hasOwn` here, since the metadata object respects inheritance, and the `properties` object might already
 * exist for some base entity.
 */
export declare function prepareMetadataContext<T>(
  context:
    | ClassFieldDecoratorContext<T>
    | ClassGetterDecoratorContext<T>
    | ClassSetterDecoratorContext<T>
    | ClassAccessorDecoratorContext<T>
    | ClassMethodDecoratorContext<T>,
  kind?: ReferenceKind,
): EntityMetadata<T>;
/**
 * Uses some dark magic to get source path to caller where decorator is used.
 * Analyzes stack trace of error created inside the function call.
 */
export declare function lookupPathFromDecorator(name: string, stack?: string[]): string;
/** Retrieves or creates the metadata object for a decorated entity class. */
export declare function getMetadataFromDecorator<T = any>(
  target: T &
    Dictionary & {
      [MetadataStorage.PATH_SYMBOL]?: string;
    },
): EntityMetadata<T>;
