{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://qazagents.qdev.run/contracts/result-receipt-v1.schema.json",
  "title": "QDev Result Receipt v1",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema_version", "workflow_id", "source_revision", "checked_at", "status", "evidence", "limitations", "next_safe_action"],
  "properties": {
    "schema_version": {"const": "qdev-result-receipt-v1"},
    "workflow_id": {"type": "string", "pattern": "^[a-z0-9-]+$"},
    "source_revision": {"type": "string", "minLength": 1},
    "checked_at": {"type": "string", "format": "date-time"},
    "status": {"enum": ["checked", "skipped", "blocked", "unknown", "needs-human"]},
    "evidence": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["claim", "status", "sources"],
        "properties": {
          "claim": {"type": "string", "minLength": 1},
          "status": {"enum": ["supported", "missing", "stale", "conflicting", "unverifiable"]},
          "sources": {"type": "array", "items": {"type": "string"}}
        }
      }
    },
    "corpus_versions": {"type": "array", "items": {"type": "string"}},
    "covered_claims": {"type": "array", "items": {"type": "string"}},
    "uncovered_claims": {"type": "array", "items": {"type": "string"}},
    "limitations": {"type": "array", "items": {"type": "string"}},
    "next_safe_action": {"type": "string", "minLength": 1},
    "product_receipts": {"type": "array", "items": {"type": "string"}}
  }
}
