{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "title": "Versioned paper feedback",
 "type": "object", "additionalProperties": false,
 "required": ["schema_version", "kind", "manuscript", "anchor", "category", "comment"],
 "properties": {
  "schema_version": {"const": "1.0"},
  "kind": {"const": "paper-feedback"},
  "category": {"enum": ["interpretation", "evidence", "methods", "writing", "other"]},
  "comment": {"type": "string", "minLength": 10, "maxLength": 6000},
  "manuscript": {
   "type": "object", "additionalProperties": false,
   "required": ["repository", "commit", "path", "sha256"],
   "properties": {
    "repository": {"type": "string", "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$"},
    "commit": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
    "path": {"type": "string", "pattern": "^CURRENT/", "maxLength": 300},
    "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}
   }
  },
  "anchor": {
   "type": "object", "additionalProperties": false,
   "required": ["start_block_id", "end_block_id", "exact", "prefix", "suffix", "start_offset", "end_offset", "offset_unit"],
   "properties": {
    "start_block_id": {"type": "string", "pattern": "^b-[0-9a-f]{16}(-[0-9]+)?$"},
    "end_block_id": {"type": "string", "pattern": "^b-[0-9a-f]{16}(-[0-9]+)?$"},
    "exact": {"type": "string", "minLength": 3, "maxLength": 3000},
    "prefix": {"type": "string", "maxLength": 80},
    "suffix": {"type": "string", "maxLength": 80},
    "start_offset": {"type": "integer", "minimum": 0},
    "end_offset": {"type": "integer", "minimum": 0},
    "offset_unit": {"const": "utf-16"}
   }
  }
 }
}
