import { AbstractNamingStrategy } from './AbstractNamingStrategy.js';
/** Naming strategy for MongoDB that uses camelCase property names and hyphenated collection names. */
export class MongoNamingStrategy extends AbstractNamingStrategy {
  classToTableName(entityName, tableName) {
    return tableName ?? entityName.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
  }
  joinColumnName(propertyName) {
    return propertyName;
  }
  joinKeyColumnName(entityName, referencedColumnName, composite, tableName) {
    return tableName ?? entityName;
  }
  joinTableName(sourceEntity, targetEntity, propertyName, tableName) {
    return this.classToTableName(sourceEntity, tableName) + '_' + this.propertyToColumnName(propertyName);
  }
  propertyToColumnName(propertyName) {
    return propertyName;
  }
  referenceColumnName() {
    return '_id';
  }
}
