import JHipsterReservedKeywords from './reserved-keywords/jhipster.js';
import PagingReservedKeywords from './reserved-keywords/paging.js';
import AngularReservedKeywords from './reserved-keywords/angular.js';
import MySQLReservedKeywords from './reserved-keywords/mysql.js';
import JavaReservedKeywords from './reserved-keywords/java.js';
import TypescriptReservedKeywords from './reserved-keywords/typescript.js';
import PostgresqlReservedKeywords from './reserved-keywords/postgresql.js';
import CassandraReservedKeywords from './reserved-keywords/cassandra.js';
import CouchbaseReservedKeywords from './reserved-keywords/couchbase.js';
import OracleReservedKeywords from './reserved-keywords/oracle.js';
import MsSQLReservedKeywords from './reserved-keywords/mssql.js';
import Neo4JReservedKeywords from './reserved-keywords/neo4j.js';
import applicationOptions from './application-options.js';
const clientFrameworks = applicationOptions.OptionValues[applicationOptions.OptionNames.CLIENT_FRAMEWORK];
const ReservedWords = {
    JHIPSTER: JHipsterReservedKeywords,
    ANGULAR: AngularReservedKeywords,
    REACT: [],
    JAVA: JavaReservedKeywords,
    TYPESCRIPT: TypescriptReservedKeywords,
    MYSQL: MySQLReservedKeywords,
    MARIADB: MySQLReservedKeywords,
    POSTGRESQL: PostgresqlReservedKeywords,
    PAGING: PagingReservedKeywords,
    CASSANDRA: CassandraReservedKeywords,
    COUCHBASE: CouchbaseReservedKeywords,
    ORACLE: OracleReservedKeywords,
    MONGODB: ['DOCUMENT'],
    MSSQL: MsSQLReservedKeywords,
    NEO4J: Neo4JReservedKeywords,
};
export function isReserved(keyword, type) {
    return !!keyword && !!type && !!ReservedWords[type.toUpperCase()] && ReservedWords[type.toUpperCase()].includes(keyword.toUpperCase());
}
export function isReservedClassName(keyword) {
    return (isReserved(keyword, 'JHIPSTER') || isReserved(keyword, 'ANGULAR') || isReserved(keyword, 'TYPESCRIPT') || isReserved(keyword, 'JAVA'));
}
export function isReservedTableName(keyword, databaseType) {
    return databaseType.toUpperCase() === 'SQL'
        ? isReserved(keyword, 'MYSQL') || isReserved(keyword, 'POSTGRESQL') || isReserved(keyword, 'ORACLE') || isReserved(keyword, 'MSSQL')
        : isReserved(keyword, databaseType);
}
export function isReservedPaginationWords(keyword) {
    return isReserved(keyword, 'PAGING');
}
export function isReservedFieldName(keyword, clientFramework) {
    if (clientFramework) {
        if (clientFramework === clientFrameworks.angular) {
            return isReserved(keyword, 'ANGULAR') || isReserved(keyword, 'TYPESCRIPT') || isReserved(keyword, 'JAVA');
        }
        if (clientFramework === clientFrameworks.react) {
            return isReserved(keyword, 'TYPESCRIPT') || isReserved(keyword, 'JAVA');
        }
    }
    return isReserved(keyword, 'ANGULAR') || isReserved(keyword, 'TYPESCRIPT') || isReserved(keyword, 'JAVA');
}
export default {
    isReserved,
    isReservedClassName,
    isReservedTableName,
    isReservedFieldName,
    isReservedPaginationWords,
    JHIPSTER: ReservedWords.JHIPSTER,
    ANGULAR: ReservedWords.ANGULAR,
    REACT: ReservedWords.REACT,
    JAVA: ReservedWords.JAVA,
    TYPESCRIPT: ReservedWords.TYPESCRIPT,
    MYSQL: ReservedWords.MYSQL,
    POSTGRESQL: ReservedWords.POSTGRESQL,
    CASSANDRA: ReservedWords.CASSANDRA,
    COUCHBASE: ReservedWords.COUCHBASE,
    ORACLE: ReservedWords.ORACLE,
    MONGODB: ReservedWords.MONGODB,
    MSSQL: ReservedWords.MSSQL,
    NEO4J: ReservedWords.NEO4J,
};
