{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/gribstream-com/json-schema/gribstream-com-quota-snapshot-schema.json",
  "title": "QuotaSnapshot",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/gribstream-com-openapi.yml#/components/schemas/QuotaSnapshot",
  "type": "object",
  "required": [
    "as_of",
    "usage_day_start_at",
    "quota_resets_at",
    "plan_id",
    "plan_name",
    "token_status",
    "credits_used",
    "plan_daily_limit",
    "overage_multiplier",
    "effective_daily_limit",
    "credits_remaining",
    "unlimited",
    "quota_exhausted",
    "recommended_retry_at"
  ],
  "properties": {
    "as_of": {
      "type": "string",
      "format": "date-time",
      "description": "UTC timestamp identifying the snapshot's accounting day."
    },
    "usage_day_start_at": {
      "type": "string",
      "format": "date-time",
      "description": "Start of the current usage day at 00:00 UTC."
    },
    "quota_resets_at": {
      "type": "string",
      "format": "date-time",
      "description": "Next daily reset at 00:00 UTC, before retry jitter."
    },
    "plan_id": {
      "type": "integer",
      "description": "Token's plan identifier."
    },
    "plan_name": {
      "type": "string"
    },
    "token_status": {
      "type": "string",
      "enum": [
        "active",
        "expired",
        "unpaid",
        "inactive"
      ],
      "description": "Locally enforced access status, independent of remaining quota. Cancelled and past_due subscriptions can still be active under existing access rules."
    },
    "credits_used": {
      "type": "integer",
      "format": "int64",
      "description": "Recorded credits used by this token in the current UTC day; in-flight usage may not yet be committed."
    },
    "plan_daily_limit": {
      "type": "integer",
      "format": "int64",
      "description": "Configured plan limit, including any dynamic plan override."
    },
    "overage_multiplier": {
      "type": "number",
      "format": "double",
      "minimum": 1,
      "description": "Combined global, plan and token multiplier after clamping."
    },
    "effective_daily_limit": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64",
      "description": "Plan limit multiplied by the overage multiplier and rounded up; null when unlimited."
    },
    "credits_remaining": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64",
      "minimum": 0,
      "description": "Effective limit minus recorded usage, clamped to zero; null when unlimited."
    },
    "unlimited": {
      "type": "boolean",
      "description": "Whether daily quota enforcement is disabled for this token."
    },
    "quota_exhausted": {
      "type": "boolean",
      "description": "True when the limited token has no positive recorded allowance left; false when unlimited."
    },
    "recommended_retry_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Stable per-token suggested retry time after reset when exhausted; otherwise null. Does not guarantee token activation."
    }
  }
}