{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bronjoy-com/json-schema/bronjoy-com-subscription-resource-schema.json",
  "title": "SubscriptionResource",
  "x-generated": "2026-11-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/bronjoy-com-api-spec-openapi.json#/components/schemas/SubscriptionResource",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    },
    "tier": {
      "type": "string"
    },
    "tier_label": {
      "type": "string",
      "enum": [
        "Spark",
        "Avtopilot"
      ]
    },
    "is_paid": {
      "type": "boolean"
    },
    "is_active": {
      "type": "boolean"
    },
    "cancelled": {
      "type": "boolean"
    },
    "on_grace_period": {
      "type": "boolean"
    },
    "ends_at": {
      "type": "string"
    },
    "period_start": {
      "type": "string"
    },
    "period_end": {
      "type": "string"
    },
    "extra_branches": {
      "type": "integer"
    },
    "billing_provider": {
      "type": "string"
    },
    "self_serve_checkout": {
      "type": "boolean",
      "description": "False while there is no merchant account to collect with: the UI\nswaps every checkout button for a \"contact us\" CTA and the\nmatching endpoints answer 409."
    },
    "contact_url": {
      "type": "string"
    },
    "plan": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "price": {
          "type": "string"
        },
        "currency": {
          "type": "string"
        },
        "features": {
          "type": "string"
        },
        "coming_soon": {
          "type": "string"
        },
        "limits": {
          "type": "string"
        },
        "branding": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "price",
        "currency",
        "features",
        "coming_soon",
        "limits",
        "branding"
      ]
    },
    "usage": {
      "type": "object",
      "properties": {
        "staff_count": {
          "type": "string"
        },
        "staff_limit": {
          "type": "string"
        },
        "branch_count": {
          "type": "string"
        },
        "branch_limit": {
          "type": "integer"
        }
      },
      "required": [
        "staff_count",
        "staff_limit",
        "branch_count",
        "branch_limit"
      ]
    },
    "ai_usage": {
      "type": "object",
      "properties": {
        "tokens_used_today": {
          "type": "string"
        },
        "daily_token_limit": {
          "type": "string",
          "description": "null = unlimited, 0 = none included (credits only)"
        },
        "per_user_daily_token_limit": {
          "type": "string",
          "description": "null = no per-user sub-cap configured"
        },
        "credit_balance": {
          "type": "string",
          "description": "Purchased overflow tokens that survive the daily reset."
        },
        "credit_pack": {
          "type": "object",
          "properties": {
            "tokens": {
              "type": "integer"
            },
            "price": {
              "type": "integer"
            },
            "currency": {
              "type": "string"
            }
          },
          "required": [
            "tokens",
            "price",
            "currency"
          ]
        }
      },
      "required": [
        "tokens_used_today",
        "daily_token_limit",
        "per_user_daily_token_limit",
        "credit_balance",
        "credit_pack"
      ]
    },
    "branch_addon_price": {
      "type": "string"
    },
    "is_referral_reward": {
      "type": "boolean"
    },
    "referral_reward_ends_at": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "id",
    "tier",
    "tier_label",
    "is_paid",
    "is_active",
    "cancelled",
    "on_grace_period",
    "ends_at",
    "period_start",
    "period_end",
    "extra_branches",
    "billing_provider",
    "self_serve_checkout",
    "contact_url",
    "plan",
    "usage",
    "ai_usage",
    "branch_addon_price",
    "is_referral_reward",
    "referral_reward_ends_at"
  ]
}