import { upperCase, snakeCase } from 'lodash-es';
import databaseMigrationOption from '../options/database-migration.js';
import messageBrokerOption from '../options/message-broker.js';
import { feignClientDefinition, syncUserWithIdpDefinition } from '../options/index.js';
import { jdlRoutesOptions } from '../../spring-cloud/generators/gateway/jdl/jdl-routes-option.js';
const jdlOptions = [
    databaseMigrationOption,
    messageBrokerOption,
    feignClientDefinition,
    syncUserWithIdpDefinition,
    jdlRoutesOptions,
];
const applicationConfig = {
    tokenConfigs: jdlOptions.map(option => ({
        name: upperCase(snakeCase(option.name)),
        pattern: option.name,
    })),
    validatorConfig: Object.fromEntries(jdlOptions.map(option => [
        upperCase(snakeCase(option.name)),
        {
            type: option.tokenType,
            pattern: option.tokenValuePattern,
            msg: `${option.name} property`,
        },
    ])),
    optionsValues: Object.fromEntries(jdlOptions
        .filter(option => option.knownChoices)
        .map(option => [option.name, Object.fromEntries(option.knownChoices.map(choice => [choice, choice]))])),
    optionsTypes: Object.fromEntries(jdlOptions.map(option => [
        option.name,
        {
            type: option.type,
        },
    ])),
};
export default applicationConfig;
