/**
Copyright: 2024 Contrast Security, Inc
  Contact: support@contrastsecurity.com
  License: Commercial

  NOTICE: This Software and the patented inventions embodied within may only be
  used as part of Contrast Security’s commercial offerings. Even though it is
  made available through public repositories, use of this Software is subject to
  the applicable End User Licensing Agreement found at
  https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
  between Contrast Security and the End User. The Software may not be reverse
  engineered, modified, repackaged, sold, redistributed or otherwise used in a
  way not consistent with the End User License Agreement.
*/
'use strict';

/**
 * for additional context see:
 * https://docs.google.com/spreadsheets/d/17p5C6NOISNuWi8D-07d8gNg8byQytuwjtgBgzGpfU_w/edit#gid=0
 */

module.exports = {
  validators: {
    isAfter: 'alphanum-space-hyphen',
    isAlpha: 'alphanum-space-hyphen',
    isAlphanumeric: 'alphanum-space-hyphen',
    isBase32: 'alphanum-space-hyphen',
    isBase58: 'alphanum-space-hyphen',
    isBase64: 'alphanum-space-hyphen',
    isBefore: 'alphanum-space-hyphen',
    isBIC: 'alphanum-space-hyphen',
    isBoolean: 'limited-chars',
    isBtcAddress: 'alphanum-space-hyphen',
    isCreditCard: 'limited-chars',
    isDate: 'limited-chars',
    isDecimal: 'limited-chars',
    // calls toFloat() which calls isFloat() so no need to hook.
    //isDivisibleBy: 'limited-chars',
    isEAN: 'limited-chars',
    isEthereumAddress: 'alphanum-space-hyphen',
    // this is used by toFloat, so no need to check toFloat as well.
    isFloat: 'limited-chars',
    isHash: 'alphanum-space-hyphen',
    isHexadecimal: 'alphanum-space-hyphen',
    isHexColor: 'alphanum-space-hyphen',
    isHSL: 'alphanum-space-hyphen',
    isIBAN: 'limited-chars',
    isIdentityCard: 'alphanum-space-hyphen',
    isIMEI: 'limited-chars',
    isInt: 'limited-chars',
    isIP: 'limited-chars',
    isIPRange: 'limited-chars',
    isISBN: 'limited-chars',
    isISIN: 'limited-chars',
    isISO8601: 'alphanum-space-hyphen',
    isISO31661Alpha2: 'alphanum-space-hyphen',
    isISO31661Alpha3: 'alphanum-space-hyphen',
    isISRC: 'alphanum-space-hyphen',
    isISSN: 'limited-chars',
    isJWT: 'alphanum-space-hyphen',
    isLatLong: 'limited-chars',
    isLicensePlate: 'alphanum-space-hyphen',
    isMACAddress: 'alphanum-space-hyphen',
    isMagnetURI: 'alphanum-space-hyphen',
    isMD5: 'alphanum-space-hyphen',
    isMobilePhone: 'limited-chars',
    isNumeric: 'limited-chars',
    isOctal: 'alphanum-space-hyphen',
    isPassportNumber: 'limited-chars',
    // limits to 65535 but uses isInt internally
    //isPort: 'limited-chars',
    isPostalCode: 'limited-chars',
    isSemVer: 'limited-chars',
    isTaxID: 'limited-chars',
    isUUID: 'alphanum-space-hyphen',
    isVAT: 'alphanum-space-hyphen',
    matches: 'string-type-checked'
  },
  untrackers: [
    // these methods have the tag 'trusted' which the node-agent doesn't support.
    // the validator propagator interprets it as "remove any existing tags and set
    // tracking false".
    'isIn',
    'isMimeType',
    'isRFC3339',
    'equals'
  ],
  sanitizers: {
    escape: 'html-encoded'
    // toFloat uses isFloat which is hooked, so no need to do so again
    // toFloat: 'limited-chars'
  },
  customLogic: {
    // this value is not used and it's added just for storing the information
    // about what's patched in one place
    isEmail: 'limited-chars'
  }
};
