{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "draw": {
      "properties": {
        "beaconRound": {
          "minimum": 1,
          "type": "integer"
        },
        "epoch": {
          "description": "The epoch under the project's policy.",
          "minimum": 1,
          "type": "integer"
        },
        "project": {
          "ref": "com.atproto.repo.strongRef",
          "type": "ref"
        },
        "schema": {
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        },
        "site": {
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        },
        "sources": {
          "description": "Source hashes the site's chain starts from.",
          "items": {
            "ref": "org.cairnsproto.draft.defs#hash",
            "type": "ref"
          },
          "type": "array"
        },
        "state": {
          "maxLength": 32,
          "type": "string"
        },
        "thresholdPpm": {
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "project",
        "site",
        "schema",
        "state",
        "epoch",
        "beaconRound",
        "thresholdPpm",
        "sources"
      ],
      "type": "object"
    },
    "main": {
      "description": "Sites a sponsor holds a deliverable draw for: the newest epoch whose retrace window is still open and whose beacon draws the sponsor, for sites not yet past their export bar, in projects where the declared model counts, where the sponsor is eligible and the draw hash falls under the escalated threshold. Each draw carries what a client needs to verify it and do the work. Course-0 sites nobody has opened are listed separately under open, since a first read needs no draw.",
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "beacons": {
              "description": "The beacons the draws used. Projects with different epoch lengths draw from different rounds.",
              "items": {
                "ref": "org.cairnsproto.draft.getReading#beacon",
                "type": "ref"
              },
              "type": "array"
            },
            "draws": {
              "items": {
                "ref": "#draw",
                "type": "ref"
              },
              "type": "array"
            },
            "open": {
              "description": "Sites no stone has reached yet, in projects where the declared model counts: root-course sites, and child sites a split course opened on a parent value past the open-children bar. A first read needs no draw and earns full credit, so anyone may open them.",
              "items": {
                "ref": "#openSite",
                "type": "ref"
              },
              "type": "array"
            },
            "sponsor": {
              "format": "did",
              "type": "string"
            },
            "versions": {
              "description": "For each project listed, the version draws and open sites were routed under, and a newer version still waiting out its activation delay.",
              "items": {
                "ref": "#routedVersion",
                "type": "ref"
              },
              "type": "array"
            }
          },
          "required": [
            "sponsor",
            "beacons",
            "draws"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "limit": {
            "default": 50,
            "maximum": 100,
            "minimum": 1,
            "type": "integer"
          },
          "model": {
            "description": "The declared model family. Projects whose policy gives it no weight are left out; without it, the weight of a stone with no model applies.",
            "maxLength": 256,
            "type": "string"
          },
          "modelVersion": {
            "maxLength": 128,
            "type": "string"
          },
          "project": {
            "description": "Limit to one project.",
            "format": "at-uri",
            "type": "string"
          },
          "site": {
            "description": "Limit to one site key, as 64 lowercase hex digits.",
            "maxLength": 64,
            "minLength": 64,
            "type": "string"
          },
          "sponsor": {
            "format": "did",
            "type": "string"
          },
          "thinking": {
            "maxLength": 64,
            "type": "string"
          }
        },
        "required": [
          "sponsor"
        ],
        "type": "params"
      },
      "type": "query"
    },
    "openSite": {
      "properties": {
        "course": {
          "maxLength": 128,
          "type": "string"
        },
        "project": {
          "ref": "com.atproto.repo.strongRef",
          "type": "ref"
        },
        "schema": {
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        },
        "site": {
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        },
        "sources": {
          "description": "The sources the site's chain starts from.",
          "items": {
            "ref": "org.cairnsproto.draft.defs#hash",
            "type": "ref"
          },
          "type": "array"
        },
        "value": {
          "description": "The site itself: base, mark and schema.",
          "ref": "org.cairnsproto.draft.defs#site",
          "type": "ref"
        }
      },
      "required": [
        "project",
        "site",
        "schema",
        "course",
        "value",
        "sources"
      ],
      "type": "object"
    },
    "pendingVersion": {
      "properties": {
        "activatesRound": {
          "description": "The drand round from which the newer version is in effect.",
          "minimum": 0,
          "type": "integer"
        },
        "cid": {
          "format": "cid",
          "type": "string"
        }
      },
      "required": [
        "cid",
        "activatesRound"
      ],
      "type": "object"
    },
    "routedVersion": {
      "properties": {
        "pending": {
          "ref": "#pendingVersion",
          "type": "ref"
        },
        "project": {
          "description": "The version in effect for routing.",
          "ref": "com.atproto.repo.strongRef",
          "type": "ref"
        }
      },
      "required": [
        "project"
      ],
      "type": "object"
    }
  },
  "id": "org.cairnsproto.draft.listDraws",
  "lexicon": 1
}
