{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/vatfind-com/json-schema/vatfind-com-usage-summary-schema.json",
  "title": "UsageSummary",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/vatfind-com-openapi.yml#/components/schemas/UsageSummary",
  "type": "object",
  "required": [
    "environment",
    "period",
    "totals",
    "allowance",
    "daily_free",
    "by_source",
    "by_operation",
    "as_of"
  ],
  "properties": {
    "environment": {
      "type": "string",
      "enum": [
        "live",
        "sandbox"
      ]
    },
    "period": {
      "type": "object",
      "required": [
        "start",
        "end"
      ],
      "properties": {
        "start": {
          "type": "string",
          "format": "date-time"
        },
        "end": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "totals": {
      "type": "object",
      "required": [
        "requests",
        "billable_units"
      ],
      "properties": {
        "requests": {
          "type": "integer",
          "minimum": 0,
          "description": "Completed VATFind usage events recorded for supported operations; not every HTTP transport attempt."
        },
        "billable_units": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "allowance": {
      "type": "object",
      "required": [
        "included_units",
        "used_units",
        "remaining_units"
      ],
      "properties": {
        "included_units": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "used_units": {
          "type": "integer",
          "minimum": 0
        },
        "remaining_units": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        }
      }
    },
    "daily_free": {
      "type": [
        "object",
        "null"
      ],
      "description": "Shared account allowance for dashboard, all live API keys and MCP; null in sandbox. Monitoring uses paid credits. Resets at 00:00 UTC.",
      "required": [
        "included_units",
        "used_units",
        "remaining_units",
        "resets_at"
      ],
      "properties": {
        "included_units": {
          "type": "integer",
          "const": 3
        },
        "used_units": {
          "type": "integer",
          "minimum": 0
        },
        "remaining_units": {
          "type": "integer",
          "minimum": 0,
          "maximum": 3
        },
        "resets_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "by_source": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source",
          "requests",
          "billable_units"
        ],
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "api",
              "mcp",
              "dashboard",
              "monitoring"
            ]
          },
          "requests": {
            "type": "integer",
            "minimum": 0,
            "description": "Recorded completed usage events for this delivery channel."
          },
          "billable_units": {
            "type": "integer",
            "minimum": 0
          }
        }
      }
    },
    "by_operation": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "operation",
          "source",
          "requests",
          "billable_units"
        ],
        "properties": {
          "operation": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "api",
              "mcp",
              "dashboard",
              "monitoring"
            ]
          },
          "requests": {
            "type": "integer",
            "minimum": 0,
            "description": "Recorded completed usage events for this operation and channel."
          },
          "billable_units": {
            "type": "integer",
            "minimum": 0
          }
        }
      }
    },
    "as_of": {
      "type": "string",
      "format": "date-time"
    }
  }
}