{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Paper 1 Claim Audit",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "paper_revision",
    "previous_edition",
    "edition",
    "checked_on",
    "ultimate_explainer_plan",
    "plan_head",
    "staged_recipe_revision",
    "renderer_pin",
    "sources",
    "checks",
    "claims"
  ],
  "properties": {
    "paper_revision": {
      "type": "string",
      "pattern": "^[a-f0-9]{40}$"
    },
    "previous_edition": {
      "type": "string",
      "pattern": "\\S"
    },
    "edition": {
      "type": "string",
      "pattern": "\\S"
    },
    "checked_on": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "ultimate_explainer_plan": {
      "type": "string",
      "pattern": "^https://[^\\s]+$"
    },
    "plan_head": {
      "type": "string",
      "pattern": "^[a-f0-9]{40}$"
    },
    "staged_recipe_revision": {
      "type": "string",
      "pattern": "^[a-f0-9]{40}$"
    },
    "renderer_pin": {
      "type": "string",
      "pattern": "^[a-f0-9]{40}$"
    },
    "sources": {
      "type": "object",
      "minProperties": 1,
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "url",
          "locator",
          "access"
        ],
        "properties": {
          "url": {
            "type": "string",
            "pattern": "^https://[^\\s]+$"
          },
          "locator": {
            "type": "string",
            "pattern": "\\S"
          },
          "access": {
            "type": "string",
            "pattern": "\\S"
          }
        }
      }
    },
    "checks": {
      "type": "object",
      "minProperties": 1,
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "method",
          "reference",
          "scope"
        ],
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "inspected-upstream-run",
              "inspected-upstream-run",
              "local-source-check",
              "local-exact-replay",
              "independent-source-review"
            ]
          },
          "reference": {
            "type": "string",
            "pattern": "\\S"
          },
          "scope": {
            "type": "string",
            "pattern": "\\S"
          }
        }
      }
    },
    "claims": {
      "type": "object",
      "minProperties": 1,
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "title",
          "manuscript_section",
          "view_kind",
          "explainer_section",
          "statement",
          "scope",
          "paper_locators",
          "lean_locators"
        ],
        "properties": {
          "title": {
            "type": "string",
            "pattern": "\\S"
          },
          "manuscript_section": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4
          },
          "view_kind": {
            "type": "string",
            "enum": [
              "math",
              "game",
              "premise"
            ]
          },
          "explainer_section": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:[-_][a-z0-9]+)*$"
          },
          "statement": {
            "type": "string",
            "pattern": "\\S"
          },
          "scope": {
            "type": "string",
            "pattern": "\\S"
          },
          "paper_locators": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "label",
                "url"
              ],
              "properties": {
                "label": {
                  "type": "string",
                  "pattern": "\\S"
                },
                "url": {
                  "type": "string",
                  "pattern": "^https://[^\\s]+$"
                }
              }
            }
          },
          "lean_locators": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "label",
                "url"
              ],
              "properties": {
                "label": {
                  "type": "string",
                  "pattern": "\\S"
                },
                "url": {
                  "type": "string",
                  "pattern": "^https://[^\\s]+$"
                }
              }
            }
          },
          "local_checks": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "pattern": "^[a-z0-9]+(?:[-_][a-z0-9]+)*$"
            }
          }
        }
      }
    }
  }
}
