{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "WorkerCompletion",
  "description": "Self-reported worker completion payload emitted by a swarm shard worker.",
  "type": "object",
  "required": ["status"],
  "properties": {
    "status": {
      "type": "string",
      "enum": ["ok", "skipped", "failed"]
    },
    "shard": { "type": "string" },
    "reason": { "type": "string" },
    "commits_made": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["sha"],
        "properties": {
          "sha": { "type": "string", "minLength": 7 },
          "message": { "type": "string" }
        },
        "additionalProperties": true
      }
    }
  },
  "additionalProperties": true,
  "allOf": [
    {
      "if": { "properties": { "status": { "const": "ok" } } },
      "then": {
        "required": ["commits_made"],
        "properties": {
          "commits_made": { "minItems": 1 }
        }
      }
    }
  ]
}
