{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/perfdelta/json-schema/perfdelta-usage-schema.json",
  "title": "Usage",
  "x-generated": "2026-12-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/perfdelta-openapi.json#/components/schemas/Usage",
  "type": "object",
  "properties": {
    "plan": {
      "type": "string"
    },
    "unit": {
      "type": "string"
    },
    "daily_limit": {
      "type": "integer"
    },
    "daily_used": {
      "type": "integer"
    },
    "daily_remaining": {
      "type": "integer"
    },
    "monthly_budget": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "monthly_used": {
      "type": "integer"
    },
    "monitoring_projected": {
      "type": "integer"
    },
    "monitoring_remaining_need": {
      "type": "integer"
    },
    "available_for_manual_scans": {
      "type": "integer"
    },
    "monthly_used_pct": {
      "type": "number"
    },
    "quota": {
      "$ref": "#/$defs/Quota"
    },
    "upgrade_plan": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "upgrade_url": {
      "type": "string"
    },
    "budget_warning": {
      "$ref": "#/$defs/BudgetWarning"
    }
  },
  "required": [
    "plan"
  ],
  "$defs": {
    "BudgetWarning": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "used_pct": {
              "type": "integer"
            },
            "upgrade_plan": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "upgrade_url": {
              "type": "string"
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "Quota": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "rolling"
          ]
        },
        "scans_used": {
          "type": "integer"
        },
        "scans_limit": {
          "type": "integer"
        },
        "scans_remaining": {
          "type": "integer"
        },
        "window_hours": {
          "type": "integer"
        },
        "next_scan_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    }
  }
}