{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://emendatio.reverdin.eu/api/v1/schema/summa-corrections.json",
  "title": "Summa Theologiae OCR corrections",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "work",
    "total",
    "corrections"
  ],
  "properties": {
    "work": {
      "type": "string",
      "const": "summa"
    },
    "total": {
      "type": "integer",
      "minimum": 0
    },
    "corrections": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "part",
          "q",
          "a",
          "occ",
          "from",
          "to",
          "type",
          "page",
          "leaf",
          "bbox",
          "tome",
          "source",
          "image",
          "viewer"
        ],
        "properties": {
          "part": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5
          },
          "q": {
            "type": "integer",
            "minimum": 1
          },
          "a": {
            "type": "integer",
            "minimum": 0
          },
          "occ": {
            "type": "integer",
            "minimum": 1
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "type": "string",
            "enum": [
              "lettre",
              "soudure",
              "coupure",
              "omission",
              "ajout",
              "ponctuation",
              "casse",
              "autre"
            ]
          },
          "page": {
            "type": [
              "integer",
              "null"
            ]
          },
          "leaf": {
            "type": "integer",
            "minimum": 0
          },
          "bbox": {
            "type": "array",
            "minItems": 4,
            "maxItems": 4,
            "items": {
              "type": "integer",
              "minimum": 0
            }
          },
          "bbox2": {
            "type": "array",
            "minItems": 4,
            "maxItems": 4,
            "items": {
              "type": "integer",
              "minimum": 0
            }
          },
          "tome": {
            "type": "integer",
            "minimum": 7,
            "maximum": 12
          },
          "source": {
            "type": "object",
            "required": [
              "archive_id",
              "url",
              "ocr"
            ],
            "additionalProperties": false,
            "properties": {
              "archive_id": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "ocr": {
                "type": "string"
              }
            }
          },
          "image": {
            "type": "string",
            "pattern": "^https://iiif\\.archive\\.org/iiif/"
          },
          "image2": {
            "type": "string",
            "pattern": "^https://iiif\\.archive\\.org/iiif/"
          },
          "viewer": {
            "type": "string",
            "pattern": "^https://archive\\.org/details/"
          }
        },
        "dependentRequired": {
          "bbox2": [
            "image2"
          ],
          "image2": [
            "bbox2"
          ]
        }
      }
    }
  }
}
