{
  "schema_version": 1,
  "diagram_type": "sequence",
  "meta": {
    "title": "iSpeed.my — Notifications & Alerts Flow",
    "subtitle": "FCM registration, inbox retrieval, and stock alerts",
    "output": "ispeed-notifications.html",
    "viewBox": [1080, 680],
    "column_fit": "spread",
    "animation": "trace",
    "quality_profile": "showcase",
    "views": [
      { "id": "register", "label": "Register Device", "focus": ["app", "fcm", "mobile-api"], "note": "FCM token and channel subscription" },
      { "id": "inbox", "label": "Inbox", "focus": ["user", "app", "mobile-api", "vbroker"], "note": "Notification list retrieval" },
      { "id": "full-flow", "label": "Full Flow", "focus": ["user", "app", "fcm", "mobile-api", "vbroker", "alert-engine"], "note": "Complete notifications and alerts lifecycle" }
    ]
  },
  "participants": [
    { "id": "user", "type": "external", "label": "User", "sublabel": "Trader" },
    { "id": "app", "type": "frontend", "label": "React Native App", "sublabel": "Expo SDK 56" },
    { "id": "fcm", "type": "cloud", "label": "FCM Push", "sublabel": "Firebase" },
    { "id": "mobile-api", "type": "backend", "label": "Mobile API", "sublabel": "rt-mx-mobile-api" },
    { "id": "vbroker", "type": "backend", "label": "VBroker API", "sublabel": "/inbox" },
    { "id": "alert-engine", "type": "external", "label": "Alert Engine", "sublabel": "alerts service" }
  ],
  "segments": [
    { "from": 150, "to": 265, "label": "Register Device" },
    { "from": 275, "to": 445, "label": "Inbox" },
    { "from": 455, "to": 625, "label": "Stock Alerts" }
  ],
  "messages": [
    { "id": "n1", "from": "app", "to": "fcm", "y": 160, "label": "getToken", "variant": "dashed" },
    { "id": "n2", "from": "fcm", "to": "app", "y": 190, "label": "device token", "variant": "return" },
    { "id": "n3", "from": "app", "to": "mobile-api", "y": 220, "label": "RegisterDevice (12348)", "variant": "emphasis" },
    { "id": "n4", "from": "mobile-api", "to": "fcm", "y": 250, "label": "store device + subscribe", "variant": "default" },
    { "id": "n5", "from": "user", "to": "app", "y": 280, "label": "Open notifications", "variant": "default" },
    { "id": "n6", "from": "app", "to": "mobile-api", "y": 310, "label": "NotificationList (12350)", "variant": "emphasis" },
    { "id": "n7", "from": "mobile-api", "to": "vbroker", "y": 340, "label": "/inbox/all", "variant": "default" },
    { "id": "n8", "from": "vbroker", "to": "mobile-api", "y": 370, "label": "notifications", "variant": "return" },
    { "id": "n9", "from": "mobile-api", "to": "app", "y": 400, "label": "list", "variant": "return" },
    { "id": "n10", "from": "app", "to": "user", "y": 430, "label": "Render list", "variant": "return" },
    { "id": "n11", "from": "user", "to": "app", "y": 460, "label": "Create price alert", "variant": "default" },
    { "id": "n12", "from": "app", "to": "mobile-api", "y": 490, "label": "AddAlert (12430)", "variant": "emphasis" },
    { "id": "n13", "from": "mobile-api", "to": "alert-engine", "y": 520, "label": "/Alert/AddAlert", "variant": "dashed" },
    { "id": "n14", "from": "alert-engine", "to": "mobile-api", "y": 550, "label": "OK", "variant": "return" },
    { "id": "n15", "from": "mobile-api", "to": "app", "y": 580, "label": "alert created", "variant": "return" }
  ],
  "activations": [
    { "participant": "app", "from": 155, "to": 585, "type": "frontend" },
    { "participant": "fcm", "from": 185, "to": 255, "type": "cloud" },
    { "participant": "mobile-api", "from": 215, "to": 585, "type": "backend" },
    { "participant": "vbroker", "from": 335, "to": 380, "type": "backend" },
    { "participant": "alert-engine", "from": 515, "to": 560, "type": "external" }
  ],
  "cards": [
    {
      "dot": "emerald",
      "title": "Delivery",
      "items": [
        "FCM project ispeed-uat-2",
        "Android channel ispeed.rakuten.my.fcm.alert.ANDROID_MFA",
        "Client redux notification slice holds payloads"
      ]
    },
    {
      "dot": "violet",
      "title": "Push Library",
      "items": [
        "PUSH_DEVICES and BADGE_INFO tables",
        "Channel procs SEND/SUBSCRIBE/UNSUBSCRIBE",
        "Inbox proc GET_INBOX_MESSAGES"
      ]
    },
    {
      "dot": "rose",
      "title": "Stock Alerts",
      "items": [
        "Alerts stored in Alert.ADDALERT",
        "External alert engine at :6005",
        "Add / List / Delete via RequestIDs 12430/12441/12446"
      ]
    }
  ]
}
