use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum AssociationFeeIncludes {
CableTV,
EarthquakeInsurance,
Electricity,
Gas,
Insurance,
Internet,
MaintenanceGrounds,
MaintenanceStructure,
PestControl,
Security,
Sewer,
SnowRemoval,
Trash,
Utilities,
Water,
OpenEnumeration(String),
}
impl crate::ResoEnumeration for AssociationFeeIncludes {
fn from_str(s: &str) -> AssociationFeeIncludes {
match s {
"Cable TV" => AssociationFeeIncludes::CableTV,
"Earthquake Insurance" => AssociationFeeIncludes::EarthquakeInsurance,
"Electricity" => AssociationFeeIncludes::Electricity,
"Gas" => AssociationFeeIncludes::Gas,
"Insurance" => AssociationFeeIncludes::Insurance,
"Internet" => AssociationFeeIncludes::Internet,
"Maintenance Grounds" => AssociationFeeIncludes::MaintenanceGrounds,
"Maintenance Structure" => AssociationFeeIncludes::MaintenanceStructure,
"Pest Control" => AssociationFeeIncludes::PestControl,
"Security" => AssociationFeeIncludes::Security,
"Sewer" => AssociationFeeIncludes::Sewer,
"Snow Removal" => AssociationFeeIncludes::SnowRemoval,
"Trash" => AssociationFeeIncludes::Trash,
"Utilities" => AssociationFeeIncludes::Utilities,
"Water" => AssociationFeeIncludes::Water,
_ => AssociationFeeIncludes::OpenEnumeration(s.into()),
}
}
fn from_string(s: String) -> AssociationFeeIncludes {
match s.as_ref() {
"Cable TV" => AssociationFeeIncludes::CableTV,
"Earthquake Insurance" => AssociationFeeIncludes::EarthquakeInsurance,
"Electricity" => AssociationFeeIncludes::Electricity,
"Gas" => AssociationFeeIncludes::Gas,
"Insurance" => AssociationFeeIncludes::Insurance,
"Internet" => AssociationFeeIncludes::Internet,
"Maintenance Grounds" => AssociationFeeIncludes::MaintenanceGrounds,
"Maintenance Structure" => AssociationFeeIncludes::MaintenanceStructure,
"Pest Control" => AssociationFeeIncludes::PestControl,
"Security" => AssociationFeeIncludes::Security,
"Sewer" => AssociationFeeIncludes::Sewer,
"Snow Removal" => AssociationFeeIncludes::SnowRemoval,
"Trash" => AssociationFeeIncludes::Trash,
"Utilities" => AssociationFeeIncludes::Utilities,
"Water" => AssociationFeeIncludes::Water,
_ => AssociationFeeIncludes::OpenEnumeration(s),
}
}
fn to_str(&self) -> &str {
match self {
AssociationFeeIncludes::CableTV => "Cable TV",
AssociationFeeIncludes::EarthquakeInsurance => "Earthquake Insurance",
AssociationFeeIncludes::Electricity => "Electricity",
AssociationFeeIncludes::Gas => "Gas",
AssociationFeeIncludes::Insurance => "Insurance",
AssociationFeeIncludes::Internet => "Internet",
AssociationFeeIncludes::MaintenanceGrounds => "Maintenance Grounds",
AssociationFeeIncludes::MaintenanceStructure => "Maintenance Structure",
AssociationFeeIncludes::PestControl => "Pest Control",
AssociationFeeIncludes::Security => "Security",
AssociationFeeIncludes::Sewer => "Sewer",
AssociationFeeIncludes::SnowRemoval => "Snow Removal",
AssociationFeeIncludes::Trash => "Trash",
AssociationFeeIncludes::Utilities => "Utilities",
AssociationFeeIncludes::Water => "Water",
AssociationFeeIncludes::OpenEnumeration(ref s) => s,
}
}
fn into_string(self) -> String {
match self {
AssociationFeeIncludes::CableTV => "Cable TV".into(),
AssociationFeeIncludes::EarthquakeInsurance => "Earthquake Insurance".into(),
AssociationFeeIncludes::Electricity => "Electricity".into(),
AssociationFeeIncludes::Gas => "Gas".into(),
AssociationFeeIncludes::Insurance => "Insurance".into(),
AssociationFeeIncludes::Internet => "Internet".into(),
AssociationFeeIncludes::MaintenanceGrounds => "Maintenance Grounds".into(),
AssociationFeeIncludes::MaintenanceStructure => "Maintenance Structure".into(),
AssociationFeeIncludes::PestControl => "Pest Control".into(),
AssociationFeeIncludes::Security => "Security".into(),
AssociationFeeIncludes::Sewer => "Sewer".into(),
AssociationFeeIncludes::SnowRemoval => "Snow Removal".into(),
AssociationFeeIncludes::Trash => "Trash".into(),
AssociationFeeIncludes::Utilities => "Utilities".into(),
AssociationFeeIncludes::Water => "Water".into(),
AssociationFeeIncludes::OpenEnumeration(s) => s,
}
}
fn fallback_value(&self) -> Option<&str> {
match self {
AssociationFeeIncludes::OpenEnumeration(ref s) => Some(s),
_ => None,
}
}
}
impl From<String> for AssociationFeeIncludes {
fn from(s: String) -> AssociationFeeIncludes {
match s.as_ref() {
"Cable TV" => AssociationFeeIncludes::CableTV,
"Earthquake Insurance" => AssociationFeeIncludes::EarthquakeInsurance,
"Electricity" => AssociationFeeIncludes::Electricity,
"Gas" => AssociationFeeIncludes::Gas,
"Insurance" => AssociationFeeIncludes::Insurance,
"Internet" => AssociationFeeIncludes::Internet,
"Maintenance Grounds" => AssociationFeeIncludes::MaintenanceGrounds,
"Maintenance Structure" => AssociationFeeIncludes::MaintenanceStructure,
"Pest Control" => AssociationFeeIncludes::PestControl,
"Security" => AssociationFeeIncludes::Security,
"Sewer" => AssociationFeeIncludes::Sewer,
"Snow Removal" => AssociationFeeIncludes::SnowRemoval,
"Trash" => AssociationFeeIncludes::Trash,
"Utilities" => AssociationFeeIncludes::Utilities,
"Water" => AssociationFeeIncludes::Water,
_ => AssociationFeeIncludes::OpenEnumeration(s),
}
}
}
impl From<&str> for AssociationFeeIncludes {
fn from(s: &str) -> AssociationFeeIncludes {
match s {
"Cable TV" => AssociationFeeIncludes::CableTV,
"Earthquake Insurance" => AssociationFeeIncludes::EarthquakeInsurance,
"Electricity" => AssociationFeeIncludes::Electricity,
"Gas" => AssociationFeeIncludes::Gas,
"Insurance" => AssociationFeeIncludes::Insurance,
"Internet" => AssociationFeeIncludes::Internet,
"Maintenance Grounds" => AssociationFeeIncludes::MaintenanceGrounds,
"Maintenance Structure" => AssociationFeeIncludes::MaintenanceStructure,
"Pest Control" => AssociationFeeIncludes::PestControl,
"Security" => AssociationFeeIncludes::Security,
"Sewer" => AssociationFeeIncludes::Sewer,
"Snow Removal" => AssociationFeeIncludes::SnowRemoval,
"Trash" => AssociationFeeIncludes::Trash,
"Utilities" => AssociationFeeIncludes::Utilities,
"Water" => AssociationFeeIncludes::Water,
_ => AssociationFeeIncludes::OpenEnumeration(s.into()),
}
}
}
impl<'a> From<&'a AssociationFeeIncludes> for &'a str {
fn from(s: &'a AssociationFeeIncludes) -> &'a str {
match s {
AssociationFeeIncludes::CableTV => "Cable TV",
AssociationFeeIncludes::EarthquakeInsurance => "Earthquake Insurance",
AssociationFeeIncludes::Electricity => "Electricity",
AssociationFeeIncludes::Gas => "Gas",
AssociationFeeIncludes::Insurance => "Insurance",
AssociationFeeIncludes::Internet => "Internet",
AssociationFeeIncludes::MaintenanceGrounds => "Maintenance Grounds",
AssociationFeeIncludes::MaintenanceStructure => "Maintenance Structure",
AssociationFeeIncludes::PestControl => "Pest Control",
AssociationFeeIncludes::Security => "Security",
AssociationFeeIncludes::Sewer => "Sewer",
AssociationFeeIncludes::SnowRemoval => "Snow Removal",
AssociationFeeIncludes::Trash => "Trash",
AssociationFeeIncludes::Utilities => "Utilities",
AssociationFeeIncludes::Water => "Water",
AssociationFeeIncludes::OpenEnumeration(s) => s,
}
}
}
impl Serialize for AssociationFeeIncludes {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.into())
}
}
impl<'de> Deserialize<'de> for AssociationFeeIncludes {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = String::deserialize(deserializer)?;
Ok(From::from(s))
}
}