{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://clavenar.com/schemas/proxy-verdict.schema.json",
  "title": "Clavenar Proxy Verdict",
  "oneOf": [
    {
      "title": "Allow",
      "type": "object",
      "required": ["jsonrpc", "id", "result"],
      "additionalProperties": true,
      "properties": {
        "jsonrpc": { "const": "2.0" },
        "id": {
          "oneOf": [
            { "type": "string", "minLength": 1 },
            { "type": "integer" }
          ]
        },
        "result": { "type": "object" },
        "correlation_id": {
          "type": "string",
          "format": "uuid"
        }
      }
    },
    {
      "title": "Deny",
      "type": "object",
      "required": ["error", "intent_category", "reasoning", "correlation_id"],
      "additionalProperties": true,
      "properties": {
        "error": { "const": "policy_denied" },
        "intent_category": { "type": "string", "minLength": 1 },
        "reasoning": { "type": "string", "minLength": 1 },
        "correlation_id": { "type": "string", "format": "uuid" }
      }
    },
    {
      "title": "Pending",
      "type": "object",
      "required": ["status", "correlation_id", "ttl_secs"],
      "additionalProperties": true,
      "properties": {
        "status": { "const": "pending" },
        "correlation_id": { "type": "string", "format": "uuid" },
        "ttl_secs": { "type": "integer", "minimum": 1 }
      }
    },
    {
      "title": "RateLimit",
      "type": "object",
      "required": ["error", "scope", "key", "retry_after_secs", "correlation_id"],
      "additionalProperties": true,
      "properties": {
        "error": { "const": "rate_limited" },
        "scope": { "type": "string", "minLength": 1 },
        "key": { "type": "string", "minLength": 1 },
        "retry_after_secs": { "type": "integer", "minimum": 1 },
        "correlation_id": { "type": "string", "format": "uuid" }
      }
    }
  ]
}
