edifact_types/d00b/
segment.rs

1use super::*;
2use crate::util::{clean_num, Parser};
3use edifact_types_macros::{DisplayOuterSegment, ParseSegment};
4use nom::{bytes::complete::take_until, character::complete::not_line_ending, IResult};
5use serde::{Deserialize, Serialize};
6use std::{
7    fmt::{self, Debug},
8    str::FromStr,
9};
10
11/// BGM - BEGINNING OF MESSAGE
12///
13/// A segment indicating the beginning of a message and identifying the consignment for which status is being reported.
14#[derive(Debug, Serialize, Deserialize, Clone, Default, DisplayOuterSegment, ParseSegment)]
15pub struct BGM {
16    pub _010: Option<C002>,
17    pub _020: Option<C106>,
18    pub _030: Option<_1225>,
19    pub _040: Option<_4343>,
20}
21
22/// CNI - CONSIGNMENT INFORMATION
23///
24/// A segment to identify a consignment for which status details are given.
25#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
26pub struct CNI {
27    /// CONSOLIDATION ITEM NUMBER
28    ///
29    /// To specify a consignment within a consolidation.
30    pub _010: Option<String>,
31    /// C503 - DOCUMENT/MESSAGE DETAILS
32    ///
33    /// Identification of document/message by number, status, source and/or language.
34    pub _020: Option<C503>,
35    /// CONSIGNMENT LOAD SEQUENCE IDENTIFIER
36    ///
37    /// To identify the loading sequence of a consignment or consignments.
38    pub _030: Option<String>,
39}
40
41#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
42pub struct CNT {
43    /// CONTROL
44    ///
45    /// Control total for checking integrity of a message or part of a message.
46    pub _010: C270,
47}
48
49/// COD - Component details
50///
51/// To provide component details of an object (e.g. product, container) such as its type and the material of which it is composed.
52#[derive(Debug, Serialize, Deserialize, Clone, DisplayOuterSegment, ParseSegment)]
53pub struct COD {
54    pub _010: Option<C823>,
55    pub _020: Option<C824>,
56}
57
58/// COM - COMMUNICATION CONTACT
59///
60/// A segment to specify a communication number related to the contact.
61#[derive(Debug, Serialize, Deserialize, DisplayOuterSegment, ParseSegment)]
62pub struct COM {
63    /// C076 - COMMUNICATION CONTACT
64    ///
65    /// Communication number of a department or employee in a specified channel.
66    pub _010: C076,
67}
68
69/// CPI Charge payment instructions
70///
71/// To identify a charge.
72#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
73pub struct CPI {
74    /// CONTACT FUNCTION CODE
75    ///
76    /// Code specifying the function of a contact (e.g. department or person).
77    pub _010: Option<C229>,
78    /// C056 - DEPARTMENT OR EMPLOYEE DETAILS
79    ///
80    /// Code and/or name of a department or employee. Code preferred.
81    pub _020: Option<C231>,
82    pub _030: Option<_4237>,
83}
84
85/// CTA - CONTACT INFORMATION
86///
87/// A segment to specify a contact name associated with the party.
88#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
89pub struct CTA {
90    /// CONTACT FUNCTION CODE
91    ///
92    /// Code specifying the function of a contact (e.g. department or person).
93    pub _010: Option<_3139>,
94    /// C056 - DEPARTMENT OR EMPLOYEE DETAILS
95    ///
96    /// Code and/or name of a department or employee. Code preferred.
97    pub _020: Option<C056>,
98}
99
100/// Currencies
101///
102/// A segment to specify a contact name associated with the party.
103#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
104pub struct CUX {
105    /// Currency details
106    ///
107    /// The usage to which a currency relates.
108    pub _010: Option<C504>,
109    /// Currency details
110    ///
111    /// The usage to which a currency relates.
112    pub _020: Option<C504>,
113    /// Currency exchange rate
114    ///
115    /// To specify the rate at which one specified currency is expressed in another specified currency.
116    pub _030: Option<String>,
117    /// Exchange rate currency market identifier
118    ///
119    /// To identify an exchange rate currency market.
120    pub _040: Option<_6341>,
121}
122
123/// DAM - Damage
124///
125/// To specify damage including action taken.
126#[derive(Debug, Serialize, Deserialize, Clone, DisplayOuterSegment, ParseSegment)]
127pub struct DAM {
128    pub _010: String,
129    pub _020: Option<C821>,
130    pub _030: Option<C822>,
131    pub _040: Option<C825>,
132    pub _050: Option<C826>,
133}
134
135/// DGS - DANGEROUS GOODS
136///
137/// A segment to specify dangerous goods details related to the goods item.
138#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
139pub struct DGS {
140    /// DANGEROUS GOODS REGULATIONS CODE
141    ///
142    /// Code specifying a dangerous goods regulation.
143    pub _010: Option<String>,
144    /// C205 - HAZARD CODE
145    ///
146    /// The identification of the dangerous goods in code.
147    pub _020: Option<C205>,
148    /// C234 - UNDG INFORMATION
149    ///
150    /// Information on dangerous goods, taken from the United Nations Dangerous Goods classification.
151    pub _030: Option<C234>,
152    /// C223 - DANGEROUS GOODS SHIPMENT FLASHPOINT
153    ///
154    /// Temperature at which a vapor can be ignited as per ISO 1523/73.
155    pub _040: Option<C223>,
156    /// PACKAGING DANGER LEVEL CODE
157    ///
158    /// Code specifying the level of danger for which the packaging must cater.
159    pub _050: Option<String>,
160    /// EMERGENCY PROCEDURE FOR SHIPS IDENTIFIER
161    ///
162    /// To identify the emergency procedure number for ships transporting dangerous goods. Synonym: EMS Number.
163    pub _060: Option<String>,
164    /// HAZARD MEDICAL FIRST AID GUIDE IDENTIFIER
165    ///
166    /// To identify a Medical First Aid Guide (MFAG) for hazardous goods.
167    pub _070: Option<String>,
168    /// TRANSPORT EMERGENCY CARD IDENTIFIER
169    ///
170    /// To identify a transport emergency (TREM) card.
171    pub _080: Option<String>,
172    /// C235 - HAZARD IDENTIFICATION PLACARD DETAILS
173    ///
174    /// These numbers appear on the hazard identification placard required on the means of transport.
175    pub _090: Option<C235>,
176    /// C236 - DANGEROUS GOODS LABEL
177    ///
178    /// Markings identifying the type of hazardous goods and similar information.
179    pub _100: Option<C236>,
180    /// PACKING INSTRUCTION TYPE CODE
181    ///
182    /// Code specifying a type of packing instruction.
183    pub _110: Option<String>,
184    /// HAZARDOUS MEANS OF TRANSPORT CATEGORY CODE
185    ///
186    /// Code specifying the category of means of transport for carrying hazardous goods.
187    pub _120: Option<String>,
188    /// HAZARDOUS CARGO TRANSPORT AUTHORISATION CODE
189    ///
190    /// Code specifying the authorisation for the transportation of hazardous cargo.
191    pub _130: Option<String>,
192}
193
194/// DIM - DIMENSIONS
195///
196/// A segment specifying dimensions of a goods item.
197#[derive(Debug, Serialize, Deserialize, Clone, DisplayOuterSegment, ParseSegment)]
198pub struct DIM {
199    /// DIMENSION TYPE CODE QUALIFIER
200    ///
201    /// Code qualifying the type of the dimension.
202    pub _010: String,
203    /// C211 - DIMENSIONS
204    ///
205    /// Specification of the dimensions of a transportable unit.
206    pub _020: C211,
207}
208
209/// DOC - DOCUMENT/MESSAGE DETAILS
210///
211/// A segment to specify document details related to the status code, such as indication which document is missing (status code: document missing).
212#[derive(Debug, Serialize, Deserialize, Clone, DisplayOuterSegment, ParseSegment)]
213pub struct DOC {
214    /// C002 - DOCUMENT/MESSAGE NAME
215    ///
216    /// Identification of a type of document/message by code or name. Code preferred.
217    pub _010: Option<C002>,
218    /// C503 - DOCUMENT/MESSAGE DETAILS
219    ///
220    /// Identification of document/message by number, status, source and/or language.
221    pub _020: Option<C503>,
222    /// COMMUNICATION MEDIUM TYPE CODE
223    ///
224    /// Code specifying the type of communication medium.
225    pub _030: Option<String>,
226    /// DOCUMENT COPIES REQUIRED QUANTITY
227    ///
228    /// Quantity of document copies required.
229    pub _040: Option<String>,
230    /// DOCUMENT ORIGINALS REQUIRED QUANTITY
231    ///
232    /// Quantity of document originals required.
233    pub _050: Option<String>,
234}
235
236#[derive(Debug, Serialize, Deserialize, Clone, DisplayOuterSegment, ParseSegment)]
237pub struct DTM {
238    pub _010: C507,
239}
240
241/// EQA - ATTACHED EQUIPMENT
242///
243/// A segment identifying attached equipment or related equipment such as a chassis attached to a container.
244#[derive(Debug, Serialize, Deserialize, Clone, DisplayOuterSegment, ParseSegment)]
245pub struct EQA {
246    /// EQUIPMENT TYPE CODE QUALIFIER
247    ///
248    /// Code qualifying a type of equipment.
249    pub _010: String,
250    /// C237 - EQUIPMENT IDENTIFICATION
251    ///
252    /// Marks (letters/numbers) identifying equipment.
253    pub _020: Option<C237>,
254}
255
256/// EQD - EQUIPMENT DETAILS
257///
258/// A segment identifying equipment related to status or event such as a container of a multi-container consignment.
259#[derive(Debug, Serialize, Deserialize, Clone, DisplayOuterSegment, ParseSegment)]
260pub struct EQD {
261    /// EQUIPMENT TYPE CODE QUALIFIER
262    ///
263    /// Code qualifying a type of equipment.
264    pub _010: String,
265    /// C237 - EQUIPMENT IDENTIFICATION
266    ///
267    /// Marks (letters/numbers) identifying equipment.
268    pub _020: Option<C237>,
269    /// C224 - EQUIPMENT SIZE AND TYPE
270    ///
271    /// Code and or name identifying size and type of equipment. Code preferred.
272    pub _030: Option<C224>,
273    /// EQUIPMENT SUPPLIER CODE
274    ///
275    /// Code specifying the party that is the supplier of the equipment.
276    pub _040: Option<String>,
277    /// EQUIPMENT STATUS CODE
278    ///
279    /// Code specifying the status of equipment.
280    pub _050: Option<String>,
281    /// FULL OR EMPTY INDICATOR CODE
282    ///
283    /// Code indicating whether an object is full or empty.
284    pub _060: Option<String>,
285}
286
287/// EQN - NUMBER OF UNITS
288///
289/// A segment specifying the number of units to which the given measurement is applicable.
290#[derive(Debug, Serialize, Deserialize, Clone, DisplayOuterSegment, ParseSegment)]
291pub struct EQN {
292    /// C523 - NUMBER OF UNIT DETAILS
293    ///
294    /// Identification of number of units and its purpose.
295    pub _010: C523,
296}
297
298/// FTX - FREE TEXT
299///
300/// A segment specifying free form or processable supplementary or other information.
301#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
302pub struct FTX {
303    /// TEXT SUBJECT CODE QUALIFIER
304    ///
305    /// Code qualifying the subject of the text.
306    pub _010: String,
307    /// FREE TEXT FUNCTION CODE
308    ///
309    /// Code specifying the function of free text.
310    pub _020: Option<String>,
311    /// TEXT REFERENCE
312    ///
313    /// Coded reference to a standard text and its source.
314    pub _030: Option<C107>,
315    /// TEXT LITERAL
316    ///
317    /// Free text; one to five lines.
318    pub _040: Option<C108>,
319    /// LANGUAGE NAME CODE
320    ///
321    /// Code specifying the language name.
322    pub _050: Option<String>,
323    /// FREE TEXT FORMAT CODE
324    ///
325    /// Code specifying the format of free text.
326    pub _060: Option<String>,
327}
328
329/// GDS Nature of cargo
330///
331/// To indicate the type of cargo as a general classification.
332#[derive(Debug, Serialize, Deserialize, Clone, DisplayOuterSegment, ParseSegment)]
333pub struct GDS {
334    /// C703 Nature of cargo
335    ///
336    /// Rough classification of a type of cargo.
337    pub _010: C703,
338}
339
340/// GID - GOODS ITEM DETAILS
341///
342/// A segment identifying a goods item.
343#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
344pub struct GID {
345    /// GOODS ITEM NUMBER
346    ///
347    /// To specify a goods item within a consignment.
348    pub _010: Option<String>,
349    /// C213 - NUMBER AND TYPE OF PACKAGES
350    ///
351    /// Number and type of individual parts of a shipment.
352    pub _020: Option<C213>,
353    /// C213 - NUMBER AND TYPE OF PACKAGES
354    ///
355    /// Number and type of individual parts of a shipment.
356    pub _030: Option<C213>,
357    /// C213 - NUMBER AND TYPE OF PACKAGES
358    ///
359    /// Number and type of individual parts of a shipment.
360    pub _040: Option<C213>,
361    /// C213 - NUMBER AND TYPE OF PACKAGES
362    ///
363    /// Number and type of individual parts of a shipment.
364    pub _050: Option<C213>,
365    /// C213 - NUMBER AND TYPE OF PACKAGES
366    ///
367    /// Number and type of individual parts of a shipment.
368    pub _060: Option<C213>,
369}
370
371/// GIN - GOODS IDENTITY NUMBER
372///
373/// A segment specifying identity numbers related to the transport line items.
374#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
375pub struct GIN {
376    /// OBJECT IDENTIFICATION CODE QUALIFIER
377    ///
378    /// Code qualifying the identification of an object.
379    pub _010: String,
380    /// C208 - IDENTITY NUMBER RANGE
381    ///
382    /// Goods item identification numbers, start and end of consecutively numbered range.
383    pub _020: C208,
384    /// C208 - IDENTITY NUMBER RANGE
385    ///
386    /// Goods item identification numbers, start and end of consecutively numbered range.
387    pub _030: Option<C208>,
388    /// C208 - IDENTITY NUMBER RANGE
389    ///
390    /// Goods item identification numbers, start and end of consecutively numbered range.
391    pub _040: Option<C208>,
392    /// C208 - IDENTITY NUMBER RANGE
393    ///
394    /// Goods item identification numbers, start and end of consecutively numbered range.
395    pub _050: Option<C208>,
396    /// C208 - IDENTITY NUMBER RANGE
397    ///
398    /// Goods item identification numbers, start and end of consecutively numbered range.
399    pub _060: Option<C208>,
400}
401
402/// GOR Governmental requirements
403///
404/// To indicate the requirement for a specific governmental action and/or
405/// procedure or which specific procedure is valid for a specific part of the transport.
406#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
407pub struct GOR {
408    /// Transport movement code
409    ///
410    /// Code specifying the transport movement.
411    pub _010: Option<String>,
412    /// C232 Government action
413    ///
414    /// Code indicating a type of government action.
415    pub _020: Option<C232>,
416    /// C232 Government action
417    ///
418    /// Code indicating a type of government action.
419    pub _030: Option<C232>,
420    /// C232 Government action
421    ///
422    /// Code indicating a type of government action.
423    pub _040: Option<C232>,
424    /// C232 Government action
425    ///
426    /// Code indicating a type of government action.
427    pub _050: Option<C232>,
428}
429
430/// HAN - HANDLING INSTRUCTIONS
431///
432/// A segment identifying handling instructions.
433#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
434pub struct HAN {
435    /// C524 - HANDLING INSTRUCTIONS
436    ///
437    /// Instruction for the handling of goods, products or articles in shipment, storage etc.
438    pub _010: Option<C524>,
439    /// C218 - HAZARDOUS MATERIAL
440    ///
441    /// To specify a hazardous material.
442    pub _020: Option<C218>,
443}
444
445/// LOC - PLACE/LOCATION IDENTIFICATION
446///
447/// A segment identifying a place/location which applies to the consignment such as consignment origin and destination.
448#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
449pub struct LOC {
450    /// LOCATION FUNCTION CODE QUALIFIER
451    ///
452    /// Code identifying the function of a location.
453    pub _010: String,
454    /// LOCATION IDENTIFICATION
455    ///
456    /// Identification of a location by code or name.
457    pub _020: Option<C517>,
458    /// RELATED LOCATION ONE IDENTIFICATION
459    ///
460    /// Identification the first related location by code or name.
461    pub _030: Option<C519>,
462    /// RELATED LOCATION TWO IDENTIFICATION
463    ///
464    /// Identification of second related location by code or name.
465    pub _040: Option<C553>,
466    /// RELATION CODE
467    ///
468    /// Code specifying a relation.
469    pub _050: Option<String>,
470}
471
472/// MEA - MEASUREMENTS
473///
474/// A segment specifying measurements, other than dimension, of a goods item.
475#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
476pub struct MEA {
477    /// MEASUREMENT PURPOSE CODE QUALIFIER
478    ///
479    /// Code qualifying the purpose of the measurement.
480    pub _010: String,
481    /// C502 - MEASUREMENT DETAILS
482    ///
483    /// Identification of measurement type.
484    pub _020: Option<C502>,
485    /// C174 - VALUE/RANGE
486    ///
487    /// Measurement value and relevant minimum and maximum values of the measurement range.
488    pub _030: Option<C174>,
489    /// SURFACE OR LAYER CODE
490    ///
491    /// Code specifying the surface or layer of an object.
492    pub _040: Option<String>,
493}
494
495/// MOA Monetary amount
496///
497/// To specify a monetary amount.
498#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
499pub struct MOA {
500    /// C516 Monetary amount
501    ///
502    /// Amount of goods or services stated as a monetary amount in a specified currency.
503    pub _010: C516,
504}
505
506/// NAD - NAME AND ADDRESS
507///
508/// A segment specifying the name and/or address associated with the event such as notify party, terminal address, trucking company for gate move.
509#[derive(Debug, Serialize, Deserialize, DisplayOuterSegment, ParseSegment)]
510pub struct NAD {
511    /// PARTY FUNCTION CODE QUALIFIER
512    ///
513    /// Code giving specific meaning to a party.
514    pub _010: _3035,
515    /// C082 - PARTY IDENTIFICATION DETAILS
516    ///
517    /// Identification of a transaction party by code.
518    pub _020: Option<C082>,
519    /// C058 - NAME AND ADDRESS
520    ///
521    /// Unstructured name and address: one to five lines.
522    pub _030: Option<C058>,
523    /// C080 - PARTY NAME
524    ///
525    /// Identification of a transaction party by name, one to five lines. Party name may be formatted.
526    pub _040: Option<C080>,
527    /// C059 - STREET
528    ///
529    /// Street address and/or PO Box number in a structured address: one to four lines.
530    pub _050: Option<C059>,
531    /// CITY NAME
532    ///
533    /// Name of a city.
534    pub _060: Option<String>,
535    /// C819 - COUNTRY SUB-ENTITY DETAILS
536    ///
537    /// To specify a part of a country (eg county or part of a city).
538    pub _070: Option<C819>,
539    /// POSTAL IDENTIFICATION CODE
540    ///
541    /// Code specifying the postal zone or address.
542    pub _080: Option<String>,
543    /// COUNTRY NAME CODE
544    ///
545    /// Identification of the name of the country or other geographical entity as specified in ISO 3166.
546    pub _090: Option<String>,
547}
548
549/// PIA Additional product id
550///
551/// To specify additional or substitutional item identification codes.
552#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
553pub struct PIA {
554    /// Product identifier code qualifier
555    ///
556    /// Code qualifying the product identifier.
557    pub _010: String,
558    /// C212 Item number identification
559    ///
560    /// Goods identification for a specified source.
561    pub _020: C212,
562    /// C212 Item number identification
563    ///
564    /// Goods identification for a specified source.
565    pub _030: Option<C212>,
566    /// C212 Item number identification
567    ///
568    /// Goods identification for a specified source.
569    pub _040: Option<C212>,
570    /// C212 Item number identification
571    ///
572    /// Goods identification for a specified source.
573    pub _050: Option<C212>,
574    /// C212 Item number identification
575    ///
576    /// Goods identification for a specified source.
577    pub _060: Option<C212>,
578}
579
580/// PCD Percentage details
581///
582/// To specify percentage information.
583#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
584pub struct PCD {
585    /// Product identifier code qualifier
586    ///
587    /// Code qualifying the product identifier.
588    pub _010: C501,
589    /// Status description code
590    ///
591    /// Code specifying a status.
592    ///
593    /// 1 For transport status, use UN/ECE Recommendation 24.
594    pub _020: Option<String>,
595}
596
597/// PCI - PACKAGE IDENTIFICATION
598///
599/// A segment specifying marks related to the transport line items.
600#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
601pub struct PCI {
602    /// MARKING INSTRUCTIONS CODE
603    ///
604    /// Code specifying instructions for marking.
605    pub _010: Option<String>,
606    /// C210 - MARKS & LABELS
607    ///
608    /// Shipping marks on packages in free text; one to ten lines.
609    pub _020: Option<C210>,
610    /// CONTAINER OR PACKAGE CONTENTS INDICATOR CODE
611    ///
612    /// Code indicating the contents of container or package.
613    pub _030: Option<String>,
614    /// C827 - TYPE OF MARKING
615    ///
616    /// Specification of the type of marking that reflects the method that was used and the conventions adhered to for marking (e.g. of packages).
617    pub _040: Option<C827>,
618}
619
620/// PRI Price details
621///
622/// To specify price information.
623#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
624pub struct PRI {
625    /// C509 Price information
626    ///
627    /// Identification of price type, price and related details.
628    pub _010: Option<C509>,
629    /// Sub-line item price change operation code
630    ///
631    /// Code specifying the price change operation for a sub- line item.
632    pub _020: Option<_5213>,
633}
634
635/// QTY Quantity
636///
637/// To specify a pertinent quantity.
638#[derive(Debug, Serialize, Deserialize, DisplayOuterSegment, ParseSegment)]
639pub struct QTY {
640    /// C186 Quantity details
641    ///
642    /// Quantity information in a transaction, qualified when relevant.
643    pub _010: C186,
644}
645
646/// RFF - REFERENCE
647///
648/// A segment to specify a reference number to equipment.
649#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
650pub struct RFF {
651    /// C506 - REFERENCE
652    ///
653    /// Identification of a reference.
654    pub _010: C506,
655}
656
657/// RNG Range details
658///
659/// To identify a range.
660#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
661pub struct RNG {
662    /// Range type code qualifier
663    ///
664    /// Code qualifying a type of range.
665    pub _010: String,
666    /// C280 Range
667    ///
668    /// Range minimum and maximum limits.
669    pub _020: Option<C280>,
670}
671
672/// SEL - SEAL NUMBER
673///
674/// A segment identifying seal and seal issuer associated with the equipment.
675#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
676pub struct SEL {
677    /// SEAL IDENTIFIER
678    ///
679    /// To identify a seal.
680    pub _010: Option<String>,
681    /// SEAL ISSUER
682    ///
683    /// Identification of the issuer of a seal on equipment either by code or by name.
684    pub _020: Option<C215>,
685    /// SEAL CONDITION CODE
686    ///
687    /// Code specifying the condition of a seal.
688    pub _030: Option<String>,
689    /// C208 - IDENTITY NUMBER RANGE
690    ///
691    /// Goods item identification numbers, start and end of consecutively numbered range.
692    pub _040: Option<C208>,
693}
694
695/// SGP - SPLIT GOODS PLACEMENT
696///
697/// A segment to identify equipment in which (part of) a goods item is transported.
698#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
699pub struct SGP {
700    /// C237 - EQUIPMENT IDENTIFICATION
701    ///
702    /// Marks (letters/numbers) identifying equipment.
703    pub _010: C237,
704    /// PACKAGE QUANTITY
705    ///
706    /// To specify the number of packages.
707    pub _020: Option<String>,
708}
709
710/// STS - STATUS
711///
712/// A segment specifying the status relating to a consignment (e.g. loaded).
713#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
714pub struct STS {
715    /// C601 - STATUS CATEGORY
716    ///
717    /// To specify the category of the status.
718    pub _010: Option<C601>,
719    /// C555 - STATUS
720    ///
721    /// To specify a status.
722    pub _020: Option<C555>,
723    /// C556 - STATUS REASON
724    ///
725    /// To specify the reason for a status.
726    pub _030: Option<C556>,
727    /// C556 - STATUS REASON
728    ///
729    /// To specify the reason for a status.
730    pub _040: Option<C556>,
731    /// C556 - STATUS REASON
732    ///
733    /// To specify the reason for a status.
734    pub _050: Option<C556>,
735    /// C556 - STATUS REASON
736    ///
737    /// To specify the reason for a status.
738    pub _060: Option<C556>,
739    /// C556 - STATUS REASON
740    ///
741    /// To specify the reason for a status.
742    pub _070: Option<C556>,
743}
744
745/// TCC Transport charge/rate calculations
746///
747/// To specify charges.
748#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
749pub struct TCC {
750    /// C200 Charge
751    ///
752    /// Identification of a charge by code and/or by name.
753    pub _010: Option<C200>,
754    /// C203 Rate/tariff class
755    ///
756    /// Identification of the applicable rate/tariff class.
757    pub _020: Option<C203>,
758    /// C528 Commodity/rate detail
759    ///
760    /// Identification of commodity/rates.
761    pub _030: Option<C528>,
762    /// C554 Rate/tariff class detail
763    ///
764    /// Identification of the applicable rate/tariff class.
765    pub _040: Option<C554>,
766}
767
768/// TDT - DETAILS OF TRANSPORT
769///
770/// A segment identifying conveyance related to the status or event such as flight, vessel/voyage.
771#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
772pub struct TDT {
773    /// TRANSPORT STAGE CODE QUALIFIER
774    ///
775    /// Code qualifying a specific stage of transport.
776    pub _010: String,
777    /// MEANS OF TRANSPORT JOURNEY IDENTIFIER
778    ///
779    /// To identify a journey of a means of transport.
780    pub _020: Option<String>,
781    /// C220 - MODE OF TRANSPORT
782    ///
783    /// Method of transport code or name. Code preferred.
784    pub _030: Option<C220>,
785    /// C228- TRANSPORT MEANS
786    ///
787    /// Code and/or name identifying the type of means of transport.
788    pub _040: Option<C228>,
789    /// C040 - CARRIER
790    ///
791    /// Identification of a carrier by code and/or by name. Code preferred.
792    pub _050: Option<C040>,
793    /// TRANSIT DIRECTION INDICATOR CODE
794    ///
795    /// Code specifying the direction of transport.
796    pub _060: Option<String>,
797    /// C401 - EXCESS TRANSPORTATION INFORMATION
798    ///
799    /// To provide details of reason for, and responsibility for, use of transportation other than normally utilized.
800    pub _070: Option<C401>,
801    /// C222 - TRANSPORT IDENTIFICATION
802    ///
803    /// Code and/or name identifying the means of transport.
804    pub _080: Option<C222>,
805    /// TRANSPORT MEANS OWNERSHIP INDICATOR CODE
806    ///
807    /// Code indicating the ownership of a means of transport.
808    pub _090: Option<String>,
809}
810
811/// TMD - TRANSPORT MOVEMENT DETAILS
812///
813/// A segment to specify transport movement details related to the equipment.
814#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
815pub struct TMD {
816    /// C219 - MOVEMENT TYPE
817    ///
818    /// Description of type of service for movement of cargo.
819    pub _010: Option<C219>,
820    /// EQUIPMENT PLAN DESCRIPTION
821    ///
822    /// Free form description of the equipment plan.
823    pub _020: Option<String>,
824    /// HAULAGE ARRANGEMENTS CODE
825    ///
826    /// Code specifying the arrangement for the haulage of goods.
827    pub _030: Option<String>,
828}
829
830/// TMP Temperature
831///
832/// To specify the temperature setting.
833#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
834pub struct TMP {
835    /// Temperature type code qualifier
836    ///
837    /// Code qualifying the type of a temperature.
838    pub _010: String,
839    /// Temperature setting
840    pub _020: Option<C239>,
841}
842
843/// TOD Terms of delivery or transport
844///
845/// To specify terms of delivery or transport.
846#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
847pub struct TOD {
848    /// Delivery or transport terms function code
849    ///
850    /// Code specifying the function of delivery or transport terms.
851    pub _010: Option<_4055>,
852    /// Transport charges payment method
853    ///
854    /// Code specifying the payment method for transport charges.
855    pub _020: Option<_4215>,
856    /// Terms of delivery or transport
857    ///
858    /// Terms of delivery or transport code from a specified source.
859    pub _030: Option<C100>,
860}
861
862/// TPL - TRANSPORT PLACEMENT
863///
864/// A segment to identify the means of transport to which the equipment is linked, necessary in cases where this forms the key to retrieve relevant information.
865#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
866pub struct TPL {
867    /// C222 - TRANSPORT IDENTIFICATION
868    ///
869    /// Code and/or name identifying the means of transport.
870    pub _010: C222,
871}
872
873/// TSR - TRANSPORT SERVICE REQUIREMENTS
874///
875/// A segment identifying the transport service relating to the consignment.
876#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
877pub struct TSR {
878    /// CONTRACT AND CARRIAGE CONDITION
879    ///
880    /// To identify a contract and carriage condition.
881    pub _010: Option<C536>,
882    /// SERVICE
883    ///
884    /// To identify a service (which may constitute an additional component to a basic contract).
885    pub _020: Option<C233>,
886    /// TRANSPORT PRIORITY
887    ///
888    /// To indicate the priority of requested transport service.
889    pub _030: Option<C537>,
890    /// NATURE OF CARGO
891    ///
892    /// Rough classification of a type of cargo.
893    pub _040: Option<C703>,
894}
895
896/// UNA, Service String advice
897///
898/// Function: To define the characters selected for use
899/// as delimiters and indicators in the rest of the
900/// interchange that follows:
901///
902/// The specifications in the Service string advice take
903/// precedence over the specifications for delimiters etc. in
904/// segment UNB.  See clause 4.
905///
906/// When transmitted, the Service string advice must appear
907/// immediately before the Interchange Header (UNB) segment and
908/// begin with the upper case characters UNA immediately followed
909/// by the six characters selected by the sender to indicate, in
910/// sequence, the following functions:
911/// Repr. | Req. | Name | Remarks
912/// --- | --- | --- | ---
913/// an1 | M | COMPONENT DATA ELEMENT SEPARATOR |
914/// an1 | M | DATA ELEMENT SEPARATOR |
915/// an1 | M | DECIMAL NOTATION | Comma or full stop
916/// an1 | M | RELEASE INDICATOR | If not used, insert space character
917/// an1 | M | Reserved for future use | Insert space character
918/// an1 | M | SEGMENT TERMINATOR |
919#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, DisplayOuterSegment)]
920pub struct UNA {
921    /// an1    M     COMPONENT DATA ELEMENT SEPARATOR
922    pub component_data_element_seperator: char,
923    /// an1    M     DATA ELEMENT SEPARATOR
924    pub data_element_seperator: char,
925    /// an1    M     DECIMAL NOTATION       Comma or full stop
926    pub decimal_notation: char,
927    /// an1    M     RELEASE INDICATOR      If not used, insert space character
928    pub release_indicator: char,
929    /// an1    M     Reserved for future use    Insert space character
930    pub reserved_for_future_use: char,
931    /// an1    M     SEGMENT TERMINATOR
932    pub segment_terminator: char,
933}
934
935impl<'a> Parser<&'a str, UNA, nom::error::Error<&'a str>> for UNA {
936    fn parse(input: &'a str) -> IResult<&'a str, UNA> {
937        let (rest, vars) = take_until("UNB")(input)?;
938        if vars.is_empty() {
939            return Err(nom::Err::Error(nom::error::Error::new(
940                rest,
941                nom::error::ErrorKind::TakeUntil,
942            )));
943        }
944        // look for trailing newline
945        let vars = not_line_ending(vars)?.1;
946        if vars.len() != 9 {
947            println!("UNA Segment found, but malformed:\n{vars:?}");
948            panic!("UNA Segment malformed, needs to be exactly 6 characters")
949        }
950        let vars = vars.strip_prefix("UNA").unwrap();
951        let mut vars = vars.chars();
952        let una = UNA {
953            component_data_element_seperator: vars.next().unwrap(),
954            data_element_seperator: vars.next().unwrap(),
955            decimal_notation: vars.next().unwrap(),
956            release_indicator: vars.next().unwrap(),
957            reserved_for_future_use: vars.next().unwrap(),
958            segment_terminator: vars.next().unwrap(),
959        };
960        Ok((rest, una))
961    }
962}
963
964/// UNB Interchange header
965///
966/// To start, identify and specify an interchange.
967#[derive(
968    Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default, DisplayOuterSegment, ParseSegment,
969)]
970pub struct UNB {
971    _010: S001,
972    _020: S002,
973    _030: S003,
974    _040: S004,
975    /// Interchange control reference
976    ///
977    /// Unique reference assigned by the sender to an interchange.
978    /// Shall be identical in UNB and UNZ.
979    _050: String,
980    _060: Option<S005>,
981    _070: Option<String>,
982    _080: Option<_0029>,
983    _090: Option<_0031>,
984    _100: Option<String>,
985    _110: Option<_0035>,
986}
987
988/// UNH - MESSAGE HEADER
989///
990/// To head, identify and specify a message.
991#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
992pub struct UNH {
993    pub _010: String,
994    pub _020: S009,
995    pub _030: Option<String>,
996    pub _040: Option<S010>,
997    pub _050: Option<S016>,
998    pub _060: Option<S017>,
999    pub _070: Option<S018>,
1000}
1001
1002#[derive(Debug, Serialize, Deserialize, Default, DisplayOuterSegment, ParseSegment)]
1003pub struct UNT {
1004    /// NUMBER OF SEGMENTS IN A MESSAGE
1005    ///
1006    /// The number of segments in a message body, plus the message header segment and message trailer segment.
1007    pub _010: String,
1008    /// MESSAGE REFERENCE NUMBER
1009    ///
1010    /// Unique message reference assigned by the sender.
1011    pub _020: String,
1012}
1013
1014/// UNZ Interchange trailer
1015///
1016/// To end and check the completeness of an interchange.
1017#[derive(
1018    Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, DisplayOuterSegment, ParseSegment,
1019)]
1020pub struct UNZ {
1021    /// Interchange control count
1022    ///
1023    /// The count either of the number of messages or, if used, of the number of functional groups in an interchange. One of these counts shall appear.
1024    _010: String,
1025    /// Interchange control reference
1026    ///
1027    /// Unique reference assigned by the sender to an interchange.
1028    /// Shall be identical in UNB and UNZ.
1029    _020: String,
1030}