{
  "schema_version": 1,
  "diagram_type": "sequence",
  "meta": {
    "title": "iSpeed.my — Watchlist & Search Flow",
    "subtitle": "Symbol search with watchlist add",
    "output": "ispeed-watchlist-search.html",
    "viewBox": [1080, 620],
    "column_fit": "spread",
    "animation": "trace",
    "quality_profile": "showcase",
    "views": [
      { "id": "search", "label": "Search", "focus": ["user", "app", "mobile-api", "ssfc", "watchlist-db"], "note": "Symbol search via cache and DB" },
      { "id": "watchlist", "label": "Add to Watchlist", "focus": ["app", "mobile-api", "watchlist-db"], "note": "Watchlist group update" },
      { "id": "full-flow", "label": "Full Flow", "focus": ["user", "app", "mobile-api", "watchlist-db", "ssfc"], "note": "Complete search-to-watchlist 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": "watchlist-db", "type": "database", "label": "Watchlist DB", "sublabel": "watchlist schema" },
    { "id": "ssfc", "type": "external", "label": "SSFC", "sublabel": "symbol cache" }
  ],
  "segments": [
    { "from": 150, "to": 355, "label": "Symbol Search" },
    { "from": 365, "to": 565, "label": "Watchlist Update" }
  ],
  "messages": [
    { "id": "ws1", "from": "user", "to": "app", "y": 160, "label": "Type search query", "variant": "default" },
    { "id": "ws2", "from": "app", "to": "mobile-api", "y": 190, "label": "SymbolSearch (10005)", "variant": "emphasis" },
    { "id": "ws3", "from": "mobile-api", "to": "ssfc", "y": 220, "label": "search cache", "variant": "dashed" },
    { "id": "ws4", "from": "ssfc", "to": "mobile-api", "y": 250, "label": "matches", "variant": "return" },
    { "id": "ws5", "from": "mobile-api", "to": "watchlist-db", "y": 280, "label": "symbols + watchlist flags", "variant": "default" },
    { "id": "ws6", "from": "watchlist-db", "to": "mobile-api", "y": 310, "label": "enriched results", "variant": "return" },
    { "id": "ws7", "from": "mobile-api", "to": "app", "y": 340, "label": "results", "variant": "return" },
    { "id": "ws8", "from": "user", "to": "app", "y": 370, "label": "Add to watchlist", "variant": "default" },
    { "id": "ws9", "from": "app", "to": "mobile-api", "y": 400, "label": "AddSymbol (21041)", "variant": "emphasis" },
    { "id": "ws10", "from": "mobile-api", "to": "watchlist-db", "y": 430, "label": "add_symbol_to_watchlist_group", "variant": "default" },
    { "id": "ws11", "from": "watchlist-db", "to": "mobile-api", "y": 460, "label": "OK", "variant": "return" },
    { "id": "ws12", "from": "mobile-api", "to": "app", "y": 490, "label": "added", "variant": "return" },
    { "id": "ws13", "from": "app", "to": "user", "y": 520, "label": "Confirm", "variant": "return" }
  ],
  "activations": [
    { "participant": "app", "from": 155, "to": 530, "type": "frontend" },
    { "participant": "mobile-api", "from": 185, "to": 505, "type": "backend" },
    { "participant": "ssfc", "from": 215, "to": 260, "type": "external" },
    { "participant": "watchlist-db", "from": 275, "to": 465, "type": "database" }
  ],
  "cards": [
    {
      "dot": "emerald",
      "title": "Search Routing",
      "items": [
        "Short symbols (<=3 chars) go to SSFC cache",
        "Longer queries hit symbols/symbols_ft",
        "Results enriched with AI rating and watchlist flags"
      ]
    },
    {
      "dot": "violet",
      "title": "Watchlist Store",
      "items": [
        "Served entirely by the MX watchlist schema",
        "No VBroker call for watchlist reads/writes",
        "symbol_watch_rel holds membership"
      ]
    },
    {
      "dot": "cyan",
      "title": "Groups",
      "items": [
        "Create/rename/delete via procs",
        "WATCH_LIST_SETTINGS caps NUMBER_OF_SYMBOLS",
        "Visitor watchlist auto-seeded"
      ]
    }
  ]
}
