{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "builtinCanonicalizer": {
      "description": "Built-in steps applied in order to every string value in the payload. Object keys, $type, $link and $bytes are never changed.",
      "properties": {
        "steps": {
          "items": {
            "knownValues": [
              "identity",
              "text",
              "integerStrings",
              "lowercase"
            ],
            "maxLength": 64,
            "type": "string"
          },
          "maxLength": 8,
          "minLength": 1,
          "type": "array"
        }
      },
      "required": [
        "steps"
      ],
      "type": "object"
    },
    "canonicalizer": {
      "description": "How payloads of one schema become candidate values. Stones whose canonical values are equal are the same candidate. Schemas without an entry use identity.",
      "properties": {
        "schema": {
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        },
        "using": {
          "refs": [
            "#checkCanonicalizer",
            "#builtinCanonicalizer"
          ],
          "type": "union"
        }
      },
      "required": [
        "schema",
        "using"
      ],
      "type": "object"
    },
    "checkCanonicalizer": {
      "description": "A WASM check that maps a payload to its canonical value.",
      "properties": {
        "check": {
          "ref": "com.atproto.repo.strongRef",
          "type": "ref"
        }
      },
      "required": [
        "check"
      ],
      "type": "object"
    },
    "courseSelector": {
      "properties": {
        "course": {
          "description": "A course id from the project.",
          "maxLength": 128,
          "type": "string"
        }
      },
      "required": [
        "course"
      ],
      "type": "object"
    },
    "credit": {
      "properties": {
        "attemptWeightPpm": {
          "default": 50000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "dedup": {
          "default": false,
          "description": "Open-scope dedup: a new site earns placement credit only if no earlier site matches it.",
          "type": "boolean"
        },
        "flowBack": {
          "ref": "#flowBack",
          "type": "ref"
        },
        "pebbleWeightPpm": {
          "default": 500000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "volunteeredWeightPpm": {
          "default": 500000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "draw": {
      "properties": {
        "drawnToRaise": {
          "default": 1,
          "description": "Agreeing drawn retraces needed before the low bound can rise without an anchor.",
          "minimum": 1,
          "type": "integer"
        },
        "epochRounds": {
          "default": 1200,
          "description": "drand quicknet rounds per epoch. 1200 rounds of 3 seconds is one hour.",
          "minimum": 1,
          "type": "integer"
        },
        "startThresholdPpm": {
          "default": 31250,
          "description": "Starting draw threshold T; doubles each epoch without a drawn retrace.",
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "volunteeredWeightPpm": {
          "default": 500000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "windowEpochs": {
          "default": 24,
          "description": "How long a drawn sponsor has to deliver.",
          "minimum": 1,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "flowBack": {
      "properties": {
        "capMultiple": {
          "default": 5,
          "description": "Flow-back is capped at this multiple of a stone's own credit.",
          "minimum": 0,
          "type": "integer"
        },
        "sharePpm": {
          "default": 250000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "judge": {
      "properties": {
        "minJudges": {
          "default": 1,
          "minimum": 1,
          "type": "integer"
        },
        "prompt": {
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        },
        "schema": {
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        }
      },
      "required": [
        "schema",
        "prompt"
      ],
      "type": "object"
    },
    "labeler": {
      "properties": {
        "did": {
          "format": "did",
          "type": "string"
        },
        "labels": {
          "description": "Label values honored from this labeler, such as bad-actor, exclude, recheck, unsafe or tag:<name>.",
          "items": {
            "maxLength": 128,
            "type": "string"
          },
          "maxLength": 64,
          "minLength": 1,
          "type": "array"
        }
      },
      "required": [
        "did",
        "labels"
      ],
      "type": "object"
    },
    "main": {
      "description": "The rules that turn evidence into confidence and credit. A policy that extends another overrides only the fields it sets.",
      "key": "tid",
      "record": {
        "properties": {
          "activationDelay": {
            "default": 24,
            "description": "Epochs after a timekeeper first sees a version before additions to its executable surface take effect.",
            "minimum": 0,
            "type": "integer"
          },
          "blind": {
            "default": false,
            "description": "Payloads are timelock-encrypted to the round that closes the epoch.",
            "type": "boolean"
          },
          "canonicalizers": {
            "items": {
              "ref": "#canonicalizer",
              "type": "ref"
            },
            "maxLength": 256,
            "type": "array"
          },
          "confidence": {
            "description": "Check that maps tallies to [low, high] per candidate. Absent means the built-in Beta-share interval.",
            "ref": "com.atproto.repo.strongRef",
            "type": "ref"
          },
          "createdAt": {
            "format": "datetime",
            "type": "string"
          },
          "credit": {
            "ref": "#credit",
            "type": "ref"
          },
          "deny": {
            "description": "Weight 0 in this reading, including agents through sponsor links.",
            "items": {
              "format": "did",
              "type": "string"
            },
            "maxLength": 10000,
            "type": "array"
          },
          "draw": {
            "ref": "#draw",
            "type": "ref"
          },
          "escalation": {
            "items": {
              "format": "did",
              "type": "string"
            },
            "maxLength": 64,
            "type": "array"
          },
          "extends": {
            "ref": "com.atproto.repo.strongRef",
            "type": "ref"
          },
          "judges": {
            "items": {
              "ref": "#judge",
              "type": "ref"
            },
            "maxLength": 64,
            "type": "array"
          },
          "labelers": {
            "description": "Labelers the policy trusts, and which of each one's labels it honors with their standard effects.",
            "items": {
              "ref": "#labeler",
              "type": "ref"
            },
            "maxLength": 64,
            "type": "array"
          },
          "models": {
            "ref": "#models",
            "type": "ref"
          },
          "nullSampling": {
            "ref": "#nullSampling",
            "type": "ref"
          },
          "priorities": {
            "items": {
              "ref": "#priority",
              "type": "ref"
            },
            "maxLength": 1024,
            "type": "array"
          },
          "requiredChecks": {
            "description": "A candidate that fails a required check has a low bound of 0.",
            "items": {
              "ref": "com.atproto.repo.strongRef",
              "type": "ref"
            },
            "maxLength": 64,
            "type": "array"
          },
          "retraceBudget": {
            "default": 3,
            "description": "Automatic retraces per site. A new distinct value schedules more.",
            "minimum": 0,
            "type": "integer"
          },
          "thresholds": {
            "ref": "#thresholds",
            "type": "ref"
          },
          "timekeepers": {
            "items": {
              "format": "did",
              "type": "string"
            },
            "maxLength": 16,
            "type": "array"
          }
        },
        "required": [
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    },
    "modelWeight": {
      "properties": {
        "family": {
          "maxLength": 256,
          "type": "string"
        },
        "thinking": {
          "items": {
            "maxLength": 64,
            "type": "string"
          },
          "maxLength": 16,
          "type": "array"
        },
        "versions": {
          "items": {
            "maxLength": 128,
            "type": "string"
          },
          "maxLength": 64,
          "type": "array"
        },
        "weightPpm": {
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "family",
        "weightPpm"
      ],
      "type": "object"
    },
    "models": {
      "properties": {
        "accept": {
          "items": {
            "ref": "#modelWeight",
            "type": "ref"
          },
          "maxLength": 256,
          "type": "array"
        },
        "defaultWeightPpm": {
          "default": 0,
          "description": "Weight for stones from unlisted models.",
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "sameSetupWeightPpm": {
          "default": 1000000,
          "description": "Extra weight on each agreeing read beyond the first from one setup (model, modelVersion and config hash) at a site.",
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "nullSampling": {
      "description": "Sampling for nulls without segments: initialPpm at first, then sampleNumerator/n after n passes, never below floorPpm.",
      "properties": {
        "floorPpm": {
          "default": 100000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "initialPpm": {
          "default": 1000000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "poolClearSamples": {
          "default": 60,
          "description": "Passing samples that clear a pool for final credit.",
          "minimum": 1,
          "type": "integer"
        },
        "sampleNumerator": {
          "default": 3,
          "minimum": 1,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "priority": {
      "properties": {
        "need": {
          "description": "Relative need. Weights routing and placement credit.",
          "minimum": 0,
          "type": "integer"
        },
        "selector": {
          "refs": [
            "#courseSelector",
            "#siteSelector"
          ],
          "type": "union"
        }
      },
      "required": [
        "selector",
        "need"
      ],
      "type": "object"
    },
    "siteSelector": {
      "properties": {
        "site": {
          "description": "Site key.",
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        }
      },
      "required": [
        "site"
      ],
      "type": "object"
    },
    "thresholds": {
      "description": "Bars on the low bound of the leading candidate's interval.",
      "properties": {
        "exportPpm": {
          "default": 950000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "finalizeCreditPpm": {
          "default": 900000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "minFamilies": {
          "default": 1,
          "description": "Model families a candidate's agreeing reads must come from before it clears the open-children or export bar. A read that declares no model is a family of its own sponsor.",
          "minimum": 1,
          "type": "integer"
        },
        "openChildrenPpm": {
          "default": 800000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "stopRoutingPpm": {
          "default": 990000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        }
      },
      "type": "object"
    }
  },
  "description": "Fractions are parts per million (0 to 1000000).",
  "id": "org.cairnsproto.draft.policy",
  "lexicon": 1
}
