import Config, { Process as process } from './config/appConstants';
import CryptoJS from 'crypto-js';
import aesjs from 'aes-js';
import sanitizeHtml from 'sanitize-html';
import { store } from './redux';
import translateLabel from './translation';
import Swal from 'sweetalert2';
const defaultOptions = {
  allowedTags: ['b', 'i', 'em', 'ul', 'li', 'strong', 'a', 'p', 'img', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span'],
  // selfClosing: ['img', 'br', 'hr', 'area', 'base', 'basefont', 'input', 'link', 'meta'],
  allowedAttributes: {
    a: ['href'],
    '*': ["style"],
    img: ['src']
  },
  allowedClasses: {
    '*': ['tiles', 'row', 'tile', 'details', 'info', 'project-title', 'title', 'demo-gallery', 'panel-body', 'bookswrapper', 'bookswrapper', 'book', 'book-img', 'book-info', 'book-title', 'testimonialSlider', 'testimonial_item', 'img-responsive', 'info-card', 'info-title-row', 'info-download-btn', 'col-md-2', 'slick-list', 'slick-track', 'slide2', 'slick-slide', 'contact-address', 'container', 'slide2', 'icon-map-pinmoh', 'icon-phonemoh', 'icon-mailmoh', 'd-flex', 'card', 'card-body', 'img-fluid', 'rounded-circle', 'row', 'd-flex', 'justify-content-center']
  } // allowedIframeHostnames: ['http://localhost:3000/']

};

const getPdfPath = (filename, isLangFoler, lang) => {
  if (isLangFoler) {
    return `${process.env.REACT_APP_WEB_HOST_PORTAL}/assets/docs/${lang === Config.LANG.EN ? "English/" : "Arabic/"}${filename}`;
  }

  return `${process.env.REACT_APP_WEB_HOST_PORTAL}/assets/docs/${filename}`;
};

const redirectWithReductData = (url, baseUrl = "") => {
  let paramsInclude = ["pki_details", "proxyUserDetails", "applicantUserType", "applicantUserTypeData", "applicantUserID", "resourceDetails", "organizationDetails", "orgUserValidator", "lang", 'createdUserTypeID', "applicableService", "applicableSubService", "selectedService", "profileUserDetails"];
  let params = store.getState();
  let loginInput = {
    "routes": url
  };
  Object.keys(params).forEach(function (key) {
    if (paramsInclude.includes(key) && Object.keys(params[key]).length) {
      loginInput = { ...loginInput,
        [key]: typeof params[key] === "object" ? { ...params[key]
        } : params[key]
      };
    }
  });
  let Base_Url = process.env.REACT_APP_WEB_HOST_REAL_ESTATE; //real-estate //slug

  if (baseUrl) {
    Base_Url = baseUrl; //real-estate //slug
  }

  let path = Base_Url + "/domain/portal/" + btoa(encodeURIComponent(JSON.stringify(loginInput)));
  window.location = path;
};

const isExisty = function (value) {
  return value !== null && value !== undefined;
};

const isEmpty = function (value) {
  if (value instanceof Array) {
    return value.length === 0;
  }

  return value === '' || !isExisty(value);
};

const isEmptyTrimed = function (value) {
  if (typeof value === 'string') {
    return value.trim() === '';
  }

  return true;
};

const WizardBreadCrumbObj = (ServiceName, serviceID, wizardPage = 0, customTitle = "service-list") => {
  let BreadObj;
  let breadLabel = {
    1: "LAND",
    2: "REAL_ESTATE",
    3: "PLANNING_SURVEY",
    4: "REAL_ESTATE_DEV",
    5: "SOCIAL_HOUSING",
    "RN": "REAL_ESTATE",
    "MYWORKITEM": "MYWORKITEM",
    "Register / Update  Wakf": "REGISTER_UPDATE_WAKF"
  };

  if (wizardPage === 1) {
    BreadObj = [{
      TITLE: translateLabel("HOME"),
      URI: Config.BREADCRUMBS_URI["HOME"]
    }, {
      TITLE: translateLabel("ESERVICES"),
      URI: Config.BREADCRUMBS_URI["E_SERVICE"]
    }, // { TITLE: translateLabel(breadLabel[ServiceName.serviceValue.ServiceDomainID]), URI: Config.BREADCRUMBS_URI[breadLabel[ServiceName.serviceValue.ServiceDomainID]] },
    {
      TITLE: translateLabel(breadLabel[serviceID]),
      URI: Config.BREADCRUMBS_URI[breadLabel[serviceID]]
    }, {
      TITLE: ServiceName.hasOwnProperty("serviceTitle") ? ServiceName.serviceTitle : store.getState().lang.lang === Config.LANG.AR ? ServiceName.serviceValue.ServiceNameArabic : ServiceName.serviceValue.ServiceNameEnglish,
      URI: ""
    }];
  } else {
    BreadObj = [{
      TITLE: translateLabel("HOME"),
      URI: Config.BREADCRUMBS_URI["HOME"]
    }, {
      TITLE: translateLabel("ESERVICES"),
      URI: Config.BREADCRUMBS_URI["E_SERVICE"]
    }, // { TITLE: translateLabel(breadLabel[ServiceName.serviceValue.ServiceDomainID]), URI: Config.BREADCRUMBS_URI[breadLabel[ServiceName.serviceValue.ServiceDomainID]] },
    {
      TITLE: translateLabel(breadLabel[serviceID]),
      URI: Config.BREADCRUMBS_URI[breadLabel[serviceID]]
    }, {
      TITLE: translateLabel("APPLICATIONS"),
      URI: ServiceName.hasOwnProperty("serviceValue") ? Config.BREADCRUMBS_URI[breadLabel[serviceID]] + "/" + findAndReplace(ServiceName.serviceValue.ServiceNameEnglish.toLowerCase(), " ", "-") + "/applications-list" : Config.BREADCRUMBS_URI[breadLabel[ServiceName.serviceValue.ServiceDomainID]] + "/" + customTitle + "/applications-list"
    }, {
      TITLE: ServiceName.hasOwnProperty("serviceTitle") ? ServiceName.serviceTitle : translateLabel(customTitle),
      URI: ""
    }];
  }

  return BreadObj;
};

const applicationListUrl = (ServiceName, customTitle = "service-list") => {
  let breadLabel = {
    1: "LAND",
    2: "REAL_ESTATE",
    3: "PLANNING_SURVEY",
    4: "REAL_ESTATE_DEV",
    5: "SOCIAL_HOUSING"
  };
  let DomainName = breadLabel[ServiceName.serviceValue.ServiceDomainID];
  return ServiceName.hasOwnProperty("serviceValue") ? Config.BREADCRUMBS_URI[DomainName] + "/" + findAndReplace(ServiceName.serviceValue.ServiceNameEnglish.toLowerCase(), " ", "-") + "/applications-list" : Config.BREADCRUMBS_URI[DomainName] + "/" + customTitle + "/applications-list";
};

const currentDate = function (format) {
  var today = new Date();
  var dd = today.getDate();
  var mm = today.getMonth() + 1;
  var yyyy = today.getFullYear();

  if (dd < 10) {
    dd = '0' + dd;
  }

  if (mm < 10) {
    mm = '0' + mm;
  }

  if (format === "yyyy-mm-dd") {
    today = yyyy + "-" + mm + '-' + dd;
  } else if (format === "yyyy/mm/dd") {
    today = yyyy + "/" + mm + '/' + dd;
  } else if (format === "dd-mm-yyyy") {
    today = dd + '-' + mm + '-' + yyyy;
  } // today = mm+'-'+dd+'-'+yyyy;
  // console.log(today);
  // today = mm+'/'+dd+'/'+yyyy;
  // console.log(today);
  // today = dd+'-'+mm+'-'+yyyy;
  // console.log(today);
  // today = dd+'/'+mm+'/'+yyyy;
  // console.log(today);


  return today;
};

const convertDateFormat = function (value, format) {
  var d = new Date(value);
  var dd = d.getDate();
  var mm = d.getMonth() + 1;
  var yyyy = d.getFullYear();

  if (dd < 10) {
    dd = '0' + dd;
  }

  if (mm < 10) {
    mm = '0' + mm;
  }

  if (format === "yyyy-mm-dd") {
    d = yyyy + "-" + mm + '-' + dd;
  } else if (format === "yyyy/mm/dd") {
    d = yyyy + "/" + mm + '/' + dd;
  } else if (format === "dd-mm-yyyy") {
    d = dd + '-' + mm + '-' + yyyy;
  } // today = mm+'-'+dd+'-'+yyyy;
  // console.log(today);
  // today = mm+'/'+dd+'/'+yyyy;
  // console.log(today);
  // today = dd+'-'+mm+'-'+yyyy;
  // console.log(today);
  // today = dd+'/'+mm+'/'+yyyy;
  // console.log(today);


  return d;
};

const fileValidator = file => {
  let status = false;
  let msg = ""; // const AllowedFileType = Config.DOCUMENT_UPLOAD_FILE_EXTENTION.split(', ')

  const AllowedFileType = process.env.REACT_APP_FILE_EXT.split(', ');
  const fileSize = parseFloat(file.size / (1024 * 1024)).toFixed(2);
  const fileUploadLimit = process.env.REACT_APP_FILE_UPLOAD_LIMTT;

  if (AllowedFileType.includes(file.type)) {
    status = true;

    if (fileSize > fileUploadLimit) {
      status = false;
      msg = `File Size should not exceed ${fileUploadLimit} mb`;
    }
  } else {
    msg = "Please upload valid file";
  }

  return {
    status,
    msg
  };
};

const getUniqueKeyForSecret = () => {
  return new Date().getSeconds().toString() + new Date().getMinutes().toString() + new Date().getHours().toString() + new Date().getDate().toString() + ("0" + (new Date().getMonth() + 1)).slice(-2) + new Date().getFullYear().toString(); // return new Date().getFullYear().toString() + ("0" + (new Date().getMonth() + 1)).slice(-2) + new Date().getDate().toString()  //new Date().getHours().toString() + new Date().getMinutes().toString() +
}; //     const isEmpty =  function(obj) {
//     // Speed up calls to hasOwnProperty
//     var hasOwnProperty = Object.prototype.hasOwnProperty;
//       // null and undefined are "empty"
//       if (obj == null) return true;
//       // Assume if it has a length property with a non-zero value
//       // that that property is correct.
//       if (obj.length > 0)    return false;
//       if (obj.length === 0)  return true;
//       // If it isn't an object at this point
//       // it is empty, but it can't be anything *but* empty
//       // Is it empty?  Depends on your application.
//       if (typeof obj !== "object") return true;
//       // Otherwise, does it have any properties of its own?
//       // Note that this doesn't handle
//       // toString and valueOf enumeration bugs in IE < 9
//       for (var key in obj) {
//           if (hasOwnProperty.call(obj, key)) return false;
//       }
//       return true;
//   };


const findAndReplace = function (string, target, replacement) {
  var i = 0,
      length = string.length;

  for (i; i < length; i++) {
    string = string.replace(".", "");
    string = string.replace(target, replacement);
  }

  return string;
};

const prefixZeroPad = function (num, size = 2) {
  num = num.toString();

  while (num.length < size) num = "0" + num;

  return num;
};

const updateFormTemplate = (formTemplate, formObjIndex, apiResponse, language) => {
  let formObject = formTemplate.form[formObjIndex].formgroup.input;
  let responseKeys = [Object.keys(apiResponse)];
  let isDataPresent = true;
  formObject.forEach((cur, idx) => {
    let foundFormObj = responseKeys[0].find(current => language === Config.LANG.AR && cur.hasOwnProperty("keyCodeAr") ? cur.keyCodeAr === current : cur.keyCode === current);
    let inputFeild = formTemplate.form[formObjIndex].formgroup.input[idx];

    if (foundFormObj) {
      inputFeild.showAsterisk = false;
      inputFeild.type = "label";
    } else {
      if (isDataPresent) {
        isDataPresent = false;
      }

      inputFeild.showAsterisk = true;
      inputFeild.type = "text";
      inputFeild.validator = {
        rules: ["required"],
        errorMsg: ["PLS_FILL_THE_ABOVE_FEILD"]
      };
    }
  });
  return {
    Template: formTemplate,
    isDataPresent: isDataPresent
  };
};

const changeFormInputTypeInToText = (formTemplate, language) => {
  formTemplate.form.forEach((current, index) => {
    let formObject = formTemplate.form[index].formgroup.input;
    formObject.forEach((cur, idx) => {
      formTemplate.form[index].formgroup.input[idx].showAsterisk = true;
      formTemplate.form[index].formgroup.input[idx].type = "text"; // formTemplate.form[index].formgroup.input[idx].validator = {
      //     rules: [
      //         "required"
      //     ],
      //     errorMsg: [
      //         "PLS_FILL_THE_ABOVE_FEILD"
      //     ]
      // }
    });
  });
  return {
    Template: formTemplate,
    isDataPresent: false
  };
};

const sanitize = (dirty, option) => {
  const options = { ...defaultOptions,
    ...option
  };
  return sanitizeHtml(dirty, options);
};

const getLoginString = (storeDetails, routes) => {
  /**
   * BUG NO Code fix for defect : MOH-3817
   * Date : 2021/03/18
   * Change Done by : Amol
   * Comment : Added proxyUserDetails in paramsInclude to get proxy details.
   * Reviewd by: Prakash kumar S
   * 
   * 
   * Start
   */
  let paramsInclude = ["pki_details", "applicantUserID", "applicantUserType", "applicantUserTypeData", "resourceDetails", "organizationDetails", "orgUserValidator", "lang", "theme", "font", "proxyUserDetails", "organizationUserDetails", "createdUserTypeID", "selectedService"];
  /** End */

  let params = storeDetails;
  let loginInput = [];
  Object.keys(params).forEach(function (key) {
    if (paramsInclude.includes(key) && Object.keys(params[key]).length) {
      loginInput = { ...loginInput,
        [key]: typeof params[key] === "object" ? { ...params[key]
        } : params[key]
      };
    }
  });
  loginInput["routes"] = routes;
  return btoa(encodeURIComponent(JSON.stringify(loginInput)));
};

const workItemRoutes = (storeDetails, WorkItemData) => {
  let paramsInclude = ["pki_details", "applicantUserID", "applicantUserType", "resourceDetails", "organizationDetails", "orgUserValidator", "lang", "theme", "proxyUserDetails", "organizationUserDetails", "createdUserTypeID", "selectedService"];
  let params = storeDetails;
  let loginInput = [];
  Object.keys(params).forEach(function (key) {
    if (paramsInclude.includes(key) && Object.keys(params[key]).length) {
      loginInput = { ...loginInput,
        [key]: typeof params[key] === "object" ? { ...params[key]
        } : params[key]
      };
    }
  });
  loginInput = { ...loginInput,
    ...WorkItemData
  };
  return btoa(encodeURIComponent(JSON.stringify(loginInput)));
};

const convertJSONToEncodedString = JSON => {
  return btoa(JSON);
};

const convertEncodedStringToJSON = encodedString => {
  return atob(encodedString);
};

var replaceAll = function (input, str1, str2, ignore) {
  return input.replace(new RegExp(str1.replace(/([\\/\\,\\!\\\\^\\$\\{\\}\\[\\]\\(\\)\\.\\*\\+\\?\\|\\<\\>\\-\\&])/g, "\\$&"), ignore ? "gi" : "g"), typeof str2 == "string" ? str2.replace(/\$/g, "$$$$") : str2);
};

const unicodeArabicDigits = (params, isDate = false) => {
  let value = isDate ? convertDateFormat(params, "yyyy/mm/dd") : params;
  var arabic = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'];
  var english = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];

  for (var i = 0; i < arabic.length; i++) {
    value = replaceAll(value, english[i], arabic[i]);
  }

  return value;
};

