use crate::ids::{ClimateSupplierId};
use crate::params::{Object};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct ClimateSupplier {
pub id: ClimateSupplierId,
pub info_url: String,
pub livemode: bool,
pub locations: Vec<ClimateRemovalsLocation>,
pub name: String,
pub removal_pathway: ClimateSupplierRemovalPathway,
}
impl Object for ClimateSupplier {
type Id = ClimateSupplierId;
fn id(&self) -> Self::Id {
self.id.clone()
}
fn object(&self) -> &'static str {
"climate.supplier"
}
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct ClimateRemovalsLocation {
pub city: Option<String>,
pub country: String,
pub latitude: Option<f64>,
pub longitude: Option<f64>,
pub region: Option<String>,
}
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum ClimateSupplierRemovalPathway {
BiomassCarbonRemovalAndStorage,
DirectAirCapture,
EnhancedWeathering,
}
impl ClimateSupplierRemovalPathway {
pub fn as_str(self) -> &'static str {
match self {
ClimateSupplierRemovalPathway::BiomassCarbonRemovalAndStorage => "biomass_carbon_removal_and_storage",
ClimateSupplierRemovalPathway::DirectAirCapture => "direct_air_capture",
ClimateSupplierRemovalPathway::EnhancedWeathering => "enhanced_weathering",
}
}
}
impl AsRef<str> for ClimateSupplierRemovalPathway {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for ClimateSupplierRemovalPathway {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for ClimateSupplierRemovalPathway {
fn default() -> Self {
Self::BiomassCarbonRemovalAndStorage
}
}