taf/types.go

189 lines
5.3 KiB
Go
Raw Normal View History

2023-08-21 23:56:17 +00:00
package taf
import (
"time"
"go.elara.ws/taf/airports"
2023-08-21 23:56:17 +00:00
"go.elara.ws/taf/units"
)
type Forecast struct {
Identifier string `json:"identifier,omitempty"`
Airport airports.Airport `json:"airport,omitempty"`
PublishTime time.Time `json:"publish_time,omitempty"`
Valid ValidPair `json:"valid,omitempty"`
Visibility Visibility `json:"visibility,omitempty"`
Wind Wind `json:"wind,omitempty"`
SkyCondition []SkyCondition `json:"sky_condition,omitempty"`
Temperature []Temperature `json:"temperature,omitempty"`
Weather []Weather `json:"weather,omitempty"`
Probabilities []*Probability `json:"probabilities,omitempty"`
Changes []*Change `json:"changes,omitempty"`
Flags []Flag `json:"flags,omitempty"`
2023-08-21 23:56:17 +00:00
}
type Change struct {
Type ChangeType `json:"type,omitempty"`
Valid ValidPair `json:"valid,omitempty"`
Visibility Visibility `json:"visibility,omitempty"`
Wind Wind `json:"wind,omitempty"`
SkyCondition []SkyCondition `json:"sky_condition,omitempty"`
Temperature []Temperature `json:"temperature,omitempty"`
Weather []Weather `json:"weather,omitempty"`
Flags []Flag `json:"flags,omitempty"`
Probability int `json:"probability,omitempty"`
}
type Probability struct {
Valid ValidPair `json:"valid,omitempty"`
Value int `json:"value,omitempty"`
Visibility Visibility `json:"visibility,omitempty"`
Wind Wind `json:"wind,omitempty"`
SkyCondition []SkyCondition `json:"sky_condition,omitempty"`
Temperature []Temperature `json:"temperature,omitempty"`
Weather []Weather `json:"weather,omitempty"`
Flags []Flag `json:"flags,omitempty"`
}
type ValidPair struct {
From time.Time `json:"from,omitempty"`
To time.Time `json:"to,omitempty"`
Duration time.Duration `json:"duration,omitempty"`
}
type Visibility struct {
Plus bool `json:"plus,omitempty"`
Value float64 `json:"value,omitempty"`
Unit units.Distance `json:"unit,omitempty"`
}
type SkyConditionType string
const (
Few SkyConditionType = "Few"
Scattered SkyConditionType = "Scattered"
Broken SkyConditionType = "Broken"
Overcast SkyConditionType = "Overcast"
VerticalVisibility SkyConditionType = "VerticalVisibility"
SkyClear SkyConditionType = "SkyClear"
2023-08-21 23:56:17 +00:00
)
type CloudType string
const (
CumuloNimbus CloudType = "CumuloNumbus"
ToweringCumulus CloudType = "ToweringCumulus"
2023-08-21 23:56:17 +00:00
)
type SkyCondition struct {
Type SkyConditionType `json:"type,omitempty"`
Altitude int `json:"altitude,omitempty"`
CloudType CloudType `json:"cloud_type,omitempty"`
}
type Wind struct {
Direction Direction `json:"direction,omitempty"`
WindShear int `json:"wind_shear,omitempty"`
Speed int `json:"speed,omitempty"`
Gusts int `json:"gusts,omitempty"`
Unit units.Speed `json:"unit,omitempty"`
}
type Direction struct {
Variable bool `json:"variable,omitempty"`
Value int `json:"value,omitempty"`
}
type Modifier string
const (
Heavy Modifier = "Heavy"
Light Modifier = "Light"
2023-08-21 23:56:17 +00:00
)
type Descriptor string
const (
Shallow Descriptor = "Shallow"
Patches Descriptor = "Patches"
LowDrifting Descriptor = "LowDrifting"
Blowing Descriptor = "Blowing"
Showers Descriptor = "Showers"
Thunderstorm Descriptor = "Thunderstorm"
Freezing Descriptor = "Freezing"
Partial Descriptor = "Partial"
2023-08-21 23:56:17 +00:00
)
type Precipitation string
const (
Drizzle Precipitation = "Drizzle"
Rain Precipitation = "Rain"
Snow Precipitation = "Snow"
SnowGrains Precipitation = "SnowGrains"
IceCrystals Precipitation = "IceCrystals"
IcePellets Precipitation = "IcePellets"
Hail Precipitation = "Hail"
SmallHail Precipitation = "SmallHail"
Unknown Precipitation = "Unknown"
2023-08-21 23:56:17 +00:00
)
type Obscuration string
const (
Mist Obscuration = "Mist"
Fog Obscuration = "Fog"
Smoke Obscuration = "Smoke"
Dust Obscuration = "Dust"
Sand Obscuration = "Sand"
Haze Obscuration = "Haze"
Spray Obscuration = "Spray"
VolcanicAsh Obscuration = "VolcanicAsh"
2023-08-21 23:56:17 +00:00
)
type Phenomenon string
const (
Whirls Phenomenon = "Whirls"
Squalls Phenomenon = "Squalls"
FunnelCloud Phenomenon = "FunnelCloud"
Sandstorm Phenomenon = "Sandstorm"
Duststorm Phenomenon = "Duststorm"
2023-08-21 23:56:17 +00:00
)
type Weather struct {
Vicinity bool `json:"vicinity,omitempty"`
Modifier Modifier `json:"modifier,omitempty"`
Descriptor Descriptor `json:"descriptor,omitempty"`
Precipitation Precipitation `json:"precipitation,omitempty"`
Obscuration Obscuration `json:"obscuration,omitempty"`
Phenomenon Phenomenon `json:"phenomenon,omitempty"`
}
type TemperatureType string
const (
High TemperatureType = "High"
Low TemperatureType = "Low"
2023-08-21 23:56:17 +00:00
)
type Temperature struct {
Type TemperatureType `json:"type,omitempty"`
Value int `json:"value,omitempty"`
Time time.Time `json:"time,omitempty"`
}
type ChangeType string
const (
From ChangeType = "From"
Becoming ChangeType = "Becoming"
Temporary ChangeType = "Temporary"
2023-08-21 23:56:17 +00:00
)
type Flag string
const (
CeilingAndVisibilityOK Flag = "CeilingAndVisibilityOK"
2023-08-21 23:56:17 +00:00
)