import { ReferenceKind } from '@mikro-orm/core';
import { processDecoratorParameters, validateSingleDecorator, getMetadataFromDecorator } from '../utils.js';
export function ManyToOne(entity = {}, options = {}) {
  return function (target, propertyName) {
    options = processDecoratorParameters({ entity, options });
    const meta = getMetadataFromDecorator(target.constructor);
    validateSingleDecorator(meta, propertyName, ReferenceKind.MANY_TO_ONE);
    const property = { name: propertyName, kind: ReferenceKind.MANY_TO_ONE };
    meta.properties[propertyName] = Object.assign(meta.properties[propertyName] ?? {}, property, options);
  };
}
