const AUTOMATION_ID = "data-id";
/**
 * https://zgit.csez.zohocorpin.com/zohodesk/desk-library/-/blob/unified-components-master/jsapps/unifiedcomponents/src/propTypes/Readme.automation.md#automation-props-support-in-component
 * @param {*} param customId, customIdPrefix , customIdSuffix
 * @param {*} defaultCustomId 
 * @param {*} otherCustomOption 
 * @returns 
 */

const getCompliedCustomId = function (_ref, defaultCustomId) {
  let {
    customId,
    customIdPrefix = "",
    customIdSuffix = ""
  } = _ref;
  let otherCustomOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  let returnId = defaultCustomId || customId;

  if (typeof defaultCustomId === "function") {
    let options = ['', customIdPrefix, customIdSuffix, ...otherCustomOption];
    returnId = defaultCustomId.apply(null, options); //returnId = defaultCustomId`${customIdPrefix} ${customIdSuffix}`;
  }

  return returnId ? returnId.toLowerCase() : null;
};
/**
 * https://zgit.csez.zohocorpin.com/zohodesk/desk-library/-/blob/unified-components-master/jsapps/unifiedcomponents/src/propTypes/Readme.automation.md#to-avoid-prefix-and-suffix-in-nested-level-of-tags-in-html-structure-how-to-handle
 * @param  {...any} props 
 * @returns  { data-id : '...' }
 */


export const getCompliedCustomIdProps = function () {
  return {
    [AUTOMATION_ID]: getCompliedCustomId(...arguments)
  };
};
/**
 * https://zgit.csez.zohocorpin.com/zohodesk/desk-library/-/blob/unified-components-master/jsapps/unifiedcomponents/src/propTypes/Readme.automation.md#to-avoid-prefix-and-suffix-in-nested-level-of-tags-in-html-structure-how-to-handle
 * @param  {...any} props 
 * @returns { data-id : '...' }
 */

export const getCompliedCustomIdOnlyProps = function () {
  return {
    [AUTOMATION_ID]: getCompliedCustomIdOnly(...arguments)
  };
};
/**
 * https://zgit.csez.zohocorpin.com/zohodesk/desk-library/-/blob/unified-components-master/jsapps/unifiedcomponents/src/propTypes/Readme.automation.md#a-componentcustomidjs-in-html-part-of-component-for-only-root-level-supported-prefixsuffix
 * @param {*} defaultCustomId 
 * @param {*} otherCustomOption as array of strings
 * @returns 
 */

export const getCompliedCustomIdOnly = function (defaultCustomId) {
  let otherCustomOption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  let returnId = defaultCustomId;

  if (typeof defaultCustomId === "function") {
    let options = ['', ...otherCustomOption];
    returnId = defaultCustomId.apply(null, options); //returnId = defaultCustomId`${customIdPrefix} ${customIdSuffix}`;
  }

  return returnId ? returnId.toLowerCase() : null;
};
export default getCompliedCustomId;