{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://okstra.dev/schemas/convergence-round-results-v1.0.json",
  "title": "OKSTRA Convergence Round Results (v1.0)",
  "type": "object",
  "required": ["schemaVersion", "round", "dispatches", "votesByFinding"],
  "additionalProperties": false,
  "properties": {
    "schemaVersion": { "const": "1.0" },
    "round": { "type": "integer", "minimum": 1 },
    "dispatches": {
      "type": "array",
      "items": { "$ref": "#/$defs/DispatchResult" }
    },
    "votesByFinding": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "additionalProperties": { "$ref": "#/$defs/Vote" }
      }
    }
  },
  "$defs": {
    "DispatchResult": {
      "type": "object",
      "required": ["worker", "status", "durationMs"],
      "additionalProperties": false,
      "properties": {
        "worker": { "type": "string", "pattern": "\\S" },
        "status": { "enum": ["completed", "timeout", "error", "not-run"] },
        "durationMs": { "type": "integer", "minimum": 0 }
      }
    },
    "Vote": {
      "type": "object",
      "required": ["verdict", "explanation"],
      "additionalProperties": false,
      "properties": {
        "verdict": { "enum": ["agree", "disagree", "supplement", "verification-error", "unverifiable"] },
        "disagreeBasis": { "enum": ["counter-evidence", "burden-not-met", null] },
        "explanation": { "type": "string", "pattern": "\\S" }
      },
      "allOf": [
        {
          "if": {
            "properties": { "verdict": { "enum": ["agree", "supplement", "verification-error", "unverifiable"] } }
          },
          "then": {
            "properties": { "disagreeBasis": { "enum": [null] } }
          }
        }
      ]
    }
  }
}
