{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "SRC Handwriting Annotation Schema",
  "type": "object",
  "required": [
    "page_id",
    "capture",
    "lines"
  ],
  "properties": {
    "page_id": {
      "type": "string"
    },
    "student": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "capture": {
      "type": "object",
      "required": [
        "source",
        "timestamp"
      ],
      "properties": {
        "source": {
          "type": "string",
          "enum": [
            "camera",
            "scanner",
            "upload"
          ]
        },
        "device": {
          "type": "string"
        },
        "dpi": {
          "type": "integer",
          "minimum": 72
        },
        "lighting": {
          "type": "string",
          "enum": [
            "ok",
            "dim",
            "backlit",
            "shadowed"
          ]
        },
        "skew_deg": {
          "type": "number"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "meta": {
      "type": "object",
      "properties": {
        "language": {
          "type": "string",
          "default": "pt-BR"
        },
        "teacher_id": {
          "type": "string"
        },
        "notes": {
          "type": "string"
        }
      }
    },
    "lines": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "y_top",
          "y_bottom"
        ],
        "properties": {
          "x_left": {
            "type": "number"
          },
          "x_right": {
            "type": "number"
          },
          "y_top": {
            "type": "number"
          },
          "y_bottom": {
            "type": "number"
          },
          "text_gt": {
            "type": "string"
          },
          "suggestions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 5
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          }
        }
      }
    }
  }
}