zugferd_code_lists/zugferd_2_3_3/
incoterms.rs

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