var JsonFormatter = {
  stringify: function (cipherParams) {
    // console.log('cipherParams', cipherParams);
    // create json object with ciphertext
    var jsonObj = {
      ct: cipherParams.ciphertext.toString(CryptoJS.enc.Hex)
    }; // optionally add iv or salt

    if (cipherParams.iv) {
      jsonObj.iv = cipherParams.iv.toString();
    }

    if (cipherParams.salt) {
      jsonObj.s = cipherParams.salt.toString();
    } // stringify json object


    return JSON.stringify(jsonObj);
  },
  parse: function (jsonStr) {
    // parse json string
    var jsonObj = JSON.parse(jsonStr); // extract ciphertext from json object, and create cipher params object

    var cipherParams = CryptoJS.lib.CipherParams.create({
      ciphertext: CryptoJS.enc.Hex.parse(jsonObj.ct)
    }); // optionally extract iv or salt

    if (jsonObj.iv) {
      cipherParams.iv = CryptoJS.enc.Hex.parse(jsonObj.iv);
    }

    if (jsonObj.s) {
      cipherParams.salt = CryptoJS.enc.Hex.parse(jsonObj.s);
    }

    if (jsonObj.auth) {
      cipherParams.auth = CryptoJS.enc.Hex.parse(jsonObj.auth);
    } // console.log('cipherParams', cipherParams)


    return cipherParams;
  }
};

