{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "recordType", "suiteType", "candidateId", "sourceCommit", "gitTree", "scopeSha256", "allPassed", "summary", "tests"],
  "properties": {
    "schemaVersion": {"const": "1.0.0"},
    "recordType": {"const": "candidate-test-results"},
    "suiteType": {"enum": ["exact-commit", "pull-payments", "fail-closed-apis", "pause-safe-exits", "protected-decision-inputs"]},
    "candidateId": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$"},
    "sourceCommit": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
    "gitTree": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
    "scopeSha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
    "allPassed": {"const": true},
    "summary": {
      "type": "object", "additionalProperties": false,
      "required": ["total", "passed", "failed", "combinedLogSha256"],
      "properties": {
        "total": {"type": "integer", "minimum": 1},
        "passed": {"type": "integer", "minimum": 1},
        "failed": {"const": 0},
        "combinedLogSha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}
      }
    },
    "tests": {
      "type": "array", "minItems": 1, "uniqueItems": true,
      "items": {
        "type": "object", "additionalProperties": false,
        "required": ["testId", "passed", "assertionCount", "logSha256"],
        "properties": {
          "testId": {"type": "string", "pattern": "^[a-z0-9][a-z0-9._:-]{2,127}$"},
          "passed": {"const": true},
          "assertionCount": {"type": "integer", "minimum": 1},
          "logSha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}
        }
      }
    }
  }
}
