const jhipsterUtils = require('../../utils');
const { SQL } = require('../../../jdl/jhipster/database-types');
const { MapperTypes, ServiceTypes } = require('../../../jdl/jhipster/entity-options');
const jhipsterConstants = require('../../generator-constants');
const { checkRegenerateFile, getModuleFilePath } = require('../../utils');
const { MAPSTRUCT } = MapperTypes;
const { SERVICE_CLASS, SERVICE_IMPL } = ServiceTypes;
const SERVER_MAIN_SRC_DIR = jhipsterConstants.SERVER_MAIN_SRC_DIR;
const SERVER_MAIN_RES_DIR = jhipsterConstants.SERVER_MAIN_RES_DIR;
const INTERPOLATE_REGEX = jhipsterConstants.INTERPOLATE_REGEX;
const getEnumInfo = jhipsterUtils.getEnumInfo;
module.exports = {
    writeOriginalFiles,
};
function writeOriginalFiles() {
    return {
        writeEnumFiles() {
            this.fields.forEach(field => {
                if (!field.fieldIsEnum) {
                    return;
                }
                const fieldType = field.fieldType;
                const enumInfo = {
                    ...getEnumInfo(field, this.clientRootFolder),
                    frontendAppName: this.frontendAppName,
                    packageName: this.packageName,
                    entityAbsolutePackage: this.packageName,
                };
                if (!this.skipServer) {
                    const pathToTemplateFile = `${this.fetchFromInstalledJHipster('entity-server/templates')}/${SERVER_MAIN_SRC_DIR}package/domain/enumeration/Enum.java.ejs`;
                    this.template(pathToTemplateFile, `${this.multiModule ? `${this.dasherizedBaseName}-base-api/` : ''}${SERVER_MAIN_SRC_DIR}${this.packageFolder}/domain/enumeration/${fieldType}.java`, this, {}, enumInfo);
                }
            });
        },
    };
}
export {};
