- Parse OWM One Call 3.0 weather alerts and map to Warning structs - Map hourly UVI from OWM response to HourlyForecast.UVIndex - Add severity helper mapping OWM alert tags to severity levels - Extract UVIndex through compute layer to timeline slots - Smart warnings: use provider-supplied alerts, fall back to DWD - Show UV index in dashboard timeline tooltips - Add provider description below forecast dropdown with i18n
53 lines
1.2 KiB
Go
53 lines
1.2 KiB
Go
package weather
|
|
|
|
import "time"
|
|
|
|
// HourlyForecast represents a single hour's weather data.
|
|
type HourlyForecast struct {
|
|
Timestamp time.Time
|
|
TemperatureC float64
|
|
ApparentTempC float64
|
|
HumidityPct float64
|
|
DewPointC float64
|
|
CloudCoverPct float64
|
|
WindSpeedMs float64
|
|
WindDirectionDeg float64
|
|
PrecipitationMm float64
|
|
SunshineMin float64
|
|
ShortwaveRadW float64
|
|
PressureHpa float64
|
|
UVIndex float64
|
|
IsDay bool
|
|
Condition string
|
|
}
|
|
|
|
// DailyForecast represents a single day's summary data.
|
|
type DailyForecast struct {
|
|
Date time.Time
|
|
TempMaxC float64
|
|
TempMinC float64
|
|
ApparentTempMaxC float64
|
|
Sunrise time.Time
|
|
Sunset time.Time
|
|
}
|
|
|
|
// ForecastResponse holds the full forecast response from a provider.
|
|
type ForecastResponse struct {
|
|
Hourly []HourlyForecast
|
|
Daily []DailyForecast
|
|
Warnings []Warning
|
|
Source string
|
|
}
|
|
|
|
// Warning represents a weather warning.
|
|
type Warning struct {
|
|
ID string
|
|
EventType string
|
|
Severity string
|
|
Headline string
|
|
Description string
|
|
Instruction string
|
|
Onset time.Time
|
|
Expires time.Time
|
|
}
|