zugferd_code_lists/zugferd_2_3_2/
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 = ();
45 fn from_str(s: &str) -> Result<Self, Self::Err> {
46 <Self as crate::FromCode>::from_code(s).ok_or(())
47 }
48}
49
50impl crate::Code for Enum5305 {
51 fn code(self) -> &'static str {
52 match self {
53 Enum5305::StandardRate => "S",
54 Enum5305::ZeroRatedGoods => "Z",
55 Enum5305::ExemptFromTax => "E",
56 Enum5305::VatReverseCharge => "AE",
57 Enum5305::VatExemptForEeaIntraCommunitySupplyGoodsAndServices => "K",
58 Enum5305::FreeExportItemTaxNotCharged => "G",
59 Enum5305::ServiceOutsideScopeTax => "O",
60 Enum5305::CanaryIslandsGeneralIndirectTax => "L",
61 Enum5305::TaxForProductionServicesAndImportationInCeutaAndMelilla => "M",
62 }
63 }
64}
65
66impl crate::Description for Enum5305 {
67 fn description(self) -> &'static str {
68 match self {
69 Enum5305::StandardRate => "Standard rate",
70 Enum5305::ZeroRatedGoods => "Zero rated goods",
71 Enum5305::ExemptFromTax => "Exempt from tax",
72 Enum5305::VatReverseCharge => "VAT Reverse charge",
73 Enum5305::VatExemptForEeaIntraCommunitySupplyGoodsAndServices => {
74 "VAT exempt for EEA intra-community supply of goods and services"
75 }
76 Enum5305::FreeExportItemTaxNotCharged => "Free export item, tax not charged",
77 Enum5305::ServiceOutsideScopeTax => "Service outside scope of tax",
78 Enum5305::CanaryIslandsGeneralIndirectTax => "Canary Islands general indirect tax",
79 Enum5305::TaxForProductionServicesAndImportationInCeutaAndMelilla => {
80 "Tax for production, services and importation in Ceuta and Melilla"
81 }
82 }
83 }
84}
85
86impl crate::FromCode for Enum5305 {
87 fn from_code(code: &str) -> Option<Self>
88 where
89 Self: Sized,
90 {
91 match code {
92 "S" => Some(Enum5305::StandardRate),
93 "Z" => Some(Enum5305::ZeroRatedGoods),
94 "E" => Some(Enum5305::ExemptFromTax),
95 "AE" => Some(Enum5305::VatReverseCharge),
96 "K" => Some(Enum5305::VatExemptForEeaIntraCommunitySupplyGoodsAndServices),
97 "G" => Some(Enum5305::FreeExportItemTaxNotCharged),
98 "O" => Some(Enum5305::ServiceOutsideScopeTax),
99 "L" => Some(Enum5305::CanaryIslandsGeneralIndirectTax),
100 "M" => Some(Enum5305::TaxForProductionServicesAndImportationInCeutaAndMelilla),
101 _ => None,
102 }
103 }
104}