zugferd_code_lists/zugferd_2_3_3/
enum5305.rs1#![allow(non_camel_case_types)]
2
3#[cfg_attr(feature = "specta", derive(specta::Type))]
4#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
5#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
6pub enum Enum5305 {
7 StandardRate,
9 ZeroRatedGoods,
11 ExemptFromTax,
13 VatReverseCharge,
17 VatExemptForEeaIntraCommunitySupplyGoodsAndServices,
21 FreeExportItemTaxNotCharged,
23 ServiceOutsideScopeTax,
27 CanaryIslandsGeneralIndirectTax,
31 TaxForProductionServicesAndImportationInCeutaAndMelilla,
35}
36
37impl std::fmt::Display for Enum5305 {
38 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39 write!(f, "{}", <Self as crate::Code>::code(*self))
40 }
41}
42
43impl std::str::FromStr for Enum5305 {
44 type Err = crate::ParseError<Self>;
45 fn from_str(s: &str) -> Result<Self, Self::Err> {
46 <Self as crate::FromCode>::from_code(s)
47 .ok_or_else(|| crate::ParseError::<Self>::new(s.to_owned()))
48 }
49}
50
51impl crate::Code for Enum5305 {
52 fn code(self) -> &'static str {
53 match self {
54 Enum5305::StandardRate => "S",
55 Enum5305::ZeroRatedGoods => "Z",
56 Enum5305::ExemptFromTax => "E",
57 Enum5305::VatReverseCharge => "AE",
58 Enum5305::VatExemptForEeaIntraCommunitySupplyGoodsAndServices => "K",
59 Enum5305::FreeExportItemTaxNotCharged => "G",
60 Enum5305::ServiceOutsideScopeTax => "O",
61 Enum5305::CanaryIslandsGeneralIndirectTax => "L",
62 Enum5305::TaxForProductionServicesAndImportationInCeutaAndMelilla => "M",
63 }
64 }
65}
66
67impl crate::Description for Enum5305 {
68 fn description(self) -> &'static str {
69 match self {
70 Enum5305::StandardRate => "Standard rate",
71 Enum5305::ZeroRatedGoods => "Zero rated goods",
72 Enum5305::ExemptFromTax => "Exempt from tax",
73 Enum5305::VatReverseCharge => "VAT Reverse charge",
74 Enum5305::VatExemptForEeaIntraCommunitySupplyGoodsAndServices => {
75 "VAT exempt for EEA intra-community supply of goods and services"
76 }
77 Enum5305::FreeExportItemTaxNotCharged => "Free export item, tax not charged",
78 Enum5305::ServiceOutsideScopeTax => "Service outside scope of tax",
79 Enum5305::CanaryIslandsGeneralIndirectTax => "Canary Islands general indirect tax",
80 Enum5305::TaxForProductionServicesAndImportationInCeutaAndMelilla => {
81 "Tax for production, services and importation in Ceuta and Melilla"
82 }
83 }
84 }
85}
86
87impl crate::FromCode for Enum5305 {
88 fn from_code(code: &str) -> Option<Self>
89 where
90 Self: Sized,
91 {
92 match code {
93 "S" => Some(Enum5305::StandardRate),
94 "Z" => Some(Enum5305::ZeroRatedGoods),
95 "E" => Some(Enum5305::ExemptFromTax),
96 "AE" => Some(Enum5305::VatReverseCharge),
97 "K" => Some(Enum5305::VatExemptForEeaIntraCommunitySupplyGoodsAndServices),
98 "G" => Some(Enum5305::FreeExportItemTaxNotCharged),
99 "O" => Some(Enum5305::ServiceOutsideScopeTax),
100 "L" => Some(Enum5305::CanaryIslandsGeneralIndirectTax),
101 "M" => Some(Enum5305::TaxForProductionServicesAndImportationInCeutaAndMelilla),
102 _ => None,
103 }
104 }
105}