{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://oms.local/schemas/conductor-waiter-payload.schema.json",
  "title": "OMS conductor waiter generation payload",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "waiter_id",
    "conductor_session_id",
    "launch_generation",
    "pane_id",
    "conductor_process",
    "waiter_process",
    "armed_by",
    "armed_at",
    "notification_id",
    "failure_code",
    "terminal_at",
    "updated_at"
  ],
  "properties": {
    "waiter_id": { "type": "string", "pattern": "^waiter-[a-f0-9]{48}$" },
    "conductor_session_id": { "type": "string", "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$" },
    "launch_generation": { "type": "integer", "minimum": 1 },
    "pane_id": { "type": "string", "pattern": "^%[0-9]{1,10}$" },
    "conductor_process": {
      "type": "object",
      "additionalProperties": false,
      "required": ["process_id", "boot_id", "start_ticks"],
      "properties": {
        "process_id": { "type": "integer", "minimum": 1 },
        "boot_id": {
          "type": "string",
          "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
        },
        "start_ticks": { "type": "string", "pattern": "^[1-9][0-9]*$" }
      }
    },
    "waiter_process": {
      "type": "object",
      "additionalProperties": false,
      "required": ["process_id", "boot_id", "start_ticks"],
      "properties": {
        "process_id": { "type": "integer", "minimum": 1 },
        "boot_id": {
          "type": "string",
          "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
        },
        "start_ticks": { "type": "string", "pattern": "^[1-9][0-9]*$" }
      }
    },
    "armed_by": { "enum": ["SessionStart", "Stop"] },
    "armed_at": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$" },
    "notification_id": {
      "type": ["string", "null"],
      "pattern": "^notice-[a-f0-9]{48}$"
    },
    "failure_code": {
      "type": ["string", "null"],
      "pattern": "^[a-z][a-z0-9-]{0,63}$"
    },
    "terminal_at": {
      "type": ["string", "null"],
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
    },
    "updated_at": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$" }
  }
}
