function createDecorator(options, unique) {
  return function (value, context) {
    const meta = context.metadata;
    if (context.kind === 'field') {
      options.properties ??= context.name;
    }
    const key = unique ? 'uniques' : 'indexes';
    meta[key] ??= [];
    meta[key].push(options);
  };
}
/** Defines a database index on a property or entity class (TC39 decorator). */
export function Index(options = {}) {
  return createDecorator(options, false);
}
/** Defines a unique constraint on a property or entity class (TC39 decorator). */
export function Unique(options = {}) {
  return createDecorator(options, true);
}
