{
  "$defs": {
    "Licence": {
      "additionalProperties": false,
      "properties": {
        "feed_cost": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Annual feed cost in client currency.",
          "title": "Feed Cost"
        },
        "product": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Product"
        },
        "scope": {
          "default": "client_only",
          "enum": [
            "pooled_use",
            "client_only"
          ],
          "title": "Scope",
          "type": "string"
        },
        "vendor": {
          "title": "Vendor",
          "type": "string"
        }
      },
      "required": [
        "vendor"
      ],
      "title": "Licence",
      "type": "object"
    },
    "MaterialityThresholds": {
      "additionalProperties": false,
      "description": "G-MAT-01 thresholds, per account. All *proposed* (spec \u00a715).",
      "properties": {
        "full_min_weeks_to_reverse": {
          "$ref": "#/$defs/Proposed",
          "default": {
            "proposed": true,
            "source": "\u00a715 'a quarter'",
            "value": 13.0
          }
        },
        "full_review_cost": {
          "$ref": "#/$defs/Proposed",
          "default": {
            "proposed": true,
            "source": "\u00a715",
            "value": 25000.0
          }
        },
        "full_spend": {
          "$ref": "#/$defs/Proposed",
          "default": {
            "proposed": true,
            "source": "\u00a715",
            "value": 2000000.0
          }
        },
        "light_max_weeks_to_reverse": {
          "$ref": "#/$defs/Proposed",
          "default": {
            "proposed": true,
            "source": "\u00a715 'a month'",
            "value": 4.0
          }
        },
        "standard_spend": {
          "$ref": "#/$defs/Proposed",
          "default": {
            "proposed": true,
            "source": "\u00a715",
            "value": 250000.0
          }
        }
      },
      "title": "MaterialityThresholds",
      "type": "object"
    },
    "Proposed": {
      "additionalProperties": false,
      "description": "A threshold value that the spec marks *proposed* (pending the pre-rollout studies).",
      "properties": {
        "proposed": {
          "default": true,
          "title": "Proposed",
          "type": "boolean"
        },
        "source": {
          "default": "",
          "description": "Spec section the value comes from, e.g. '\u00a714'.",
          "title": "Source",
          "type": "string"
        },
        "value": {
          "title": "Value",
          "type": "number"
        }
      },
      "required": [
        "value"
      ],
      "title": "Proposed",
      "type": "object"
    }
  },
  "$id": "https://schemas.ump.dev/v1/contract-terms.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "licences": {
      "items": {
        "$ref": "#/$defs/Licence"
      },
      "title": "Licences",
      "type": "array"
    },
    "materiality": {
      "$ref": "#/$defs/MaterialityThresholds"
    },
    "min_segment_size": {
      "default": 50,
      "description": "G-PRIV-01 floor from the contract.",
      "minimum": 1,
      "title": "Min Segment Size",
      "type": "integer"
    },
    "on_gate_fail": {
      "anyOf": [
        {
          "enum": [
            "fallback",
            "strict"
          ],
          "type": "string"
        },
        {
          "patternProperties": {
            "^(\\*|G-[A-Z]+-[0-9]{2})$": {
              "enum": [
                "fallback",
                "strict"
              ],
              "type": "string"
            }
          },
          "type": "object"
        }
      ],
      "default": "fallback",
      "description": "Account policy (spec \u00a715): a string for every gate or {gate_id: mode, '*': default}. A request never relaxes it.",
      "title": "On Gate Fail"
    },
    "opt_out_channels": {
      "items": {
        "type": "string"
      },
      "title": "Opt Out Channels",
      "type": "array"
    },
    "pool_opt_in": {
      "default": true,
      "title": "Pool Opt In",
      "type": "boolean"
    },
    "query_budget": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "G-PRIV-03 aggregate query budget.",
      "title": "Query Budget"
    },
    "retention_days": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Retention Days"
    },
    "strict_gates": {
      "description": "Deprecated: read as on_gate_fail {gate_id: strict} entries.",
      "items": {
        "type": "string"
      },
      "title": "Strict Gates",
      "type": "array"
    }
  },
  "title": "ContractTerms",
  "type": "object"
}
