{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://oms.local/schemas/trust-report.schema.json",
  "title": "OMS closed UTC daily trust report",
  "description": "Complete sorted trust-run evidence for [utc_date 00:00:00Z, next day 00:00:00Z); eligibility is review-only.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "utc_date",
    "closed_at",
    "policy_version",
    "policy_digest",
    "gate_digest",
    "trust_run_evidence",
    "assessment",
    "review_only"
  ],
  "properties": {
    "schema_version": { "const": 1 },
    "utc_date": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" },
    "closed_at": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T00:00:00\\.000Z$"
    },
    "policy_version": { "type": "integer", "minimum": 1 },
    "policy_digest": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
    "gate_digest": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
    "trust_run_evidence": {
      "type": "array",
      "maxItems": 10000,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["evidence_id", "sha256", "file_name"],
        "properties": {
          "evidence_id": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
          },
          "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
          "file_name": { "type": "string", "maxLength": 69 }
        }
      }
    },
    "assessment": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "matching_runs",
        "passed_runs",
        "pass_rate_basis_points",
        "minimum_matching_runs",
        "required_pass_rate_basis_points"
      ],
      "properties": {
        "status": { "enum": ["manual", "eligible_for_review"] },
        "matching_runs": { "type": "integer", "minimum": 0 },
        "passed_runs": { "type": "integer", "minimum": 0 },
        "pass_rate_basis_points": { "type": "integer", "minimum": 0, "maximum": 10000 },
        "minimum_matching_runs": { "const": 20 },
        "required_pass_rate_basis_points": { "const": 9500 }
      }
    },
    "review_only": { "const": true }
  }
}
