-- DreamStack 4-App Composition Dashboard
-- Composes signals from 4 independent streaming apps.
-- Each app has explicit output declarations:
--   counter: count, doubled   (NOT message)
--   clock:   hours, minutes, seconds (NOT tick)
--   stats:   total, average, max (NOT sum, last_sample)
--   mood:    mood, energy, color (NOT clicks)
--
-- Run with:
--   Tab 1: cargo run -p ds-stream
--   Tab 2: dreamstack stream examples/streaming-counter.ds --port 3000
--   Tab 3: dreamstack stream examples/streaming-clock.ds --port 3002
--   Tab 4: dreamstack stream examples/streaming-stats.ds --port 3003
--   Tab 5: dreamstack stream examples/streaming-mood.ds --port 3004
--   Tab 6: dreamstack build examples/compose-dashboard.ds
--
--   Open the built file in a browser.

let counter = stream from "ws://localhost:9100/stream/counter"
let clock = stream from "ws://localhost:9100/stream/clock"
let stats = stream from "ws://localhost:9100/stream/stats"
let mood = stream from "ws://localhost:9100/stream/mood"

view main =
  column [
    text "🎛️ DreamStack Signal Composition"
    text "4 apps → 1 dashboard"
    row [
      column [
        text "── 🔢 Counter ──"
        text "Count: {counter.count}"
        text "Doubled: {counter.doubled}"
      ]
      column [
        text "── 🕐 Clock ──"
        text "{clock.hours}:{clock.minutes}:{clock.seconds}"
      ]
    ]
    row [
      column [
        text "── 📊 Stats ──"
        text "Samples: {stats.total}"
        text "Average: {stats.average}"
        text "Max: {stats.max}"
      ]
      column [
        text "── 😊 Mood ──"
        text "Mood: {mood.mood}"
        text "Energy: {mood.energy}%"
        text "Color: {mood.color}"
      ]
    ]
  ]
