{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.kapiworks.com/schemas/support-1.json",
  "title": "Kapi Works support (support.json)",
  "description": "support.json: where each answer key and fact comes from, quoted word for word from its source.",
  "type": "object",
  "required": [
    "schema",
    "items"
  ],
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "description": "This file's schema, https://docs.kapiworks.com/schemas/support-1.json, so editors check the file as you type. Kapi ignores it."
    },
    "schema": {
      "const": "kapi.works.support/1",
      "description": "The format, kapi.works.support/1."
    },
    "items": {
      "type": "array",
      "items": {
        "description": "An answer key or fact, and the passage that supports it.",
        "type": "object",
        "required": [
          "for",
          "source",
          "quote"
        ],
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A schema address for editors. Kapi ignores it."
          },
          "for": {
            "type": "string",
            "anyOf": [
              {
                "pattern": "^(?=.{1,128}$)[a-z0-9][a-z0-9_-]*(?:\\.[a-z0-9][a-z0-9_-]*)*$"
              },
              {
                "pattern": "^[a-z0-9][a-z0-9-]{0,63}$"
              }
            ],
            "description": "The question ID or text ID it supports."
          },
          "source": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$",
            "description": "The source's SHA-256, as in kapi-works.json's sources."
          },
          "unit": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",
            "description": "The ID of the part of the source the quote is from, such as u2-1."
          },
          "quote": {
            "type": "string",
            "maxLength": 2000,
            "pattern": "\\S",
            "description": "The passage, word for word, up to 2,000 characters."
          }
        }
      },
      "description": "One item for each answer key or fact."
    }
  }
}
