{
  "schema_version": 1,
  "diagram_type": "sequence",
  "meta": {
    "title": "iSpeed.my — View All Orders Flow",
    "subtitle": "Order book retrieval with status polling",
    "output": "ispeed-view-orders.html",
    "viewBox": [1080, 840],
    "column_fit": "spread",
    "animation": "trace",
    "quality_profile": "showcase",
    "views": [
      { "id": "load-orders", "label": "Load Orders", "focus": ["user", "app", "mobile-api", "web-api"], "note": "Initial order book fetch" },
      { "id": "status-poll", "label": "Status Polling", "focus": ["app", "web-api", "vbroker"], "note": "Real-time order status updates" },
      { "id": "full-flow", "label": "Full Flow", "focus": ["user", "app", "mobile-api", "web-api", "session", "vbroker"], "note": "Complete order view lifecycle" }
    ]
  },
  "participants": [
    { "id": "user", "type": "external", "label": "User", "sublabel": "Trader" },
    { "id": "app", "type": "frontend", "label": "React Native App", "sublabel": "Expo SDK 56" },
    { "id": "mobile-api", "type": "backend", "label": "Mobile API", "sublabel": "rt-mx-mobile-api" },
    { "id": "web-api", "type": "backend", "label": "Web API", "sublabel": "rt-mx-web-api" },
    { "id": "session", "type": "database", "label": "AuthConn", "sublabel": "Redis sessions" },
    { "id": "vbroker", "type": "external", "label": "VBroker API", "sublabel": "Back office" }
  ],
  "segments": [
    { "from": 155, "to": 265, "label": "Session Setup" },
    { "from": 275, "to": 445, "label": "Fetch Orders" },
    { "from": 455, "to": 745, "label": "Status Check" }
  ],
  "messages": [
    { "id": "v1", "from": "user", "to": "app", "y": 160, "label": "Open orders tab", "variant": "default" },
    { "id": "v2", "from": "app", "to": "mobile-api", "y": 190, "label": "POST /mobile-exs/member (login)", "variant": "emphasis" },
    { "id": "v3", "from": "mobile-api", "to": "session", "y": 220, "label": "validate + store session", "variant": "security" },
    { "id": "v4", "from": "mobile-api", "to": "app", "y": 250, "label": "session ID", "variant": "return" },
    { "id": "v5", "from": "app", "to": "mobile-api", "y": 280, "label": "POST ViewAllOrderService", "variant": "emphasis" },
    { "id": "v6", "from": "mobile-api", "to": "web-api", "y": 310, "label": "ViewAllOrderService", "variant": "default" },
    { "id": "v7", "from": "web-api", "to": "session", "y": 340, "label": "validate session", "variant": "security" },
    { "id": "v8", "from": "session", "to": "web-api", "y": 370, "label": "session valid", "variant": "return" },
    { "id": "v9", "from": "web-api", "to": "vbroker", "y": 400, "label": "viewAllOrders", "variant": "emphasis" },
    { "id": "v10", "from": "vbroker", "to": "web-api", "y": 430, "label": "orderList[]", "variant": "return" },
    { "id": "v11", "from": "web-api", "to": "mobile-api", "y": 460, "label": "orders JSON", "variant": "return" },
    { "id": "v12", "from": "mobile-api", "to": "app", "y": 490, "label": "orders data", "variant": "return" },
    { "id": "v13", "from": "app", "to": "user", "y": 520, "label": "Render order list", "variant": "return" },
    { "id": "v14", "from": "user", "to": "app", "y": 550, "label": "Pull to refresh", "variant": "default" },
    { "id": "v15", "from": "app", "to": "mobile-api", "y": 580, "label": "POST OrderStatus", "variant": "emphasis" },
    { "id": "v16", "from": "mobile-api", "to": "web-api", "y": 610, "label": "ViewOrderStatusService", "variant": "default" },
    { "id": "v17", "from": "web-api", "to": "vbroker", "y": 640, "label": "viewAllOrders (status)", "variant": "emphasis" },
    { "id": "v18", "from": "vbroker", "to": "web-api", "y": 670, "label": "ordCount + orderList", "variant": "return" },
    { "id": "v19", "from": "web-api", "to": "app", "y": 700, "label": "updated orders", "variant": "return" },
    { "id": "v20", "from": "app", "to": "user", "y": 730, "label": "Refresh order list", "variant": "return" }
  ],
  "activations": [
    { "participant": "app", "from": 155, "to": 740, "type": "frontend" },
    { "participant": "mobile-api", "from": 185, "to": 710, "type": "backend" },
    { "participant": "web-api", "from": 310, "to": 710, "type": "backend" },
    { "participant": "session", "from": 215, "to": 380, "type": "database" },
    { "participant": "vbroker", "from": 395, "to": 680, "type": "external" }
  ],
  "cards": [
    {
      "dot": "emerald",
      "title": "Order Book",
      "items": [
        "ViewAllOrderService returns full order list per account + exchange",
        "ViewOrderStatusService returns order count + status list",
        "Both route to VBroker viewAllOrders endpoint"
      ]
    },
    {
      "dot": "violet",
      "title": "Account Filtering",
      "items": [
        "Session validates account ownership",
        "MXHelper.isAllowedToViewOrders checks account state",
        "Inactive accounts are blocked from viewing orders"
      ]
    },
    {
      "dot": "cyan",
      "title": "Market Routing",
      "items": [
        "Bursa orders use vbAPI.viewAllOrders",
        "Foreign market orders use vbAPI.viewAllOrders_ft",
        "Exchange parameter determines routing"
      ]
    }
  ]
}