{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weverlabs.com/schemas/agent-credit-entitlement.schema.json",
  "title": "Agent Credit Entitlement",
  "description": "Public-safe record showing that an agent account has funded, scoped credits available for paid Wever Labs OS usage.",
  "type": "object",
  "required": [
    "entitlement_id",
    "entitlement_type",
    "agent_account_id",
    "quote_id",
    "status",
    "credits_authorized",
    "credits_remaining",
    "tool_scope",
    "issued_at"
  ],
  "additionalProperties": true,
  "properties": {
    "entitlement_id": {
      "type": "string"
    },
    "entitlement_type": {
      "type": "string",
      "const": "agent_credit_entitlement"
    },
    "agent_account_id": {
      "type": "string"
    },
    "trust_profile_id": {
      "type": "string"
    },
    "quote_id": {
      "type": "string"
    },
    "settlement_reference": {
      "type": "string"
    },
    "payment_request_reference": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "quoted",
        "pending_payment",
        "funded",
        "active",
        "exhausted",
        "expired",
        "suspended"
      ]
    },
    "credits_authorized": {
      "type": "number",
      "minimum": 0
    },
    "credits_remaining": {
      "type": "number",
      "minimum": 0
    },
    "tool_scope": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "packetops",
          "distributionops",
          "tokenops",
          "wever_labs_os"
        ]
      }
    },
    "allowed_capabilities": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "metering_policy": {
      "type": "object",
      "additionalProperties": true
    },
    "issued_at": {
      "type": "string",
      "format": "date-time"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
