{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/gajo-io/json-schema/gajo-io-usage-result-schema.json",
  "title": "UsageResult",
  "description": "Envelope with usage details.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/gajo-io-account-api-openapi.yml#/components/schemas/UsageResult",
  "allOf": [
    {
      "$ref": "#/$defs/ApiResult"
    },
    {
      "type": "object",
      "required": [
        "data"
      ],
      "properties": {
        "success": {
          "const": true
        },
        "data": {
          "$ref": "#/$defs/Usage"
        }
      }
    }
  ],
  "$defs": {
    "ApiResult": {
      "type": "object",
      "description": "Envelope shared by every response.",
      "required": [
        "success"
      ],
      "properties": {
        "success": {
          "type": "boolean",
          "description": "`true` when the request succeeded."
        },
        "message": {
          "type": [
            "string",
            "null"
          ],
          "description": "Human-readable status or error message. Often `null` on reads."
        },
        "data": {
          "description": "Operation-specific payload; `null` or absent when there is nothing to return."
        }
      }
    },
    "Plan": {
      "type": "string",
      "enum": [
        "Free",
        "Basic",
        "Pro"
      ],
      "description": "Gajo account plan."
    },
    "Usage": {
      "type": "object",
      "required": [
        "plan",
        "urlsCreatedThisMonth",
        "urlsMonthlyLimit",
        "urlsRemaining",
        "requestsPerMinute",
        "maxLinkLifetimeDays",
        "totalUrls",
        "totalClicks"
      ],
      "properties": {
        "plan": {
          "$ref": "#/$defs/Plan"
        },
        "urlsCreatedThisMonth": {
          "type": "integer",
          "minimum": 0,
          "description": "Links created since the start of the calendar month (UTC), via the API or dashboard."
        },
        "urlsMonthlyLimit": {
          "type": "integer",
          "minimum": 1,
          "description": "Monthly link allowance for the plan (50 Free, 500 Basic, 10,000 Pro)."
        },
        "urlsRemaining": {
          "type": "integer",
          "minimum": 0,
          "description": "Links you can still create this month."
        },
        "requestsPerMinute": {
          "type": "integer",
          "minimum": 1,
          "description": "API requests allowed per 60-second window (10 Free, 30 Basic, 60 Pro)."
        },
        "maxLinkLifetimeDays": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1,
          "description": "Longest allowed link lifetime in days; `null` = unlimited (Pro)."
        },
        "totalUrls": {
          "type": "integer",
          "minimum": 0,
          "description": "All links on the account."
        },
        "totalClicks": {
          "type": "integer",
          "format": "int64",
          "minimum": 0,
          "description": "Human clicks across all links."
        }
      }
    }
  }
}