import Config from '../../config/appConstants';
import { store } from '../../redux';

class RealEstateRequestService {
  constructor() {
    this.loginDtls = store.getState().pki_details.hasOwnProperty("OrgUserValidator") ? store.getState().pki_details.OrgUserValidator : store.getState().pki_details;
  }

  async retrieveTemplate(type) {
    var API_URL;

    switch (type) {
      case "Real-Estate-View":
        API_URL = Config.REOWNERUNFREEZEVIEWFILE;
        break;
      // RN1

      case Config.ROLES_ID.OMANI_CITIZEN:
        API_URL = Config.RN1OMANISERVICEAPPLICATIONFORMVIEW;
        break;

      case Config.ROLES_ID.GCC_CITIZEN:
        API_URL = Config.RN1GCCFOREINGERSERVICEAPPLICATIONFORMVIEW;
        break;

      case Config.ROLES_ID.FOREIGNER:
        API_URL = Config.RN1GCCFOREINGERSERVICEAPPLICATIONFORMVIEW;
        break;

      case Config.ROLES_ID.CITIZEN_AS_PROXY:
        API_URL = Config.RN1OMANISERVICEAPPLICATIONFORMVIEW;
        break;

      case Config.ROLES_ID.AS_A_COMPANY:
        API_URL = Config.RN1COMPANYAPPLICATIONFORMVIEW;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_lost_preview":
        API_URL = Config.RN1OMANILOSTSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_lost_preview":
        API_URL = Config.RN1COMPANYLOSTSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_damaged_preview":
        API_URL = Config.RN1OMANIDAMAGEDSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_damaged_preview":
        API_URL = Config.RN1COMPANYDAMAGEDSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_requestdocument_preview":
        API_URL = Config.RN1OMANIREQUESTDOCUMENTSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_requestdocument_preview":
        API_URL = Config.RN1COMPANYREQUESTDOCUMENTSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_ownershipdataNamechange_preview":
        API_URL = Config.RN1OMANIOWNERSHIPDATASERVICEPREVIEW;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_ownershipdataNamechange_preview":
        API_URL = Config.RN1COMPANYOWNERSHIPDATASERVICEPREVIEW;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_ownershipdataOfficalrecords_preview":
        API_URL = Config.RN1DOMANIOWNERSHIPDATASERVICEPREVIEW;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_ownershipdataOfficalrecords_preview":
        API_URL = Config.RN1DCOMPANYOWNERSHIPDATASERVICEPREVIEW;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_requestredocument_preview":
        API_URL = Config.RN1OMANIREQUEESTREDOCUMENTSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_lost_preview":
        API_URL = Config.RN1OMANILOSTSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_damaged_preview":
        API_URL = Config.RN1OMANIDAMAGEDSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_requestdocument_preview":
        API_URL = Config.RN1OMANIREQUESTDOCUMENTSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_ownershipdataNamechange_preview":
        API_URL = Config.RN1OMANIOWNERSHIPDATASERVICEPREVIEW;
        break;

      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_ownershipdataOfficalrecords_preview":
        API_URL = Config.RN1DOMANIOWNERSHIPDATASERVICEPREVIEW;
        break;

      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_requestredocument_preview":
        API_URL = Config.RN1OMANIREQUEESTREDOCUMENTSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_lost_preview":
      case Config.ROLES_ID.GCC_AS_PROXY + "_lost_preview":
        API_URL = Config.RN1GCCFOREINGERLOSTSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_damaged_preview":
      case Config.ROLES_ID.GCC_AS_PROXY + "_damaged_preview":
        API_URL = Config.RN1GCCFOREINGERDAMAGEDSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_requestdocument_preview":
      case Config.ROLES_ID.GCC_AS_PROXY + "_requestdocument_preview":
        API_URL = Config.RN1GCCFOREINGERREQUESTDOCUMENTSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_ownershipdataNamechange_preview":
      case Config.ROLES_ID.GCC_AS_PROXY + "_ownershipdataNamechange_preview":
        API_URL = Config.RN1GCCFOREINGEROWNERSHIPDATASERVICEPREVIEW;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_ownershipdataOfficalrecords_preview":
      case Config.ROLES_ID.GCC_AS_PROXY + "_ownershipdataOfficalrecords_preview":
        API_URL = Config.RN1DGCCFOREINGEROWNERSHIPDATASERVICEPREVIEW;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_requestredocument_preview":
      case Config.ROLES_ID.GCC_AS_PROXY + "_requestredocument_preview":
        API_URL = Config.RN1GCCFOREINGERREQUEESTREDOCUMENTSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.FOREIGNER + "_lost_preview":
      case Config.ROLES_ID.FOREIGNER_RESIDENT_CARD_AS_PROXY + "_lost_preview":
        API_URL = Config.RN1GCCFOREINGERLOSTSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.FOREIGNER + "_damaged_preview":
      case Config.ROLES_ID.FOREIGNER_RESIDENT_CARD_AS_PROXY + "_damaged_preview":
        API_URL = Config.RN1GCCFOREINGERDAMAGEDSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.FOREIGNER + "_requestdocument_preview":
      case Config.ROLES_ID.FOREIGNER_RESIDENT_CARD_AS_PROXY + "_requestdocument_preview":
        API_URL = Config.RN1GCCFOREINGERREQUESTDOCUMENTSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.FOREIGNER + "_ownershipdataNamechange_preview":
      case Config.ROLES_ID.FOREIGNER_RESIDENT_CARD_AS_PROXY + "_ownershipdataNamechange_preview":
        API_URL = Config.RN1GCCFOREINGEROWNERSHIPDATASERVICEPREVIEW;
        break;

      case Config.ROLES_ID.FOREIGNER + "_ownershipdataOfficalrecords_preview":
      case Config.ROLES_ID.FOREIGNER_RESIDENT_CARD_AS_PROXY + "_ownershipdataOfficalrecords_preview":
        API_URL = Config.RN1DGCCFOREINGEROWNERSHIPDATASERVICEPREVIEW;
        break;

      case Config.ROLES_ID.FOREIGNER + "_requestredocument_preview":
      case Config.ROLES_ID.FOREIGNER_RESIDENT_CARD_AS_PROXY + "_requestredocument_preview":
        API_URL = Config.RN1GCCFOREINGERREQUEESTREDOCUMENTSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.POST_OFFICE + "_lost_preview":
        API_URL = Config.RN1GCCFOREINGERLOSTSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.POST_OFFICE + "_damaged_preview":
        API_URL = Config.RN1GCCFOREINGERDAMAGEDSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.POST_OFFICE + "_requestdocument_preview":
        API_URL = Config.RN1GCCFOREINGERREQUESTDOCUMENTSERVICEPREVIEW;
        break;

      case Config.ROLES_ID.POST_OFFICE + "_ownershipdataNamechange_preview":
        API_URL = Config.RN1GCCFOREINGEROWNERSHIPDATASERVICEPREVIEW;
        break;

      case Config.ROLES_ID.POST_OFFICE + "_ownershipdataOfficalrecords_preview":
        API_URL = Config.RN1DGCCFOREINGEROWNERSHIPDATASERVICEPREVIEW;
        break;

      case Config.ROLES_ID.POST_OFFICE + "_requestredocument_preview":
        API_URL = Config.RN1GCCFOREINGERREQUEESTREDOCUMENTSERVICEPREVIEW;
        break;

      case "loss-document":
        API_URL = Config.RN1LOSTDOCUMENTREQUEST;
        break;

      case "damaged-document":
        API_URL = Config.RN1DAMAGEDDOCUMENTREQUEST;
        break;

      case "requestredocument":
        API_URL = Config.RN1REQUESTDISPLAYREALESTATEDDOCUMENT;
        break;
      //RN1 Application Details

      case Config.ROLES_ID.OMANI_CITIZEN + "_RN01A_view":
        API_URL = Config.RN1AOMANIREALESTATEVIEWFORM;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_RN01A_view":
        API_URL = Config.RN1AOMANIREALESTATEVIEWFORM;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_RN01A_view":
        API_URL = Config.RN1ACOMPANYREALESTATEVIEWFORM;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_RN01B_view":
        API_URL = Config.RN1BOMANIREALESTATEVIEWFORM;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_RN01B_view":
        API_URL = Config.RN1BOMANIREALESTATEVIEWFORM;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_RN01B_view":
        API_URL = Config.RN1BCOMPANYREALESTATEVIEWFORM;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_RN01C_view":
        API_URL = Config.RN1COMANIREALESTATEVIEWFORM;
        break;
      // case Config.ROLES_ID.GCC_CITIZEN + "_RN01C_view":
      //   API_URL = Config.RN1COMANIREALESTATEVIEWFORM;
      //   break;

      case Config.ROLES_ID.AS_A_COMPANY + "_RN01C_view":
        API_URL = Config.RN1CCOMPANYREALESTATEVIEWFORM;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_RN01D_view":
        API_URL = Config.RN1CCOMPANYREALESTATEVIEWFORM;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_RN01C_view":
        API_URL = Config.RN1CGCCREALESTATEVIEWFORM;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_RN01D_view":
        API_URL = Config.RN1COMANIREALESTATEVIEWFORM;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_RN01D_view":
        API_URL = Config.RN1CGCCREALESTATEVIEWFORM;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_RN01E_view":
        API_URL = Config.RN1EOMANIREALESTATEVIEWFORM;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_RN01E_view":
        API_URL = Config.RN1ECOMPANYREALESTATEVIEWFORM;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_RN01E_view":
        API_URL = Config.RN1EGCCREALESTATEVIEWFORM;
        break;
      //RN1 Final payment 

      case Config.ROLES_ID.OMANI_CITIZEN + "_RN01A_final":
      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_RN01A_final":
        API_URL = Config.RN1AOMANIREALESTATEVIEWFORMFINAL;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_RN01A_final":
        API_URL = Config.RN1ACOMPANYREALESTATEVIEWFORMFINAL;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_RN01A_final":
        API_URL = Config.RN1AGCCREALESTATEVIEWFORMFINAL;
        break;

      case Config.ROLES_ID.FOREIGNER + "_RN01A_final":
        API_URL = Config.RN1AGCCREALESTATEVIEWFORMFINAL;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_RN01B_final":
      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_RN01B_final":
        API_URL = Config.RN1BOMANIREALESTATEVIEWFORMFINAL;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_RN01B_final":
        API_URL = Config.RN1BCOMPANYREALESTATEVIEWFORMFINAL;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_RN01B_final":
        API_URL = Config.RN1BGCCREALESTATEVIEWFORMFINAL;
        break;

      case Config.ROLES_ID.FOREIGNER + "_RN01B_final":
        API_URL = Config.RN1BGCCREALESTATEVIEWFORMFINAL;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_RN01C_final":
      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_RN01C_final":
        API_URL = Config.RN1COMANIREALESTATEVIEWFORMFINAL;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_RN01C_final":
        API_URL = Config.RN1CCOMPANYREALESTATEVIEWFORMFINAL;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_RN01D_final":
      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_RN01D_final":
        API_URL = Config.RN1DCOMANIREALESTATEVIEWFORMFINAL;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_RN01D_final":
        API_URL = Config.RN1DCCOMPANYREALESTATEVIEWFORMFINAL;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_RN01C_final":
      case Config.ROLES_ID.FOREIGNER + "_RN01C_final":
        API_URL = Config.RN1CGCCREALESTATEVIEWFORMFINAL;
        break;

      case Config.ROLES_ID.FOREIGNER + "_RN01D_final":
      case Config.ROLES_ID.GCC_CITIZEN + "_RN01D_final":
        API_URL = Config.RN1CGCCREALESTATEVIEWFORMFINAL;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_RN01E_final":
      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_RN01E_final":
        API_URL = Config.RN1EOMANIREALESTATEVIEWFORMFINAL;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_RN01E_final":
        API_URL = Config.RN1ECOMPANYREALESTATEVIEWFORMFINAL;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_RN01E_final":
        API_URL = Config.RN1EGCCREALESTATEVIEWFORMFINAL;
        break;

      case Config.ROLES_ID.FOREIGNER + "_RN01E_final":
        API_URL = Config.RN1EGCCREALESTATEVIEWFORMFINAL;
        break;
      //RN1 workitem 2_RN01A_preview

      case Config.ROLES_ID.OMANI_CITIZEN + "_RN01A_preview":
      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_RN01A_preview":
        API_URL = Config.RN1AOMANIREALESTATEWORKIREMFORM;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_RN01A_preview":
        API_URL = Config.RN1ACOMPANYREALESTATEWORKIREMFORM;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_RN01B_preview":
      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_RN01B_preview":
        API_URL = Config.RN1BOMANIREALESTATEWORKIREMFORM;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_RN01B_preview":
        API_URL = Config.RN1BCOMPANYREALESTATEWORKIREMFORM;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_RN01A_preview":
      case Config.ROLES_ID.FOREIGNER + "_RN01A_preview":
        API_URL = Config.RN1AGCCREALESTATEWORKIREMFORM;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_RN01B_preview":
      case Config.ROLES_ID.FOREIGNER + "_RN01B_preview":
        API_URL = Config.RN1BGCCREALESTATEWORKIREMFORM;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_RN01C_preview":
      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_RN01C_preview":
        API_URL = Config.RN1COMANIREALESTATEWORKIREMFORM;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_RN01C_preview":
        API_URL = Config.RN1CCOMPANYREALESTATEWORKIREMFORM;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_RN01C_preview":
      case Config.ROLES_ID.FOREIGNER + "_RN01C_preview":
        API_URL = Config.RN1CGCCREALESTATEWORKIREMFORM;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_RN01D_preview":
      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_RN01D_preview":
        API_URL = Config.RN1DCOMANIREALESTATEWORKIREMFORM;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_RN01D_preview":
        API_URL = Config.RN1DCCOMAPYREALESTATEWORKIREMFORM;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_RN01D_preview":
      case Config.ROLES_ID.FOREIGNER + "_RN01D_preview":
        API_URL = Config.RN1DCGCCREALESTATEWORKIREMFORM;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_RN01E_preview":
      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_RN01E_preview":
        API_URL = Config.RN1EOMANIREALESTATEWORKIREMFORM;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_RN01E_preview":
        API_URL = Config.RN1ECOMPANYREALESTATEWORKIREMFORM;
        break;

      case Config.ROLES_ID.GCC_CITIZEN + "_RN01E_preview":
      case Config.ROLES_ID.FOREIGNER + "_RN01E_preview":
        API_URL = Config.RN1EGCCREALESTATEWORKIREMFORM;
        break;
      //RN2 

      case "real-estate-freezing":
        API_URL = Config.RN2REALESTATEFREEZINGFORMREQUESTVIEW;
        break;

      case "freez-file":
        API_URL = Config.RN2FREEZREQUESTFILEFORM;
        break;

      case "freeze-preview":
        API_URL = Config.RN2REALESTATEFREEZINGFORMPREVIEW;
        break;

      case "company-freeze-preview":
        API_URL = Config.RN2COMPANYREALESTATEFREEZINGFORMPREVIEW;
        break;

      case "real-estate-court-freezing":
        API_URL = Config.RN2REALESTATEFREEZINGCOURTFORMREQUESTVIEW;
        break;

      case "freeze-workitem-preview":
        API_URL = Config.RN2REALESTATEFREEZINGWORKITEMFORMPREVIEW;
        break;

      case "freez-file-workitem":
        API_URL = Config.RN2REALESTATEFREEZINGWORKITEM;
        break;

      case "payment-freeze-unfreeze":
        API_URL = Config.RN2REALESTATEFREEZINGWORKITEMPAYMENT;
        break;

      case "court-workitem-preview":
        API_URL = Config.RN2REALESTATEFREEZINGWORKITEMFORMPREVIEWCOURT;
        break;

      case "comapny-court-workitem-preview":
        API_URL = Config.RN2COMPANYREALESTATEFREEZINGWORKITEM;
        break;

      case "comapny-unfreezecourt-workitem-preview":
        API_URL = Config.RN2COMPANYREALESTATEUNFREEZINGWORKITEM;
        break;

      case "reowner-workitem-resubmit-preview":
        API_URL = Config.RN2REALESTATEFREEZINGAPPRESUBMIT;
        break;

      case "reowner-workitem-unfreeze-resubmit-preview":
        API_URL = Config.RN3REALESTATEUNFREEZINGAPPRESUBMIT;
        break;

      case "freezeReason_mohuser":
        API_URL = Config.RN2REALESTATEFREEZINGMOHUSER;
        break;

      case "UnfreezeReason_mohuser":
        API_URL = Config.RN2REALESTATEFREEZINGMOHUSERUNFREEZE;
        break;

      case "company-workitem-resubmit-preview":
        API_URL = Config.RN2REALESTATECOMPANYFREEZINGAPPRESUBMIT;
        break;

      case "company-workitem-unfreeze-resubmit-preview":
        API_URL = Config.RN3REALESTATECOMPANYUNFREEZINGAPPRESUBMIT;
        break;
      //Dashboard

      case Config.ROLES_ID.OMANI_CITIZEN + "_RN02A_view":
      case Config.ROLES_ID.GCC_CITIZEN + "_RN02A_view":
      case Config.ROLES_ID.FOREIGNER + "_RN02A_view":
      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_RN02A_view":
      case Config.ROLES_ID.GCC_AS_PROXY + "_RN02A_view":
      case Config.ROLES_ID.FOREIGNER_RESIDENT_CARD_AS_PROXY + "_RN02A_view":
      case Config.ROLES_ID.FOREIGNER_WO_RESIDENT_CARD_AS_PROXY + "_RN02A_view":
        API_URL = Config.RN2REALESTATEFREEZINGAPPVIEW;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_RN02A_view":
        API_URL = Config.RN2REALESTATECOMPANYFREEZINGAPPVIEW;
        break;

      case Config.ROLES_ID.OMANI_CITIZEN + "_RN03A_view":
      case Config.ROLES_ID.GCC_CITIZEN + "_RN03A_view":
      case Config.ROLES_ID.FOREIGNER + "_RN03A_view":
      case Config.ROLES_ID.CITIZEN_AS_PROXY + "_RN03A_view":
      case Config.ROLES_ID.GCC_AS_PROXY + "_RN03A_view":
      case Config.ROLES_ID.FOREIGNER_RESIDENT_CARD_AS_PROXY + "_RN03A_view":
      case Config.ROLES_ID.FOREIGNER_WO_RESIDENT_CARD_AS_PROXY + "_RN03A_view":
        API_URL = Config.RN3REALESTATEUNFREEZINGAPPVIEW;
        break;

      case Config.ROLES_ID.AS_A_COMPANY + "_RN03A_view":
        API_URL = Config.RN3REALESTATECOMPANYUNFREEZINGAPPVIEW;
        break;
      //RN3

      case "unfreezing-request":
        API_URL = Config.RN3REALESTATEUNFREEZEAPPREQUEST;
        break;

      case "real-estate-unfreezing":
        API_URL = Config.RN3UNFREEZREFORMVIEW;
        break;

      case "unfreeze-file":
        API_URL = Config.RN3UNFREEZEVIEWFILE;
        break;

      case "unfreeze-preview":
        API_URL = Config.RN3REALESTATEFREEZINGFORMPREVIEW;
        break;

      case "company-unfreeze-preview":
        API_URL = Config.RN3COMPANYREALESTATEFREEZINGFORMPREVIEW;
        break;

      case "unfreez-file-workitem":
        API_URL = Config.RN3REALESTATEFREEZINGFORMREASON;
        break;

      case "unfreeze_workitem_preview":
        API_URL = Config.RN3REALESTATEUNFREEZINGWORKITEMFORMPREVIEWCOURT;
        break;
      //MOH User

      case "query-mohuser":
        API_URL = Config.RN2REALESTATEFREEZINGMOHUSERFORM;
        break;

      case "query-orguser":
        API_URL = Config.RN1REALESTATEORGUSERFORM;
        break;

      case "query-orguser-transaction":
        API_URL = Config.RNREALESTATEORGUSERFORM;
        break;

      case "mohuser-freeze-preview":
        API_URL = Config.RN2_FREEZE_PREVIEW_MOHUSER;
        break;

      case "mohuser-unfreeze-preview":
        API_URL = Config.RN2_FREEZE_PREVIEW_MOHUSER_WORKITEM;
        break;

      case "mohuser-unfreeze-application-preview":
        API_URL = Config.RN3_UNFREEZE_PREVIEW_MOHUSER;
        break;
      //RN4

      case "bank_RN04A_preview":
        API_URL = Config.RN4_SERVICE_APPLICATION_FORM;
        break;

      case "dashboard_preview":
        API_URL = Config.RN4_DASHBOARD_APPLICATION_FORM;
        break;

      case "company_dashboard_preview":
        API_URL = Config.RN4_COMPANY_DASHBOARD_APPLICATION_FORM;
        break;
      //RN7

      case "rn7_omani_dashboard_preview":
        API_URL = Config.RN7_APPLICATION_DETAIL_FORM;
        break;
      // RN9

      case "endowment_dashboard_preview":
        API_URL = Config.RN9_ENDOWMENT_DASHBOARD_PREVIEW;
        break;

      default:
        API_URL = Config.RN1OMANISERVICEAPPLICATIONFORMVIEW;
        break;
    }

    if (API_URL) {
      return fetch(API_URL).then(response => {
        if (!response.ok) {
          this.handleResponseError(response);
        }

        return response.json();
      }).then(json => {
        let response = json;
        return response;
      }).catch(error => {
        this.handleError(error);
      });
    } else {
      console.log('No Valid Request');
    }
  }

  async fetchTemplate(API_URL) {
    if (API_URL) {
      return fetch(API_URL).then(response => {
        if (!response.ok) {
          this.handleResponseError(response);
        }

        return response.json();
      }).then(json => {
        let response = json;
        return response;
      }).catch(error => {
        this.handleError(error);
      });
    } else {
      console.log('No Valid Request');
    }
  }

  handleResponseError(response) {
    throw new Error("HTTP error, status = " + response.status);
  }

  handleError(error) {
    console.log(error.message);
  }

}

export default RealEstateRequestService;