package api

// Dashboard WebSocket payload types (keep in sync with server/web/src/types/ws.ts).
// Shared types: WSDashboardInit, WSAgentOffline, WSStatsUpdate, WSCommandResult, WSAgentLog, WSServerLog.
// Cross-language drift guard: testdata/ws_types_fixture.json (Go ws_types_test.go, TS ws.test.ts).

type WSDashboardInit struct {
	Agents []interface{} `json:"agents"`
}

type WSAgentOffline struct {
	AgentID string `json:"agent_id"`
}

type WSStatsUpdate struct {
	AgentID          string  `json:"agent_id"`
	Hashrate15s      float64 `json:"hashrate_15s"`
	Hashrate1m       float64 `json:"hashrate_1m"`
	Hashrate15m      float64 `json:"hashrate_15m"`
	CPUUsagePct      float64 `json:"cpu_usage_pct"`
	MemoryUsagePct   float64 `json:"memory_usage_pct,omitempty"`
	UptimeSeconds    int     `json:"uptime_seconds,omitempty"`
	SharesSubmitted  int     `json:"shares_submitted,omitempty"`
	SharesAccepted   int     `json:"shares_accepted,omitempty"`
}

type WSCommandResult struct {
	AgentID string `json:"agent_id"`
	Action  string `json:"action"`
	Success bool   `json:"success"`
	Message string `json:"message,omitempty"`
}

type WSAgentLog struct {
	AgentID string `json:"agent_id"`
	Content string `json:"content"`
}

type WSServerLog struct {
	Line string `json:"line"`
}
