{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://medgauge.org/schemas/0.1.0/grading-reference.schema.json",
  "title": "grading-reference",
  "description": "One external clause that a verifier checkpoint is built on: the standard, its locator, and the rule the checkpoint applies. A reference is listed only once a frozen benchmark version uses it and the clause has been checked on the original source.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^gr-[a-z0-9-]+$"
    },
    "benchmarks": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "pattern": "^bm-[a-z0-9-]+$"
      },
      "description": "Frozen benchmark families whose checkpoints apply this reference"
    },
    "standard": {
      "type": "string",
      "minLength": 1,
      "description": "Standards registry id"
    },
    "locator": {
      "type": "string",
      "minLength": 1,
      "description": "Clause, recommendation number, table or section in the standard"
    },
    "checked_on": {
      "type": "string",
      "format": "date"
    },
    "when": {
      "type": "string",
      "minLength": 1,
      "description": "Condition under which the checkpoint applies"
    },
    "rule": {
      "type": "string",
      "minLength": 1,
      "description": "What the artifact field must or must not contain"
    },
    "polarity": {
      "type": "string",
      "enum": [
        "must",
        "must_not",
        "should",
        "should_not"
      ]
    },
    "check_form": {
      "type": "string",
      "enum": [
        "program",
        "checkpoint"
      ]
    },
    "veto": {
      "type": "boolean",
      "description": "true = a violation fails the task outright"
    },
    "capabilities": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[A-EX]\\.\\d{1,2}$"
      }
    },
    "jurisdiction": {
      "type": "string",
      "description": "For references whose sources differ by region: the regional standard the task must state"
    },
    "version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$"
    }
  },
  "required": [
    "id",
    "benchmarks",
    "standard",
    "locator",
    "checked_on",
    "when",
    "rule",
    "polarity",
    "check_form",
    "veto",
    "version"
  ]
}
