import { snakeCase } from 'lodash-es';
import { hibernateSnakeCase } from '../../generators/server/support/string.js';
export default function getTableNameFromEntityName(entityName) {
    if (!entityName) {
        throw new Error('An entity name must be passed to get a table name.');
    }
    return snakeCase(entityName);
}
export const getTableNameFromEntityNameFallback = (entityName) => {
    const snakeCasedEntityName = getTableNameFromEntityName(entityName);
    if (snakeCasedEntityName !== hibernateSnakeCase(entityName)) {
        return snakeCasedEntityName;
    }
    return undefined;
};
export const shouldWriteEntityTableName = (entityName, entityTableName) => {
    return entityTableName !== snakeCase(entityName) || entityTableName !== hibernateSnakeCase(entityName);
};
