use std::fmt;
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PsiResponse {
pub code: NeaSuccessCode,
#[cfg_attr(feature = "serde", serde(rename = "errorMsg"))]
pub error_msg: String,
pub data: PsiData,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Pm25Response {
pub code: NeaSuccessCode,
#[cfg_attr(feature = "serde", serde(rename = "errorMsg"))]
pub error_msg: String,
pub data: Pm25Data,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct AirTemperatureResponse {
pub code: NeaSuccessCode,
#[cfg_attr(feature = "serde", serde(rename = "errorMsg"))]
pub error_msg: String,
pub data: AirTemperatureData,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct RelativeHumidityResponse {
pub code: NeaSuccessCode,
#[cfg_attr(feature = "serde", serde(rename = "errorMsg"))]
pub error_msg: String,
pub data: RelativeHumidityData,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WindSpeedResponse {
pub code: NeaSuccessCode,
#[cfg_attr(feature = "serde", serde(rename = "errorMsg"))]
pub error_msg: String,
pub data: WindSpeedData,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WindDirectionResponse {
pub code: NeaSuccessCode,
#[cfg_attr(feature = "serde", serde(rename = "errorMsg"))]
pub error_msg: String,
pub data: WindDirectionData,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct RainfallResponse {
pub code: NeaSuccessCode,
#[cfg_attr(feature = "serde", serde(rename = "errorMsg"))]
pub error_msg: String,
pub data: RainfallData,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TwoHrForecastResponse {
pub code: NeaSuccessCode,
#[cfg_attr(feature = "serde", serde(rename = "errorMsg"))]
pub error_msg: String,
pub data: TwoHrForecastData,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TwentyFourHrForecastResponse {
pub code: NeaSuccessCode,
#[cfg_attr(feature = "serde", serde(rename = "errorMsg"))]
pub error_msg: String,
pub data: TwentyFourHrForecastData,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct FourDayOutlookResponse {
pub code: NeaSuccessCode,
#[cfg_attr(feature = "serde", serde(rename = "errorMsg"))]
pub error_msg: String,
pub data: FourDayOutlookData,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct UvResponse {
pub code: NeaSuccessCode,
#[cfg_attr(feature = "serde", serde(rename = "errorMsg"))]
pub error_msg: String,
pub data: UvData,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WeatherSubApiResponse {
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub code: Option<NeaSuccessCode>,
#[cfg_attr(
feature = "serde",
serde(rename = "errorMsg", default, skip_serializing_if = "Option::is_none")
)]
pub error_msg: Option<String>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub data: Option<WeatherSubApiData>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct InvalidParamsError {
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub code: Option<f64>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub name: Option<String>,
#[cfg_attr(
feature = "serde",
serde(rename = "errorMsg", default, skip_serializing_if = "Option::is_none")
)]
pub error_msg: Option<NeaInvalidParamsErrorMsg>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct InvalidParamsError22 {
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub code: Option<f64>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub name: Option<String>,
#[cfg_attr(
feature = "serde",
serde(rename = "errorMsg", default, skip_serializing_if = "Option::is_none")
)]
pub error_msg: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DataNotFoundError {
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub code: Option<f64>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub name: Option<String>,
#[cfg_attr(
feature = "serde",
serde(rename = "errorMsg", default, skip_serializing_if = "Option::is_none")
)]
pub error_msg: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct RateLimitError {
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub code: Option<f64>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub name: Option<String>,
#[cfg_attr(
feature = "serde",
serde(rename = "errorMsg", default, skip_serializing_if = "Option::is_none")
)]
pub error_msg: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct MissingAuthResponse {
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub message: Option<String>,
}
#[nutype::nutype(
validate(less_or_equal = 0),
derive(
Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, AsRef, Deref, TryFrom, Into, Display
),
cfg_attr(feature = "serde", derive(Serialize, Deserialize))
)]
pub struct NeaSuccessCode(u8);
pub type NeaOffsetDateTime = satay_runtime::OffsetDateTime;
pub type NeaDate = satay_runtime::Date;
#[nutype::nutype(
validate(finite, greater_or_equal = 1.0, less_or_equal = 1.5),
derive(
Debug, Clone, Copy, PartialEq, PartialOrd, AsRef, Deref, TryFrom, Into, Display
),
cfg_attr(feature = "serde", derive(Serialize, Deserialize))
)]
pub struct NeaLatitude(f64);
#[nutype::nutype(
validate(finite, greater_or_equal = 103.5, less_or_equal = 104.2),
derive(
Debug, Clone, Copy, PartialEq, PartialOrd, AsRef, Deref, TryFrom, Into, Display
),
cfg_attr(feature = "serde", derive(Serialize, Deserialize))
)]
pub struct NeaLongitude(f64);
#[nutype::nutype(
validate(less_or_equal = 500),
derive(
Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, AsRef, Deref, TryFrom, Into, Display
),
cfg_attr(feature = "serde", derive(Serialize, Deserialize))
)]
pub struct NeaRegionalReading(u16);
#[nutype::nutype(
validate(less_or_equal = 500),
derive(
Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, AsRef, Deref, TryFrom, Into, Display
),
cfg_attr(feature = "serde", derive(Serialize, Deserialize))
)]
pub struct NeaPm25HourlyReading(u16);
#[nutype::nutype(
validate(less_or_equal = 360),
derive(
Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, AsRef, Deref, TryFrom, Into, Display
),
cfg_attr(feature = "serde", derive(Serialize, Deserialize))
)]
pub struct NeaWindDirectionDegrees(u16);
#[nutype::nutype(
validate(less_or_equal = 16),
derive(
Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, AsRef, Deref, TryFrom, Into, Display
),
cfg_attr(feature = "serde", derive(Serialize, Deserialize))
)]
pub struct NeaUvIndex(u8);
#[nutype::nutype(
validate(finite, greater_or_equal = 0.0, less_or_equal = 100.0),
derive(
Debug, Clone, Copy, PartialEq, PartialOrd, AsRef, Deref, TryFrom, Into, Display
),
cfg_attr(feature = "serde", derive(Serialize, Deserialize))
)]
pub struct NeaHumidityPercent(f64);
#[nutype::nutype(
validate(finite, greater_or_equal = 15.0, less_or_equal = 45.0),
derive(
Debug, Clone, Copy, PartialEq, PartialOrd, AsRef, Deref, TryFrom, Into, Display
),
cfg_attr(feature = "serde", derive(Serialize, Deserialize))
)]
pub struct NeaTemperatureCelsius(f64);
#[nutype::nutype(
validate(finite, greater_or_equal = 0.0, less_or_equal = 120.0),
derive(
Debug, Clone, Copy, PartialEq, PartialOrd, AsRef, Deref, TryFrom, Into, Display
),
cfg_attr(feature = "serde", derive(Serialize, Deserialize))
)]
pub struct NeaWindSpeedKmh(f64);
#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum NeaForecastCode {
#[cfg_attr(feature = "serde", serde(rename = "FA"))]
FairDay,
#[cfg_attr(feature = "serde", serde(rename = "FN"))]
FairNight,
#[cfg_attr(feature = "serde", serde(rename = "FW"))]
FairAndWarm,
#[cfg_attr(feature = "serde", serde(rename = "CL"))]
Cloudy,
#[cfg_attr(feature = "serde", serde(rename = "PC"))]
PartlyCloudyDay,
#[cfg_attr(feature = "serde", serde(rename = "PN"))]
PartlyCloudyNight,
#[cfg_attr(feature = "serde", serde(rename = "HZ"))]
Hazy,
#[cfg_attr(feature = "serde", serde(rename = "SH"))]
SlightlyHazy,
#[cfg_attr(feature = "serde", serde(rename = "WI"))]
Windy,
#[cfg_attr(feature = "serde", serde(rename = "MS"))]
Mist,
#[cfg_attr(feature = "serde", serde(rename = "FG"))]
Fog,
#[cfg_attr(feature = "serde", serde(rename = "LR"))]
LightRain,
#[cfg_attr(feature = "serde", serde(rename = "MR"))]
ModerateRain,
#[cfg_attr(feature = "serde", serde(rename = "HR"))]
HeavyRain,
#[cfg_attr(feature = "serde", serde(rename = "PS"))]
PassingShowers,
#[cfg_attr(feature = "serde", serde(rename = "LS"))]
LightShowers,
#[cfg_attr(feature = "serde", serde(rename = "HS"))]
HeavyShowers,
#[cfg_attr(feature = "serde", serde(rename = "TS"))]
ThunderyShowers,
#[cfg_attr(feature = "serde", serde(rename = "HT"))]
HeavyThunderyShowers,
#[cfg_attr(feature = "serde", serde(rename = "HG"))]
HeavyThunderyShowersWithGustyWinds,
#[cfg_attr(feature = "serde", serde(rename = "TL"))]
ThunderyShowersAlt,
#[default]
#[cfg_attr(feature = "serde", serde(other))]
Unknown,
}
impl NeaForecastCode {
pub const fn as_str(&self) -> &'static str {
match self {
Self::FairDay => "FA",
Self::FairNight => "FN",
Self::FairAndWarm => "FW",
Self::Cloudy => "CL",
Self::PartlyCloudyDay => "PC",
Self::PartlyCloudyNight => "PN",
Self::Hazy => "HZ",
Self::SlightlyHazy => "SH",
Self::Windy => "WI",
Self::Mist => "MS",
Self::Fog => "FG",
Self::LightRain => "LR",
Self::ModerateRain => "MR",
Self::HeavyRain => "HR",
Self::PassingShowers => "PS",
Self::LightShowers => "LS",
Self::HeavyShowers => "HS",
Self::ThunderyShowers => "TS",
Self::HeavyThunderyShowers => "HT",
Self::HeavyThunderyShowersWithGustyWinds => "HG",
Self::ThunderyShowersAlt => "TL",
Self::Unknown => "",
}
}
}
impl AsRef<str> for NeaForecastCode {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl fmt::Display for NeaForecastCode {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum NeaLightningType {
#[cfg_attr(feature = "serde", serde(rename = "C"))]
CloudToCloud,
#[cfg_attr(feature = "serde", serde(rename = "G"))]
CloudToGround,
#[default]
#[cfg_attr(feature = "serde", serde(other))]
Unknown,
}
impl NeaLightningType {
pub const fn as_str(&self) -> &'static str {
match self {
Self::CloudToCloud => "C",
Self::CloudToGround => "G",
Self::Unknown => "",
}
}
}
impl AsRef<str> for NeaLightningType {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl fmt::Display for NeaLightningType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum NeaForecastText {
Fair,
#[cfg_attr(feature = "serde", serde(rename = "Fair (Day)"))]
FairDay,
#[cfg_attr(feature = "serde", serde(rename = "Fair (Night)"))]
FairNight,
#[cfg_attr(feature = "serde", serde(rename = "Fair and Warm"))]
FairAndWarm,
#[cfg_attr(feature = "serde", serde(rename = "Partly Cloudy"))]
PartlyCloudy,
#[cfg_attr(feature = "serde", serde(rename = "Partly Cloudy (Day)"))]
PartlyCloudyDay,
#[cfg_attr(feature = "serde", serde(rename = "Partly Cloudy (Night)"))]
PartlyCloudyNight,
Cloudy,
Hazy,
#[cfg_attr(feature = "serde", serde(rename = "Slightly Hazy"))]
SlightlyHazy,
Windy,
Mist,
Fog,
#[cfg_attr(feature = "serde", serde(rename = "Light Rain"))]
LightRain,
#[cfg_attr(feature = "serde", serde(rename = "Moderate Rain"))]
ModerateRain,
#[cfg_attr(feature = "serde", serde(rename = "Heavy Rain"))]
HeavyRain,
#[cfg_attr(feature = "serde", serde(rename = "Passing Showers"))]
PassingShowers,
#[cfg_attr(feature = "serde", serde(rename = "Light Showers"))]
LightShowers,
Showers,
#[cfg_attr(feature = "serde", serde(rename = "Heavy Showers"))]
HeavyShowers,
#[cfg_attr(feature = "serde", serde(rename = "Thundery Showers"))]
ThunderyShowers,
#[cfg_attr(feature = "serde", serde(rename = "Heavy Thundery Showers"))]
HeavyThunderyShowers,
#[cfg_attr(
feature = "serde",
serde(rename = "Heavy Thundery Showers with Gusty Winds")
)]
HeavyThunderyShowersWithGustyWinds,
#[default]
#[cfg_attr(feature = "serde", serde(other))]
Unknown,
}
impl NeaForecastText {
pub const fn as_str(&self) -> &'static str {
match self {
Self::Fair => "Fair",
Self::FairDay => "Fair (Day)",
Self::FairNight => "Fair (Night)",
Self::FairAndWarm => "Fair and Warm",
Self::PartlyCloudy => "Partly Cloudy",
Self::PartlyCloudyDay => "Partly Cloudy (Day)",
Self::PartlyCloudyNight => "Partly Cloudy (Night)",
Self::Cloudy => "Cloudy",
Self::Hazy => "Hazy",
Self::SlightlyHazy => "Slightly Hazy",
Self::Windy => "Windy",
Self::Mist => "Mist",
Self::Fog => "Fog",
Self::LightRain => "Light Rain",
Self::ModerateRain => "Moderate Rain",
Self::HeavyRain => "Heavy Rain",
Self::PassingShowers => "Passing Showers",
Self::LightShowers => "Light Showers",
Self::Showers => "Showers",
Self::HeavyShowers => "Heavy Showers",
Self::ThunderyShowers => "Thundery Showers",
Self::HeavyThunderyShowers => "Heavy Thundery Showers",
Self::HeavyThunderyShowersWithGustyWinds => "Heavy Thundery Showers with Gusty Winds",
Self::Unknown => "",
}
}
}
impl AsRef<str> for NeaForecastText {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl fmt::Display for NeaForecastText {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum NeaDayOfWeek {
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday,
#[default]
#[cfg_attr(feature = "serde", serde(other))]
Unknown,
}
impl NeaDayOfWeek {
pub const fn as_str(&self) -> &'static str {
match self {
Self::Monday => "Monday",
Self::Tuesday => "Tuesday",
Self::Wednesday => "Wednesday",
Self::Thursday => "Thursday",
Self::Friday => "Friday",
Self::Saturday => "Saturday",
Self::Sunday => "Sunday",
Self::Unknown => "",
}
}
}
impl AsRef<str> for NeaDayOfWeek {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl fmt::Display for NeaDayOfWeek {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum NeaInvalidParamsErrorMsg {
#[cfg_attr(
feature = "serde",
serde(
rename = "Invalid date format. Date format must be YYYY-MM-DD (2024-06-01) or YYYY-MM-DDTHH:mm:ss (2024-06-01T08:30:00)."
)
)]
InvalidDateFormat,
#[cfg_attr(feature = "serde", serde(rename = "Invalid pagination token."))]
InvalidPaginationToken,
#[default]
#[cfg_attr(feature = "serde", serde(other))]
Unknown,
}
impl NeaInvalidParamsErrorMsg {
pub const fn as_str(&self) -> &'static str {
match self {
Self::InvalidDateFormat => {
"Invalid date format. Date format must be YYYY-MM-DD (2024-06-01) or YYYY-MM-DDTHH:mm:ss (2024-06-01T08:30:00)."
}
Self::InvalidPaginationToken => "Invalid pagination token.",
Self::Unknown => "",
}
}
}
impl AsRef<str> for NeaInvalidParamsErrorMsg {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl fmt::Display for NeaInvalidParamsErrorMsg {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum NeaWeatherSubApi {
#[cfg_attr(feature = "serde", serde(rename = "lightning"))]
Lightning,
#[cfg_attr(feature = "serde", serde(rename = "wbgt"))]
WetBulbGlobeTemperature,
#[default]
#[cfg_attr(feature = "serde", serde(other))]
Unknown,
}
impl NeaWeatherSubApi {
pub const fn as_str(&self) -> &'static str {
match self {
Self::Lightning => "lightning",
Self::WetBulbGlobeTemperature => "wbgt",
Self::Unknown => "",
}
}
}
impl AsRef<str> for NeaWeatherSubApi {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl fmt::Display for NeaWeatherSubApi {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
#[nutype::nutype(
validate(regex = "^S[0-9]{2,3}$", len_char_min = 3, len_char_max = 4),
derive(
Debug, Clone, PartialEq, Eq, PartialOrd, Ord, AsRef, Deref, TryFrom, Into, Display, Hash
),
cfg_attr(feature = "serde", derive(Serialize, Deserialize))
)]
pub struct NeaStationId(String);
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NeaStationLocation {
pub latitude: NeaLatitude,
pub longitude: NeaLongitude,
}
#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum NeaWindDirection16 {
N,
#[cfg_attr(feature = "serde", serde(rename = "NNE"))]
Nne,
#[cfg_attr(feature = "serde", serde(rename = "NE"))]
Ne,
#[cfg_attr(feature = "serde", serde(rename = "ENE"))]
Ene,
E,
#[cfg_attr(feature = "serde", serde(rename = "ESE"))]
Ese,
#[cfg_attr(feature = "serde", serde(rename = "SE"))]
Se,
#[cfg_attr(feature = "serde", serde(rename = "SSE"))]
Sse,
S,
#[cfg_attr(feature = "serde", serde(rename = "SSW"))]
Ssw,
#[cfg_attr(feature = "serde", serde(rename = "SW"))]
Sw,
#[cfg_attr(feature = "serde", serde(rename = "WSW"))]
Wsw,
W,
#[cfg_attr(feature = "serde", serde(rename = "WNW"))]
Wnw,
#[cfg_attr(feature = "serde", serde(rename = "NW"))]
Nw,
#[cfg_attr(feature = "serde", serde(rename = "NNW"))]
Nnw,
#[default]
#[cfg_attr(feature = "serde", serde(other))]
Unknown,
}
impl NeaWindDirection16 {
pub const fn as_str(&self) -> &'static str {
match self {
Self::N => "N",
Self::Nne => "NNE",
Self::Ne => "NE",
Self::Ene => "ENE",
Self::E => "E",
Self::Ese => "ESE",
Self::Se => "SE",
Self::Sse => "SSE",
Self::S => "S",
Self::Ssw => "SSW",
Self::Sw => "SW",
Self::Wsw => "WSW",
Self::W => "W",
Self::Wnw => "WNW",
Self::Nw => "NW",
Self::Nnw => "NNW",
Self::Unknown => "",
}
}
}
impl AsRef<str> for NeaWindDirection16 {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl fmt::Display for NeaWindDirection16 {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
pub type NeaStringLatitude = f64;
pub type NeaStringLongitude = f64;
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NeaWeatherStation {
pub id: NeaStationId,
#[cfg_attr(feature = "serde", serde(rename = "deviceId"))]
pub device_id: NeaStationId,
pub name: String,
pub location: NeaStationLocation,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NeaReadingSnapshot {
#[cfg_attr(
feature = "serde",
serde(with = "satay_runtime::serde_string::as_offset_datetime")
)]
pub timestamp: satay_runtime::OffsetDateTime,
pub data: Vec<NeaStationReading>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NeaStationReading {
#[cfg_attr(feature = "serde", serde(rename = "stationId"))]
pub station_id: NeaStationId,
pub value: f64,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NeaHumidityRange {
pub low: NeaHumidityPercent,
pub high: NeaHumidityPercent,
pub unit: NeaMeasurementUnit,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NeaTemperatureRange {
pub low: NeaTemperatureCelsius,
pub high: NeaTemperatureCelsius,
pub unit: NeaMeasurementUnit,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NeaWindSpeedRange {
pub low: NeaWindSpeedKmh,
pub high: NeaWindSpeedKmh,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NeaOutlookWind {
pub speed: NeaWindSpeedRange,
pub direction: NeaWindDirection16,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NeaMssForecast {
pub code: NeaForecastCode,
pub text: NeaForecastText,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NeaGeoPoint {
pub latitude: NeaLatitude,
pub longitude: NeaLongitude,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct AirTemperatureData {
pub stations: Vec<NeaWeatherStation>,
pub readings: Vec<NeaReadingSnapshot>,
#[cfg_attr(feature = "serde", serde(rename = "readingType"))]
pub reading_type: String,
#[cfg_attr(feature = "serde", serde(rename = "readingUnit"))]
pub reading_unit: NeaMeasurementUnit,
#[cfg_attr(
feature = "serde",
serde(
rename = "paginationToken",
default,
skip_serializing_if = "Option::is_none"
)
)]
pub pagination_token: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct RelativeHumidityData {
pub stations: Vec<NeaWeatherStation>,
pub readings: Vec<NeaReadingSnapshot>,
#[cfg_attr(feature = "serde", serde(rename = "readingType"))]
pub reading_type: String,
#[cfg_attr(feature = "serde", serde(rename = "readingUnit"))]
pub reading_unit: NeaMeasurementUnit,
#[cfg_attr(
feature = "serde",
serde(
rename = "paginationToken",
default,
skip_serializing_if = "Option::is_none"
)
)]
pub pagination_token: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WindSpeedData {
pub stations: Vec<NeaWeatherStation>,
pub readings: Vec<NeaReadingSnapshot>,
#[cfg_attr(feature = "serde", serde(rename = "readingType"))]
pub reading_type: String,
#[cfg_attr(feature = "serde", serde(rename = "readingUnit"))]
pub reading_unit: NeaMeasurementUnit,
#[cfg_attr(
feature = "serde",
serde(
rename = "paginationToken",
default,
skip_serializing_if = "Option::is_none"
)
)]
pub pagination_token: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WindDirectionData {
pub stations: Vec<NeaWeatherStation>,
pub readings: Vec<NeaReadingSnapshot>,
#[cfg_attr(feature = "serde", serde(rename = "readingType"))]
pub reading_type: String,
#[cfg_attr(feature = "serde", serde(rename = "readingUnit"))]
pub reading_unit: NeaMeasurementUnit,
#[cfg_attr(
feature = "serde",
serde(
rename = "paginationToken",
default,
skip_serializing_if = "Option::is_none"
)
)]
pub pagination_token: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct RainfallData {
pub stations: Vec<NeaWeatherStation>,
pub readings: Vec<NeaReadingSnapshot>,
#[cfg_attr(feature = "serde", serde(rename = "readingType"))]
pub reading_type: String,
#[cfg_attr(feature = "serde", serde(rename = "readingUnit"))]
pub reading_unit: NeaMeasurementUnit,
#[cfg_attr(
feature = "serde",
serde(
rename = "paginationToken",
default,
skip_serializing_if = "Option::is_none"
)
)]
pub pagination_token: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct FourDayOutlookData {
pub records: Vec<FourDayOutlookDay>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct FourDayOutlookDay {
#[cfg_attr(
feature = "serde",
serde(with = "satay_runtime::serde_string::as_date")
)]
pub date: satay_runtime::Date,
#[cfg_attr(
feature = "serde",
serde(
rename = "updatedTimestamp",
with = "satay_runtime::serde_string::as_offset_datetime"
)
)]
pub updated_timestamp: satay_runtime::OffsetDateTime,
#[cfg_attr(
feature = "serde",
serde(with = "satay_runtime::serde_string::as_offset_datetime")
)]
pub timestamp: satay_runtime::OffsetDateTime,
pub forecasts: Vec<FourDayOutlookPeriod>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct FourDayOutlookPeriod {
#[cfg_attr(
feature = "serde",
serde(with = "satay_runtime::serde_string::as_offset_datetime")
)]
pub timestamp: satay_runtime::OffsetDateTime,
pub temperature: NeaTemperatureRange,
#[cfg_attr(feature = "serde", serde(rename = "relativeHumidity"))]
pub relative_humidity: NeaHumidityRange,
pub forecast: NeaOutlookForecastDetail,
pub day: NeaDayOfWeek,
pub wind: NeaOutlookWind,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NeaOutlookForecastDetail {
pub summary: String,
pub code: NeaForecastCode,
pub text: NeaForecastText,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TwentyFourHrForecastData {
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub area_metadata: Option<Vec<NeaForecastArea>>,
pub records: Vec<TwentyFourHrForecastDay>,
#[cfg_attr(
feature = "serde",
serde(
rename = "paginationToken",
default,
skip_serializing_if = "Option::is_none"
)
)]
pub pagination_token: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TwentyFourHrForecastDay {
#[cfg_attr(
feature = "serde",
serde(with = "satay_runtime::serde_string::as_date")
)]
pub date: satay_runtime::Date,
#[cfg_attr(
feature = "serde",
serde(
rename = "updatedTimestamp",
with = "satay_runtime::serde_string::as_offset_datetime"
)
)]
pub updated_timestamp: satay_runtime::OffsetDateTime,
#[cfg_attr(
feature = "serde",
serde(with = "satay_runtime::serde_string::as_offset_datetime")
)]
pub timestamp: satay_runtime::OffsetDateTime,
pub general: TwentyFourHrForecastGeneral,
pub periods: Vec<TwentyFourHrForecastPeriod>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TwentyFourHrForecastGeneral {
#[cfg_attr(feature = "serde", serde(rename = "validPeriod"))]
pub valid_period: NeaValidPeriod,
pub temperature: NeaTemperatureRange,
#[cfg_attr(feature = "serde", serde(rename = "relativeHumidity"))]
pub relative_humidity: NeaHumidityRange,
pub forecast: NeaMssForecast,
pub wind: NeaOutlookWind,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TwentyFourHrForecastPeriod {
#[cfg_attr(feature = "serde", serde(rename = "timePeriod"))]
pub time_period: NeaValidPeriod,
pub regions: TwentyFourHrRegionalForecast,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TwentyFourHrRegionalForecast {
pub west: NeaMssForecast,
pub east: NeaMssForecast,
pub central: NeaMssForecast,
pub north: NeaMssForecast,
pub south: NeaMssForecast,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TwoHrForecastData {
pub area_metadata: Vec<NeaForecastArea>,
pub items: Vec<TwoHrForecastSnapshot>,
#[cfg_attr(
feature = "serde",
serde(
rename = "paginationToken",
default,
skip_serializing_if = "Option::is_none"
)
)]
pub pagination_token: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NeaForecastArea {
pub name: String,
pub label_location: NeaGeoPoint,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TwoHrForecastSnapshot {
#[cfg_attr(
feature = "serde",
serde(with = "satay_runtime::serde_string::as_offset_datetime")
)]
pub update_timestamp: satay_runtime::OffsetDateTime,
#[cfg_attr(
feature = "serde",
serde(with = "satay_runtime::serde_string::as_offset_datetime")
)]
pub timestamp: satay_runtime::OffsetDateTime,
pub valid_period: NeaValidPeriod,
pub forecasts: Vec<TwoHrAreaForecast>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TwoHrAreaForecast {
pub area: String,
pub forecast: NeaForecastText,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NeaValidPeriod {
#[cfg_attr(
feature = "serde",
serde(with = "satay_runtime::serde_string::as_offset_datetime")
)]
pub start: satay_runtime::OffsetDateTime,
#[cfg_attr(
feature = "serde",
serde(with = "satay_runtime::serde_string::as_offset_datetime")
)]
pub end: satay_runtime::OffsetDateTime,
pub text: String,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PsiData {
#[cfg_attr(feature = "serde", serde(rename = "regionMetadata"))]
pub region_metadata: Vec<NeaRegionMetadata>,
pub items: Vec<PsiSnapshot>,
#[cfg_attr(
feature = "serde",
serde(
rename = "paginationToken",
default,
skip_serializing_if = "Option::is_none"
)
)]
pub pagination_token: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PsiSnapshot {
#[cfg_attr(
feature = "serde",
serde(with = "satay_runtime::serde_string::as_date")
)]
pub date: satay_runtime::Date,
#[cfg_attr(
feature = "serde",
serde(
rename = "updatedTimestamp",
with = "satay_runtime::serde_string::as_offset_datetime"
)
)]
pub updated_timestamp: satay_runtime::OffsetDateTime,
#[cfg_attr(
feature = "serde",
serde(with = "satay_runtime::serde_string::as_offset_datetime")
)]
pub timestamp: satay_runtime::OffsetDateTime,
pub readings: PsiReadings,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PsiReadings {
pub co_sub_index: PsiCoSubIndexRegional,
pub so2_twenty_four_hourly: PsiSo2TwentyFourHourRegional,
pub so2_sub_index: PsiSo2SubIndexRegional,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub psi_three_hourly: Option<PsiThreeHourRegional>,
pub co_eight_hour_max: PsiCoEightHourMaxRegional,
pub no2_one_hour_max: PsiNo2OneHourMaxRegional,
pub pm10_sub_index: PsiPm10SubIndexRegional,
pub pm25_sub_index: PsiPm25SubIndexRegional,
pub o3_eight_hour_max: PsiO3EightHourMaxRegional,
pub psi_twenty_four_hourly: PsiTwentyFourHourRegional,
pub o3_sub_index: PsiO3SubIndexRegional,
pub pm25_twenty_four_hourly: PsiPm25TwentyFourHourRegional,
pub pm10_twenty_four_hourly: PsiPm10TwentyFourHourRegional,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NeaRegionMetadata {
pub name: NeaRegionMetadataName,
#[cfg_attr(feature = "serde", serde(rename = "labelLocation"))]
pub label_location: NeaGeoPoint,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PsiCoEightHourMaxRegional {
pub east: NeaRegionalReading,
pub west: NeaRegionalReading,
pub north: NeaRegionalReading,
pub south: NeaRegionalReading,
pub central: NeaRegionalReading,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PsiCoSubIndexRegional {
pub east: NeaRegionalReading,
pub west: NeaRegionalReading,
pub north: NeaRegionalReading,
pub south: NeaRegionalReading,
pub central: NeaRegionalReading,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PsiNo2OneHourMaxRegional {
pub east: NeaRegionalReading,
pub west: NeaRegionalReading,
pub north: NeaRegionalReading,
pub south: NeaRegionalReading,
pub central: NeaRegionalReading,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PsiO3EightHourMaxRegional {
pub east: NeaRegionalReading,
pub west: NeaRegionalReading,
pub north: NeaRegionalReading,
pub south: NeaRegionalReading,
pub central: NeaRegionalReading,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PsiO3SubIndexRegional {
pub east: NeaRegionalReading,
pub west: NeaRegionalReading,
pub north: NeaRegionalReading,
pub south: NeaRegionalReading,
pub central: NeaRegionalReading,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PsiPm10SubIndexRegional {
pub east: NeaRegionalReading,
pub west: NeaRegionalReading,
pub north: NeaRegionalReading,
pub south: NeaRegionalReading,
pub central: NeaRegionalReading,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PsiPm10TwentyFourHourRegional {
pub east: NeaRegionalReading,
pub west: NeaRegionalReading,
pub north: NeaRegionalReading,
pub south: NeaRegionalReading,
pub central: NeaRegionalReading,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PsiPm25SubIndexRegional {
pub east: NeaRegionalReading,
pub west: NeaRegionalReading,
pub north: NeaRegionalReading,
pub south: NeaRegionalReading,
pub central: NeaRegionalReading,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PsiPm25TwentyFourHourRegional {
pub east: NeaRegionalReading,
pub west: NeaRegionalReading,
pub north: NeaRegionalReading,
pub south: NeaRegionalReading,
pub central: NeaRegionalReading,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PsiThreeHourRegional {
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub east: Option<NeaRegionalReading>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub west: Option<NeaRegionalReading>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub north: Option<NeaRegionalReading>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub south: Option<NeaRegionalReading>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub central: Option<NeaRegionalReading>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PsiTwentyFourHourRegional {
pub east: NeaRegionalReading,
pub west: NeaRegionalReading,
pub north: NeaRegionalReading,
pub south: NeaRegionalReading,
pub central: NeaRegionalReading,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PsiSo2SubIndexRegional {
pub east: NeaRegionalReading,
pub west: NeaRegionalReading,
pub north: NeaRegionalReading,
pub south: NeaRegionalReading,
pub central: NeaRegionalReading,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PsiSo2TwentyFourHourRegional {
pub east: NeaRegionalReading,
pub west: NeaRegionalReading,
pub north: NeaRegionalReading,
pub south: NeaRegionalReading,
pub central: NeaRegionalReading,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Pm25Data {
#[cfg_attr(feature = "serde", serde(rename = "regionMetadata"))]
pub region_metadata: Vec<NeaRegionMetadata>,
pub items: Vec<Pm25Snapshot>,
#[cfg_attr(
feature = "serde",
serde(
rename = "paginationToken",
default,
skip_serializing_if = "Option::is_none"
)
)]
pub pagination_token: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Pm25Snapshot {
#[cfg_attr(
feature = "serde",
serde(with = "satay_runtime::serde_string::as_date")
)]
pub date: satay_runtime::Date,
#[cfg_attr(
feature = "serde",
serde(
rename = "updatedTimestamp",
with = "satay_runtime::serde_string::as_offset_datetime"
)
)]
pub updated_timestamp: satay_runtime::OffsetDateTime,
#[cfg_attr(
feature = "serde",
serde(with = "satay_runtime::serde_string::as_offset_datetime")
)]
pub timestamp: satay_runtime::OffsetDateTime,
pub readings: Pm25Readings,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Pm25Readings {
pub pm25_one_hourly: Pm25OneHourRegional,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Pm25OneHourRegional {
pub east: NeaPm25HourlyReading,
pub west: NeaPm25HourlyReading,
pub north: NeaPm25HourlyReading,
pub south: NeaPm25HourlyReading,
pub central: NeaPm25HourlyReading,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct UvData {
pub records: Vec<UvDayRecord>,
#[cfg_attr(
feature = "serde",
serde(
rename = "paginationToken",
default,
skip_serializing_if = "Option::is_none"
)
)]
pub pagination_token: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct UvDayRecord {
pub index: Vec<UvHourlyIndex>,
#[cfg_attr(
feature = "serde",
serde(with = "satay_runtime::serde_string::as_date")
)]
pub date: satay_runtime::Date,
#[cfg_attr(
feature = "serde",
serde(
rename = "updatedTimestamp",
with = "satay_runtime::serde_string::as_offset_datetime"
)
)]
pub updated_timestamp: satay_runtime::OffsetDateTime,
#[cfg_attr(
feature = "serde",
serde(with = "satay_runtime::serde_string::as_offset_datetime")
)]
pub timestamp: satay_runtime::OffsetDateTime,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct UvHourlyIndex {
#[cfg_attr(
feature = "serde",
serde(with = "satay_runtime::serde_string::as_offset_datetime")
)]
pub hour: satay_runtime::OffsetDateTime,
pub value: NeaUvIndex,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WeatherSubApiData {
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub records: Option<Vec<WeatherSubApiDayRecord>>,
#[cfg_attr(
feature = "serde",
serde(
rename = "paginationToken",
default,
skip_serializing_if = "Option::is_none"
)
)]
pub pagination_token: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WeatherSubApiDayRecord {
#[cfg_attr(
feature = "serde",
serde(
with = "satay_runtime::serde_string::as_offset_datetime::option",
default,
skip_serializing_if = "Option::is_none"
)
)]
pub datetime: Option<satay_runtime::OffsetDateTime>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub item: Option<WeatherSubApiObservation>,
#[cfg_attr(
feature = "serde",
serde(
rename = "updatedTimestamp",
with = "satay_runtime::serde_string::as_offset_datetime::option",
default,
skip_serializing_if = "Option::is_none"
)
)]
pub updated_timestamp: Option<satay_runtime::OffsetDateTime>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WeatherSubApiObservation {
#[cfg_attr(
feature = "serde",
serde(rename = "type", default, skip_serializing_if = "Option::is_none")
)]
pub type_: Option<String>,
#[cfg_attr(
feature = "serde",
serde(
rename = "isStationData",
default,
skip_serializing_if = "Option::is_none"
)
)]
pub is_station_data: Option<bool>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub readings: Option<Vec<WeatherSubApiLightningReading>>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WeatherSubApiLightningReading {
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub location: Option<NeaLightningGeoPoint>,
#[cfg_attr(
feature = "serde",
serde(
with = "satay_runtime::serde_string::as_offset_datetime::option",
default,
skip_serializing_if = "Option::is_none"
)
)]
pub datetime: Option<satay_runtime::OffsetDateTime>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub text: Option<String>,
#[cfg_attr(
feature = "serde",
serde(rename = "type", default, skip_serializing_if = "Option::is_none")
)]
pub type_: Option<NeaLightningType>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub station: Option<NeaWbgtStation>,
#[cfg_attr(
feature = "serde",
serde(
with = "satay_runtime::serde_string::as_f64::option",
default,
skip_serializing_if = "Option::is_none"
)
)]
pub wbgt: Option<f64>,
#[cfg_attr(
feature = "serde",
serde(
rename = "heatStress",
default,
skip_serializing_if = "Option::is_none"
)
)]
pub heat_stress: Option<NeaHeatStressLevel>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WeatherSubApiInvalidParamsError {
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub code: Option<f64>,
#[cfg_attr(
feature = "serde",
serde(default, skip_serializing_if = "Option::is_none")
)]
pub name: Option<String>,
#[cfg_attr(
feature = "serde",
serde(rename = "errorMsg", default, skip_serializing_if = "Option::is_none")
)]
pub error_msg: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum NeaMeasurementUnit {
#[cfg_attr(feature = "serde", serde(rename = "deg C"))]
DegC,
#[cfg_attr(feature = "serde", serde(rename = "Degrees Celsius"))]
DegreesCelsius,
Percentage,
#[cfg_attr(feature = "serde", serde(rename = "percentage"))]
PercentLower,
#[cfg_attr(feature = "serde", serde(rename = "knots"))]
Knots,
#[cfg_attr(feature = "serde", serde(rename = "degrees"))]
Degrees,
#[cfg_attr(feature = "serde", serde(rename = "mm"))]
Millimeters,
#[default]
#[cfg_attr(feature = "serde", serde(other))]
Unknown,
}
impl NeaMeasurementUnit {
pub const fn as_str(&self) -> &'static str {
match self {
Self::DegC => "deg C",
Self::DegreesCelsius => "Degrees Celsius",
Self::Percentage => "Percentage",
Self::PercentLower => "percentage",
Self::Knots => "knots",
Self::Degrees => "degrees",
Self::Millimeters => "mm",
Self::Unknown => "",
}
}
}
impl AsRef<str> for NeaMeasurementUnit {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl fmt::Display for NeaMeasurementUnit {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NeaLightningGeoPoint {
#[cfg_attr(feature = "serde", serde(with = "satay_runtime::serde_string::as_f64"))]
pub latitude: f64,
#[cfg_attr(feature = "serde", serde(with = "satay_runtime::serde_string::as_f64"))]
pub longitude: f64,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NeaWbgtStation {
pub id: NeaStationId,
pub name: String,
#[cfg_attr(feature = "serde", serde(rename = "townCenter"))]
pub town_center: String,
}
pub type NeaWbgt = f64;
#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum NeaHeatStressLevel {
Low,
Moderate,
High,
#[default]
#[cfg_attr(feature = "serde", serde(other))]
Unknown,
}
impl NeaHeatStressLevel {
pub const fn as_str(&self) -> &'static str {
match self {
Self::Low => "Low",
Self::Moderate => "Moderate",
Self::High => "High",
Self::Unknown => "",
}
}
}
impl AsRef<str> for NeaHeatStressLevel {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl fmt::Display for NeaHeatStressLevel {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum NeaRegionMetadataName {
#[cfg_attr(feature = "serde", serde(rename = "west"))]
West,
#[cfg_attr(feature = "serde", serde(rename = "east"))]
East,
#[cfg_attr(feature = "serde", serde(rename = "north"))]
North,
#[cfg_attr(feature = "serde", serde(rename = "south"))]
South,
#[cfg_attr(feature = "serde", serde(rename = "central"))]
Central,
#[default]
#[cfg_attr(feature = "serde", serde(other))]
Unknown,
}
impl NeaRegionMetadataName {
pub const fn as_str(&self) -> &'static str {
match self {
Self::West => "west",
Self::East => "east",
Self::North => "north",
Self::South => "south",
Self::Central => "central",
Self::Unknown => "",
}
}
}
impl AsRef<str> for NeaRegionMetadataName {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl fmt::Display for NeaRegionMetadataName {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}