{
  "schema_version": 1,
  "diagram_type": "sequence",
  "meta": {
    "title": "iSpeed.my — Assisted / Privileged Order Flow",
    "subtitle": "Staff privileged login and assisted order placement",
    "output": "ispeed-assisted-order.html",
    "viewBox": [1080, 560],
    "column_fit": "spread",
    "animation": "trace",
    "quality_profile": "showcase",
    "views": [
      { "id": "login", "label": "Privileged Login", "focus": ["staff", "web-api", "vbroker", "session-db"], "note": "Key validation and privileged session" },
      { "id": "order", "label": "Assisted Order", "focus": ["staff", "web-api", "ors", "session-db"], "note": "Back-office order to ORS" },
      { "id": "full-flow", "label": "Full Flow", "focus": ["staff", "web-api", "vbroker", "session-db", "ors"], "note": "Complete assisted order lifecycle" }
    ]
  },
  "participants": [
    { "id": "staff", "type": "external", "label": "CS Staff", "sublabel": "back office" },
    { "id": "web-api", "type": "backend", "label": "Web API", "sublabel": "rt-mx-web-api" },
    { "id": "vbroker", "type": "backend", "label": "VBroker API", "sublabel": "/general/config_values" },
    { "id": "session-db", "type": "database", "label": "Auth DB", "sublabel": "USER_SESSION" },
    { "id": "ors", "type": "external", "label": "ORS", "sublabel": "order routing" }
  ],
  "segments": [
    { "from": 150, "to": 295, "label": "Privileged Login" },
    { "from": 305, "to": 505, "label": "Assisted Order" }
  ],
  "messages": [
    { "id": "ao1", "from": "staff", "to": "web-api", "y": 160, "label": "PriviledgedLogin", "variant": "emphasis" },
    { "id": "ao2", "from": "web-api", "to": "vbroker", "y": 190, "label": "/general/config_values", "variant": "default" },
    { "id": "ao3", "from": "vbroker", "to": "web-api", "y": 220, "label": "assistedOrderKey", "variant": "return" },
    { "id": "ao4", "from": "web-api", "to": "session-db", "y": 250, "label": "create PRIVILEDGED session", "variant": "security" },
    { "id": "ao5", "from": "session-db", "to": "web-api", "y": 280, "label": "session ID", "variant": "return" },
    { "id": "ao6", "from": "web-api", "to": "staff", "y": 310, "label": "JSESSIONID + accounts", "variant": "return" },
    { "id": "ao7", "from": "staff", "to": "web-api", "y": 340, "label": "PlaceNewOrderBO", "variant": "emphasis" },
    { "id": "ao8", "from": "web-api", "to": "ors", "y": 370, "label": "/PlaceOrder/1.0.0", "variant": "dashed" },
    { "id": "ao9", "from": "ors", "to": "web-api", "y": 400, "label": "order ack", "variant": "return" },
    { "id": "ao10", "from": "web-api", "to": "session-db", "y": 430, "label": "update order summary", "variant": "default" },
    { "id": "ao11", "from": "web-api", "to": "staff", "y": 460, "label": "assisted order result", "variant": "return" }
  ],
  "activations": [
    { "participant": "web-api", "from": 155, "to": 475, "type": "backend" },
    { "participant": "vbroker", "from": 185, "to": 230, "type": "backend" },
    { "participant": "session-db", "from": 245, "to": 440, "type": "database" },
    { "participant": "ors", "from": 365, "to": 410, "type": "external" }
  ],
  "cards": [
    {
      "dot": "emerald",
      "title": "Privileged Session",
      "items": [
        "user_stage = PRIVILEDGED vs NORMAL",
        "Accepted by all order and account services",
        "Sets orderChannel = AssistedTrade"
      ]
    },
    {
      "dot": "violet",
      "title": "Access Key",
      "items": [
        "assistedOrderKey is a vb_config value",
        "Read via /general/config_values",
        "Failure returns EGN0003"
      ]
    },
    {
      "dot": "rose",
      "title": "Back-Office Path",
      "items": [
        "PlaceNewOrderBO / CancelOrderBO route to ORS",
        "Normal orders persist to PostgreSQL, not ORS",
        "ORS has primary/secondary failover"
      ]
    }
  ]
}
