{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "ocr_stats.v1",
  "type": "object",
  "properties": {
    "schema_version": { "const": "ocr_stats.v1" },
    "total_events": { "type": "integer" },
    "total_runs": { "type": "integer" },
    "success_count": { "type": "integer" },
    "failure_count": { "type": "integer" },
    "success_rate": { "type": "number" },
    "p50_ms": { "type": ["integer", "null"] },
    "p90_ms": { "type": ["integer", "null"] },
    "p99_ms": { "type": ["integer", "null"] },
    "max_ms": { "type": ["integer", "null"] },
    "by_engine": { "type": "object", "additionalProperties": { "type": "integer" } },
    "by_doc": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "doc_id": { "type": "string" },
          "failure_count": { "type": "integer" },
          "success_count": { "type": "integer" },
          "p90_ms": { "type": ["integer", "null"] }
        }
      }
    }
  },
  "required": ["schema_version", "total_events", "total_runs", "success_count", "failure_count", "success_rate"]
}
