{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://humanindexed.work/schemas/evidence-receipt-v0.1.json",
  "title": "HIWP Evidence Receipt v0.1",
  "type": "object",
  "additionalProperties": false,
  "required": ["protocolVersion", "receiptId", "manifestHash", "subjectId", "assessorId", "task", "conditions", "timing", "result", "interventions", "failures", "integrity"],
  "properties": {
    "protocolVersion": {"const": "0.1"}, "receiptId": {"type": "string"}, "manifestHash": {"type": "string"},
    "subjectId": {"type": "string"}, "assessorId": {"type": "string"},
    "task": {"type": "object", "required": ["taskId", "taskVersion", "population", "inputDescriptor"], "properties": {
      "taskId": {"type": "string"}, "taskVersion": {"type": "string"}, "population": {"type": "string"},
      "inputDescriptor": {"type": "string"}, "inputHash": {"type": "string"}
    }},
    "conditions": {"type": "object", "required": ["comparisonCondition", "autonomy", "risk"], "properties": {
      "comparisonCondition": {"enum": ["conventional", "generic-ai", "declared-hcu", "substitution", "clean-transfer"]},
      "autonomy": {"enum": ["A0", "A1", "A2", "A3", "A4"]}, "risk": {"enum": ["R0", "R1", "R2", "R3", "R4"]},
      "dependencyVersions": {"type": "array", "items": {"type": "string"}}
    }},
    "timing": {"type": "object", "required": ["startedAt", "endedAt", "humanAttentionSeconds"], "properties": {
      "startedAt": {"type": "string", "format": "date-time"}, "endedAt": {"type": "string", "format": "date-time"},
      "humanAttentionSeconds": {"type": "integer", "minimum": 0}, "reviewSeconds": {"type": "integer", "minimum": 0},
      "exceptionSeconds": {"type": "integer", "minimum": 0}
    }},
    "result": {"type": "object", "required": ["outputHash", "accepted", "rubricVersion", "scores"], "properties": {
      "outputHash": {"type": "string"}, "accepted": {"type": "boolean"}, "rubricVersion": {"type": "string"},
      "scores": {"type": "object"}, "cost": {"type": "number", "minimum": 0}, "currency": {"type": "string"}
    }},
    "interventions": {"type": "array", "items": {"type": "object"}},
    "failures": {"type": "array", "items": {"type": "object", "required": ["severity", "category", "contained"], "properties": {
      "severity": {"enum": ["none", "minor", "material", "serious", "critical"]}, "category": {"type": "string"},
      "contained": {"type": "boolean"}, "recoverySeconds": {"type": "integer", "minimum": 0}
    }}},
    "deviations": {"type": "array", "items": {"type": "string"}},
    "integrity": {"type": "object", "required": ["issuedAt", "proofType", "proofValue"], "properties": {
      "issuedAt": {"type": "string", "format": "date-time"}, "proofType": {"type": "string"}, "proofValue": {"type": "string"}
    }}
  }
}
