package spot import ( "fmt" "time" ) // SpotSource identifie l'origine d'un spot type SpotSource int const ( SourceCluster SpotSource = iota // Spot reçu depuis un cluster DX telnet SourceManual // Spot ajouté manuellement depuis l'UI ) // Spot est la struct universelle — remplace TelnetSpot + FlexSpot // Plus de conversion entre les deux, tout passe par cette struct unique type Spot struct { // --- Persistance --- ID int64 // --- Identité --- DX string Spotter string // --- Fréquence --- // FrequencyKHz est la source de vérité interne // FrequencyMHz est le format string attendu par FlexRadio (ex: "14.195000") FrequencyKHz float64 FrequencyMHz string Band string // --- Mode --- Mode string // --- Métadonnées cluster --- Comment string Time string // Format "1234Z" Timestamp int64 // Unix timestamp ReceivedAt time.Time ClusterName string Source SpotSource // --- DXCC --- DXCC string CountryName string // --- Flags Log4OM (calculés depuis la DB Log4OM) --- NewDXCC bool NewBand bool NewMode bool NewSlot bool CallsignWorked bool // --- Watchlist --- InWatchlist bool WatchlistNotify bool // --- POTA / SOTA --- POTARef string SOTARef string ParkName string SummitName string // --- FlexRadio panadapter --- FlexSpotNumber int CommandNumber int Color string BackgroundColor string Priority string LifeTime string OriginalComment string } // FreqMHzString retourne la fréquence formatée pour FlexRadio // ex: 14195.0 kHz → "14.195000" func (s *Spot) FreqMHzString() string { if s.FrequencyMHz != "" { return s.FrequencyMHz } if s.FrequencyKHz > 1000 { return formatMHz(s.FrequencyKHz / 1000.0) } return formatMHz(s.FrequencyKHz) } // FreqKHz retourne la fréquence en kHz depuis le champ disponible func (s *Spot) FreqKHz() float64 { if s.FrequencyKHz > 0 { return s.FrequencyKHz } return 0 } func formatMHz(mhz float64) string { return fmt.Sprintf("%.6f", mhz) }