-- Paste into a separate Script, compile, and enable it.
-- These are demonstration durations, not actual spell timings.
local buffs = ui.window("buffs")

function onLoad()
  buffs:create({ title = "Demo buffs", x = 470, y = 24, width = 260, height = 240 })
  buffs:render({ type = "column", id = "buff_root", style = { gap = 10 }, children = {
    { type = "text", id = "note", text = "Sample countdowns", style = { color = "muted" } },
    { type = "countdown", id = "haste", label = "Haste", seconds = 120, style = { color = "cyan" } },
    { type = "countdown", id = "shield", label = "Shield", seconds = 90, style = { color = "gold" } },
    { type = "countdown", id = "bless", label = "Bless", seconds = 45 },
    { type = "button", id = "restart", text = "Restart samples", action = "restart_samples" },
  } })
end

-- Refresh from a Lua trigger or alias: DemoHaste(120).
function DemoHaste(seconds)
  buffs:update("haste", { seconds = tonumber(seconds) or 0 })
end

function onUI(event)
  if event.window == "buffs" and event.action == "restart_samples" then
    DemoHaste(120)
    buffs:update("shield", { seconds = 90 })
    buffs:update("bless", { seconds = 45 })
  end
end
