{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://oms.local/schemas/conductor-route.schema.json",
  "title": "OMS deterministic conductor route",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "decision_id",
    "operation_nonce",
    "run_id",
    "ticket_id",
    "ticket_version",
    "ticket_attempt",
    "ticket_state",
    "policy_digest",
    "gate_digest",
    "action",
    "eligible_role_ids",
    "evidence_paths",
    "manual_start_required",
    "provider_started",
    "reason"
  ],
  "properties": {
    "schema_version": { "const": 1 },
    "decision_id": { "type": "string", "pattern": "^decision-[a-f0-9]{48}$" },
    "operation_nonce": { "type": "string", "pattern": "^route-[a-f0-9]{48}$" },
    "run_id": { "type": "string", "pattern": "^run-[a-f0-9]{48}$" },
    "ticket_id": { "type": ["string", "null"], "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$" },
    "ticket_version": { "type": ["integer", "null"], "minimum": 0 },
    "ticket_attempt": { "type": ["integer", "null"], "minimum": 1 },
    "ticket_state": { "type": ["string", "null"], "enum": ["pending", "leased", "running", "verifying", "retryable", "parked", "blocked", null] },
    "policy_digest": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
    "gate_digest": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" },
    "action": { "type": "string", "enum": ["human-start-required", "await-native-hook", "wait-resume", "human-hold", "queue-empty"] },
    "eligible_role_ids": {
      "type": "array",
      "maxItems": 2,
      "items": { "type": "string", "enum": ["oms.ticket-executor", "oms.goal-long-executor"] }
    },
    "evidence_paths": {
      "type": "array",
      "maxItems": 8,
      "items": { "type": "string", "pattern": "^/", "maxLength": 4096 }
    },
    "manual_start_required": { "type": "boolean" },
    "provider_started": { "const": false },
    "reason": { "type": "string", "minLength": 1, "maxLength": 256 }
  }
}
