{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Consult the tavern's grand ledger to retrieve an adventurer's indexed battle chronicles, ordered newest first.",
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "cursor": {
              "description": "Offset-based pagination cursor (next offset as string).",
              "type": "string"
            },
            "results": {
              "items": {
                "ref": "#matchResultView",
                "type": "ref"
              },
              "type": "array"
            }
          },
          "required": [
            "results"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "did": {
            "description": "The adventurer's DID.",
            "format": "did",
            "type": "string"
          },
          "limit": {
            "default": 20,
            "maximum": 100,
            "minimum": 1,
            "type": "integer"
          },
          "offset": {
            "default": 0,
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "did"
        ],
        "type": "params"
      },
      "type": "query"
    },
    "matchResultView": {
      "description": "An indexed chronicle entry — one adventurer's record from a single tavern battle.",
      "properties": {
        "cid": {
          "format": "cid",
          "type": "string"
        },
        "did": {
          "format": "did",
          "type": "string"
        },
        "heroKey": {
          "type": "string"
        },
        "heroName": {
          "type": "string"
        },
        "lobbyId": {
          "type": "string"
        },
        "mmrAfter": {
          "type": "number"
        },
        "mmrBefore": {
          "type": "number"
        },
        "mmrChange": {
          "type": "number"
        },
        "opponents": {
          "items": {
            "ref": "gg.infinitetavern.chronicle.entry#opponent",
            "type": "ref"
          },
          "type": "array"
        },
        "placement": {
          "maximum": 8,
          "minimum": 1,
          "type": "integer"
        },
        "playedAt": {
          "format": "datetime",
          "type": "string"
        },
        "roundSurvived": {
          "minimum": 0,
          "type": "integer"
        },
        "seasonNumber": {
          "type": "integer"
        },
        "uri": {
          "format": "at-uri",
          "type": "string"
        }
      },
      "required": [
        "uri",
        "cid",
        "did",
        "lobbyId",
        "seasonNumber",
        "placement",
        "heroKey",
        "heroName",
        "roundSurvived",
        "mmrBefore",
        "mmrAfter",
        "mmrChange",
        "playedAt",
        "opponents"
      ],
      "type": "object"
    }
  },
  "id": "gg.infinitetavern.tavern.getAdventurerChronicles",
  "lexicon": 1
}
