zugferd_code_lists/zugferd_2_3_3/
hybridconformance.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 HybridConformance {
7    /// The included document uses a MINIMUM profile
8    ///
9    /// Only applicable in Factur-X/ZUGFeRD
10    ///
11    /// Not allowed in Germany from 2025-01-01
12    TheIncludedDocumentUsesAMinimumProfile,
13    /// The included document uses a Basic Without Lines profile
14    ///
15    /// Only applicable in Factur-X/ZUGFeRD
16    ///
17    /// Not allowed in Germany from 2025-01-01
18    TheIncludedDocumentUsesABasicWithoutLinesProfile,
19    /// The included document uses a Basic profile
20    ///
21    /// Applicable in Factur-X/ZUGFeRD and Order-X. For Factur-X/ZUGFeRD the BASIC profile is compliant to the EN16931.
22    TheIncludedDocumentUsesABasicProfile,
23    /// The included document uses a Comfort profile
24    ///
25    /// Only applicable in Order-X
26    TheIncludedDocumentUsesAComfortProfile,
27    /// The included document uses a EN 16931 profile
28    ///
29    /// Only applicable in Factur-X/ZUGFeRD. This profile is compliant to the EN16931.
30    TheIncludedDocumentUsesAEn16931Profile,
31    /// The included document uses a Comfort profile
32    ///
33    /// Applicable in Factur-X/ZUGFeRD and Order-X. For Factur-X/ZUGFeRD the EXTENDED profile is compliant to and conformant extension of the EN16931.
34    TheIncludedDocumentUsesAComfortProfile_Dup,
35    /// The included document uses an XRECHNUNG profile
36    ///
37    /// Only applicable in Factur-X/ZUGFeRD.
38    ///
39    /// Not applicable in France
40    TheIncludedDocumentUsesAnXrechnungProfile,
41}
42
43impl std::fmt::Display for HybridConformance {
44    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
45        write!(f, "{}", <Self as crate::Code>::code(*self))
46    }
47}
48
49impl std::str::FromStr for HybridConformance {
50    type Err = crate::ParseError<Self>;
51    fn from_str(s: &str) -> Result<Self, Self::Err> {
52        <Self as crate::FromCode>::from_code(s)
53            .ok_or_else(|| crate::ParseError::<Self>::new(s.to_owned()))
54    }
55}
56
57impl crate::Code for HybridConformance {
58    fn code(self) -> &'static str {
59        match self {
60            HybridConformance::TheIncludedDocumentUsesAMinimumProfile => "MINIMUM",
61            HybridConformance::TheIncludedDocumentUsesABasicWithoutLinesProfile => "BASIC WL",
62            HybridConformance::TheIncludedDocumentUsesABasicProfile => "BASIC",
63            HybridConformance::TheIncludedDocumentUsesAComfortProfile => "COMFORT",
64            HybridConformance::TheIncludedDocumentUsesAEn16931Profile => "EN 16931",
65            HybridConformance::TheIncludedDocumentUsesAComfortProfile_Dup => "EXTENDED",
66            HybridConformance::TheIncludedDocumentUsesAnXrechnungProfile => "XRECHNUNG",
67        }
68    }
69}
70
71impl crate::Description for HybridConformance {
72    fn description(self) -> &'static str {
73        match self {
74            HybridConformance::TheIncludedDocumentUsesAMinimumProfile => {
75                "The included document uses a MINIMUM profile"
76            }
77            HybridConformance::TheIncludedDocumentUsesABasicWithoutLinesProfile => {
78                "The included document uses a Basic Without Lines profile"
79            }
80            HybridConformance::TheIncludedDocumentUsesABasicProfile => {
81                "The included document uses a Basic profile"
82            }
83            HybridConformance::TheIncludedDocumentUsesAComfortProfile => {
84                "The included document uses a Comfort profile"
85            }
86            HybridConformance::TheIncludedDocumentUsesAEn16931Profile => {
87                "The included document uses a EN 16931 profile"
88            }
89            HybridConformance::TheIncludedDocumentUsesAComfortProfile_Dup => {
90                "The included document uses a Comfort profile"
91            }
92            HybridConformance::TheIncludedDocumentUsesAnXrechnungProfile => {
93                "The included document uses an XRECHNUNG profile"
94            }
95        }
96    }
97}
98
99impl crate::FromCode for HybridConformance {
100    fn from_code(code: &str) -> Option<Self>
101    where
102        Self: Sized,
103    {
104        match code {
105            "MINIMUM" => Some(HybridConformance::TheIncludedDocumentUsesAMinimumProfile),
106            "BASIC WL" => Some(HybridConformance::TheIncludedDocumentUsesABasicWithoutLinesProfile),
107            "BASIC" => Some(HybridConformance::TheIncludedDocumentUsesABasicProfile),
108            "COMFORT" => Some(HybridConformance::TheIncludedDocumentUsesAComfortProfile),
109            "EN 16931" => Some(HybridConformance::TheIncludedDocumentUsesAEn16931Profile),
110            "EXTENDED" => Some(HybridConformance::TheIncludedDocumentUsesAComfortProfile_Dup),
111            "XRECHNUNG" => Some(HybridConformance::TheIncludedDocumentUsesAnXrechnungProfile),
112            _ => None,
113        }
114    }
115}