{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.bayanatlabs.com/research/arabic-scene-text-vqa-kit/v0.1/schema.json",
  "title": "Annotated Arabic image record (Bayanat Labs scene-text and visual QA inspection kit v0.1)",
  "description": "One image with its text regions, questions grounded in those regions, source type, capture conditions, people handling, split group and rights. Each right is recorded separately; a missing right is 'not_stated', never assumed.",
  "type": "object",
  "required": ["image_id", "file", "width", "height", "source", "capture_conditions", "people_in_frame", "split_group", "regions", "rights"],
  "$defs": {
    "right": { "type": "string", "enum": ["granted", "not_granted", "not_stated"] },
    "bbox": {
      "type": "array", "items": { "type": "number", "minimum": 0 }, "minItems": 4, "maxItems": 4,
      "description": "[x, y, width, height] in pixels from the top-left corner of the image."
    }
  },
  "properties": {
    "image_id": { "type": "string" },
    "file": { "type": "string", "description": "Path of the image file relative to the record file." },
    "width": { "type": "integer", "minimum": 1 },
    "height": { "type": "integer", "minimum": 1 },
    "description_en": { "type": "string", "description": "What the image shows, in plain words. Describes visible content only." },
    "scene_type": { "type": "string", "description": "For example storefront, road_sign, packaging, menu, product_label, notice, form." },
    "source": {
      "type": "object",
      "required": ["type", "generated"],
      "properties": {
        "type": { "type": "string", "enum": ["field_capture", "client_supplied", "generated"] },
        "generated": { "type": "boolean", "description": "True for any generated or drawn image, so results on real photos can be reported separately." },
        "method": { "type": "string" }
      }
    },
    "capture_conditions": {
      "type": "object",
      "properties": {
        "lighting": { "type": "string", "description": "For example even, daylight, indoor, low_light, backlit." },
        "angle": { "type": "string", "description": "For example frontal, oblique, overhead." },
        "distance": { "type": "string", "enum": ["close", "medium", "far"] },
        "blur": { "type": "string", "enum": ["none", "slight", "strong"] },
        "glare": { "type": "string", "enum": ["none", "partial", "strong"] },
        "occlusion": { "type": "string", "enum": ["none", "partial", "heavy"] }
      }
    },
    "location": {
      "type": "object",
      "description": "Capture location at the granularity agreed in the scope (for example city). Null for generated images.",
      "properties": {
        "country": { "type": ["string", "null"] },
        "city": { "type": ["string", "null"] },
        "note": { "type": "string" }
      }
    },
    "people_in_frame": {
      "type": "object",
      "required": ["present", "handling"],
      "properties": {
        "present": { "type": "boolean" },
        "handling": { "type": "string", "enum": ["not_applicable", "consented", "blurred", "excluded"], "description": "How people in frame were handled under the agreed permissions. Labels never infer identity from appearance." }
      }
    },
    "split_group": { "type": "string", "description": "The store, location, source or recording the image belongs to. All images in one group stay in one split." },
    "regions": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["region_id", "bbox_xywh", "legibility"],
        "properties": {
          "region_id": { "type": "string" },
          "bbox_xywh": { "$ref": "#/$defs/bbox" },
          "transcription": { "type": ["string", "null"], "description": "Text exactly as written, in reading order. Null for non-text regions. Unreadable parts are written [غير مقروء]." },
          "object": { "type": "string", "description": "For non-text regions: what the region shows, for example an arrow." },
          "script": { "type": "string", "enum": ["arabic", "latin", "mixed", "none"] },
          "digits": { "type": "string", "enum": ["eastern", "western", "mixed", "none"] },
          "legibility": { "type": "string", "enum": ["full", "partial", "none"] },
          "note": { "type": "string" }
        }
      }
    },
    "questions": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["question_id", "question_ar", "answerable", "evidence_regions", "tests"],
        "properties": {
          "question_id": { "type": "string" },
          "question_ar": { "type": "string" },
          "question_en": { "type": "string", "description": "English gloss for reviewers. The question to the model is the Arabic one." },
          "answerable": { "type": "boolean" },
          "answer_ar": { "type": ["string", "null"] },
          "answer_en": { "type": ["string", "null"] },
          "unanswerable_reason": { "type": "string", "enum": ["not_present", "not_legible"] },
          "expected_response_ar": { "type": "string", "description": "For unanswerable questions: what a correct response says." },
          "expected_response_en": { "type": "string" },
          "evidence_regions": { "type": "array", "items": { "type": "string" }, "description": "Region IDs that hold the answer, or that show why the question cannot be answered." },
          "tests": { "type": "array", "items": { "type": "string" }, "description": "Error codes from rubric.md this question can catch." }
        }
      }
    },
    "rights": {
      "type": "object",
      "required": ["model_training", "evaluation", "redistribution", "public_display"],
      "properties": {
        "model_training": { "$ref": "#/$defs/right" },
        "evaluation": { "$ref": "#/$defs/right" },
        "redistribution": { "$ref": "#/$defs/right" },
        "public_display": { "$ref": "#/$defs/right" },
        "license": { "type": ["string", "null"] },
        "consent_ref": { "type": ["string", "null"], "description": "Pointer to the permission or consent record. Null when no person or private property needs one." }
      }
    },
    "illustrative": { "type": "boolean", "description": "True for records made up to show the format." }
  }
}
