{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/mmerterden/multi-agent-pipeline/pipeline/schemas/answer-result.schema.json",
  "title": "Answer result",
  "description": "What `answer-question.mjs` prints, and POST /v1/runs/{id}/answer returns, once an answer is recorded: the lastAnswer written to the run's state in the same write that cleared pendingQuestion.",
  "type": "object",
  "additionalProperties": false,
  "required": ["contractVersion", "answered"],
  "properties": {
    "contractVersion": {
      "type": "string",
      "pattern": "^1\\.[0-9]+\\.[0-9]+$",
      "x-sensitivity": "none"
    },
    "answered": {
      "type": "object",
      "additionalProperties": false,
      "required": ["questionId", "stepId", "optionIds", "answeredAt"],
      "x-sensitivity": "none",
      "properties": {
        "questionId": { "type": "string" },
        "stepId": { "type": "string" },
        "optionIds": { "type": "array", "minItems": 1, "items": { "type": "string" } },
        "answeredAt": { "type": "string", "format": "date-time" }
      }
    }
  }
}
