package alerts

// Event toggles — all default true in server DefaultConfig.
type EventToggles struct {
	AgentConnect    bool
	AgentReconnect  bool
	AgentOffline    bool
	HashrateDrop    bool
	RejectionRate   bool
	BuildComplete   bool
	KEVExposure     bool
}

// Settings combines delivery credentials with per-event toggles.
type Settings struct {
	NotifyConfig
	Events EventToggles
}

func NewSettings(nc NotifyConfig, ev EventToggles) Settings {
	return Settings{NotifyConfig: nc, Events: ev}
}

// EnabledForAlertType maps evaluator alert types to toggles.
func (s Settings) EnabledForAlertType(alertType string) bool {
	switch alertType {
	case "offline":
		return s.Events.AgentOffline
	case "hashrate_drop":
		return s.Events.HashrateDrop
	case "rejection_rate":
		return s.Events.RejectionRate
	default:
		return true
	}
}

const (
	EventAgentConnect   = "agent_connect"
	EventAgentReconnect = "agent_reconnect"
	EventBuildComplete  = "build_complete"
)
