{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/knoxcall/json-schema/knoxcall-account-usage-schema.json",
  "title": "AccountUsage",
  "description": "Current billing period usage and plan limits.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/knoxcall-account-api-openapi.yml#/components/schemas/AccountUsage",
  "type": "object",
  "properties": {
    "billing_period": {
      "type": "object",
      "description": "Current billing period dates.",
      "properties": {
        "year": {
          "type": "integer"
        },
        "month": {
          "type": "integer"
        },
        "start": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Billing period start date."
        },
        "end": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Billing period end date."
        }
      }
    },
    "api_calls": {
      "type": "object",
      "description": "API call usage for the current billing period.",
      "properties": {
        "used": {
          "type": "integer",
          "description": "Number of API calls made this period."
        },
        "limit": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Maximum API calls allowed per period (null for unlimited)."
        },
        "percentage": {
          "type": "integer",
          "description": "Percentage of the limit used."
        }
      }
    },
    "resources": {
      "type": "object",
      "description": "Resource counts and plan limits.",
      "properties": {
        "routes": {
          "$ref": "#/$defs/ResourceUsage"
        },
        "secrets": {
          "$ref": "#/$defs/ResourceUsage"
        },
        "clients": {
          "$ref": "#/$defs/ResourceUsage"
        },
        "environments": {
          "$ref": "#/$defs/ResourceUsage"
        }
      }
    },
    "plan": {
      "type": "string",
      "description": "Current subscription plan."
    },
    "status": {
      "type": "string",
      "description": "Current subscription status."
    }
  },
  "$defs": {
    "ResourceUsage": {
      "type": "object",
      "description": "Usage count and limit for a resource type.",
      "properties": {
        "used": {
          "type": "integer",
          "description": "Number of resources currently in use."
        },
        "limit": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Maximum allowed by the plan (null for unlimited)."
        }
      }
    }
  }
}