{
  "$schema": "http://json-schema.org/draft-06/schema#",
  "title": "Unit Settings",
  "description": "Settings that describe the behaviour and formatting of rewards corresponding to the configured unit or unit pattern",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "title": "Reward Unit Settings Id",
      "description": "A unique identifier generated by combining reward type and unit or unit pattern (e.g. CREDIT/USD)"
    },
    "config": {
      "type": "object",
      "title": "Unit Settings Configuration",
      "description": "Behaviour and formatting supported by this unit setting",
      "properties": {
        "rewardModifications": {
          "type": "object",
          "title": "Reward Modifications",
          "description": "The modifications supported by rewards applicable for this unit setting",
          "properties": {
            "isCancellable": {
              "type": "boolean",
              "title": "Is Cancellable",
              "description": "Indicates whether rewards of this unit can be cancelled via SaaSquatch API/Portal"
            },
            "isRedeemable": {
              "type": "boolean",
              "title": "Is Redeemable",
              "description": "Indicates whether rewards of this unit can be redeemed via SaaSquatch API/Portal"
            },
            "isExpirable": {
              "type": "boolean",
              "title": "Is Expirable",
              "description": "Indicates whether expiration is applicable to this reward of this unit"
            }
          },
          "additionalProperties": false,
          "required": [
            "isCancellable",
            "isRedeemable",
            "isExpirable"
          ]
        },
        "supportsCurrencies": {
          "type": "boolean",
          "title": "Supports Currencies",
          "description": "Whether this unit supports multi-currencies. false by default."
        },
        "usTaxableValueFormula": {
          "type": "string",
          "title": "US Taxable Value Formula",
          "description": "JSONata expression for calculating the US taxable value"
        },
        "fulfilledByCashPayout": {
          "type": "boolean",
          "title": "Is Impact Cash Payout",
          "description": "Whether this unit is fulfilled by Impact cash payout. false by default."
        },
        "translatableConfig": {
          "type": "object",
          "title": "Translatable Configuration",
          "description": "Locale-specific configuration for rewards of this unit",
          "properties": {
            "name": {
              "type": "string",
              "title": "Name",
              "description": "The name of this reward unit"
            },
            "prettyValueFormat": {
              "type": "object",
              "title": "Pretty Value Format",
              "description": "Format for prettyValue for rewards of this unit",
              "properties": {
                "templateType": {
                  "type": "string",
                  "title": "Template Type",
                  "description": "The type of this template, \"ICU\" by default.",
                  "enum": [
                    "ICU"
                  ]
                },
                "template": {
                  "type": "string",
                  "title": "Template",
                  "description": "The template string for reward prettyValue"
                }
              },
              "additionalProperties": false,
              "required": [
                "template"
              ]
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false,
      "required": [
        "rewardModifications",
        "supportsCurrencies"
      ]
    }
  },
  "additionalProperties": false,
  "required": [
    "id",
    "config"
  ]
}