const cmsEncryptHeaderAuthKey = string => {
  const UniqueKey = getUniqueKeyForSecret(); // Encrypt 

  var ciphertext = CryptoJS.AES.encrypt(JSON.stringify(string), UniqueKey, {
    //process.env.REACT_APP_SECRET_KEY + getUniqueKeyForSecret()
    format: JsonFormatter
  });
  const parsedJSON = JSON.parse(ciphertext);
  parsedJSON['auth'] = UniqueKey;
  const stringifiedJSON = JSON.stringify(parsedJSON);
  return stringifiedJSON.toString();
};

const cmsDecryptHeaderAuthKey = ciphertext => {
  const secret = JSON.parse(ciphertext).auth; // console.log('secret', secret)
  // Decrypt

  var bytes = CryptoJS.AES.decrypt(ciphertext, secret, {
    //process.env.REACT_APP_SECRET_KEY + getUniqueKeyForSecret(),
    // iv: CryptoJS.enc.Hex.stringify('485465232ee3e811335ee4517e59a210'),
    // s: CryptoJS.enc.Hex.stringify('563087ebca3a8d8b'),
    format: JsonFormatter
  });
  return bytes.toString(CryptoJS.enc.Utf8); // originalText
};

const bwEncryptHeaderAuthKey = string => {
  const UniqueKey = "eservice@moh123"; // Encrypt 

  var ciphertext = CryptoJS.AES.encrypt(JSON.stringify(string), UniqueKey, {
    //process.env.REACT_APP_SECRET_KEY + getUniqueKeyForSecret()
    format: JsonFormatter
  });
  const parsedJSON = JSON.parse(ciphertext);
  parsedJSON['auth'] = UniqueKey;
  const stringifiedJSON = JSON.stringify(parsedJSON);
  return stringifiedJSON.toString();
};

