// Mock data + strategy registry for Flutter (股票提醒)
// All copy in Traditional Chinese (繁中). Tickers stay English.

const SEED_NOW = new Date('2026-05-02T14:32:00Z');

// ── Strategy registry ─────────────────────────────────────────────
// Each strategy declares its params; the create-alert UI renders these dynamically.
const STRATEGIES = [
  {
    id: 'pct_change',
    name: '漲跌幅 > 3%',
    emoji: '📈',
    color: 'coral',
    desc: '當日漲跌幅超過設定門檻時觸發',
    params: [
      { id: 'baseline', label: '比較基準', kind: 'segment',
        options: [{v:'open', label:'開盤'}, {v:'prev_close', label:'昨收'}, {v:'intraday', label:'日內高低'}], default: 'prev_close' },
      { id: 'pct', label: '門檻 %', kind: 'slider', min: 0.5, max: 15, step: 0.5, default: 3, suffix: '%' },
      { id: 'direction', label: '方向', kind: 'segment',
        options: [{v:'up', label:'上漲'}, {v:'down', label:'下跌'}, {v:'either', label:'雙向'}], default: 'either' },
    ],
  },
  {
    id: 'vwap',
    name: 'VWAP',
    emoji: '📊',
    color: 'mint',
    desc: '價格穿越成交量加權均價（VWAP）',
    params: [
      { id: 'session', label: '計算區間', kind: 'segment',
        options: [{v:'day', label:'當日'}, {v:'5d', label:'5日'}, {v:'20d', label:'20日'}], default: 'day' },
      { id: 'cross', label: '穿越方向', kind: 'segment',
        options: [{v:'above', label:'價格上穿'}, {v:'below', label:'價格下穿'}, {v:'either', label:'雙向'}], default: 'either' },
      { id: 'deviation', label: '偏離門檻', kind: 'slider', min: 0, max: 3, step: 0.1, default: 0.5, suffix: '%' },
    ],
  },
  {
    id: 'kd',
    name: 'KD 指標',
    emoji: '〽️',
    color: 'lilac',
    desc: '隨機指標 KD 進入超買 / 超賣或發生交叉',
    params: [
      { id: 'period', label: '週期', kind: 'segment',
        options: [{v:'9', label:'KD(9)'}, {v:'14', label:'KD(14)'}, {v:'21', label:'KD(21)'}], default: '9' },
      { id: 'event', label: '觸發條件', kind: 'segment',
        options: [{v:'overbought', label:'超買'}, {v:'oversold', label:'超賣'}, {v:'golden', label:'黃金交叉'}, {v:'death', label:'死亡交叉'}], default: 'oversold' },
      { id: 'threshold', label: '門檻', kind: 'slider', min: 10, max: 90, step: 1, default: 20 },
    ],
  },
  {
    id: 'volume_above',
    name: '成交量 above',
    emoji: '🔊',
    color: 'butter',
    desc: '成交量超過絕對值或均量倍數',
    params: [
      { id: 'mode', label: '比較模式', kind: 'segment',
        options: [{v:'absolute', label:'絕對量'}, {v:'multiple', label:'均量倍數'}], default: 'multiple' },
      { id: 'window', label: '均量區間', kind: 'segment',
        options: [{v:'5', label:'5日'}, {v:'10', label:'10日'}, {v:'20', label:'20日'}], default: '20' },
      { id: 'multiplier', label: '倍數門檻', kind: 'slider', min: 1.5, max: 6, step: 0.5, default: 2.5, suffix: '×' },
      { id: 'absolute', label: '絕對量 (千股)', kind: 'number', default: 5000, step: 500, suffix: 'K' },
    ],
  },
];

const STRATEGY_BY_ID = Object.fromEntries(STRATEGIES.map(s => [s.id, s]));

