{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rightis-org/json-schema/rightis-org-usage-event-schema.json",
  "title": "UsageEvent",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rightis-org-openapi.json#/components/schemas/UsageEvent",
  "type": "object",
  "required": [
    "event_id",
    "license_public_code",
    "occurred_at",
    "use_type",
    "decision"
  ],
  "properties": {
    "event_id": {
      "type": "string",
      "maxLength": 128,
      "description": "Partner-side idempotency key"
    },
    "license_public_code": {
      "type": "string",
      "description": "L-… (asset licence) or PL-… (persona licence)"
    },
    "occurred_at": {
      "type": "string",
      "format": "date-time"
    },
    "use_type": {
      "type": "string",
      "enum": [
        "generation",
        "exposure",
        "inference",
        "voice_synthesis",
        "training",
        "other"
      ]
    },
    "decision": {
      "type": "string",
      "enum": [
        "allow",
        "block",
        "fallback"
      ]
    },
    "channel": {
      "type": "string",
      "maxLength": 64
    },
    "rights_categories": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RightsCategory"
      }
    },
    "reason_code": {
      "type": "string",
      "maxLength": 120
    },
    "policy_version": {
      "type": "integer",
      "minimum": 1
    },
    "content_hash": {
      "type": "string",
      "maxLength": 128
    },
    "generation_tool": {
      "type": "string",
      "maxLength": 80,
      "description": "Tool that produced the output (docs/47). Recorded as declared; never verified against the vendor."
    },
    "generation_tool_version": {
      "type": "string",
      "maxLength": 40
    },
    "output_license_ref": {
      "type": "string",
      "maxLength": 200,
      "description": "Your reference for the tool's own commercial-use right: a download receipt, order id or agreement number."
    },
    "metadata": {
      "type": "object",
      "additionalProperties": true,
      "description": "≤ 4 KB, never end-user PII"
    }
  },
  "$defs": {
    "RightsCategory": {
      "type": "string",
      "enum": [
        "face",
        "voice",
        "image",
        "style",
        "persona",
        "ip"
      ]
    }
  }
}