text: const {
    PROJECT_TYPE, PROJECT_CREATION_STEP, DB_ADAPTER,
  } = require('../constants/constant');
  
  function getProjectSteps (type) {
    if (type === PROJECT_TYPE.MVC) {
      return [
        PROJECT_CREATION_STEP.INPUT_PARSER,
        PROJECT_CREATION_STEP.CREATE_ROOT_DIRECTORY,
        PROJECT_CREATION_STEP.SCHEMA_VALIDATION,
        PROJECT_CREATION_STEP.CREATE_BLANK_DIRECTORY_MVC,
        PROJECT_CREATION_STEP.CREATE_MODELS,
        PROJECT_CREATION_STEP.CREATE_ROUTES,
        PROJECT_CREATION_STEP.MODEL_SERVICE,
        PROJECT_CREATION_STEP.CREATE_CONSTANT,
        PROJECT_CREATION_STEP.CREATE_DEPENDENT_FILE,
        PROJECT_CREATION_STEP.CREATE_DB_CONNECTION,
        PROJECT_CREATION_STEP.CREATE_CONTROLLERS,
        PROJECT_CREATION_STEP.IDENTIFY_AUTH,
        PROJECT_CREATION_STEP.SETUP_ENV_FILE,
        PROJECT_CREATION_STEP.CREATE_VALIDATION_FILE,
        PROJECT_CREATION_STEP.CREATE_CUSTOM_POLICY,
        PROJECT_CREATION_STEP.CREATE_CUSTOM_ROUTES,
        PROJECT_CREATION_STEP.CREATE_POSTMAN,
        PROJECT_CREATION_STEP.CREATE_FILE_UPLOAD_FILES,
        PROJECT_CREATION_STEP.ADD_SOCIAL_LOGIN,
        PROJECT_CREATION_STEP.GENERATE_STATIC_FILES_MVC,
        PROJECT_CREATION_STEP.CREATE_DEPENDENCY_SERVICE,
        PROJECT_CREATION_STEP.CREATE_CUSTOM_ROUTES_SERVICE,
        PROJECT_CREATION_STEP.ADD_ROLE_PERMISSION,
        PROJECT_CREATION_STEP.ADD_SEEDER_MONGOOSE,
        PROJECT_CREATION_STEP.GENERATE_TEST_CASES,
        PROJECT_CREATION_STEP.RENDER_EJS, // must be last step
        PROJECT_CREATION_STEP.APPLY_ESLINT,
        PROJECT_CREATION_STEP.CREATE_APP_FILE,
      ];
    }
    if (type === PROJECT_TYPE.CLEAN_CODE) {
      return [
        PROJECT_CREATION_STEP.INPUT_PARSER,
        PROJECT_CREATION_STEP.CREATE_ROOT_DIRECTORY,
        PROJECT_CREATION_STEP.CREATE_BLANK_DIRECTORY_CC,
        PROJECT_CREATION_STEP.SCHEMA_VALIDATION,
        PROJECT_CREATION_STEP.CREATE_MODELS,
        PROJECT_CREATION_STEP.CREATE_ENTITY,
        PROJECT_CREATION_STEP.IDENTIFY_AUTH,
        PROJECT_CREATION_STEP.CREATE_CONSTANT,
        PROJECT_CREATION_STEP.SETUP_ENV_FILE,
        PROJECT_CREATION_STEP.CREATE_DEPENDENT_FILE,
        PROJECT_CREATION_STEP.CREATE_DB_CONNECTION,
        PROJECT_CREATION_STEP.CREATE_CONTROLLER_INDEX,
        PROJECT_CREATION_STEP.CREATE_CONTROLLERS,
        PROJECT_CREATION_STEP.CREATE_AUTH_CONTROLLER_INDEX,
        PROJECT_CREATION_STEP.CREATE_ROUTES,
        PROJECT_CREATION_STEP.MODEL_SERVICE,
        PROJECT_CREATION_STEP.GENERATE_STATIC_FILES_CC,
        PROJECT_CREATION_STEP.CREATE_POSTMAN,
        PROJECT_CREATION_STEP.CREATE_FILE_UPLOAD_FILES,
        PROJECT_CREATION_STEP.CREATE_FIE_UPLOAD_CONTROLLER_INDEX,
        PROJECT_CREATION_STEP.CREATE_FILE_UPLOAD_SERVICE,
        PROJECT_CREATION_STEP.CREATE_FILE_UPLOAD_USECASE,
        PROJECT_CREATION_STEP.ADD_SOCIAL_LOGIN,
        PROJECT_CREATION_STEP.CREATE_VALIDATION_FILE,
        PROJECT_CREATION_STEP.CREATE_CUSTOM_POLICY,
        PROJECT_CREATION_STEP.CREATE_CUSTOM_ROUTES,
        PROJECT_CREATION_STEP.CREATE_INDEX_FILES_OF_CONTROLLER_CUSTOM_ROUTES,
        PROJECT_CREATION_STEP.CREATE_CUSTOM_ROUTES_SERVICE,
        PROJECT_CREATION_STEP.CREATE_DEPENDENCY_SERVICE,
        PROJECT_CREATION_STEP.ADD_ROLE_PERMISSION,
        PROJECT_CREATION_STEP.ADD_SEEDER_MONGOOSE,
        PROJECT_CREATION_STEP.GENERATE_TEST_CASES,
        PROJECT_CREATION_STEP.RENDER_EJS, // must be the last step
        PROJECT_CREATION_STEP.APPLY_ESLINT,
        PROJECT_CREATION_STEP.CREATE_APP_FILE,
        PROJECT_CREATION_STEP.CREATE_DATA_ACCESS_FILES,
        PROJECT_CREATION_STEP.CREATE_USECASE_FILES,
        PROJECT_CREATION_STEP.CREATE_COMMON_USE_CASE_FILES,
        PROJECT_CREATION_STEP.CREATE_MIDDLEWARE_INDEX,
        PROJECT_CREATION_STEP.CREATE_CUSTOM_ROUTES_USECASE,
  
      ];
    }
    if (type === PROJECT_TYPE.MVC_SEQUELIZE) {
      return [
        PROJECT_CREATION_STEP.INPUT_PARSER_SEQUELIZE,
        PROJECT_CREATION_STEP.CREATE_ROOT_DIRECTORY,
        PROJECT_CREATION_STEP.SEQUELIZE_SCHEMA_VALIDATION,
        PROJECT_CREATION_STEP.SEQUELIZE_TYPE_CONVERSION,
        PROJECT_CREATION_STEP.SEQUELIZE_TYPE_VALIDATION,
        PROJECT_CREATION_STEP.CREATE_BLANK_DIRECTORY_MVC,
        PROJECT_CREATION_STEP.CONVERT_HOOK_NAMES,
        PROJECT_CREATION_STEP.CREATE_SEQUELIZE_MODELS,
        PROJECT_CREATION_STEP.CREATE_CONTROLLERS,
        PROJECT_CREATION_STEP.CREATE_ROUTES,
        PROJECT_CREATION_STEP.MODEL_SERVICE,
        PROJECT_CREATION_STEP.SEQUELIZE_DB_SERVICE,
        PROJECT_CREATION_STEP.CREATE_CONSTANT,
        PROJECT_CREATION_STEP.CREATE_DEPENDENT_FILE_SEQUELIZE,
        PROJECT_CREATION_STEP.CREATE_DB_CONNECTION_SEQUELIZE,
        PROJECT_CREATION_STEP.IDENTIFY_AUTH,
        PROJECT_CREATION_STEP.SETUP_ENV_FILE_SEQUELIZE,
        PROJECT_CREATION_STEP.CREATE_SEQUELIZE_VALIDATION_FILE,
        PROJECT_CREATION_STEP.CREATE_CUSTOM_POLICY,
        PROJECT_CREATION_STEP.CREATE_CUSTOM_ROUTES,
        PROJECT_CREATION_STEP.CREATE_POSTMAN_SEQUELIZE,
        PROJECT_CREATION_STEP.CREATE_FILE_UPLOAD_FILES,
        PROJECT_CREATION_STEP.ADD_SOCIAL_LOGIN,
        PROJECT_CREATION_STEP.GENERATE_STATIC_FILES_MVC_SEQUELIZE,
        PROJECT_CREATION_STEP.CREATE_DEPENDENCY_SERVICE,
        PROJECT_CREATION_STEP.CREATE_CUSTOM_ROUTES_SERVICE,
        PROJECT_CREATION_STEP.QUERY_BUILDER_PARSE_SEQUELIZE,
        PROJECT_CREATION_STEP.ADD_ROLE_PERMISSION,
        PROJECT_CREATION_STEP.ADD_SEEDER_SEQUELIZE,
        PROJECT_CREATION_STEP.GENERATE_TEST_CASES_SEQUELIZE,
        PROJECT_CREATION_STEP.RENDER_EJS, // must be last step
        PROJECT_CREATION_STEP.APPLY_ESLINT,
        PROJECT_CREATION_STEP.CREATE_APP_FILE,
      ];
    }
    if (type === PROJECT_TYPE.CC_SEQUELIZE) {
      return [
        PROJECT_CREATION_STEP.INPUT_PARSER_SEQUELIZE,
        PROJECT_CREATION_STEP.CREATE_ROOT_DIRECTORY,
        PROJECT_CREATION_STEP.CREATE_BLANK_DIRECTORY_CC,
        PROJECT_CREATION_STEP.SEQUELIZE_SCHEMA_VALIDATION,
        PROJECT_CREATION_STEP.SEQUELIZE_TYPE_CONVERSION,
        PROJECT_CREATION_STEP.SEQUELIZE_TYPE_VALIDATION,
        PROJECT_CREATION_STEP.CONVERT_HOOK_NAMES,
        PROJECT_CREATION_STEP.CREATE_SEQUELIZE_MODELS,
        PROJECT_CREATION_STEP.CREATE_ENTITY,
        PROJECT_CREATION_STEP.IDENTIFY_AUTH,
        PROJECT_CREATION_STEP.CREATE_CONSTANT,
        PROJECT_CREATION_STEP.SETUP_ENV_FILE_SEQUELIZE,
        PROJECT_CREATION_STEP.CREATE_DEPENDENT_FILE_SEQUELIZE,
        PROJECT_CREATION_STEP.CREATE_DB_CONNECTION_SEQUELIZE,
        PROJECT_CREATION_STEP.CREATE_CONTROLLER_INDEX,
        PROJECT_CREATION_STEP.CREATE_CONTROLLERS,
        PROJECT_CREATION_STEP.CREATE_AUTH_CONTROLLER_INDEX,
        PROJECT_CREATION_STEP.CREATE_ROUTES,
        PROJECT_CREATION_STEP.MODEL_SERVICE,
        PROJECT_CREATION_STEP.GENERATE_STATIC_FILES_CC_SEQUELIZE,
        PROJECT_CREATION_STEP.CREATE_POSTMAN_SEQUELIZE,
        PROJECT_CREATION_STEP.CREATE_FILE_UPLOAD_FILES,
        PROJECT_CREATION_STEP.CREATE_FIE_UPLOAD_CONTROLLER_INDEX,
        PROJECT_CREATION_STEP.CREATE_FILE_UPLOAD_SERVICE,
        PROJECT_CREATION_STEP.CREATE_FILE_UPLOAD_USECASE,
        PROJECT_CREATION_STEP.ADD_SOCIAL_LOGIN,
        PROJECT_CREATION_STEP.CREATE_SEQUELIZE_VALIDATION_FILE,
        PROJECT_CREATION_STEP.CREATE_CUSTOM_POLICY,
        PROJECT_CREATION_STEP.CREATE_CUSTOM_ROUTES,
        PROJECT_CREATION_STEP.CREATE_INDEX_FILES_OF_CONTROLLER_CUSTOM_ROUTES,
        PROJECT_CREATION_STEP.CREATE_CUSTOM_ROUTES_SERVICE,
        PROJECT_CREATION_STEP.CREATE_DEPENDENCY_SERVICE,
        PROJECT_CREATION_STEP.ADD_ROLE_PERMISSION,
        PROJECT_CREATION_STEP.ADD_SEEDER_SEQUELIZE,
        PROJECT_CREATION_STEP.GENERATE_TEST_CASES_SEQUELIZE,
        PROJECT_CREATION_STEP.EXTERNAL_EMAIL_SERVICE_PROVIDER,
        PROJECT_CREATION_STEP.RENDER_EJS, // must be the last step
        PROJECT_CREATION_STEP.APPLY_ESLINT,
        PROJECT_CREATION_STEP.CREATE_APP_FILE,
        PROJECT_CREATION_STEP.CREATE_DATA_ACCESS_FILES,
        PROJECT_CREATION_STEP.CREATE_USECASE_FILES,
        PROJECT_CREATION_STEP.CREATE_COMMON_USE_CASE_FILES,
        PROJECT_CREATION_STEP.CREATE_MIDDLEWARE_INDEX,
        PROJECT_CREATION_STEP.CREATE_CUSTOM_ROUTES_USECASE,
      ];
    }
    return [];
  }
  
  module.exports = {
    setup: (projectType, databaseAdapter) => {
      let modelPathAccordingORM = '/model';
      let dbConnectionFilePathAccordingORM = '/config/db.js';
      let dbServiceFilePathAccordingORM = '/service/dbService.js';
  
      if (projectType === PROJECT_TYPE.CLEAN_CODE && (databaseAdapter === DB_ADAPTER.MONGODB)) {
        modelPathAccordingORM = '/db/mongoDB/models';
        dbConnectionFilePathAccordingORM = '/db/mongoDB/connection.js';
        dbServiceFilePathAccordingORM = '/db/mongoDB/dbService.js';
      } else if (projectType === PROJECT_TYPE.CC_SEQUELIZE && ([DB_ADAPTER.POSTGRESQL, DB_ADAPTER.MYSQL, DB_ADAPTER.MSSQL].includes(databaseAdapter))) {
        modelPathAccordingORM = '/db/sequelize/models';
        dbConnectionFilePathAccordingORM = '/db/sequelize/connection.js';
        dbServiceFilePathAccordingORM = '/db/sequelize/dbService.js';
      }
  
      let settingJson = {};
  
      settingJson = {
        // ? MVC Settings.
        [PROJECT_TYPE.MVC]: {
          templateFolderName: 'mvc',
          templateRegistry: {
            modelFolderPath: '/models',
            configFolderPath: '/config',
            controllerFolderPath: '/controllers',
            routesFolderPath: '/routes',
            serviceFolderPath: '/services',
            individualRoutesFolderPath: '/individualRoutes',
            utilsFolderPath: '/utils',
            validationFolderPath: '/utils/validation',
            viewsFolderPath: '/views',
            middlewareFolderPath: '/middleware',
            // From Here
            testCaseTemplatePath: '/__test__',
            smsServiceTemplateName: '/services/smsService.js',
            emailServiceTemplateName: '/services/emailService.js',
            pushNotificationPath: '/services/pushNotification',
            seedersPath: '/seeders',
          },
          userDirectoryStructure: {
            modelFolderPath: '/model',
            configFolderPath: '/config',
            controllerFolderPath: '/controller',
            routesFolderPath: '/routes',
            serviceFolderPath: '/services',
            constantFolderPath: '/constants',
            mainJSFilePath: '/app.js',
            publicFolderPath: 'public',
            utilsFolderPath: '/utils',
            validationFolderPath: '/utils/validation',
            viewsFolderPath: '/views',
            middlewareFolderPath: '/middleware',
            generatedControllerPath: '/controller/{{ platform }}/{{ model }}Controller.js',
            authControllerPath: '/controller/{{ platform }}',
            fileUploadControllerPath: '/controller/{{ platform }}',
            adminFileUploadControllerPath: 'controller/{{ platform }}',
            generatedCustomRouteControllerPath: 'controller/{{ platform }}/{{ controller }}Controller.js',
            dbConnectionFolderPath: '/config/db.js',
            generatedTestCasePath: '/__test__/{{ platform }}/{{ model }}.test.js',
            testCasePath: '/__test__',
            seedersPath: '/seeders',
            envFilePath: '.env',
          },
          steps: getProjectSteps(projectType),
        },
        // ? Clean Code Settings.
        [PROJECT_TYPE.CLEAN_CODE]: {
          templateFolderName: 'cleanCode',
          templateRegistry: {
            entityFolderPath: '/entity',
            modelFolderPath: '/models',
            configFolderPath: '/config',
            controllerFolderPath: '/controllers',
            routesFolderPath: '/routes',
            middlewareFolderPath: '/middleware',
            viewsFolderPath: '/views',
            serviceFolderPath: '/services',
            utilsFolderPath: '/utils',
            validationFolderPath: '/validation',
            individualRoutesFolderPath: '/individualRoutes',
            testCaseTemplatePath: '/__test__',
            smsServiceTemplateName: '/services/smsService.js',
            emailServiceTemplateName: '/services/emailService.js',
            pushNotificationPath: '/services/pushNotification',
            seedersPath: '/seeders',
            dataAccessFolderPath: '/data-access',
            useCaseFolderPath: '/use-case',
            useCaseFilePath: '/use-case/{{ model }}/{{ fileName }}.js',
          },
          userDirectoryStructure: {
            mainJSFilePath: '/app.js',
            entityFolderPath: '/entities',
            modelFolderPath: modelPathAccordingORM,
            configFolderPath: '/config',
            controllerFolderPath: '/controller',
            routesFolderPath: '/routes',
            middlewareFolderPath: '/middleware',
            viewsFolderPath: '/views',
            serviceFolderPath: '/services',
            publicFolderPath: '/public',
            helperFolderPath: '/helpers',
            constantFolderPath: '/constants',
            utilsFolderPath: '/utils',
            validationFolderPath: '/validation',
            generatedCustomRouteControllerPath: 'controller/{{ platform }}/{{ controller }}/{{ controller }}.js',
            generatedIndexForNewPlatformPath: '/{{ platform }}/',
            generatedControllerPath: '/controller/{{ platform }}/{{ model }}/{{ model }}.js',
            authControllerPath: '/controller/{{ platform }}/authentication',
            fileUploadControllerPath: '/controller/{{ platform }}/fileUpload',
            adminFileUploadControllerPath: 'controller/{{ platform }}',
            dbConnectionFolderPath: dbConnectionFilePathAccordingORM,
            generatedTestCasePath: '/__test__/{{ platform }}/{{ model }}.test.js',
            testCasePath: '/__test__',
            seedersPath: '/seeders',
            envFilePath: '.env',
            dataAccessFolderPath: '/data-access',
            dbServiceFilePath: dbServiceFilePathAccordingORM,
            useCaseFolderPath: '/use-case',
            useCaseFilePath: '/use-case/{{ model }}/{{ fileName }}.js',
          },
          steps: getProjectSteps(projectType),
        },
        // ? MVC Sequelize Settings.
        [PROJECT_TYPE.MVC_SEQUELIZE]: {
          templateFolderName: 'mvcSequelize',
          templateRegistry: {
            modelFolderPath: '/models',
            configFolderPath: '/config',
            controllerFolderPath: '/controllers',
            routesFolderPath: '/routes',
            serviceFolderPath: '/services',
            individualRoutesFolderPath: '/individualRoutes',
            utilsFolderPath: '/utils',
            validationFolderPath: '/utils/validation',
            viewsFolderPath: '/views',
            middlewareFolderPath: '/middleware',
            testCaseTemplatePath: '/__test__',
            smsServiceTemplateName: '/services/smsService.js',
            emailServiceTemplateName: '/services/emailService.js',
            pushNotificationPath: '/services/pushNotification',
            seedersPath: '/seeders',
          },
          userDirectoryStructure: {
            mainJSFilePath: '/app.js',
            modelFolderPath: '/model',
            configFolderPath: '/config',
            controllerFolderPath: '/controller',
            routesFolderPath: '/routes',
            serviceFolderPath: '/services',
            constantFolderPath: '/constants',
            individualRoutesFolderPath: '/individualRoutes',
            utilsFolderPath: '/utils',
            publicFolderPath: '/public',
            validationFolderPath: '/utils/validation',
            viewsFolderPath: '/views',
            middlewareFolderPath: '/middleware',
            generatedControllerPath: '/controller/{{ platform }}/{{ model }}Controller.js',
            authControllerPath: '/controller/{{ platform }}',
            fileUploadControllerPath: '/controller/{{ platform }}',
            adminFileUploadControllerPath: 'controller/{{ platform }}',
            generatedCustomRouteControllerPath: 'controller/{{ platform }}/{{ controller }}Controller.js',
            dbConnectionFolderPath: '/config/db.js',
            generatedTestCasePath: '/__test__/{{ platform }}/{{ model }}.test.js',
            testCasePath: '/__test__',
            seedersPath: '/seeders',
            envFilePath: '.env',
          },
          steps: getProjectSteps(projectType),
        },
  
        [PROJECT_TYPE.CC_SEQUELIZE]: {
          templateFolderName: 'cleanCodeSequelize',
          templateRegistry: {
            entityFolderPath: '/entity',
            modelFolderPath: '/models',
            configFolderPath: '/config',
            controllerFolderPath: '/controllers',
            routesFolderPath: '/routes',
            middlewareFolderPath: '/middleware',
            viewsFolderPath: '/views',
            serviceFolderPath: '/services',
            utilsFolderPath: '/utils',
            validationFolderPath: '/validation',
            individualRoutesFolderPath: '/individualRoutes',
            testCaseTemplatePath: '/__test__',
            smsServiceTemplateName: '/services/smsService.js',
            emailServiceTemplateName: '/services/emailService.js',
            pushNotificationPath: '/services/pushNotification',
            seedersPath: '/seeders',
            dataAccessFolderPath: '/data-access',
            useCaseFolderPath: '/use-case',
            useCaseFilePath: '/use-case/{{ model }}/{{ fileName }}.js',
          },
          userDirectoryStructure: {
            mainJSFilePath: '/app.js',
            entityFolderPath: '/entities',
            modelFolderPath: modelPathAccordingORM,
            configFolderPath: '/config',
            controllerFolderPath: '/controller',
            routesFolderPath: '/routes',
            middlewareFolderPath: '/middleware',
            viewsFolderPath: '/views',
            serviceFolderPath: '/services',
            publicFolderPath: '/public',
            helperFolderPath: '/helpers',
            constantFolderPath: '/constants',
            utilsFolderPath: '/utils',
            validationFolderPath: '/validation',
            generatedCustomRouteControllerPath: 'controller/{{ platform }}/{{ controller }}/{{ controller }}.js',
            generatedIndexForNewPlatformPath: '/{{ platform }}/',
            generatedControllerPath: '/controller/{{ platform }}/{{ model }}/{{ model }}.js',
            authControllerPath: '/controller/{{ platform }}/authentication',
            fileUploadControllerPath: '/controller/{{ platform }}/fileUpload',
            adminFileUploadControllerPath: '/controller/{{ platform }}',
            dbConnectionFolderPath: dbConnectionFilePathAccordingORM,
            generatedTestCasePath: '/__test__/{{ platform }}/{{ model }}.test.js',
            testCasePath: '/__test__',
            seedersPath: '/seeders',
            envFilePath: '.env',
            dataAccessFolderPath: '/data-access',
            dbServiceFilePath: dbServiceFilePathAccordingORM,
            useCaseFolderPath: '/use-case',
            useCaseFilePath: '/use-case/{{ model }}/{{ fileName }}.js',
          },
          steps: getProjectSteps(projectType),
        },
      };
  
      return settingJson;
    },
  };
  