{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "chronicleSignature": {
      "description": "ES256 cryptographic signature proving record authenticity. The signature itself proves legitimacy - no separate verification lexicons needed.",
      "properties": {
        "alg": {
          "description": "Signing algorithm (ES256)",
          "type": "string"
        },
        "kid": {
          "description": "Key identifier for the signing key",
          "type": "string"
        },
        "nonce": {
          "description": "Unique random nonce to prevent replay",
          "type": "string"
        },
        "sig": {
          "description": "Base64-encoded ES256 signature",
          "type": "string"
        },
        "signedAt": {
          "description": "When the record was signed",
          "format": "datetime",
          "type": "string"
        },
        "version": {
          "description": "Signature schema version",
          "type": "integer"
        }
      },
      "required": [
        "sig",
        "alg",
        "kid",
        "signedAt",
        "nonce",
        "version"
      ],
      "type": "object"
    },
    "main": {
      "description": "A milestone reached in the field, shown on the Fieldwork page's Milestones tab. Successor to net.anisota.chronicle.achievement (legacy records in that collection remain readable but no new ones are written). rkey is the milestone ID (e.g. level-50, expedition-first-light) before the 2027 season, and the season id and the milestone ID (e.g. 2027-social-posts-10) from then on; season milestones are never written to the legacy collection. Created once with createRecord when the milestone is reached. Immutable.",
      "key": "any",
      "record": {
        "properties": {
          "category": {
            "description": "Category of the milestone",
            "enum": [
              "level",
              "social",
              "collection",
              "patterns",
              "special",
              "expedition"
            ],
            "type": "string"
          },
          "context": {
            "ref": "#milestoneContext",
            "type": "ref"
          },
          "createdAt": {
            "description": "When the milestone record was created",
            "format": "datetime",
            "type": "string"
          },
          "dailyRecordRef": {
            "description": "AT URI of the daily record when the milestone was reached",
            "type": "string"
          },
          "description": {
            "description": "Description of what was reached",
            "maxLength": 500,
            "type": "string"
          },
          "milestoneId": {
            "description": "Unique identifier for the milestone (e.g. 'level-50', 'expedition-first-light'), always bare, whatever the season",
            "maxLength": 100,
            "type": "string"
          },
          "name": {
            "description": "Display name of the milestone",
            "maxLength": 100,
            "type": "string"
          },
          "rarity": {
            "description": "Rarity tier of the milestone",
            "enum": [
              "common",
              "uncommon",
              "rare",
              "epic",
              "legendary"
            ],
            "type": "string"
          },
          "season": {
            "description": "The game season this record counts toward, e.g. 2027. Absent: before the 2027 season.",
            "maxLength": 8,
            "type": "string"
          },
          "signature": {
            "ref": "#chronicleSignature",
            "type": "ref"
          },
          "tier": {
            "description": "Tier or threshold value (e.g. 50 for level-50)",
            "minimum": 0,
            "type": "integer"
          },
          "unlockedAt": {
            "description": "When the milestone was reached",
            "format": "datetime",
            "type": "string"
          },
          "xpReward": {
            "description": "XP awarded for this milestone",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "milestoneId",
          "category",
          "unlockedAt",
          "signature",
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    },
    "milestoneContext": {
      "description": "Contextual data at the time the milestone was reached",
      "properties": {
        "level": {
          "description": "Player level when the milestone was reached",
          "minimum": 1,
          "type": "integer"
        },
        "postCount": {
          "description": "Post count when the milestone was reached",
          "minimum": 0,
          "type": "integer"
        },
        "specimenCount": {
          "description": "Specimen count when the milestone was reached",
          "minimum": 0,
          "type": "integer"
        },
        "totalXP": {
          "description": "Total XP when the milestone was reached",
          "minimum": 0,
          "type": "integer"
        }
      },
      "type": "object"
    }
  },
  "id": "net.anisota.chronicle.milestone",
  "lexicon": 1
}