const bwDecryptHeaderAuthKey = ciphertext => {
  const secret = "eservice@moh123"; // Decrypt

  var bytes = CryptoJS.AES.decrypt(ciphertext, secret, {
    format: JsonFormatter
  });
  return bytes.toString(CryptoJS.enc.Utf8); // originalText
};

const encryptHeaderAuthKey = string => {
  // Encrypt
  // console.log("tst", string, typeof string);
  var ciphertext = CryptoJS.AES.encrypt(string, "eservice@moh123", {
    mode: CryptoJS.mode.CBC,
    adding: CryptoJS.pad.Pkcs7
  }).toString(); // console.log("helper cipher enc", ciphertext);

  return ciphertext;
};

const decryptHeaderAuthKey = ciphertext => {
  // Decrypt
  var bytes = CryptoJS.AES.decrypt(ciphertext, "eservice@moh123");
  return bytes.toString(CryptoJS.enc.Utf8); // originalText
};

function appendZeroToLength(value, length) {
  return `${value}`.padStart(length, 0);
}

const getDateAsText = () => {
  const now = new Date();
  const nowText = appendZeroToLength(now.getUTCFullYear(), 4) + '.' + appendZeroToLength(now.getUTCMonth() + 1, 2) + '.' + appendZeroToLength(now.getUTCDate(), 2) + ', ' + appendZeroToLength(now.getUTCHours(), 2) + ':' + appendZeroToLength(now.getUTCMinutes(), 2) + ':' + appendZeroToLength(now.getUTCSeconds(), 2) + '.' + appendZeroToLength(now.getUTCMilliseconds(), 4) + ' UTC';
  return nowText;
}; // CMS calls encryption 
// var JsonFormatter = {
//     stringify: function (cipherParams) {
//         // create json object with ciphertext
//         var jsonObj = { ct: cipherParams.ciphertext.toString(CryptoJS.enc.Hex) };
//         // optionally add iv or salt
//         if (cipherParams.iv) {
//             jsonObj.iv = cipherParams.iv.toString();
//         }
//         if (cipherParams.salt) {
//             jsonObj.s = cipherParams.salt.toString();
//         }
//         // stringify json object
//         return JSON.stringify(jsonObj);
//     },
//     parse: function (jsonStr) {
//         // parse json string
//         var jsonObj = JSON.parse(jsonStr);
//         // extract ciphertext from json object, and create cipher params object
//         var cipherParams = CryptoJS.lib.CipherParams.create({
//             ciphertext: CryptoJS.enc.Hex.parse(jsonObj.ct)
//         });
//         // optionally extract iv or salt
//         if (jsonObj.iv) {
//             cipherParams.iv = CryptoJS.enc.Hex.parse(jsonObj.iv);
//         }
//         if (jsonObj.s) {
//             cipherParams.salt = CryptoJS.enc.Hex.parse(jsonObj.s);
//         }
//         // console.log('cipherParams', cipherParams)
//         return cipherParams;
//     }
// };