// ── Symbol metadata ───────────────────────────────────────────────
// price = current (incl. AH if any), prev = regular session close, afterPct = AH only
const SYMBOLS = [
  // ── 美股 ────────────────────────────────────────────────────────
  { sym: 'BRK.A', name: '伯克希爾-A',       market: 'us', price: 710300.00, prev: 711868.00, chg: -0.22, afterPct: +0.00, color: '#4E3B2D' },
  { sym: 'NVDA',  name: 'NVIDIA',         market: 'us', price: 1184.32, prev: 1156.45, chg:  +2.41, afterPct: +0.31, color: '#76B900' },
  { sym: 'TSLA',  name: 'Tesla',          market: 'us', price:  254.18, prev:  258.93, chg:  -1.83, afterPct: -0.42, color: '#E31937' },
  { sym: 'AAPL',  name: 'Apple',          market: 'us', price:  213.45, prev:  212.13, chg:  +0.62, afterPct: +0.18, color: '#1F1F1F' },
  { sym: 'AMD',   name: 'AMD',            market: 'us', price:  168.90, prev:  162.50, chg:  +3.94, afterPct: +0.55, color: '#ED1C24' },
  { sym: 'PLTR',  name: 'Palantir',       market: 'us', price:   28.74, prev:   29.36, chg:  -2.10, afterPct: -0.21, color: '#101820' },
  { sym: 'MSFT',  name: 'Microsoft',      market: 'us', price:  428.06, prev:  426.30, chg:  +0.41, afterPct: +0.12, color: '#0078D4' },
  { sym: 'COIN',  name: 'Coinbase',       market: 'us', price:  238.55, prev:  225.64, chg:  +5.72, afterPct: +1.08, color: '#0052FF' },
  { sym: 'META',  name: 'Meta',           market: 'us', price:  512.33, prev:  513.77, chg:  -0.28, afterPct: -0.09, color: '#1877F2' },
  { sym: 'GOOGL', name: 'Alphabet',       market: 'us', price:  176.89, prev:  174.95, chg:  +1.11, afterPct: +0.24, color: '#4285F4' },
  { sym: 'SMCI',  name: 'Super Micro',    market: 'us', price:   54.12, prev:   48.15, chg: +12.40, afterPct: -0.81, color: '#1A4D8C' },
  { sym: 'AMZN',  name: 'Amazon',         market: 'us', price:  186.42, prev:  184.30, chg:  +1.15, afterPct: +0.12, color: '#FF9900' },
  { sym: 'NFLX',  name: 'Netflix',        market: 'us', price:  662.18, prev:  655.50, chg:  +1.02, afterPct: +0.08, color: '#E50914' },
  { sym: 'AVGO',  name: 'Broadcom',       market: 'us', price:  1452.30, prev: 1430.10, chg:  +1.55, afterPct: +0.20, color: '#CC092F' },
  { sym: 'ORCL',  name: 'Oracle',         market: 'us', price:  145.20, prev:  142.80, chg:  +1.68, afterPct: +0.10, color: '#C74634' },
  { sym: 'ADBE',  name: 'Adobe',          market: 'us', price:  518.40, prev:  525.10, chg:  -1.28, afterPct: -0.15, color: '#FF0000' },
  { sym: 'CRM',   name: 'Salesforce',     market: 'us', price:  268.95, prev:  272.40, chg:  -1.27, afterPct: -0.08, color: '#00A1E0' },
  { sym: 'INTC',  name: 'Intel',          market: 'us', price:   22.18, prev:   22.84, chg:  -2.89, afterPct: -0.41, color: '#0071C5' },
  { sym: 'QCOM',  name: 'Qualcomm',       market: 'us', price:  168.50, prev:  166.20, chg:  +1.38, afterPct: +0.18, color: '#3253DC' },
  { sym: 'MU',    name: 'Micron',         market: 'us', price:   95.40, prev:   91.20, chg:  +4.60, afterPct: +0.62, color: '#0091CD' },
  { sym: 'ARM',   name: 'Arm Holdings',   market: 'us', price:  118.30, prev:  112.80, chg:  +4.88, afterPct: +0.55, color: '#0091BD' },
  { sym: 'TSM',   name: 'TSMC ADR',       market: 'us', price:  168.40, prev:  164.50, chg:  +2.37, afterPct: +0.28, color: '#CC0000' },
  { sym: 'ASML',  name: 'ASML',           market: 'us', price:  890.20, prev:  878.50, chg:  +1.33, afterPct: +0.18, color: '#0E54AB' },
  { sym: 'JPM',   name: 'JPMorgan',       market: 'us', price:  208.40, prev:  207.10, chg:  +0.63, afterPct: +0.05, color: '#0B4A82' },
  { sym: 'V',     name: 'Visa',           market: 'us', price:  282.50, prev:  280.40, chg:  +0.75, afterPct: +0.10, color: '#1A1F71' },
  { sym: 'MA',    name: 'Mastercard',     market: 'us', price:  470.20, prev:  468.50, chg:  +0.36, afterPct: +0.05, color: '#EB001B' },
  { sym: 'WMT',   name: 'Walmart',        market: 'us', price:   72.40, prev:   72.10, chg:  +0.42, afterPct: +0.03, color: '#0071CE' },
  { sym: 'COST',  name: 'Costco',         market: 'us', price:  890.30, prev:  885.10, chg:  +0.59, afterPct: +0.08, color: '#005DAA' },
  { sym: 'DIS',   name: 'Disney',         market: 'us', price:  103.20, prev:  105.80, chg:  -2.46, afterPct: -0.25, color: '#001E5C' },
  { sym: 'KO',    name: 'Coca-Cola',      market: 'us', price:   67.40, prev:   67.10, chg:  +0.45, afterPct: +0.04, color: '#F40009' },
  { sym: 'XOM',   name: 'Exxon Mobil',    market: 'us', price:  118.30, prev:  116.80, chg:  +1.28, afterPct: +0.10, color: '#FF1F1F' },
  // ── 台股 ────────────────────────────────────────────────────────
  { sym: '2330',  name: '台積電',          market: 'tw', price:  1085.00, prev: 1060.00, chg:  +2.36, afterPct: 0, color: '#CC0000' },
  { sym: '2317',  name: '鴻海',            market: 'tw', price:   215.50, prev:  218.00, chg:  -1.15, afterPct: 0, color: '#003D7A' },
  { sym: '2454',  name: '聯發科',          market: 'tw', price:  1340.00, prev: 1305.00, chg:  +2.68, afterPct: 0, color: '#005CAB' },
  { sym: '2603',  name: '長榮',            market: 'tw', price:   188.50, prev:  192.00, chg:  -1.82, afterPct: 0, color: '#0E7C3A' },
  { sym: '0050',  name: '元大台灣50',       market: 'tw', price:   195.20, prev:  193.40, chg:  +0.93, afterPct: 0, color: '#E36B00' },
  { sym: '0056',  name: '元大高股息',       market: 'tw', price:    42.85, prev:   42.50, chg:  +0.82, afterPct: 0, color: '#E36B00' },
  { sym: '2308',  name: '台達電',          market: 'tw', price:   415.50, prev:  408.00, chg:  +1.84, afterPct: 0, color: '#003366' },
  { sym: '3008',  name: '大立光',          market: 'tw', price:  2210.00, prev: 2235.00, chg:  -1.12, afterPct: 0, color: '#001F5C' },
  { sym: '2882',  name: '國泰金',          market: 'tw', price:    62.50, prev:   61.80, chg:  +1.13, afterPct: 0, color: '#005CAB' },
  { sym: '2891',  name: '中信金',          market: 'tw', price:    37.20, prev:   36.95, chg:  +0.68, afterPct: 0, color: '#0E54AB' },
  { sym: '2884',  name: '玉山金',          market: 'tw', price:    28.45, prev:   28.20, chg:  +0.89, afterPct: 0, color: '#0B8043' },
  { sym: '2881',  name: '富邦金',          market: 'tw', price:    85.40, prev:   84.60, chg:  +0.95, afterPct: 0, color: '#007F3D' },
  { sym: '2002',  name: '中鋼',            market: 'tw', price:    22.85, prev:   23.10, chg:  -1.08, afterPct: 0, color: '#003D82' },
  { sym: '1303',  name: '南亞',            market: 'tw', price:    52.80, prev:   53.40, chg:  -1.12, afterPct: 0, color: '#0066B3' },
  { sym: '1216',  name: '統一',            market: 'tw', price:    78.40, prev:   77.90, chg:  +0.64, afterPct: 0, color: '#E60012' },
  { sym: '2412',  name: '中華電',          market: 'tw', price:   128.50, prev:  128.00, chg:  +0.39, afterPct: 0, color: '#005DAA' },
  { sym: '3711',  name: '日月光投控',       market: 'tw', price:   148.50, prev:  145.00, chg:  +2.41, afterPct: 0, color: '#003D82' },
  { sym: '2382',  name: '廣達',            market: 'tw', price:   285.00, prev:  278.00, chg:  +2.52, afterPct: 0, color: '#005CAB' },
  { sym: '6505',  name: '台塑化',          market: 'tw', price:    62.40, prev:   62.90, chg:  -0.79, afterPct: 0, color: '#003D82' },
  { sym: '2207',  name: '和泰車',          market: 'tw', price:   685.00, prev:  675.00, chg:  +1.48, afterPct: 0, color: '#CC0000' },
  { sym: '2912',  name: '統一超',          market: 'tw', price:   285.50, prev:  283.00, chg:  +0.88, afterPct: 0, color: '#E60012' },
  { sym: '2615',  name: '萬海',            market: 'tw', price:    85.40, prev:   86.80, chg:  -1.61, afterPct: 0, color: '#0066B3' },
  { sym: '2609',  name: '陽明',            market: 'tw', price:    78.20, prev:   79.40, chg:  -1.51, afterPct: 0, color: '#003D82' },
  { sym: '00878', name: '國泰永續高股息',    market: 'tw', price:    24.15, prev:   24.00, chg:  +0.63, afterPct: 0, color: '#005CAB' },
  { sym: '00919', name: '群益台灣精選高息',  market: 'tw', price:    22.85, prev:   22.70, chg:  +0.66, afterPct: 0, color: '#E36B00' },
  // ── 加密貨幣 ────────────────────────────────────────────────────
  { sym: 'BTC',   name: 'Bitcoin',        market: 'crypto', price: 96420.50, prev: 94100.00, chg:  +2.47, afterPct: 0, color: '#F7931A' },
  { sym: 'ETH',   name: 'Ethereum',       market: 'crypto', price:  3285.40, prev: 3360.00, chg:  -2.22, afterPct: 0, color: '#627EEA' },
  { sym: 'SOL',   name: 'Solana',         market: 'crypto', price:   168.20, prev:  155.80, chg:  +7.96, afterPct: 0, color: '#14F195' },
  { sym: 'DOGE',  name: 'Dogecoin',       market: 'crypto', price:    0.385, prev:   0.402, chg:  -4.23, afterPct: 0, color: '#C2A633' },
  { sym: 'BNB',   name: 'BNB',            market: 'crypto', price:   612.40, prev:  598.20, chg:  +2.37, afterPct: 0, color: '#F3BA2F' },
  { sym: 'XRP',   name: 'Ripple',         market: 'crypto', price:    2.18, prev:   2.24, chg:  -2.68, afterPct: 0, color: '#23292F' },
  { sym: 'ADA',   name: 'Cardano',        market: 'crypto', price:    0.92, prev:   0.88, chg:  +4.55, afterPct: 0, color: '#0033AD' },
  { sym: 'AVAX',  name: 'Avalanche',      market: 'crypto', price:   38.50, prev:   36.40, chg:  +5.77, afterPct: 0, color: '#E84142' },
  { sym: 'DOT',   name: 'Polkadot',       market: 'crypto', price:    7.85, prev:   8.10, chg:  -3.09, afterPct: 0, color: '#E6007A' },
  { sym: 'LINK',  name: 'Chainlink',      market: 'crypto', price:   18.40, prev:   17.85, chg:  +3.08, afterPct: 0, color: '#2A5ADA' },
  { sym: 'UNI',   name: 'Uniswap',        market: 'crypto', price:   12.85, prev:   13.20, chg:  -2.65, afterPct: 0, color: '#FF007A' },
  { sym: 'ATOM',  name: 'Cosmos',         market: 'crypto', price:    6.20, prev:   6.05, chg:  +2.48, afterPct: 0, color: '#2E3148' },
  { sym: 'NEAR',  name: 'NEAR Protocol',  market: 'crypto', price:    5.85, prev:   5.50, chg:  +6.36, afterPct: 0, color: '#00C08B' },
  { sym: 'APT',   name: 'Aptos',          market: 'crypto', price:    9.40, prev:   8.90, chg:  +5.62, afterPct: 0, color: '#000000' },
  { sym: 'ARB',   name: 'Arbitrum',       market: 'crypto', price:    0.78, prev:   0.82, chg:  -4.88, afterPct: 0, color: '#28A0F0' },
  { sym: 'OP',    name: 'Optimism',       market: 'crypto', price:    1.85, prev:   1.92, chg:  -3.65, afterPct: 0, color: '#FF0420' },
  { sym: 'LTC',   name: 'Litecoin',       market: 'crypto', price:  102.40, prev:  100.50, chg:  +1.89, afterPct: 0, color: '#345D9D' },
  { sym: 'BCH',   name: 'Bitcoin Cash',   market: 'crypto', price:  445.20, prev:  438.50, chg:  +1.53, afterPct: 0, color: '#0AC18E' },
  { sym: 'SHIB',  name: 'Shiba Inu',      market: 'crypto', price:    0.0000218, prev: 0.0000232, chg: -6.03, afterPct: 0, color: '#FFA409' },
  { sym: 'PEPE',  name: 'Pepe',           market: 'crypto', price:    0.0000124, prev: 0.0000118, chg: +5.08, afterPct: 0, color: '#4A8741' },
  { sym: 'TON',   name: 'Toncoin',        market: 'crypto', price:    5.40, prev:   5.20, chg:  +3.85, afterPct: 0, color: '#0098EA' },
];
const SYMBOL_BY = Object.fromEntries(SYMBOLS.map(s => [s.sym, s]));

