{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openprivacyprotocol.com/schema/0.1/catalog.schema.json",
  "title": "OPP catalog",
  "type": "object",
  "properties": {
    "opp": {
      "type": "string",
      "minLength": 1
    },
    "name": {
      "type": "string",
      "minLength": 1
    },
    "version": {
      "type": "string",
      "minLength": 1
    },
    "description": {
      "type": "string"
    },
    "extends": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CatalogRef"
      }
    },
    "groups": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/Group"
      }
    },
    "classes": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/Class"
      }
    },
    "references": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ReferenceSource"
      }
    }
  },
  "required": [
    "opp",
    "name",
    "version",
    "groups",
    "classes"
  ],
  "additionalProperties": false,
  "$defs": {
    "Sensitivity": {
      "enum": [
        "public",
        "internal",
        "confidential",
        "restricted"
      ]
    },
    "Handling": {
      "enum": [
        "allow",
        "generalize",
        "pseudonymize",
        "redact",
        "block"
      ]
    },
    "Destination": {
      "enum": [
        "internal",
        "partner",
        "external_ai",
        "public"
      ]
    },
    "Action": {
      "enum": [
        "allow",
        "generalize",
        "pseudonymize",
        "redact",
        "block",
        "review",
        "handling"
      ]
    },
    "Status": {
      "enum": [
        "proposed",
        "certified"
      ]
    },
    "CatalogRef": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "version": {
          "type": "string",
          "minLength": 1
        },
        "url": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "name",
        "version"
      ],
      "additionalProperties": false
    },
    "Extension": {
      "type": "object",
      "properties": {
        "vendor_name": {
          "type": "string",
          "minLength": 1
        },
        "data": {
          "type": "object"
        }
      },
      "required": [
        "vendor_name",
        "data"
      ],
      "additionalProperties": false
    },
    "Group": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]*(\\.[a-z0-9_]+)*$"
        },
        "label": {
          "type": "string",
          "minLength": 1
        },
        "description": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "label"
      ],
      "additionalProperties": false
    },
    "ReferenceSource": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]*(\\.[a-z0-9_]+)*$"
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "url": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "id",
        "title"
      ],
      "additionalProperties": false
    },
    "Reference": {
      "type": "object",
      "properties": {
        "source": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]*(\\.[a-z0-9_]+)*$"
        },
        "item": {
          "type": "string",
          "minLength": 1
        },
        "note": {
          "type": "string"
        }
      },
      "required": [
        "source",
        "item"
      ],
      "additionalProperties": false
    },
    "Hints": {
      "type": "object",
      "properties": {
        "name_hints": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "value_types": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "cues": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "required": [],
      "additionalProperties": false
    },
    "Class": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]*(\\.[a-z0-9_]+)*$"
        },
        "label": {
          "type": "string",
          "minLength": 1
        },
        "description": {
          "type": "string",
          "minLength": 1
        },
        "group": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]*(\\.[a-z0-9_]+)*$"
        },
        "kind": {
          "enum": [
            "value",
            "topic"
          ]
        },
        "sensitivity": {
          "$ref": "#/$defs/Sensitivity"
        },
        "handling": {
          "$ref": "#/$defs/Handling"
        },
        "refs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Reference"
          }
        },
        "hints": {
          "$ref": "#/$defs/Hints"
        }
      },
      "required": [
        "id",
        "label",
        "description",
        "group",
        "kind",
        "sensitivity",
        "handling"
      ],
      "additionalProperties": false
    }
  }
}
