import { getDBTypeFromDBValue } from "./support/database.js";
const command = {
    configs: {
        enableSwaggerCodegen: {
            description: 'API first development using OpenAPI-generator',
            cli: {
                type: Boolean,
            },
            scope: 'storage',
        },
        searchEngine: {
            description: 'Provide search engine for the application when skipping server side generation',
            cli: {
                type: String,
            },
            choices: ['no', 'elasticsearch', 'couchbase'],
            scope: 'storage',
        },
        skipCheckLengthOfIdentifier: {
            description: 'Skip check the length of the identifier, only for recent Oracle databases that support 30+ characters metadata',
            cli: {
                type: Boolean,
            },
            scope: 'storage',
        },
        skipFakeData: {
            description: 'Skip generation of fake data for development',
            cli: {
                type: Boolean,
            },
            scope: 'storage',
        },
        websocket: {
            description: 'Provide websocket option for the application when skipping server side generation',
            cli: {
                type: String,
            },
            scope: 'storage',
        },
        db: {
            description: 'Provide DB name for the application when skipping server side generation',
            cli: {
                type: String,
            },
            configure: (gen, value) => {
                if (value) {
                    const databaseType = getDBTypeFromDBValue(value);
                    if (databaseType) {
                        gen.jhipsterConfig.databaseType = databaseType;
                    }
                    else if (!gen.jhipsterConfig.databaseType) {
                        throw new Error(`Could not detect databaseType for database ${value}`);
                    }
                    if (value !== databaseType) {
                        gen.jhipsterConfig.devDatabaseType = value;
                        gen.jhipsterConfig.prodDatabaseType = value;
                    }
                }
            },
            scope: 'none',
        },
        databaseType: {
            cli: {
                type: String,
                hide: true,
            },
            choices: ['sql', 'mongodb', 'couchbase', 'cassandra', 'neo4j', 'no'],
            scope: 'storage',
        },
        devDatabaseType: {
            description: 'Development database',
            cli: {
                type: String,
            },
            choices: ['postgresql', 'mysql', 'mariadb', 'oracle', 'mssql', 'h2Disk', 'h2Memory'],
            scope: 'storage',
        },
        prodDatabaseType: {
            cli: {
                type: String,
                hide: true,
            },
            choices: ['postgresql', 'mysql', 'mariadb', 'oracle', 'mssql'],
            scope: 'storage',
        },
    },
    import: ['common', 'spring-boot'],
};
export default command;
