{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/snapvisor-io/json-schema/snapvisor-io-billing-status-schema.json",
  "title": "BillingStatus",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/snapvisor-io-openapi.yml#/components/schemas/BillingStatus",
  "type": "object",
  "properties": {
    "accountSlug": {
      "type": "string"
    },
    "plan": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "paid": {
          "type": "boolean"
        }
      },
      "required": [
        "id",
        "name",
        "paid"
      ],
      "additionalProperties": false
    },
    "subscription": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "provider": {
              "type": "string",
              "enum": [
                "stripe",
                "revenuecat",
                "github"
              ]
            },
            "status": {
              "type": "string"
            },
            "trialEndsAt": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "endsAt": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                {
                  "type": "null"
                }
              ],
              "description": "When a cancelled subscription stops; null while it renews."
            }
          },
          "required": [
            "provider",
            "status",
            "trialEndsAt",
            "endsAt"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "period": {
      "type": "object",
      "properties": {
        "start": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
        },
        "end": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
        }
      },
      "required": [
        "start",
        "end"
      ],
      "additionalProperties": false
    },
    "usage": {
      "type": "object",
      "properties": {
        "screenshots": {
          "type": "number"
        },
        "includedScreenshots": {
          "type": "number"
        },
        "consumptionRatio": {
          "type": "number"
        },
        "additionalScreenshotsCost": {
          "type": "number"
        }
      },
      "required": [
        "screenshots",
        "includedScreenshots",
        "consumptionRatio",
        "additionalScreenshotsCost"
      ],
      "additionalProperties": false
    },
    "spendLimit": {
      "type": "object",
      "properties": {
        "monthly": {
          "type": [
            "number",
            "null"
          ]
        },
        "blockWhenReached": {
          "type": "boolean"
        }
      },
      "required": [
        "monthly",
        "blockWhenReached"
      ],
      "additionalProperties": false
    },
    "invoices": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "number": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "total": {
            "type": "number",
            "description": "In the currency's minor unit (cents)."
          },
          "currency": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "hostedInvoiceUrl": {
            "description": "The app's session-authenticated invoice route, which redirects to a fresh Stripe URL; null when Stripe has no hosted document.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "number",
          "status",
          "total",
          "currency",
          "createdAt",
          "hostedInvoiceUrl"
        ],
        "additionalProperties": false
      },
      "description": "The 10 latest Stripe invoices; empty unless you administer the team."
    }
  },
  "required": [
    "accountSlug",
    "plan",
    "subscription",
    "period",
    "usage",
    "spendLimit",
    "invoices"
  ],
  "additionalProperties": false
}