import { getMetadataFromDecorator } from '../utils.js';
/** Defines a database check constraint on a property or entity class (legacy TypeScript decorator). */
export function Check(options) {
  return function (target, propertyName) {
    const meta = getMetadataFromDecorator(propertyName ? target.constructor : target);
    options.property ??= propertyName;
    meta.checks.push(options);
    if (!propertyName) {
      return target;
    }
    return undefined;
  };
}
