{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dropto-run/json-schema/dropto-run-subscription-response-schema.json",
  "title": "SubscriptionResponse",
  "description": "Response of `GET /api/billing/subscription`.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dropto-run-billing-api-openapi.yml#/components/schemas/SubscriptionResponse",
  "properties": {
    "pendingCheckout": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/PendingCheckoutRow",
          "description": "A checkout still being confirmed, or null when none is.",
          "__uniqueRefKey": "#/components/schemas/PendingCheckoutRow__20"
        }
      ]
    },
    "subscription": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/SubscriptionRow",
          "description": "The current subscription, or null when there is none.",
          "__uniqueRefKey": "#/components/schemas/SubscriptionRow__21"
        }
      ]
    }
  },
  "required": [
    "subscription",
    "pendingCheckout"
  ],
  "type": "object",
  "$defs": {
    "PendingCheckoutRow": {
      "description": "A checkout still being confirmed, as the billing page renders it.",
      "properties": {
        "createdAt": {
          "description": "When the checkout began.",
          "format": "date-time",
          "type": "string"
        },
        "interval": {
          "description": "The billing interval chosen.",
          "type": "string"
        },
        "planId": {
          "description": "The plan the checkout is for.",
          "type": "string"
        },
        "status": {
          "description": "`open` or `completed`.",
          "type": "string"
        }
      },
      "required": [
        "planId",
        "interval",
        "status",
        "createdAt"
      ],
      "type": "object"
    },
    "SubscriptionRow": {
      "description": "One subscription, as the billing page renders it.",
      "properties": {
        "cancelAtPeriodEnd": {
          "description": "Whether it stops at the end of the current period.",
          "type": "boolean"
        },
        "currentPeriodEnd": {
          "description": "When the paid period ends; null while paused.",
          "format": "date-time",
          "type": [
            "null",
            "string"
          ]
        },
        "graceUntil": {
          "description": "When the grace window on a failed payment runs out, or null.",
          "format": "date-time",
          "type": [
            "null",
            "string"
          ]
        },
        "interval": {
          "description": "The billing interval.",
          "type": "string"
        },
        "pausedAt": {
          "description": "When it was paused, or null.",
          "format": "date-time",
          "type": [
            "null",
            "string"
          ]
        },
        "pendingInterval": {
          "description": "The interval it switches to at the next renewal, or null.",
          "type": [
            "null",
            "string"
          ]
        },
        "pendingPlanId": {
          "description": "The plan it switches to at the next renewal, or null.",
          "type": [
            "null",
            "string"
          ]
        },
        "planId": {
          "description": "The plan currently paid for.",
          "type": "string"
        },
        "seats": {
          "description": "How many seats are being paid for; one on every tier not sold by the seat.",
          "format": "int32",
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ]
        },
        "status": {
          "description": "One of the SubscriptionStatus names.",
          "type": "string"
        }
      },
      "required": [
        "planId",
        "pendingPlanId",
        "status",
        "interval",
        "pendingInterval",
        "currentPeriodEnd",
        "cancelAtPeriodEnd",
        "graceUntil",
        "pausedAt",
        "seats"
      ],
      "type": "object"
    }
  }
}