use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum ListingTerms {
_1031Exchange,
AllInclusiveTrustDeed,
Assumable,
Cash,
Contract,
Conventional,
ExistingBonds,
FHA,
LandUseFee,
LeaseBack,
LeaseOption,
LeasePurchase,
LienRelease,
OwnerMayCarry,
OwnerPayPoints,
OwnerWillCarry,
PrivateFinancingAvailable,
RelocationProperty,
SellerEquityShare,
SpecialFunding,
Submit,
Trade,
TrustConveyance,
TrustDeed,
USDALoan,
VALoan,
OpenEnumeration(String),
}
impl crate::ResoEnumeration for ListingTerms {
fn from_str(s: &str) -> ListingTerms {
match s {
"1031 Exchange" => ListingTerms::_1031Exchange,
"All Inclusive Trust Deed" => ListingTerms::AllInclusiveTrustDeed,
"Assumable" => ListingTerms::Assumable,
"Cash" => ListingTerms::Cash,
"Contract" => ListingTerms::Contract,
"Conventional" => ListingTerms::Conventional,
"Existing Bonds" => ListingTerms::ExistingBonds,
"FHA" => ListingTerms::FHA,
"Land Use Fee" => ListingTerms::LandUseFee,
"Lease Back" => ListingTerms::LeaseBack,
"Lease Option" => ListingTerms::LeaseOption,
"Lease Purchase" => ListingTerms::LeasePurchase,
"Lien Release" => ListingTerms::LienRelease,
"Owner May Carry" => ListingTerms::OwnerMayCarry,
"Owner Pay Points" => ListingTerms::OwnerPayPoints,
"Owner Will Carry" => ListingTerms::OwnerWillCarry,
"Private Financing Available" => ListingTerms::PrivateFinancingAvailable,
"Relocation Property" => ListingTerms::RelocationProperty,
"Seller Equity Share" => ListingTerms::SellerEquityShare,
"Special Funding" => ListingTerms::SpecialFunding,
"Submit" => ListingTerms::Submit,
"Trade" => ListingTerms::Trade,
"Trust Conveyance" => ListingTerms::TrustConveyance,
"Trust Deed" => ListingTerms::TrustDeed,
"USDA Loan" => ListingTerms::USDALoan,
"VA Loan" => ListingTerms::VALoan,
_ => ListingTerms::OpenEnumeration(s.into()),
}
}
fn from_string(s: String) -> ListingTerms {
match s.as_ref() {
"1031 Exchange" => ListingTerms::_1031Exchange,
"All Inclusive Trust Deed" => ListingTerms::AllInclusiveTrustDeed,
"Assumable" => ListingTerms::Assumable,
"Cash" => ListingTerms::Cash,
"Contract" => ListingTerms::Contract,
"Conventional" => ListingTerms::Conventional,
"Existing Bonds" => ListingTerms::ExistingBonds,
"FHA" => ListingTerms::FHA,
"Land Use Fee" => ListingTerms::LandUseFee,
"Lease Back" => ListingTerms::LeaseBack,
"Lease Option" => ListingTerms::LeaseOption,
"Lease Purchase" => ListingTerms::LeasePurchase,
"Lien Release" => ListingTerms::LienRelease,
"Owner May Carry" => ListingTerms::OwnerMayCarry,
"Owner Pay Points" => ListingTerms::OwnerPayPoints,
"Owner Will Carry" => ListingTerms::OwnerWillCarry,
"Private Financing Available" => ListingTerms::PrivateFinancingAvailable,
"Relocation Property" => ListingTerms::RelocationProperty,
"Seller Equity Share" => ListingTerms::SellerEquityShare,
"Special Funding" => ListingTerms::SpecialFunding,
"Submit" => ListingTerms::Submit,
"Trade" => ListingTerms::Trade,
"Trust Conveyance" => ListingTerms::TrustConveyance,
"Trust Deed" => ListingTerms::TrustDeed,
"USDA Loan" => ListingTerms::USDALoan,
"VA Loan" => ListingTerms::VALoan,
_ => ListingTerms::OpenEnumeration(s),
}
}
fn to_str(&self) -> &str {
match self {
ListingTerms::_1031Exchange => "1031 Exchange",
ListingTerms::AllInclusiveTrustDeed => "All Inclusive Trust Deed",
ListingTerms::Assumable => "Assumable",
ListingTerms::Cash => "Cash",
ListingTerms::Contract => "Contract",
ListingTerms::Conventional => "Conventional",
ListingTerms::ExistingBonds => "Existing Bonds",
ListingTerms::FHA => "FHA",
ListingTerms::LandUseFee => "Land Use Fee",
ListingTerms::LeaseBack => "Lease Back",
ListingTerms::LeaseOption => "Lease Option",
ListingTerms::LeasePurchase => "Lease Purchase",
ListingTerms::LienRelease => "Lien Release",
ListingTerms::OwnerMayCarry => "Owner May Carry",
ListingTerms::OwnerPayPoints => "Owner Pay Points",
ListingTerms::OwnerWillCarry => "Owner Will Carry",
ListingTerms::PrivateFinancingAvailable => "Private Financing Available",
ListingTerms::RelocationProperty => "Relocation Property",
ListingTerms::SellerEquityShare => "Seller Equity Share",
ListingTerms::SpecialFunding => "Special Funding",
ListingTerms::Submit => "Submit",
ListingTerms::Trade => "Trade",
ListingTerms::TrustConveyance => "Trust Conveyance",
ListingTerms::TrustDeed => "Trust Deed",
ListingTerms::USDALoan => "USDA Loan",
ListingTerms::VALoan => "VA Loan",
ListingTerms::OpenEnumeration(ref s) => s,
}
}
fn into_string(self) -> String {
match self {
ListingTerms::_1031Exchange => "1031 Exchange".into(),
ListingTerms::AllInclusiveTrustDeed => "All Inclusive Trust Deed".into(),
ListingTerms::Assumable => "Assumable".into(),
ListingTerms::Cash => "Cash".into(),
ListingTerms::Contract => "Contract".into(),
ListingTerms::Conventional => "Conventional".into(),
ListingTerms::ExistingBonds => "Existing Bonds".into(),
ListingTerms::FHA => "FHA".into(),
ListingTerms::LandUseFee => "Land Use Fee".into(),
ListingTerms::LeaseBack => "Lease Back".into(),
ListingTerms::LeaseOption => "Lease Option".into(),
ListingTerms::LeasePurchase => "Lease Purchase".into(),
ListingTerms::LienRelease => "Lien Release".into(),
ListingTerms::OwnerMayCarry => "Owner May Carry".into(),
ListingTerms::OwnerPayPoints => "Owner Pay Points".into(),
ListingTerms::OwnerWillCarry => "Owner Will Carry".into(),
ListingTerms::PrivateFinancingAvailable => "Private Financing Available".into(),
ListingTerms::RelocationProperty => "Relocation Property".into(),
ListingTerms::SellerEquityShare => "Seller Equity Share".into(),
ListingTerms::SpecialFunding => "Special Funding".into(),
ListingTerms::Submit => "Submit".into(),
ListingTerms::Trade => "Trade".into(),
ListingTerms::TrustConveyance => "Trust Conveyance".into(),
ListingTerms::TrustDeed => "Trust Deed".into(),
ListingTerms::USDALoan => "USDA Loan".into(),
ListingTerms::VALoan => "VA Loan".into(),
ListingTerms::OpenEnumeration(s) => s,
}
}
fn fallback_value(&self) -> Option<&str> {
match self {
ListingTerms::OpenEnumeration(ref s) => Some(s),
_ => None,
}
}
}
impl From<String> for ListingTerms {
fn from(s: String) -> ListingTerms {
match s.as_ref() {
"1031 Exchange" => ListingTerms::_1031Exchange,
"All Inclusive Trust Deed" => ListingTerms::AllInclusiveTrustDeed,
"Assumable" => ListingTerms::Assumable,
"Cash" => ListingTerms::Cash,
"Contract" => ListingTerms::Contract,
"Conventional" => ListingTerms::Conventional,
"Existing Bonds" => ListingTerms::ExistingBonds,
"FHA" => ListingTerms::FHA,
"Land Use Fee" => ListingTerms::LandUseFee,
"Lease Back" => ListingTerms::LeaseBack,
"Lease Option" => ListingTerms::LeaseOption,
"Lease Purchase" => ListingTerms::LeasePurchase,
"Lien Release" => ListingTerms::LienRelease,
"Owner May Carry" => ListingTerms::OwnerMayCarry,
"Owner Pay Points" => ListingTerms::OwnerPayPoints,
"Owner Will Carry" => ListingTerms::OwnerWillCarry,
"Private Financing Available" => ListingTerms::PrivateFinancingAvailable,
"Relocation Property" => ListingTerms::RelocationProperty,
"Seller Equity Share" => ListingTerms::SellerEquityShare,
"Special Funding" => ListingTerms::SpecialFunding,
"Submit" => ListingTerms::Submit,
"Trade" => ListingTerms::Trade,
"Trust Conveyance" => ListingTerms::TrustConveyance,
"Trust Deed" => ListingTerms::TrustDeed,
"USDA Loan" => ListingTerms::USDALoan,
"VA Loan" => ListingTerms::VALoan,
_ => ListingTerms::OpenEnumeration(s),
}
}
}
impl From<&str> for ListingTerms {
fn from(s: &str) -> ListingTerms {
match s {
"1031 Exchange" => ListingTerms::_1031Exchange,
"All Inclusive Trust Deed" => ListingTerms::AllInclusiveTrustDeed,
"Assumable" => ListingTerms::Assumable,
"Cash" => ListingTerms::Cash,
"Contract" => ListingTerms::Contract,
"Conventional" => ListingTerms::Conventional,
"Existing Bonds" => ListingTerms::ExistingBonds,
"FHA" => ListingTerms::FHA,
"Land Use Fee" => ListingTerms::LandUseFee,
"Lease Back" => ListingTerms::LeaseBack,
"Lease Option" => ListingTerms::LeaseOption,
"Lease Purchase" => ListingTerms::LeasePurchase,
"Lien Release" => ListingTerms::LienRelease,
"Owner May Carry" => ListingTerms::OwnerMayCarry,
"Owner Pay Points" => ListingTerms::OwnerPayPoints,
"Owner Will Carry" => ListingTerms::OwnerWillCarry,
"Private Financing Available" => ListingTerms::PrivateFinancingAvailable,
"Relocation Property" => ListingTerms::RelocationProperty,
"Seller Equity Share" => ListingTerms::SellerEquityShare,
"Special Funding" => ListingTerms::SpecialFunding,
"Submit" => ListingTerms::Submit,
"Trade" => ListingTerms::Trade,
"Trust Conveyance" => ListingTerms::TrustConveyance,
"Trust Deed" => ListingTerms::TrustDeed,
"USDA Loan" => ListingTerms::USDALoan,
"VA Loan" => ListingTerms::VALoan,
_ => ListingTerms::OpenEnumeration(s.into()),
}
}
}
impl<'a> From<&'a ListingTerms> for &'a str {
fn from(s: &'a ListingTerms) -> &'a str {
match s {
ListingTerms::_1031Exchange => "1031 Exchange",
ListingTerms::AllInclusiveTrustDeed => "All Inclusive Trust Deed",
ListingTerms::Assumable => "Assumable",
ListingTerms::Cash => "Cash",
ListingTerms::Contract => "Contract",
ListingTerms::Conventional => "Conventional",
ListingTerms::ExistingBonds => "Existing Bonds",
ListingTerms::FHA => "FHA",
ListingTerms::LandUseFee => "Land Use Fee",
ListingTerms::LeaseBack => "Lease Back",
ListingTerms::LeaseOption => "Lease Option",
ListingTerms::LeasePurchase => "Lease Purchase",
ListingTerms::LienRelease => "Lien Release",
ListingTerms::OwnerMayCarry => "Owner May Carry",
ListingTerms::OwnerPayPoints => "Owner Pay Points",
ListingTerms::OwnerWillCarry => "Owner Will Carry",
ListingTerms::PrivateFinancingAvailable => "Private Financing Available",
ListingTerms::RelocationProperty => "Relocation Property",
ListingTerms::SellerEquityShare => "Seller Equity Share",
ListingTerms::SpecialFunding => "Special Funding",
ListingTerms::Submit => "Submit",
ListingTerms::Trade => "Trade",
ListingTerms::TrustConveyance => "Trust Conveyance",
ListingTerms::TrustDeed => "Trust Deed",
ListingTerms::USDALoan => "USDA Loan",
ListingTerms::VALoan => "VA Loan",
ListingTerms::OpenEnumeration(s) => s,
}
}
}
impl Serialize for ListingTerms {
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 ListingTerms {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = String::deserialize(deserializer)?;
Ok(From::from(s))
}
}