{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://oms.local/schemas/team-checkpoint.schema.json",
  "title": "Read-only OMS executor-group checkpoint",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema_version", "goal_id", "test_sha256", "delivery_wave"],
  "properties": {
    "schema_version": { "const": 1 },
    "goal_id": { "type": "string", "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$" },
    "test_sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
    "delivery_wave": {
      "type": "object",
      "additionalProperties": false,
      "required": ["wave_id", "kind", "completed_at", "workers"],
      "properties": {
        "wave_id": { "type": "string", "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$" },
        "kind": { "const": "delivery" },
        "completed_at": { "type": "string", "minLength": 20, "maxLength": 24 },
        "workers": {
          "type": "array",
          "minItems": 1,
          "maxItems": 20,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["worker_id", "role", "status", "terminal", "worktree_id", "test_sha256", "evidence_sha256"],
            "properties": {
              "worker_id": { "type": "string", "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$" },
              "role": { "const": "delivery" },
              "status": { "const": "completed" },
              "terminal": { "const": true },
              "worktree_id": { "type": "string", "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$" },
              "test_sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
              "evidence_sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
            }
          }
        }
      }
    }
  }
}
