{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Onboarding Run State",
  "type": "object",
  "required": ["run_id", "kit_id", "kit_version", "learner", "journey_id", "created_at", "updated_at", "steps"],
  "properties": {
    "run_id": {"type": "string"},
    "kit_id": {"type": "string"},
    "kit_version": {"type": "string"},
    "journey_id": {"type": "string"},
    "created_at": {"type": "string"},
    "updated_at": {"type": "string"},
    "learner": {
      "type": "object",
      "required": ["name", "role", "onboarding_date", "mentor"],
      "properties": {
        "name": {"type": "string"},
        "role": {"type": "string"},
        "onboarding_date": {"type": "string"},
        "mentor": {"type": "string"}
      }
    },
    "steps": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "required": ["status"],
        "properties": {
          "status": {"enum": ["not_started", "in_progress", "blocked", "completed"]},
          "completed_at": {"type": "string"},
          "evidence": {"type": "string"},
          "blocker": {"type": "string"}
        }
      }
    },
    "questions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "asked_at": {"type": "string"},
          "question": {"type": "string"},
          "answer_status": {"enum": ["answered", "unresolved", "escalated"]},
          "citations": {"type": "array", "items": {"type": "string"}}
        }
      }
    }
  }
}
