use std::borrow::Cow;
use crate::query::AsApiStr;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize)]
#[non_exhaustive]
pub enum TemperatureUnit {
Celsius,
Fahrenheit,
}
impl AsApiStr for TemperatureUnit {
fn as_api_str(&self) -> Cow<'static, str> {
Cow::Borrowed(match self {
Self::Celsius => "celsius",
Self::Fahrenheit => "fahrenheit",
})
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize)]
#[non_exhaustive]
pub enum WindSpeedUnit {
Kmh,
Ms,
Mph,
Kn,
}
impl AsApiStr for WindSpeedUnit {
fn as_api_str(&self) -> Cow<'static, str> {
Cow::Borrowed(match self {
Self::Kmh => "kmh",
Self::Ms => "ms",
Self::Mph => "mph",
Self::Kn => "kn",
})
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize)]
#[non_exhaustive]
pub enum LengthUnit {
Metric,
Imperial,
}
impl AsApiStr for LengthUnit {
fn as_api_str(&self) -> Cow<'static, str> {
Cow::Borrowed(match self {
Self::Metric => "metric",
Self::Imperial => "imperial",
})
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize)]
#[non_exhaustive]
pub enum PrecipitationUnit {
Mm,
Inch,
}
impl AsApiStr for PrecipitationUnit {
fn as_api_str(&self) -> Cow<'static, str> {
Cow::Borrowed(match self {
Self::Mm => "mm",
Self::Inch => "inch",
})
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize)]
#[non_exhaustive]
pub enum TimeFormat {
Iso8601,
UnixTime,
}
impl AsApiStr for TimeFormat {
fn as_api_str(&self) -> Cow<'static, str> {
Cow::Borrowed(match self {
Self::Iso8601 => "iso8601",
Self::UnixTime => "unixtime",
})
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize)]
#[non_exhaustive]
pub enum Timezone {
Auto,
Gmt,
Iana(String),
}
impl AsApiStr for Timezone {
fn as_api_str(&self) -> Cow<'static, str> {
match self {
Self::Auto => Cow::Borrowed("auto"),
Self::Gmt => Cow::Borrowed("GMT"),
Self::Iana(value) => Cow::Owned(value.clone()),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize)]
#[non_exhaustive]
pub enum CellSelection {
Land,
Sea,
Nearest,
}
impl AsApiStr for CellSelection {
fn as_api_str(&self) -> Cow<'static, str> {
Cow::Borrowed(match self {
Self::Land => "land",
Self::Sea => "sea",
Self::Nearest => "nearest",
})
}
}