/*
    Encryption Method : AES
    Method : CTR
    */


const encryptRequestBody = requestParams => {
  // An example 128-bit key (16 bytes * 8 bits/byte = 128 bits)
  var key = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; // Convert text to bytes

  var text = JSON.stringify(requestParams);
  var textBytes = aesjs.utils.utf8.toBytes(text); // The counter is optional, and if omitted will begin at 1

  var aesCtr = new aesjs.ModeOfOperation.ctr(key, new aesjs.Counter(5));
  var encryptedBytes = aesCtr.encrypt(textBytes); // To print or store the binary data, you may convert it to hex

  var encryptedHex = aesjs.utils.hex.fromBytes(encryptedBytes); // console.log("encrypt", encryptedHex);

  return encryptedHex;
};

const decryptRequestBody = responseDataEncHex => {
  // An example 128-bit key (16 bytes * 8 bits/byte = 128 bits)
  var key = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; // When ready to decrypt the hex string, convert it back to bytes

  var encryptedBytes = aesjs.utils.hex.toBytes(responseDataEncHex); // The counter mode of operation maintains internal state, so to
  // decrypt a new instance must be instantiated.

  var aesCtr = new aesjs.ModeOfOperation.ctr(key, new aesjs.Counter(5));
  var decryptedBytes = aesCtr.decrypt(encryptedBytes); // Convert our bytes back into text

  var decryptedText = aesjs.utils.utf8.fromBytes(decryptedBytes); //    console.log("encrypt - decrypt", decryptedText);

  return decryptedText;
};

