"""ADR-095 12-Agent 視覺分派對照表

2026-04-24 Claude Sonnet 4.6 (WS4 Hermes NL)
"""
from __future__ import annotations
from dataclasses import dataclass


@dataclass(frozen=True)
class AgentVisual:
    emoji: str
    hashtag: str
    handle: str   # 文字 prefix，非真 bot
    short_name: str


# 鍵值 = .claude/agents/{key}.md 的檔名（不含副檔名）
AGENT_VISUALS: dict[str, AgentVisual] = {
    "critic":              AgentVisual("🔍", "#審查",    "@hermes-critic",    "找碴專家"),
    "vuln-verifier":       AgentVisual("🎯", "#漏洞驗證", "@hermes-verifier",  "漏洞驗證官"),
    "debugger":            AgentVisual("🐛", "#除錯",    "@hermes-debugger",  "除錯偵探"),
    "db-expert":           AgentVisual("💾", "#資料庫",  "@hermes-db",        "DB 軍師"),
    "planner":             AgentVisual("📋", "#拆解",    "@hermes-planner",   "任務拆解官"),
    "fullstack-engineer":  AgentVisual("🛠️", "#工程",   "@hermes-engineer",  "全端工程師"),
    "frontend-designer":   AgentVisual("🎨", "#設計",    "@hermes-designer",  "前端設計師"),
    "refactor-specialist": AgentVisual("♻️", "#重構",   "@hermes-refactor",  "重構專家"),
    "migration-engineer":  AgentVisual("🚚", "#升級",    "@hermes-migration", "升級工程師"),
    "onboarder":           AgentVisual("🗺️", "#導覽",   "@hermes-onboarder", "領航員"),
    "tool-expert":         AgentVisual("🧰", "#工具",    "@hermes-tools",     "工具專家"),
    "web-researcher":      AgentVisual("📚", "#文檔",    "@hermes-web",       "文獻研究員"),
}

DEFAULT_AGENT = "debugger"  # Layer 3 fallback（最常見「X 為什麼壞了」）


def get_visual(agent_name: str) -> AgentVisual:
    return AGENT_VISUALS.get(agent_name, AGENT_VISUALS[DEFAULT_AGENT])


def format_response_header(agent_name: str) -> str:
    """回傳 Telegram 訊息的 agent 識別前綴，格式: emoji 短稱 handle hashtag"""
    v = get_visual(agent_name)
    return f"{v.emoji} **{v.short_name}** `{v.handle}` {v.hashtag}\n\n"
