{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "beacon": {
      "properties": {
        "round": {
          "minimum": 1,
          "type": "integer"
        },
        "signature": {
          "maxLength": 96,
          "minLength": 96,
          "type": "string"
        }
      },
      "required": [
        "round",
        "signature"
      ],
      "type": "object"
    },
    "candidate": {
      "properties": {
        "agreePpm": {
          "minimum": 0,
          "type": "integer"
        },
        "agreeingSponsors": {
          "minimum": 0,
          "type": "integer"
        },
        "disagreePpm": {
          "minimum": 0,
          "type": "integer"
        },
        "drawnAgreeing": {
          "minimum": 0,
          "type": "integer"
        },
        "high": {
          "description": "High bound of the agreement interval, in ppm.",
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "low": {
          "description": "Low bound of the agreement interval, in ppm: support for the share of independent reads that agree on this candidate. It is not a measured accuracy.",
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "stones": {
          "items": {
            "ref": "com.atproto.repo.strongRef",
            "type": "ref"
          },
          "type": "array"
        },
        "value": {
          "description": "Digest of the canonical value.",
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        },
        "vouched": {
          "description": "Present and true when a converted stone naming a transform the project vouches for reads this candidate, so its support rests on the maintainer's vouch, not only on independent reads.",
          "type": "boolean"
        }
      },
      "required": [
        "value",
        "agreeingSponsors",
        "drawnAgreeing",
        "agreePpm",
        "disagreePpm",
        "low",
        "high",
        "stones"
      ],
      "type": "object"
    },
    "export": {
      "properties": {
        "export": {
          "ref": "com.atproto.repo.strongRef",
          "type": "ref"
        },
        "merged": {
          "ref": "#merge",
          "type": "ref"
        }
      },
      "required": [
        "export"
      ],
      "type": "object"
    },
    "gap": {
      "description": "A site that is not done. A site no stone has reached yet also names its course and the site itself, and a root-course one its source, so a contributor can place the first stone.",
      "properties": {
        "course": {
          "description": "Course id, for a root-course site with no stones.",
          "maxLength": 128,
          "type": "string"
        },
        "reason": {
          "knownValues": [
            "open",
            "contested",
            "tied",
            "ambiguous",
            "belowExport",
            "unreadable",
            "held"
          ],
          "maxLength": 32,
          "type": "string"
        },
        "site": {
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        },
        "source": {
          "description": "The source an empty root-course site marks into.",
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        },
        "value": {
          "description": "The site itself, for a site no stone has reached: a root course's whole-source site, or a child site a split course opened.",
          "ref": "org.cairnsproto.draft.defs#site",
          "type": "ref"
        }
      },
      "required": [
        "site",
        "reason"
      ],
      "type": "object"
    },
    "input": {
      "properties": {
        "cid": {
          "format": "cid",
          "type": "string"
        },
        "seenEpoch": {
          "minimum": 0,
          "type": "integer"
        },
        "uri": {
          "format": "at-uri",
          "type": "string"
        }
      },
      "required": [
        "uri",
        "cid",
        "seenEpoch"
      ],
      "type": "object"
    },
    "main": {
      "description": "The current reading of a project under its policy, with the inputs a client needs to recompute it: every input record's URI, CID and first-seen epoch, and the beacons its draw claims used.",
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "beacons": {
              "items": {
                "ref": "#beacon",
                "type": "ref"
              },
              "type": "array"
            },
            "epoch": {
              "description": "The indexer's current epoch.",
              "minimum": 0,
              "type": "integer"
            },
            "exports": {
              "items": {
                "ref": "#export",
                "type": "ref"
              },
              "type": "array"
            },
            "gaps": {
              "items": {
                "ref": "#gap",
                "type": "ref"
              },
              "type": "array"
            },
            "inputRoot": {
              "ref": "org.cairnsproto.draft.defs#hash",
              "type": "ref"
            },
            "inputs": {
              "items": {
                "ref": "#input",
                "type": "ref"
              },
              "type": "array"
            },
            "policy": {
              "ref": "com.atproto.repo.strongRef",
              "type": "ref"
            },
            "project": {
              "ref": "com.atproto.repo.strongRef",
              "type": "ref"
            },
            "published": {
              "description": "The official repo's state, from the latest import result a maintainer published.",
              "ref": "#published",
              "type": "ref"
            },
            "rejected": {
              "items": {
                "ref": "#rejected",
                "type": "ref"
              },
              "type": "array"
            },
            "sites": {
              "items": {
                "ref": "#siteReading",
                "type": "ref"
              },
              "type": "array"
            }
          },
          "required": [
            "project",
            "policy",
            "epoch",
            "inputRoot",
            "sites",
            "gaps",
            "rejected",
            "inputs",
            "beacons"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "project": {
            "format": "at-uri",
            "type": "string"
          },
          "site": {
            "description": "Limit sites to this site key (hex).",
            "maxLength": 64,
            "minLength": 64,
            "type": "string"
          }
        },
        "required": [
          "project"
        ],
        "type": "params"
      },
      "type": "query"
    },
    "merge": {
      "description": "The first maintainer import result holding every file of the export at the same hash.",
      "properties": {
        "commit": {
          "maxLength": 64,
          "type": "string"
        },
        "importResult": {
          "ref": "com.atproto.repo.strongRef",
          "type": "ref"
        }
      },
      "required": [
        "importResult",
        "commit"
      ],
      "type": "object"
    },
    "published": {
      "properties": {
        "commit": {
          "maxLength": 64,
          "type": "string"
        },
        "importResult": {
          "ref": "com.atproto.repo.strongRef",
          "type": "ref"
        },
        "source": {
          "ref": "com.atproto.repo.strongRef",
          "type": "ref"
        },
        "valuesFetched": {
          "description": "Whether the indexer has the import result's values blob. Sites carry no comparison until it does.",
          "type": "boolean"
        }
      },
      "required": [
        "importResult",
        "source",
        "commit",
        "valuesFetched"
      ],
      "type": "object"
    },
    "rejected": {
      "properties": {
        "reason": {
          "maxLength": 1000,
          "type": "string"
        },
        "uri": {
          "format": "at-uri",
          "type": "string"
        }
      },
      "required": [
        "uri",
        "reason"
      ],
      "type": "object"
    },
    "siteReading": {
      "properties": {
        "candidates": {
          "items": {
            "ref": "#candidate",
            "type": "ref"
          },
          "type": "array"
        },
        "course": {
          "description": "The id of the project course whose schema the site's schema is.",
          "maxLength": 128,
          "type": "string"
        },
        "error": {
          "maxLength": 1000,
          "type": "string"
        },
        "parent": {
          "description": "The site a child site's base builds on.",
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        },
        "published": {
          "description": "How the official repo's value compares with the leading candidate.",
          "knownValues": [
            "matches",
            "diverges"
          ],
          "maxLength": 32,
          "type": "string"
        },
        "schema": {
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        },
        "site": {
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        },
        "split": {
          "description": "Whether the leading value is a split, whose parts are child sites in the same course.",
          "type": "boolean"
        },
        "state": {
          "knownValues": [
            "open",
            "contested",
            "tied",
            "ambiguous",
            "leading",
            "unreadable",
            "held"
          ],
          "maxLength": 32,
          "type": "string"
        },
        "stones": {
          "items": {
            "ref": "#stoneStatus",
            "type": "ref"
          },
          "type": "array"
        }
      },
      "required": [
        "site",
        "schema",
        "state",
        "candidates",
        "stones"
      ],
      "type": "object"
    },
    "stoneStatus": {
      "properties": {
        "author": {
          "format": "did",
          "type": "string"
        },
        "drawn": {
          "type": "boolean"
        },
        "status": {
          "knownValues": [
            "leading",
            "pebble",
            "tied",
            "withdrawn",
            "attempt",
            "sealed",
            "unsponsored",
            "branched",
            "unreadable",
            "hollow",
            "excluded"
          ],
          "maxLength": 32,
          "type": "string"
        },
        "stone": {
          "ref": "com.atproto.repo.strongRef",
          "type": "ref"
        }
      },
      "required": [
        "stone",
        "author",
        "status",
        "drawn"
      ],
      "type": "object"
    }
  },
  "id": "org.cairnsproto.draft.getReading",
  "lexicon": 1
}
