{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "attempt": {
      "default": 0,
      "maximum": 9007199254740991,
      "minimum": 0,
      "type": "integer"
    },
    "authorized_units": {
      "minimum": 0,
      "type": "number"
    },
    "credits": {
      "properties": {
        "estimated": {
          "maximum": 9007199254740991,
          "minimum": 0,
          "type": "integer"
        },
        "rate_card_version": {
          "type": "string"
        }
      },
      "required": [
        "estimated",
        "rate_card_version"
      ],
      "type": "object"
    },
    "decision": {
      "enum": [
        "authorized",
        "denied"
      ],
      "type": "string"
    },
    "pending_operation_id": {
      "pattern": "^pend_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$",
      "type": "string"
    },
    "reason_code": {
      "enum": [
        "within_policy",
        "budget_exceeded",
        "plan_not_entitled",
        "rate_limited",
        "approval_rejected",
        "approval_expired",
        "insufficient_credit"
      ],
      "type": "string"
    },
    "request_event_id": {
      "pattern": "^evt_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$",
      "type": "string"
    },
    "subject_id": {
      "pattern": "^(mres|ws|usr|prod|rev|ver|rel|env|dep|srf|acc|ses|inv|exe|evt|pend|ddl|ntf|pipe|fnd|qual|cred|bind|hdl|cap|svc|frz|adj|fix|upl|dom|wb|ctx|aud|pay|ivc|rfd)_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$",
      "type": "string"
    },
    "usage_category": {
      "enum": [
        "ai_tokens",
        "runtime",
        "provider_call",
        "storage"
      ],
      "type": "string"
    }
  },
  "required": [
    "request_event_id",
    "subject_id",
    "usage_category",
    "decision",
    "reason_code"
  ],
  "type": "object"
}
