{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "readOnly": true,
  "type": "object",
  "properties": {
    "version": {
      "type": "number",
      "const": 6,
      "description": "The review format this file is written in"
    },
    "verdict": {
      "type": "string",
      "enum": [
        "approve",
        "comment",
        "request-changes"
      ],
      "description": "The reviewer's verdict on the whole change"
    },
    "body": {
      "description": "The reviewer's general comment on the whole change",
      "type": "string"
    },
    "reviewed": {
      "readOnly": true,
      "description": "What the page was drawn for",
      "type": "object",
      "properties": {
        "range": {
          "type": "string",
          "description": "The range the page was drawn for, `<from>..<to>`, or `HEAD..worktree` for uncommitted work"
        },
        "pullRequest": {
          "description": "The pull request it was drawn for",
          "type": "number"
        }
      },
      "required": [
        "range"
      ],
      "additionalProperties": false
    },
    "read": {
      "readOnly": true,
      "description": "The parts the reviewer marked read, by node id, in reading order",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "resolved": {
      "readOnly": true,
      "description": "The anchors of the last review's comments the reviewer closed, as they were said",
      "type": "array",
      "items": {
        "anyOf": [
          {
            "oneOf": [
              {
                "readOnly": true,
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "part"
                  },
                  "id": {
                    "type": "string",
                    "description": "A node id"
                  }
                },
                "required": [
                  "kind",
                  "id"
                ],
                "additionalProperties": false
              },
              {
                "readOnly": true,
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "edge"
                  },
                  "id": {
                    "type": "string",
                    "description": "`<from> -> <to>`, the node ids at its ends"
                  }
                },
                "required": [
                  "kind",
                  "id"
                ],
                "additionalProperties": false
              },
              {
                "readOnly": true,
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "symbol"
                  },
                  "id": {
                    "type": "string",
                    "description": "`<file node id>#<scope.name>`: a function, method or class in a file, then, from the second on, `#<n>` on the n-th of the file's symbols of that name, as a getter and its setter are, in the page data's `symbols` order"
                  }
                },
                "required": [
                  "kind",
                  "id"
                ],
                "additionalProperties": false
              },
              {
                "readOnly": true,
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "decision"
                  },
                  "id": {
                    "type": "string",
                    "description": "`<symbol id>#<text>`: a logic line of a function, the symbol's id with its `#<n>` if it has one, its text the base side's when removed, else the head side's, then, from the second on, `#<n>` on the n-th line of the function whose id reads the same. A removed guard's or catch's id is its `logic:removed:` finding's id without that prefix"
                  },
                  "text": {
                    "type": "string",
                    "description": "The logic line's text"
                  }
                },
                "required": [
                  "kind",
                  "id",
                  "text"
                ],
                "additionalProperties": false
              },
              {
                "readOnly": true,
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "test"
                  },
                  "id": {
                    "type": "string",
                    "description": "`<test file>#<heading › … › name>`: a test by its headings and name, then, from the second on, `#<n>` on the n-th of the file's tests with those headings and that name, in the page data's `tests` order"
                  }
                },
                "required": [
                  "kind",
                  "id"
                ],
                "additionalProperties": false
              },
              {
                "readOnly": true,
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "line"
                  },
                  "id": {
                    "type": "string",
                    "description": "`<file>@<base|head>:<n>`: a diff line by its side and line number"
                  },
                  "text": {
                    "type": "string",
                    "description": "The line's text, since its number drifts between rounds"
                  }
                },
                "required": [
                  "kind",
                  "id",
                  "text"
                ],
                "additionalProperties": false
              }
            ]
          },
          {
            "readOnly": true,
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "finding",
                "description": "An answer to a finding"
              },
              "id": {
                "type": "string",
                "description": "The finding's id"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          }
        ]
      }
    },
    "comments": {
      "readOnly": true,
      "description": "The reviewer's comments and answers to findings, one per anchor",
      "type": "array",
      "items": {
        "anyOf": [
          {
            "readOnly": true,
            "type": "object",
            "properties": {
              "anchor": {
                "oneOf": [
                  {
                    "readOnly": true,
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "part"
                      },
                      "id": {
                        "type": "string",
                        "description": "A node id"
                      }
                    },
                    "required": [
                      "kind",
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "readOnly": true,
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "edge"
                      },
                      "id": {
                        "type": "string",
                        "description": "`<from> -> <to>`, the node ids at its ends"
                      }
                    },
                    "required": [
                      "kind",
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "readOnly": true,
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "symbol"
                      },
                      "id": {
                        "type": "string",
                        "description": "`<file node id>#<scope.name>`: a function, method or class in a file, then, from the second on, `#<n>` on the n-th of the file's symbols of that name, as a getter and its setter are, in the page data's `symbols` order"
                      }
                    },
                    "required": [
                      "kind",
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "readOnly": true,
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "decision"
                      },
                      "id": {
                        "type": "string",
                        "description": "`<symbol id>#<text>`: a logic line of a function, the symbol's id with its `#<n>` if it has one, its text the base side's when removed, else the head side's, then, from the second on, `#<n>` on the n-th line of the function whose id reads the same. A removed guard's or catch's id is its `logic:removed:` finding's id without that prefix"
                      },
                      "text": {
                        "type": "string",
                        "description": "The logic line's text"
                      }
                    },
                    "required": [
                      "kind",
                      "id",
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "readOnly": true,
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "test"
                      },
                      "id": {
                        "type": "string",
                        "description": "`<test file>#<heading › … › name>`: a test by its headings and name, then, from the second on, `#<n>` on the n-th of the file's tests with those headings and that name, in the page data's `tests` order"
                      }
                    },
                    "required": [
                      "kind",
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "readOnly": true,
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "line"
                      },
                      "id": {
                        "type": "string",
                        "description": "`<file>@<base|head>:<n>`: a diff line by its side and line number"
                      },
                      "text": {
                        "type": "string",
                        "description": "The line's text, since its number drifts between rounds"
                      }
                    },
                    "required": [
                      "kind",
                      "id",
                      "text"
                    ],
                    "additionalProperties": false
                  }
                ],
                "description": "What the comment is on"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "change",
                  "question",
                  "suggestion"
                ],
                "description": "What the comment asks for: a task, an answer, or a thought to weigh"
              },
              "text": {
                "type": "string"
              }
            },
            "required": [
              "anchor",
              "kind",
              "text"
            ],
            "additionalProperties": false
          },
          {
            "readOnly": true,
            "type": "object",
            "properties": {
              "anchor": {
                "readOnly": true,
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "finding",
                    "description": "An answer to a finding"
                  },
                  "id": {
                    "type": "string",
                    "description": "The finding's id"
                  }
                },
                "required": [
                  "kind",
                  "id"
                ],
                "additionalProperties": false
              },
              "kind": {
                "type": "string",
                "enum": [
                  "fix",
                  "fine",
                  "explain"
                ],
                "description": "What the answer asks for: a task, nothing, or an answer"
              },
              "text": {
                "description": "Why it is fine, when the reviewer says",
                "type": "string"
              }
            },
            "required": [
              "anchor",
              "kind"
            ],
            "additionalProperties": false
          }
        ]
      }
    }
  },
  "required": [
    "version",
    "verdict",
    "reviewed",
    "read",
    "resolved",
    "comments"
  ],
  "additionalProperties": false
}
