{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/audivo-dev/json-schema/audivo-dev-usage-response-schema.json",
  "title": "UsageResponse",
  "description": "What the account holds and what it has spent this period. See `GET /v1/usage` for what the period is while no subscription exists, and why `allowance_resets_at` is `null` on the free tier.",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/audivo-dev-openapi.yaml#/components/schemas/UsageResponse",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "tier",
    "balance_credits",
    "reserved_credits",
    "included_credits",
    "additional_credits",
    "period_start",
    "period_end",
    "period_used_credits",
    "allowance_resets_at",
    "daily"
  ],
  "properties": {
    "tier": {
      "$ref": "#/$defs/Tier"
    },
    "balance_credits": {
      "$ref": "#/$defs/CreditAmount"
    },
    "reserved_credits": {
      "$ref": "#/$defs/CreditAmount"
    },
    "included_credits": {
      "$ref": "#/$defs/CreditAmount"
    },
    "additional_credits": {
      "$ref": "#/$defs/CreditAmount"
    },
    "period_start": {
      "type": "string",
      "format": "date-time"
    },
    "period_end": {
      "type": "string",
      "format": "date-time"
    },
    "period_used_credits": {
      "$ref": "#/$defs/CreditAmount"
    },
    "allowance_resets_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the plan's included credits next refill. `null` when nothing refills them — the free tier's grant is issued once at signup, and there is no sweep that renews it."
    },
    "daily": {
      "type": "array",
      "maxItems": 31,
      "description": "The period's spend by day, from its first day through today, zero-filled and always summing to `period_used_credits`. It stops at today rather than running to `period_end`: a zero for a day that has not happened is not a fact.",
      "items": {
        "$ref": "#/$defs/DailyUsage"
      }
    }
  },
  "$defs": {
    "CreditAmount": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991,
      "description": "A non-negative JavaScript-safe integer credit amount. The upper bound matches `Number.MAX_SAFE_INTEGER`, which is enforced by the domain ledger so arithmetic and JSON round-trips cannot silently lose cents worth of credit precision."
    },
    "DailyUsage": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "date",
        "used_credits"
      ],
      "description": "One UTC calendar day of the reporting period, and what was settled in it.",
      "properties": {
        "date": {
          "type": "string",
          "format": "date",
          "description": "A UTC calendar day. UTC and not the viewer's zone: every timestamp this system stores is UTC, and a local-zone series would move credits between days depending on who is looking at it."
        },
        "used_credits": {
          "$ref": "#/$defs/CreditAmount"
        }
      }
    },
    "Tier": {
      "type": "string",
      "enum": [
        "free",
        "hobby",
        "startup",
        "growth",
        "scale"
      ]
    }
  }
}