{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "finish": {
      "description": "Where a person finishes in an event (golf, racing).",
      "type": "token"
    },
    "main": {
      "description": "Recommended key: '<subject rkey>-<kind>' (finish: '<subject rkey>-finish-<person rkey>'), so a fan has one prediction per subject and kind. Any key is accepted; if several exist, the newest counts.",
      "key": "any",
      "record": {
        "properties": {
          "awayScore": {
            "description": "score kind.",
            "maximum": 999,
            "minimum": 0,
            "type": "integer"
          },
          "confidence": {
            "description": "Rank within a confidence contest.",
            "maximum": 64,
            "minimum": 1,
            "type": "integer"
          },
          "contest": {
            "description": "Optional com.professorbutts.sports.contest this counts toward. Without it, the prediction still counts on open leaderboards.",
            "format": "at-uri",
            "type": "string"
          },
          "createdAt": {
            "format": "datetime",
            "type": "string"
          },
          "homeScore": {
            "description": "score kind.",
            "maximum": 999,
            "minimum": 0,
            "type": "integer"
          },
          "kind": {
            "knownValues": [
              "com.professorbutts.sports.prediction#winner",
              "com.professorbutts.sports.prediction#score",
              "com.professorbutts.sports.prediction#total",
              "com.professorbutts.sports.prediction#margin",
              "com.professorbutts.sports.prediction#spread",
              "com.professorbutts.sports.prediction#finish"
            ],
            "maxLength": 128,
            "type": "string"
          },
          "line": {
            "description": "The spread or total line predicted against, as a decimal string, e.g. '-3.5' or '47.5'. Integers only in lexicons, so strings carry halves.",
            "maxLength": 16,
            "type": "string"
          },
          "margin": {
            "description": "margin kind: winning margin in points, with team as the winner.",
            "maximum": 999,
            "minimum": 0,
            "type": "integer"
          },
          "overUnder": {
            "description": "total or spread kind, when predicting against a line instead of an exact number.",
            "knownValues": [
              "over",
              "under"
            ],
            "maxLength": 16,
            "type": "string"
          },
          "person": {
            "description": "com.professorbutts.sports.person record (finish kind, or winner of an individual event).",
            "format": "at-uri",
            "type": "string"
          },
          "position": {
            "description": "finish kind: predicted finishing position of person. 1 = wins.",
            "maximum": 999,
            "minimum": 1,
            "type": "integer"
          },
          "subject": {
            "description": "The com.professorbutts.sports.game or com.professorbutts.sports.leaderboard record.",
            "format": "at-uri",
            "type": "string"
          },
          "subjectCid": {
            "description": "Optional CID of the subject version the fan saw. Game records are rewritten in place, so graders use the uri; this is for display and audit only.",
            "format": "cid",
            "type": "string"
          },
          "team": {
            "description": "com.professorbutts.sports.team record predicted to win (winner), or to cover (spread).",
            "format": "at-uri",
            "type": "string"
          },
          "total": {
            "description": "total kind: combined points. Paired with over/under when a line is given.",
            "maximum": 1998,
            "minimum": 0,
            "type": "integer"
          },
          "updatedAt": {
            "format": "datetime",
            "type": "string"
          }
        },
        "required": [
          "subject",
          "kind",
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    },
    "margin": {
      "description": "Winning team and margin of victory.",
      "type": "token"
    },
    "score": {
      "description": "Exact final score of both teams.",
      "type": "token"
    },
    "spread": {
      "description": "Which team covers a point spread.",
      "type": "token"
    },
    "total": {
      "description": "Combined points, exact or over/under a line.",
      "type": "token"
    },
    "winner": {
      "description": "Which team wins.",
      "type": "token"
    }
  },
  "description": "One fan's prediction about one game or event, kept in their own repo: who wins, the final score, the combined total, the margin, the winner against a spread, or a finishing position (golf, racing). One record per subject per kind (finish: per person). Counts only if an indexer saw it before the subject starts; graded when final.",
  "id": "com.professorbutts.sports.prediction",
  "lexicon": 1
}
