package weather import ( "encoding/json" "math" "time" ) // Observation represents a weather observation from a station type Observation struct { Station int `json:"station"` Parameter string `json:"parameter"` Time time.Time `json:"time"` Value *float64 `json:"value,omitempty"` } // ForecastValue represents a weather forecast value type ForecastValue struct { Location struct { Lat float64 `json:"lat"` Lon float64 `json:"lon"` } `json:"location"` Model string `json:"model"` RunTime time.Time `json:"run_time"` ForecastTime time.Time `json:"forecast_time"` Parameter string `json:"parameter"` Value *float64 `json:"value,omitempty"` } // JSONFloat64 handles NaN values properly in JSON type JSONFloat64 float64 func (f JSONFloat64) MarshalJSON() ([]byte, error) { if math.IsNaN(float64(f)) { return []byte("null"), nil } return json.Marshal(float64(f)) } // TopicStats tracks message statistics for subscribers type TopicStats struct { MessagesReceived map[string]int LastMessageTime map[string]time.Time }