{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://oms.local/schemas/conductor-dispatch-preparation.schema.json",
  "title": "OMS conductor dispatch preparation",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "goal_id",
    "goal_version",
    "ticket_id",
    "expected_ticket_version",
    "ticket_content_sha256",
    "attempt",
    "role_id",
    "acceptance_criteria",
    "evidence_requirements",
    "task_body",
    "operation_nonce"
  ],
  "properties": {
    "goal_id": { "type": "string", "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$" },
    "goal_version": { "type": "integer", "minimum": 0 },
    "ticket_id": { "type": "string", "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$" },
    "expected_ticket_version": { "type": "integer", "minimum": 0 },
    "ticket_content_sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
    "attempt": { "type": "integer", "minimum": 1, "maximum": 3 },
    "role_id": { "enum": ["oms.ticket-executor", "oms.goal-long-executor"] },
    "acceptance_criteria": {
      "type": "array",
      "minItems": 1,
      "maxItems": 32,
      "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
    },
    "evidence_requirements": {
      "type": "array",
      "minItems": 1,
      "maxItems": 32,
      "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
    },
    "task_body": { "type": "string", "minLength": 1, "maxLength": 32768 },
    "operation_nonce": {
      "type": "string",
      "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
    }
  }
}
