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