{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://othmaneblial.github.io/pdf-editor-offline/trust-lab/schemas/v1/accessibility-inspection.schema.json",
  "title": "PDF Editor Offline accessibility inspection",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "schema_version", "source_sha256", "audit_sha256", "content_included", "automated_remediation", "pdf_ua_conformance_claim", "summary", "inventory", "checks"],
  "properties": {
    "schema": {"const": "pdf-editor-offline.accessibility-inspection"},
    "schema_version": {"const": "1.0.0"},
    "source_sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"},
    "audit_sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"},
    "content_included": {"const": false},
    "automated_remediation": {"const": false},
    "pdf_ua_conformance_claim": {"const": false},
    "summary": {
      "type": "object",
      "additionalProperties": false,
      "required": ["status", "total_pages", "pages_scanned", "partial", "checks_passed", "checks_needing_attention", "checks_requiring_manual_review", "high_priority_issues"],
      "properties": {
        "status": {"enum": ["needs_attention", "manual_review"]},
        "total_pages": {"type": "integer", "minimum": 0},
        "pages_scanned": {"type": "integer", "minimum": 0},
        "partial": {"type": "boolean"},
        "checks_passed": {"type": "integer", "minimum": 0},
        "checks_needing_attention": {"type": "integer", "minimum": 0},
        "checks_requiring_manual_review": {"type": "integer", "minimum": 0},
        "high_priority_issues": {"type": "integer", "minimum": 0}
      }
    },
    "inventory": {
      "type": "object",
      "additionalProperties": false,
      "required": ["language", "tags", "reading_order", "headings", "images", "bookmarks", "tables", "forms"],
      "properties": {
        "language": {"type": "object", "additionalProperties": false, "required": ["present", "valid_format", "value"], "properties": {"present": {"type": "boolean"}, "valid_format": {"type": "boolean"}, "value": {"type": ["string", "null"], "maxLength": 64}}},
        "tags": {"$ref": "#/$defs/countMapWithPresent"},
        "reading_order": {"$ref": "#/$defs/countMap"},
        "headings": {"$ref": "#/$defs/countMap"},
        "images": {"$ref": "#/$defs/countMap"},
        "bookmarks": {"$ref": "#/$defs/countMap"},
        "tables": {"$ref": "#/$defs/countMap"},
        "forms": {"$ref": "#/$defs/countMap"}
      }
    },
    "checks": {
      "type": "array",
      "minItems": 8,
      "maxItems": 8,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "title", "status", "severity", "summary", "count", "page_hints", "guidance"],
        "properties": {
          "id": {"enum": ["document-language", "tag-tree", "reading-order", "headings", "image-alternatives", "bookmarks", "tables", "form-labels"]},
          "title": {"type": "string", "minLength": 1, "maxLength": 80},
          "status": {"enum": ["pass", "needs_attention", "manual_review", "not_applicable"]},
          "severity": {"enum": ["high", "medium", "low", "info"]},
          "summary": {"type": "string", "minLength": 1, "maxLength": 240},
          "count": {"type": "integer", "minimum": 0},
          "page_hints": {"type": "array", "maxItems": 20, "items": {"type": "integer", "minimum": 1}},
          "guidance": {"type": "array", "minItems": 1, "maxItems": 4, "items": {"type": "string", "minLength": 1, "maxLength": 240}}
        }
      }
    }
  },
  "$defs": {
    "countMap": {
      "type": "object",
      "minProperties": 1,
      "additionalProperties": {"type": "integer", "minimum": 0}
    },
    "countMapWithPresent": {
      "type": "object",
      "required": ["present"],
      "properties": {"present": {"type": "boolean"}},
      "additionalProperties": {"oneOf": [{"type": "boolean"}, {"type": "integer", "minimum": 0}]}
    }
  }
}