const CreatedUserDetails = () => {
  let createdUserID = store.getState().orgUserValidator.hasOwnProperty("OrgUserType") && store.getState().organizationDetails.hasOwnProperty("resourceDetails") ? store.getState().organizationDetails.resourceDetails.InvolvedPartyID : store.getState().organizationDetails.hasOwnProperty("OrganizationUserDetails") && !store.getState().organizationDetails.OrganizationUserDetails.hasOwnProperty("OrganizationSubTypeID") ? store.getState().organizationDetails.OrganizationUserDetails.OrganizationUserID : store.getState().proxyUserDetails.hasOwnProperty("ProxyLoginDetails") ? store.getState().proxyUserDetails.ProxyLoginDetails.ProxyID : store.getState().resourceDetails.InvolvedPartyID;
  return {
    CreatedUserID: createdUserID
  };
};

const ActionUserDetails = () => {
  let actionUserID = store.getState().organizationDetails.hasOwnProperty("OrganizationUserDetails") && !store.getState().organizationDetails.OrganizationUserDetails.hasOwnProperty("OrganizationSubTypeID") ? store.getState().organizationDetails.OrganizationUserDetails.OrganizationUserID : store.getState().proxyUserDetails.hasOwnProperty("ProxyLoginDetails") ? store.getState().proxyUserDetails.ProxyLoginDetails.ApplicantID : store.getState().resourceDetails.InvolvedPartyID;
  return {
    ActionUserID: actionUserID
  };
};

const notReleasedService = title => {
  Swal.fire({
    title: translateLabel('Info'),
    text: translateLabel("SERVICE_UNDER_DEVELOPEMT"),
    icon: 'info',
    confirmButtonColor: '#470BFF',
    confirmButtonText: 'OK'
  });
};

const Utils = {
  currentDate,
  isExisty,
  isEmpty,
  isEmptyTrimed,
  convertDateFormat,
  findAndReplace,
  fileValidator,
  prefixZeroPad,
  updateFormTemplate,
  changeFormInputTypeInToText,
  getLoginString,
  convertJSONToEncodedString,
  convertEncodedStringToJSON,
  encryptHeaderAuthKey,
  decryptHeaderAuthKey,
  encryptRequestBody,
  decryptRequestBody,
  cmsEncryptHeaderAuthKey,
  cmsDecryptHeaderAuthKey,
  bwEncryptHeaderAuthKey,
  bwDecryptHeaderAuthKey,
  sanitize,
  getDateAsText,
  unicodeArabicDigits,
  redirectWithReductData,
  WizardBreadCrumbObj,
  applicationListUrl,
  workItemRoutes,
  CreatedUserDetails,
  getPdfPath,
  notReleasedService,
  ActionUserDetails
};
export default Utils;