{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cayra-io/json-schema/cayra-io-subscription-response-schema.json",
  "title": "SubscriptionResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cayra-io-stripe-api-openapi.yml#/components/schemas/SubscriptionResponse",
  "properties": {
    "has_subscription": {
      "type": "boolean",
      "title": "Has Subscription"
    },
    "status": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Status"
    },
    "billing_cycle": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Billing Cycle"
    },
    "current_period_end": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Current Period End"
    },
    "cancel_at_period_end": {
      "type": "boolean",
      "title": "Cancel At Period End",
      "default": false
    },
    "package": {
      "anyOf": [
        {
          "$ref": "#/$defs/PackageInfo"
        },
        {
          "type": "null"
        }
      ]
    },
    "current_balance": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Current Balance"
    },
    "warnings": {
      "items": {
        "$ref": "#/$defs/SubscriptionWarning"
      },
      "type": "array",
      "title": "Warnings",
      "default": []
    },
    "package_features": {
      "anyOf": [
        {
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Package Features"
    },
    "pending_downgrade_package_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Pending Downgrade Package Name"
    }
  },
  "type": "object",
  "required": [
    "has_subscription"
  ],
  "$defs": {
    "PackageInfo": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "code": {
          "type": "string",
          "title": "Code"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "credits_total": {
          "type": "integer",
          "title": "Credits Total"
        },
        "price_usd_monthly": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Price Usd Monthly"
        },
        "price_usd_yearly": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Price Usd Yearly"
        }
      },
      "type": "object",
      "required": [
        "id",
        "code",
        "name",
        "credits_total"
      ],
      "title": "PackageInfo"
    },
    "SubscriptionWarning": {
      "properties": {
        "type": {
          "type": "string",
          "title": "Type"
        },
        "message": {
          "type": "string",
          "title": "Message"
        },
        "severity": {
          "type": "string",
          "title": "Severity"
        }
      },
      "type": "object",
      "required": [
        "type",
        "message",
        "severity"
      ],
      "title": "SubscriptionWarning"
    }
  }
}