{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "A subscription tier offered by a creator. Lives in the creator's repository, so the creator is the repo owner and is not repeated as a field. Tiers are tied to the creator's DID rather than to any publication or app.",
      "key": "tid",
      "record": {
        "properties": {
          "amount": {
            "description": "Price per billing period, in the smallest unit of the currency (e.g. cents). Matches network.attested.payment.recurring's amount so no conversion is needed when the payment record is written.",
            "minimum": 1,
            "type": "integer"
          },
          "closedAt": {
            "description": "When this tier stopped accepting NEW subscriptions. Closing is not deleting: existing entitlements keep referencing this record and must keep resolving, so a tier is never removed once anyone has subscribed to it.",
            "format": "datetime",
            "type": "string"
          },
          "createdAt": {
            "format": "datetime",
            "type": "string"
          },
          "currency": {
            "description": "ISO 4217 currency code, e.g. USD.",
            "maxLength": 3,
            "minLength": 3,
            "type": "string"
          },
          "description": {
            "description": "What a subscriber gets. Prose, not machine-read.",
            "maxGraphemes": 1000,
            "maxLength": 10000,
            "type": "string"
          },
          "frequency": {
            "default": 1,
            "description": "Multiplier on unit, so unit=monthly with frequency=3 bills every three months. Defaults to 1. Mirrors network.attested.payment.recurring.",
            "minimum": 1,
            "type": "integer"
          },
          "name": {
            "description": "Display name of the tier.",
            "maxGraphemes": 64,
            "maxLength": 640,
            "type": "string"
          },
          "unit": {
            "description": "Billing period. Closed set, matching network.attested.payment.recurring exactly. Closed rather than knownValues because an unrecognised unit is not forward-compatible, it is uncomputable: a verifier cannot derive a billing period from a value it does not know, so accepting one would mean writing a tier nothing can price.",
            "enum": [
              "monthly",
              "quarterly",
              "semiannual",
              "yearly"
            ],
            "type": "string"
          }
        },
        "required": [
          "name",
          "amount",
          "currency",
          "unit",
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    }
  },
  "id": "blue.hearth.tier",
  "lexicon": 1
}
