{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hobbycardindex-com/json-schema/hobbycardindex-com-usage-schema.json",
  "title": "Usage",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hobbycardindex-com-openapi.json#/components/schemas/Usage",
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "plan": {
          "type": "string",
          "const": "self-serve",
          "description": "An Enterprise (or Dealer) key: 1 request a second, licensed for your own business."
        },
        "rateLimitPerSecond": {
          "type": "integer"
        },
        "dailyCeiling": {
          "type": "integer",
          "description": "The runaway backstop, requests a day."
        }
      },
      "required": [
        "plan",
        "rateLimitPerSecond",
        "dailyCeiling"
      ]
    },
    {
      "type": "object",
      "properties": {
        "plan": {
          "type": "string",
          "description": "The commercial plan id: trial, lite, growth_lite, growth, platform, or a custom plan."
        },
        "label": {
          "type": "string",
          "description": "The plan as we name it."
        },
        "month": {
          "type": "string",
          "description": "The month the counters cover, YYYY-MM (UTC)."
        },
        "requests": {
          "$ref": "#/$defs/UsageCounter"
        },
        "scans": {
          "$ref": "#/$defs/UsageCounter"
        },
        "saleLookups": {
          "type": "object",
          "properties": {
            "used": {
              "type": [
                "integer",
                "null"
              ],
              "description": ""
            },
            "allowance": {
              "type": "integer"
            }
          },
          "description": "Plans with sold sales."
        },
        "certLookups": {
          "type": "object",
          "properties": {
            "used": {
              "type": [
                "integer",
                "null"
              ],
              "description": ""
            },
            "allowance": {
              "type": "integer"
            }
          },
          "description": "Plans with cert lookups."
        },
        "popReports": {
          "type": "object",
          "properties": {
            "used": {
              "type": [
                "integer",
                "null"
              ],
              "description": ""
            },
            "allowance": {
              "type": "integer"
            }
          },
          "description": "Plans with pop reports."
        },
        "features": {
          "type": "object",
          "properties": {
            "soldSales": {
              "type": "boolean",
              "description": ""
            },
            "certLookups": {
              "type": "boolean",
              "description": ""
            },
            "priceHistory": {
              "type": "boolean",
              "description": ""
            },
            "population": {
              "type": "boolean",
              "description": ""
            },
            "bulkFiles": {
              "type": "boolean",
              "description": ""
            }
          }
        },
        "perSecond": {
          "type": "object",
          "properties": {
            "lookups": {
              "type": "integer"
            },
            "scans": {
              "type": "integer"
            },
            "certs": {
              "type": "integer"
            }
          }
        },
        "overage": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "usdPer1000": {
                  "type": "number"
                },
                "price": {
                  "type": "string",
                  "description": "The rate in words, for example $1 per 1,000."
                },
                "stopsAt": {
                  "type": "string",
                  "description": "For example 3x allowance."
                },
                "billed": {
                  "type": "string",
                  "description": "When and how overage is billed."
                }
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "null on plans that stop at the allowance."
        },
        "overageOffer": {
          "type": "object",
          "properties": {
            "usdPer1000": {
              "type": "number"
            },
            "price": {
              "type": "string"
            },
            "stopsAt": {
              "type": "string"
            },
            "acceptAt": {
              "type": "string",
              "format": "uri"
            }
          },
          "description": "Present while overage waits on your acceptance of the updated terms."
        },
        "trialEndsAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When a free setup month ends; null on paid plans."
        },
        "bulkFiles": {
          "type": "boolean",
          "description": "Whether the daily price files are included."
        }
      },
      "required": [
        "plan",
        "label",
        "month",
        "requests",
        "scans",
        "features",
        "perSecond"
      ]
    }
  ],
  "$defs": {
    "UsageCounter": {
      "type": "object",
      "properties": {
        "used": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Used this month (this setup month, on a free setup month with its daily pool lifted)."
        },
        "allowance": {
          "type": "integer",
          "description": "The plan's monthly number."
        },
        "usedToday": {
          "type": "integer",
          "description": "Plans with a daily pool only."
        },
        "allowancePerDay": {
          "type": "integer",
          "description": "Plans with a daily pool only."
        }
      },
      "required": [
        "used",
        "allowance"
      ]
    }
  }
}