{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "ace://schemas/swarm-handoff/1.0.0",
  "title": "ACE Swarm Handoff",
  "type": "object",
  "required": [
    "handoff_id",
    "timestamp_utc",
    "router",
    "task",
    "context",
    "acceptance_criteria",
    "verification",
    "return_payload_contract"
  ],
  "additionalProperties": false,
  "properties": {
    "handoff_id": {
      "type": "string",
      "minLength": 1
    },
    "timestamp_utc": {
      "type": "string",
      "format": "date-time"
    },
    "router": {
      "type": "object",
      "required": [
        "from",
        "via",
        "to"
      ],
      "additionalProperties": false,
      "properties": {
        "from": {"type": "string", "minLength": 1},
        "via": {"type": "string", "minLength": 1},
        "to": {"type": "string", "minLength": 1}
      }
    },
    "task": {
      "type": "object",
      "required": [
        "title",
        "type",
        "priority",
        "owner",
        "depends_on",
        "scope"
      ],
      "additionalProperties": false,
      "properties": {
        "title": {"type": "string", "minLength": 1},
        "type": {"type": "string", "enum": ["venture", "ux", "engineering", "mixed"]},
        "priority": {"type": "string", "enum": ["P0", "P1", "P2"]},
        "owner": {"type": "string", "minLength": 1},
        "depends_on": {"type": "array", "items": {"type": "string"}},
        "scope": {"type": "string", "minLength": 1}
      }
    },
    "context": {
      "type": "object",
      "required": [
        "business_requirement",
        "design_constraint",
        "engineering_constraint",
        "directive"
      ],
      "additionalProperties": false,
      "properties": {
        "business_requirement": {"type": "string"},
        "design_constraint": {"type": "string"},
        "engineering_constraint": {"type": "string"},
        "directive": {"type": "string", "minLength": 1}
      }
    },
    "acceptance_criteria": {
      "type": "array",
      "minItems": 1,
      "items": {"type": "string", "minLength": 1}
    },
    "deliverables": {
      "type": "array",
      "items": {"type": "string"}
    },
    "verification": {
      "type": "object",
      "required": [
        "required_evidence",
        "review_check",
        "status"
      ],
      "additionalProperties": false,
      "properties": {
        "required_evidence": {
          "type": "array",
          "minItems": 1,
          "items": {"type": "string", "minLength": 1}
        },
        "review_check": {"type": "string", "minLength": 1},
        "status": {"type": "string", "enum": ["pending", "in_progress", "pass", "fail"]}
      }
    },
    "risks": {
      "type": "array",
      "items": {"type": "string"}
    },
    "open_questions": {
      "type": "array",
      "items": {"type": "string"}
    },
    "lessons_hook": {
      "type": "object",
      "required": [
        "on_correction_update",
        "rule_format"
      ],
      "additionalProperties": false,
      "properties": {
        "on_correction_update": {"type": "string", "minLength": 1},
        "rule_format": {"type": "string", "minLength": 1}
      }
    },
    "return_payload_contract": {
      "type": "object",
      "required": [
        "must_include"
      ],
      "additionalProperties": false,
      "properties": {
        "must_include": {
          "type": "array",
          "minItems": 1,
          "items": {"type": "string", "minLength": 1}
        }
      }
    }
  }
}
