import entityOptions from './entity-options.js';
const { MapperTypes, PaginationTypes, SearchTypes, ServiceTypes } = entityOptions;
const { MAPSTRUCT } = MapperTypes;
const NO_MAPPER = MapperTypes.NO;
const { SERVICE_CLASS, SERVICE_IMPL } = ServiceTypes;
const NO_SERVICE = ServiceTypes.NO;
const { ELASTICSEARCH, COUCHBASE, NO: NO_SEARCH } = SearchTypes;
const Options = {
    DTO: 'dto',
    SERVICE: 'service',
    PAGINATION: 'pagination',
    MICROSERVICE: 'microservice',
    SEARCH: 'search',
    ANGULAR_SUFFIX: 'angularSuffix',
    CLIENT_ROOT_FOLDER: 'clientRootFolder',
};
const optionNames = Object.values(Options);
const dtoValues = { MAPSTRUCT, NO: NO_MAPPER };
const serviceValues = { SERVICE_CLASS, SERVICE_IMPL, NO: NO_SERVICE };
const paginationValues = {
    PAGINATION: PaginationTypes.PAGINATION,
    'INFINITE-SCROLL': PaginationTypes.INFINITE_SCROLL,
    NO: PaginationTypes.NO,
};
const searchValues = { ELASTICSEARCH, COUCHBASE, NO: NO_SEARCH };
const Values = {
    dto: dtoValues,
    service: serviceValues,
    pagination: paginationValues,
    search: searchValues,
};
const DefaultValues = {
    [Options.DTO]: Values[Options.DTO].NO,
    [Options.SERVICE]: Values[Options.SERVICE].NO,
    [Options.PAGINATION]: Values[Options.PAGINATION].NO,
};
function getOptionName(optionValue) {
    return optionNames.find(optionName => Values[optionName] && Values[optionName][optionValue]);
}
const OptionValues = {
    mapstruct: 'MAPSTRUCT',
    serviceClass: 'SERVICE_CLASS',
    serviceImpl: 'SERVICE_IMPL',
    pagination: 'PAGINATION',
    'infinite-scroll': 'INFINITE-SCROLL',
    elasticsearch: 'ELASTICSEARCH',
    couchbase: 'COUCHBASE',
};
function forEach(passedFunction) {
    if (!passedFunction) {
        throw new Error('A function has to be passed to loop over the binary options.');
    }
    optionNames.forEach(passedFunction);
}
function exists(passedOption, passedValue) {
    return (!Object.values(Options).includes(passedOption) ||
        Object.values(Options).some(option => passedOption === option &&
            (passedOption === Options.MICROSERVICE ||
                passedOption === Options.ANGULAR_SUFFIX ||
                passedOption === Options.CLIENT_ROOT_FOLDER ||
                Object.values(Values[option]).includes(passedValue))));
}
export default {
    Options,
    DefaultValues,
    OptionValues,
    Values,
    exists,
    forEach,
    getOptionName,
};
