import { Utils } from '@mikro-orm/core';
import { getMetadataFromDecorator } from '../utils.js';
/** Marks a class as a MikroORM entity (TC39 decorator). */
export function Entity(options = {}) {
  return function (target, context) {
    const meta = getMetadataFromDecorator(target);
    const metadata = { ...context.metadata };
    Utils.mergeConfig(meta, metadata, options);
    meta.class = target;
    if (!options.abstract || meta.discriminatorColumn) {
      meta.name = context.name;
    }
  };
}
