zugferd_code_lists/zugferd_2_3_3/
incoterms.rs

1#![allow(non_camel_case_types)]
2
3#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
5pub enum INCOTERMS {
6    /// Delivery arranged by supplier
7    DeliveryArrangedBySupplier,
8    /// Delivery arranged by logistic service provider
9    DeliveryArrangedByLogisticServiceProvider,
10    /// Cost and Freight
11    CostAndFreight,
12    /// Cost, Insurance and Freight
13    CostInsuranceAndFreight,
14    /// Carriage and Insurance Paid to (insert named place of destination)
15    CarriageAndInsurancePaidToInsertNamedPlaceDestination,
16    /// Carriage Paid To (insert named place of destination)
17    CarriagePaidToInsertNamedPlaceDestination,
18    /// Delivered At Place (insert named place of destination)
19    DeliveredAtPlaceInsertNamedPlaceDestination,
20    /// Delivered Duty Paid (insert named place of destination)
21    DeliveredDutyPaidInsertNamedPlaceDestination,
22    /// Delivered At Place Unloaded (insert named place of unloading)
23    DeliveredAtPlaceUnloadedInsertNamedPlaceUnloading,
24    /// Ex Works (insert named place of delivery)
25    ExWorksInsertNamedPlaceDelivery,
26    /// Free Alongside Ship (insert named port of shipment)
27    FreeAlongsideShipInsertNamedPortShipment,
28    /// Free Carrier (insert named place of delivery)
29    FreeCarrierInsertNamedPlaceDelivery,
30    ///  Free On Board (insert named port of shipment)
31    FreeOnBoardInsertNamedPortShipment,
32}
33
34impl crate::Code for INCOTERMS {
35    fn code(self) -> &'static str {
36        match self {
37            INCOTERMS::DeliveryArrangedBySupplier => "1",
38            INCOTERMS::DeliveryArrangedByLogisticServiceProvider => "2",
39            INCOTERMS::CostAndFreight => "CFR",
40            INCOTERMS::CostInsuranceAndFreight => "CIF",
41            INCOTERMS::CarriageAndInsurancePaidToInsertNamedPlaceDestination => "CIP",
42            INCOTERMS::CarriagePaidToInsertNamedPlaceDestination => "CPT",
43            INCOTERMS::DeliveredAtPlaceInsertNamedPlaceDestination => "DAP",
44            INCOTERMS::DeliveredDutyPaidInsertNamedPlaceDestination => "DDP",
45            INCOTERMS::DeliveredAtPlaceUnloadedInsertNamedPlaceUnloading => "DPU",
46            INCOTERMS::ExWorksInsertNamedPlaceDelivery => "EXW",
47            INCOTERMS::FreeAlongsideShipInsertNamedPortShipment => "FAS",
48            INCOTERMS::FreeCarrierInsertNamedPlaceDelivery => "FCA",
49            INCOTERMS::FreeOnBoardInsertNamedPortShipment => "FOB",
50        }
51    }
52}
53
54impl crate::Description for INCOTERMS {
55    fn description(self) -> &'static str {
56        match self {
57            INCOTERMS::DeliveryArrangedBySupplier => "Delivery arranged by supplier",
58            INCOTERMS::DeliveryArrangedByLogisticServiceProvider => {
59                "Delivery arranged by logistic service provider"
60            }
61            INCOTERMS::CostAndFreight => "Cost and Freight",
62            INCOTERMS::CostInsuranceAndFreight => "Cost, Insurance and Freight",
63            INCOTERMS::CarriageAndInsurancePaidToInsertNamedPlaceDestination => {
64                "Carriage and Insurance Paid to (insert named place of destination)"
65            }
66            INCOTERMS::CarriagePaidToInsertNamedPlaceDestination => {
67                "Carriage Paid To (insert named place of destination)"
68            }
69            INCOTERMS::DeliveredAtPlaceInsertNamedPlaceDestination => {
70                "Delivered At Place (insert named place of destination)"
71            }
72            INCOTERMS::DeliveredDutyPaidInsertNamedPlaceDestination => {
73                "Delivered Duty Paid (insert named place of destination)"
74            }
75            INCOTERMS::DeliveredAtPlaceUnloadedInsertNamedPlaceUnloading => {
76                "Delivered At Place Unloaded (insert named place of unloading)"
77            }
78            INCOTERMS::ExWorksInsertNamedPlaceDelivery => {
79                "Ex Works (insert named place of delivery)"
80            }
81            INCOTERMS::FreeAlongsideShipInsertNamedPortShipment => {
82                "Free Alongside Ship (insert named port of shipment)"
83            }
84            INCOTERMS::FreeCarrierInsertNamedPlaceDelivery => {
85                "Free Carrier (insert named place of delivery)"
86            }
87            INCOTERMS::FreeOnBoardInsertNamedPortShipment => {
88                " Free On Board (insert named port of shipment)"
89            }
90        }
91    }
92}
93
94impl crate::FromCode for INCOTERMS {
95    fn from_code(code: &str) -> Option<Self>
96    where
97        Self: Sized,
98    {
99        match code {
100            "1" => Some(INCOTERMS::DeliveryArrangedBySupplier),
101            "2" => Some(INCOTERMS::DeliveryArrangedByLogisticServiceProvider),
102            "CFR" => Some(INCOTERMS::CostAndFreight),
103            "CIF" => Some(INCOTERMS::CostInsuranceAndFreight),
104            "CIP" => Some(INCOTERMS::CarriageAndInsurancePaidToInsertNamedPlaceDestination),
105            "CPT" => Some(INCOTERMS::CarriagePaidToInsertNamedPlaceDestination),
106            "DAP" => Some(INCOTERMS::DeliveredAtPlaceInsertNamedPlaceDestination),
107            "DDP" => Some(INCOTERMS::DeliveredDutyPaidInsertNamedPlaceDestination),
108            "DPU" => Some(INCOTERMS::DeliveredAtPlaceUnloadedInsertNamedPlaceUnloading),
109            "EXW" => Some(INCOTERMS::ExWorksInsertNamedPlaceDelivery),
110            "FAS" => Some(INCOTERMS::FreeAlongsideShipInsertNamedPortShipment),
111            "FCA" => Some(INCOTERMS::FreeCarrierInsertNamedPlaceDelivery),
112            "FOB" => Some(INCOTERMS::FreeOnBoardInsertNamedPortShipment),
113            _ => None,
114        }
115    }
116}