// ── Initial alerts (each is "a chat room message") ────────────────
// id, sym, strategyId, params snapshot, status, lastFiredAt, firedHistory[]
function ago(mins) { return new Date(SEED_NOW.getTime() - mins * 60_000); }

function ahead(mins) { return new Date(SEED_NOW.getTime() + mins * 60_000); }

const INITIAL_ALERTS = [
  // ── BRK.A: pct_change ──────────────────────────────────────────
  { id: 'a0', sym: 'BRK.A', strategyId: 'pct_change', params: { baseline:'prev_close', pct: 0.5, direction:'down' },
    status: 'active', muted: false, createdAt: ago(60*24*5), expiresAt: ahead(60*24*25),
    history: [
      { t: ago(55),  text: '當日跌幅達 -0.22%（vs. 昨收 $711,868.00）', kind: 'fire' },
    ]},

  // ── NVDA: pct_change + vwap ─────────────────────────────────────
  { id: 'a1', sym: 'NVDA', strategyId: 'pct_change', params: { baseline:'prev_close', pct: 3, direction:'up' },
    status: 'active', muted: false, createdAt: ago(60*24*10), expiresAt: ahead(60*24*30),
    history: [
      { t: ago(8),        text: '當日漲幅達 +3.21%（vs. 昨收 $1,156.45）', kind: 'fire' },
      { t: ago(60*26),    text: '當日漲幅達 +4.10%（vs. 昨收 $1,109.20）', kind: 'fire' },
      { t: ago(60*24*2),  text: '當日漲幅達 +3.55%（vs. 昨收 $1,088.40）', kind: 'fire' },
      { t: ago(60*24*5),  text: '當日漲幅達 +5.20%（vs. 昨收 $1,042.10）', kind: 'fire' },
      { t: ago(60*24*10), text: '提醒已啟用', kind: 'system' },
    ]},
  { id: 'a2', sym: 'NVDA', strategyId: 'volume_above', params: { mode:'multiple', window:'20', multiplier: 2.5, absolute: 5000 },
    status: 'active', muted: false, createdAt: ago(60*24*9), expiresAt: ahead(60*24*25),
    history: [
      { t: ago(22),  text: '成交量達 20 日均量 3.1×（57.8M 股）', kind: 'fire' },
    ]},

  // ── TSLA: pct_change down ───────────────────────────────────────
  { id: 'a3', sym: 'TSLA', strategyId: 'pct_change', params: { baseline:'prev_close', pct: 3, direction:'down' },
    status: 'active', muted: false, createdAt: ago(60*24*8), expiresAt: ahead(60*24*20),
    history: [
      { t: ago(45),  text: '當日跌幅達 -3.42%（vs. 昨收）', kind: 'fire' },
    ]},

  // ── AAPL: VWAP cross ────────────────────────────────────────────
  { id: 'a4', sym: 'AAPL', strategyId: 'vwap', params: { session:'day', cross:'above', deviation: 0.5 },
    status: 'active', muted: true, createdAt: ago(60*24*7), expiresAt: ahead(60*24*15),
    history: [
      { t: ago(60*8),  text: '價格上穿當日 VWAP $212.40（偏離 +0.49%）', kind: 'fire' },
    ]},

  // ── AMD: KD overbought ──────────────────────────────────────────
  { id: 'a5', sym: 'AMD', strategyId: 'kd', params: { period:'9', event:'overbought', threshold: 80 },
    status: 'active', muted: false, createdAt: ago(60*24*6), expiresAt: ahead(60*24*14),
    history: [
      { t: ago(12),   text: 'KD(9) K=85.4 D=78.1，已進入超買區', kind: 'fire' },
      { t: ago(60*26), text: '提醒已啟用', kind: 'system' },
    ]},

  // ── PLTR: VWAP cross below ──────────────────────────────────────
  { id: 'a6', sym: 'PLTR', strategyId: 'vwap', params: { session:'day', cross:'below', deviation: 0.3 },
    status: 'active', muted: false, createdAt: ago(60*24*5), expiresAt: ahead(60*24*10),
    history: [
      { t: ago(95),  text: '價格下穿當日 VWAP $28.95（偏離 -0.72%）', kind: 'fire' },
    ]},

  // ── COIN: pct_change up ─────────────────────────────────────────
  { id: 'a7', sym: 'COIN', strategyId: 'pct_change', params: { baseline:'prev_close', pct: 5, direction:'up' },
    status: 'active', muted: false, createdAt: ago(60*24*4), expiresAt: ahead(60*24*8),
    history: [
      { t: ago(3),  text: '當日漲幅達 +5.72%（vs. 昨收）', kind: 'fire' },
    ]},

  // ── SMCI: volume_above absolute + pct_change ────────────────────
  { id: 'a8', sym: 'SMCI', strategyId: 'pct_change', params: { baseline:'prev_close', pct: 8, direction:'up' },
    status: 'active', muted: false, createdAt: ago(60*24*3), expiresAt: ahead(60*24*7),
    history: [
      { t: ago(1),   text: '當日漲幅達 +12.40%（vs. 昨收）', kind: 'fire' },
      { t: ago(35),  text: '當日漲幅達 +9.10%（vs. 昨收）', kind: 'fire' },
    ]},
  { id: 'a8b', sym: 'SMCI', strategyId: 'volume_above', params: { mode:'absolute', window:'20', multiplier: 2.5, absolute: 8000 },
    status: 'active', muted: false, createdAt: ago(60*24*3), expiresAt: ahead(60*24*7),
    history: [
      { t: ago(40),  text: '成交量突破 8,000K（已達 9,420K 股）', kind: 'fire' },
    ]},

  // ── MSFT: KD golden cross ───────────────────────────────────────
  { id: 'a9', sym: 'MSFT', strategyId: 'kd', params: { period:'9', event:'golden', threshold: 30 },
    status: 'active', muted: false, createdAt: ago(60*24*2), expiresAt: ahead(60*24*14),
    history: [
      { t: ago(60*3),  text: 'KD(9) 黃金交叉，K=32.4 上穿 D=29.8', kind: 'fire' },
    ]},

  // ── META: vwap pending ──────────────────────────────────────────
  { id: 'a10', sym: 'META', strategyId: 'vwap', params: { session:'day', cross:'either', deviation: 1 },
    status: 'active', muted: false, createdAt: ago(60*24*2), expiresAt: ahead(60*24*14),
    history: [
      { t: ago(60*40), text: '提醒已啟用，等待觸發', kind: 'system' },
    ]},

  // ── GOOGL: volume_above multiple ────────────────────────────────
  { id: 'a11', sym: 'GOOGL', strategyId: 'volume_above', params: { mode:'multiple', window:'10', multiplier: 2, absolute: 5000 },
    status: 'active', muted: false, createdAt: ago(60*24*1), expiresAt: ahead(60*24*30),
    history: [
      { t: ago(60*5), text: '成交量達 10 日均量 2.4×', kind: 'fire' },
    ]},

  // ── 已失效 demo ─────────────────────────────────────────────────
  { id: 'a12', sym: 'TSLA', strategyId: 'kd', params: { period:'14', event:'oversold', threshold: 20 },
    status: 'cancelled', muted: false, createdAt: ago(60*24*14),
    history: [
      { t: ago(60*24*14), text: '提醒已建立', kind: 'system' },
    ]},
  { id: 'a13', sym: 'PLTR', strategyId: 'pct_change', params: { baseline:'open', pct: 5, direction:'up' },
    status: 'failed', muted: false, createdAt: ago(60*24*12),
    history: [
      { t: ago(60*24*12), text: '提醒已建立', kind: 'system' },
    ]},
  { id: 'a14', sym: 'META', strategyId: 'volume_above', params: { mode:'absolute', window:'5', multiplier: 2, absolute: 3000 },
    status: 'cancelled', muted: false, createdAt: ago(60*24*20),
    history: [
      { t: ago(60*24*20), text: '提醒已建立', kind: 'system' },
    ]},

  // ── 台股 ────────────────────────────────────────────────────────
  { id: 'tw1', sym: '2330', strategyId: 'pct_change', params: { baseline:'prev_close', pct: 2, direction:'up' },
    status: 'active', muted: false, createdAt: ago(60*24*4), expiresAt: ahead(60*24*20),
    history: [
      { t: ago(15),  text: '當日漲幅達 +2.36%（vs. 昨收 1,060.00）', kind: 'fire' },
    ]},
  { id: 'tw2', sym: '2454', strategyId: 'volume_above', params: { mode:'multiple', window:'20', multiplier: 2, absolute: 5000 },
    status: 'active', muted: false, createdAt: ago(60*24*3), expiresAt: ahead(60*24*15),
    history: [
      { t: ago(50),  text: '成交量達 20 日均量 2.4×', kind: 'fire' },
    ]},
  { id: 'tw3', sym: '2603', strategyId: 'pct_change', params: { baseline:'prev_close', pct: 1.5, direction:'down' },
    status: 'active', muted: false, createdAt: ago(60*24*2), expiresAt: ahead(60*24*10),
    history: [
      { t: ago(75),  text: '當日跌幅達 -1.82%（vs. 昨收）', kind: 'fire' },
    ]},
  { id: 'tw4', sym: '2317', strategyId: 'kd', params: { period:'9', event:'oversold', threshold: 20 },
    status: 'active', muted: true, createdAt: ago(60*24*1),
    history: [
      { t: ago(60*3),  text: 'KD(9) K=18.4 D=22.1，已進入超賣區', kind: 'fire' },
    ]},

  // ── 加密貨幣 ────────────────────────────────────────────────────
  { id: 'cx1', sym: 'BTC', strategyId: 'pct_change', params: { baseline:'prev_close', pct: 2, direction:'either' },
    status: 'active', muted: false, createdAt: ago(60*24*6), expiresAt: ahead(60*24*30),
    history: [
      { t: ago(20),  text: '當日漲幅達 +2.47%（vs. 昨收 $94,100.00）', kind: 'fire' },
    ]},
  { id: 'cx2', sym: 'ETH', strategyId: 'pct_change', params: { baseline:'prev_close', pct: 2, direction:'down' },
    status: 'active', muted: false, createdAt: ago(60*24*5), expiresAt: ahead(60*24*25),
    history: [
      { t: ago(40),  text: '當日跌幅達 -2.22%（vs. 昨收）', kind: 'fire' },
    ]},
  { id: 'cx3', sym: 'SOL', strategyId: 'pct_change', params: { baseline:'prev_close', pct: 5, direction:'up' },
    status: 'active', muted: false, createdAt: ago(60*24*4), expiresAt: ahead(60*24*20),
    history: [
      { t: ago(8),   text: '當日漲幅達 +7.96%（vs. 昨收）', kind: 'fire' },
    ]},
  { id: 'cx4', sym: 'DOGE', strategyId: 'kd', params: { period:'14', event:'overbought', threshold: 80 },
    status: 'active', muted: false, createdAt: ago(60*24*2),
    history: [
      { t: ago(60*5),  text: 'KD(14) 已進入超賣區', kind: 'fire' },
    ]},
];

Object.assign(window, { STRATEGIES, STRATEGY_BY_ID, SYMBOLS, SYMBOL_BY, INITIAL_ALERTS, SEED_NOW });
