{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mencoro-com/json-schema/mencoro-com-subscription-resource-schema.json",
  "title": "SubscriptionResource",
  "description": "The current subscription contract of an organization",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mencoro-com-openapi.json#/components/schemas/SubscriptionResource",
  "required": [
    "status",
    "isEntitled"
  ],
  "properties": {
    "status": {
      "description": "Contract state. \"none\" when the organization has never held a subscription.",
      "type": "string",
      "enum": [
        "active",
        "inactive",
        "none"
      ]
    },
    "tierCode": {
      "description": "Public tier identifier derived from the check budget.",
      "type": [
        "string",
        "null"
      ]
    },
    "billingCycleType": {
      "description": "Billing interval of the contract.",
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "monthly",
        "yearly"
      ]
    },
    "billingCycleAnchor": {
      "description": "Instant the billing cycle is anchored to.",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "checkBudget": {
      "description": "Checks the current cycle grants. Null when there is no subscription, never a stand-in for zero.",
      "type": [
        "integer",
        "null"
      ]
    },
    "checksConsumed": {
      "description": "Checks consumed so far in the current cycle. Null when there is no subscription; zero means none consumed yet.",
      "type": [
        "integer",
        "null"
      ]
    },
    "checksAvailable": {
      "description": "Checks still available in the current cycle. Null when there is no subscription; zero means the budget is exhausted.",
      "type": [
        "integer",
        "null"
      ]
    },
    "nextResetAt": {
      "description": "When the check budget resets next.",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "cancelledAt": {
      "description": "When the subscription was terminally cancelled. Null while it has not been.",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "scheduledToCancelAt": {
      "description": "When a scheduled cancellation takes effect, while the subscription is still running. Null when none is scheduled.",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "gracePeriodEndsAt": {
      "description": "When paid access ends after a cancellation. Null when the subscription is not cancelled.",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "deactivationReason": {
      "description": "Why the subscription is currently inactive. Null for an active subscription, and meaningless once \"cancelledAt\" is set - the cancellation supersedes it.",
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "payment_failed",
        "paused",
        "incomplete",
        "other"
      ]
    },
    "isEntitled": {
      "description": "Whether the organization may use paid features right now: active, or cancelled but still inside its paid grace window.",
      "type": "boolean"
    }
  },
  "type": "object"
}