{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://opendapi.org/spec/0-0-1/purposes.json",
    "$defs": {
      "purpose": {
        "type": "object",
        "properties": {
          "urn": {
            "type": "string",
            "order": 1,
            "examples": ["consumer_marketing", "fraud_analytics"],
            "description": "The URN of this purpose."
          },
          "description": {
            "type": ["string", "null"],
            "order": 2,
            "description": "Description of this business purpose."
          },
          "personal_data_policy": {
            "type": "object",
            "order": 3,
            "description": "Information relating to the management of personal data for this purpose.",
            "properties": {
              "max_retention_days": {
                "type": ["number", "null"],
                "minimum": 0,
                "description": "The maximum number of days data is retained for this purpose.",
                "order": 1
              },
              "min_retention_days": {
                "type": ["number", "null"],
                "minimum": 0,
                "description": "The minimum number of days data is retained for this purpose.",
                "order": 2
              },
              "require_dsr_access": {
                "type": ["boolean", "null"],
                "description": "Whether this purpose requires DSR access endpoints to be defined.",
                "order": 3
              },
              "require_dsr_deletion": {
                "type": ["boolean", "null"],
                "description": "Whether this purpose requires DSR deletion endpoints to be defined.",
                "order": 4
              }
            }
          },
          "stakeholder_team_urns": {
            "type": ["array", "null"],
            "order": 4,
            "description": "The URNs of the teams that are stakeholders of this purpose.",
            "items": {
              "type": "string",
              "pattern": "^[\\w.-]+$",
              "description": "The URN of a team that is a stakeholder of this purpose."
            }
          },
          "label": {
            "type": "string",
            "order": 5,
            "description": "A UI-friendly label for the business purpose.",
            "examples": [
              "customer_marketing",
              "fraud_analytics"
            ]
          }
        },
        "required": ["urn", "description", "label"],
        "description": "Business Purpose information."
      }
    },
    "type": "object",
    "properties": {
      "schema": {
        "type": "string",
        "format": "uri",
        "order": 1,
        "default": "https://opendapi.org/spec/0-0-1/purposes.json",
        "description": "The URI schema version for this data",
        "examples": ["https://opendapi.org/spec/0-0-1/purposes.json"]
      },
      "purposes": {
        "type": "array",
        "order": 2,
        "items": {
          "$ref": "#/$defs/purpose"
        },
        "description": "List of business purposes"
      }
    },
    "required": ["schema", "purposes"],
    "title": "Business Purposes",
    "description": "Approved Business Purposes in this organization"
  }
