{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/fwozen-com/json-schema/fwozen-com-billing-schema.json",
  "title": "Billing",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/fwozen-com-openapi.yml#/components/schemas/Billing",
  "type": "object",
  "properties": {
    "tier": {
      "type": "string",
      "enum": [
        "free",
        "team",
        "business",
        "enterprise"
      ]
    },
    "billingSource": {
      "type": "string",
      "enum": [
        "none",
        "trial",
        "stripe",
        "github_marketplace"
      ]
    },
    "source": {
      "type": "string",
      "const": "cache"
    },
    "features": {
      "type": "object",
      "propertyNames": {
        "type": "string",
        "enum": [
          "slack_app",
          "scheduled_freezes",
          "api_access",
          "enforcement_verification",
          "merge_queue_safe",
          "deployment_gating",
          "pr_exceptions",
          "cli_and_action",
          "override_approvals",
          "release_manager_role",
          "audit_export",
          "saml_sso",
          "scim",
          "unlimited_private_repos",
          "unlimited_github_orgs",
          "custom_retention"
        ]
      },
      "additionalProperties": {
        "type": "boolean"
      },
      "required": [
        "slack_app",
        "scheduled_freezes",
        "api_access",
        "enforcement_verification",
        "merge_queue_safe",
        "deployment_gating",
        "pr_exceptions",
        "cli_and_action",
        "override_approvals",
        "release_manager_role",
        "audit_export",
        "saml_sso",
        "scim",
        "unlimited_private_repos",
        "unlimited_github_orgs",
        "custom_retention"
      ]
    },
    "limits": {
      "$ref": "#/$defs/EntitlementLimits"
    },
    "usage": {
      "type": "object",
      "properties": {
        "billableRepos": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "githubOrgs": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "apiKeys": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "schedules": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "billableRepos",
        "githubOrgs",
        "apiKeys",
        "schedules"
      ],
      "additionalProperties": false
    },
    "overLimit": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "limit": {
            "type": "string"
          },
          "used": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "max": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "limit",
          "used",
          "max"
        ],
        "additionalProperties": false
      }
    },
    "banner": {
      "type": "string",
      "enum": [
        "none",
        "trial_ending",
        "trial_expired",
        "payment_failed",
        "over_repo_limit",
        "marketplace_mismatch"
      ]
    },
    "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"
        }
      ]
    },
    "gracePeriodEndsAt": {
      "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"
        }
      ]
    },
    "updatedAt": {
      "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))$"
    },
    "subscription": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "state": {
              "type": "string",
              "enum": [
                "none",
                "trialing",
                "active",
                "past_due",
                "unpaid",
                "canceled",
                "incomplete",
                "paused"
              ]
            },
            "priceLookupKey": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "interval": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "month",
                    "year"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "currentPeriodEnd": {
              "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"
                }
              ]
            },
            "cancelAtPeriodEnd": {
              "type": "boolean"
            },
            "latestInvoiceUrl": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uri"
                },
                {
                  "type": "null"
                }
              ]
            },
            "pastDueSince": {
              "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"
                }
              ]
            }
          },
          "required": [
            "state",
            "priceLookupKey",
            "interval",
            "currentPeriodEnd",
            "cancelAtPeriodEnd",
            "latestInvoiceUrl",
            "pastDueSince"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "canStartTrial": {
      "type": "boolean"
    },
    "portalAvailable": {
      "type": "boolean"
    },
    "marketplace": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "planId": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "planName": {
              "type": "string"
            },
            "manageUrl": {
              "type": "string",
              "format": "uri"
            }
          },
          "required": [
            "planId",
            "planName",
            "manageUrl"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "tier",
    "billingSource",
    "source",
    "features",
    "limits",
    "usage",
    "overLimit",
    "banner",
    "trialEndsAt",
    "gracePeriodEndsAt",
    "updatedAt",
    "subscription",
    "canStartTrial",
    "portalAvailable",
    "marketplace"
  ],
  "additionalProperties": false,
  "$defs": {
    "EntitlementLimits": {
      "type": "object",
      "properties": {
        "billableRepos": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "githubOrgs": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "auditRetentionDays": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "apiReadPerMinute": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "apiWritePerMinute": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "freezeStatePerMinute": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "apiKeys": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "schedules": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "billableRepos",
        "githubOrgs",
        "auditRetentionDays",
        "apiReadPerMinute",
        "apiWritePerMinute",
        "freezeStatePerMinute",
        "apiKeys",
        "schedules"
      ],
      "additionalProperties": false
    }
  }
}