package alerts

import "testing"

func TestNotifierRespectsToggles(t *testing.T) {
	n := NewNotifier(func() Settings {
		return NewSettings(
			NotifyConfig{TelegramBotToken: "t", TelegramChatID: "1"},
			EventToggles{AgentConnect: false, AgentReconnect: true},
		)
	})
	// disabled — no panic
	n.Emit(EventAgentConnect, "title", "body")
	n.Emit(EventAgentReconnect, "title", "body")
}

func TestSettingsEnabledForAlertType(t *testing.T) {
	s := NewSettings(NotifyConfig{}, EventToggles{AgentOffline: false, HashrateDrop: true})
	if s.EnabledForAlertType("offline") {
		t.Fatal("expected offline disabled")
	}
	if !s.EnabledForAlertType("hashrate_drop") {
		t.Fatal("expected hashrate enabled")
	}
}
