#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum SourceKind {
Rain,
ImperviousLand,
ModifiedGreenAmpt,
Evaporation,
Withdrawal,
LateralInflow,
LateralWithdrawal,
ExchangeVolume,
LocalPoolRain,
LocalPoolLoss,
}
impl SourceKind {
pub fn id(&self) -> &'static str {
match self {
Self::Rain => "rain",
Self::ImperviousLand => "impervious-land",
Self::ModifiedGreenAmpt => "modified-green-ampt",
Self::Evaporation => "evaporation",
Self::Withdrawal => "withdrawal",
Self::LateralInflow => "lateral-inflow",
Self::LateralWithdrawal => "lateral-withdrawal",
Self::ExchangeVolume => "exchange-volume",
Self::LocalPoolRain => "local-pool-rain",
Self::LocalPoolLoss => "local-pool-loss",
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::capability::id_check::assert_ids;
#[test]
fn ids_are_unique_kebab_case() {
let all = [
SourceKind::Rain,
SourceKind::ImperviousLand,
SourceKind::ModifiedGreenAmpt,
SourceKind::Evaporation,
SourceKind::Withdrawal,
SourceKind::LateralInflow,
SourceKind::LateralWithdrawal,
SourceKind::ExchangeVolume,
SourceKind::LocalPoolRain,
SourceKind::LocalPoolLoss,
];
assert_ids(&all.map(|s| s.id()));
}
}