zugferd_code_lists/zugferd_2_3_2/
timecii.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 TimeCII {
7    /// Date of invoice
8    DateInvoice,
9    /// Date of delivery of goods to establishments/domicile/site
10    DateDeliveryGoodsToEstablishmentsDomicileSite,
11    /// Payment date
12    PaymentDate,
13}
14
15impl crate::Code for TimeCII {
16    fn code(self) -> &'static str {
17        match self {
18            TimeCII::DateInvoice => "5",
19            TimeCII::DateDeliveryGoodsToEstablishmentsDomicileSite => "29",
20            TimeCII::PaymentDate => "72",
21        }
22    }
23}
24
25impl crate::Description for TimeCII {
26    fn description(self) -> &'static str {
27        match self {
28            TimeCII::DateInvoice => "Date of invoice",
29            TimeCII::DateDeliveryGoodsToEstablishmentsDomicileSite => {
30                "Date of delivery of goods to establishments/domicile/site"
31            }
32            TimeCII::PaymentDate => "Payment date",
33        }
34    }
35}
36
37impl crate::FromCode for TimeCII {
38    fn from_code(code: &str) -> Option<Self>
39    where
40        Self: Sized,
41    {
42        match code {
43            "5" => Some(TimeCII::DateInvoice),
44            "29" => Some(TimeCII::DateDeliveryGoodsToEstablishmentsDomicileSite),
45            "72" => Some(TimeCII::PaymentDate),
46            _ => None,
47        }
48    }
49}