zugferd_code_lists/zugferd_2_3_2/
enum5305.rs

1#![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    /// Standard rate
8    StandardRate,
9    /// Zero rated goods
10    ZeroRatedGoods,
11    /// Exempt from tax
12    ExemptFromTax,
13    /// VAT Reverse charge
14    ///
15    /// VAT reverse charge
16    VatReverseCharge,
17    /// VAT exempt for EEA intra-community supply of goods and services
18    ///
19    /// VAT exempt for intra community supply of goods
20    VatExemptForEeaIntraCommunitySupplyGoodsAndServices,
21    /// Free export item, tax not charged
22    FreeExportItemTaxNotCharged,
23    /// Service outside scope of tax
24    ///
25    /// Services outside scope of tax
26    ServiceOutsideScopeTax,
27    /// Canary Islands general indirect tax
28    ///
29    /// Canary Islands General Indirect Tax
30    CanaryIslandsGeneralIndirectTax,
31    /// Tax for production, services and importation in Ceuta and Melilla
32    ///
33    /// Liable for IPSI
34    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}