1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
use arrayvec::ArrayString;
#[derive(Clone, Eq, PartialEq, Hash, Debug, Default)]
pub struct Leg {
pub(crate) operating_carrier_pnr_code: ArrayString<[u8; 7]>,
pub(crate) from_city_airport_code: ArrayString<[u8; 3]>,
pub(crate) to_city_airport_code: ArrayString<[u8; 3]>,
pub(crate) operating_carrier_designator: ArrayString<[u8; 3]>,
pub(crate) flight_number: ArrayString<[u8; 5]>,
pub(crate) date_of_flight: ArrayString<[u8; 3]>,
pub(crate) compartment_code: char,
pub(crate) seat_number: ArrayString<[u8; 4]>,
pub(crate) check_in_sequence_number: ArrayString<[u8; 5]>,
pub(crate) passenger_status: char,
pub(crate) airline_numeric_code: Option<ArrayString<[u8; 3]>>,
pub(crate) document_form_serial_number: Option<ArrayString<[u8; 10]>>,
pub(crate) selectee_indicator: Option<char>,
pub(crate) international_document_verification: Option<char>,
pub(crate) marketing_carrier_designator: Option<ArrayString<[u8; 3]>>,
pub(crate) frequent_flyer_airline_designator: Option<ArrayString<[u8; 3]>>,
pub(crate) frequent_flyer_number: Option<ArrayString<[u8; 16]>>,
pub(crate) id_ad_indicator: Option<char>,
pub(crate) free_baggage_allowance: Option<ArrayString<[u8; 3]>>,
pub(crate) fast_track: Option<char>,
pub(crate) airline_individual_use: Option<String>,
}
impl Leg {
pub fn operating_carrier_pnr_code(&self) -> &str {
&self.operating_carrier_pnr_code
}
pub fn from_city_airport_code(&self) -> &str {
&self.from_city_airport_code
}
pub fn to_city_airport_code(&self) -> &str {
&self.to_city_airport_code
}
pub fn marketing_carrier_designator(&self) -> Option<&str> {
self.marketing_carrier_designator
.as_ref()
.map(|x| x.as_str())
}
pub fn frequent_flyer_airline_designator(&self) -> Option<&str> {
self.frequent_flyer_airline_designator
.as_ref()
.map(|x| x.as_str())
}
pub fn frequent_flyer_number(&self) -> Option<&str> {
self.frequent_flyer_number
.as_ref()
.map(|x| x.as_str())
}
pub fn id_ad_indicator(&self) -> Option<char> {
self.id_ad_indicator
}
pub fn operating_carrier_designator(&self) -> &str {
&self.operating_carrier_designator
}
pub fn flight_number(&self) -> &str {
&self.flight_number
}
pub fn date_of_flight(&self) -> &str {
&self.date_of_flight
}
pub fn compartment_code(&self) -> char {
self.compartment_code
}
pub fn seat_number(&self) -> &str {
&self.seat_number
}
pub fn check_in_sequence_number(&self) -> &str {
&self.check_in_sequence_number
}
pub fn passenger_status(&self) -> char {
self.passenger_status
}
pub fn airline_numeric_code(&self) -> Option<&str> {
self.airline_numeric_code
.as_ref()
.map(|x| x.as_str())
}
pub fn document_form_serial_number(&self) -> Option<&str> {
self.document_form_serial_number
.as_ref()
.map(|x| x.as_str())
}
pub fn selectee_indicator(&self) -> Option<char> {
self.selectee_indicator
}
pub fn international_document_verification(&self) -> Option<char> {
self.international_document_verification
}
pub fn fast_track(&self) -> Option<char> {
self.fast_track
}
pub fn free_baggage_allowance(&self) -> Option<&str> {
self.free_baggage_allowance
.as_ref()
.map(|x| x.as_str())
}
pub fn airline_individual_use(&self) -> Option<&str> {
self.airline_individual_use
.as_ref()
.map(|x| x.as_str())
}
}
#[derive(Clone, Eq, PartialEq, Hash, Debug, Default)]
pub struct SecurityData {
pub(crate) type_of_security_data: Option<char>,
pub(crate) security_data: Option<String>,
}
impl SecurityData {
pub fn type_of_security_data(&self) -> Option<char> {
self.type_of_security_data
}
pub fn security_data(&self) -> Option<&str> {
self.security_data
.as_ref()
.map(|x| x.as_str())
}
}
#[derive(Clone, Eq, PartialEq, Hash, Debug, Default)]
pub(crate) struct ConditionalMetadata {
pub(crate) version_number: Option<char>,
pub(crate) passenger_description: Option<char>,
pub(crate) source_of_check_in: Option<char>,
pub(crate) source_of_boarding_pass_issuance: Option<char>,
pub(crate) date_of_issue_of_boarding_pass: Option<ArrayString<[u8; 4]>>,
pub(crate) document_type: Option<char>,
pub(crate) airline_designator_of_boarding_pass_issuer: Option<ArrayString<[u8; 3]>>,
pub(crate) baggage_tag_license_plate_numbers: Option<ArrayString<[u8; 13]>>,
pub(crate) first_non_consecutive_baggage_tag_license_plate_numbers: Option<ArrayString<[u8; 13]>>,
pub(crate) second_non_consecutive_baggage_tag_license_plate_numbers: Option<ArrayString<[u8; 13]>>,
}
#[derive(Clone, Eq, PartialEq, Hash, Debug, Default)]
pub struct Bcbp {
pub(crate) passenger_name: ArrayString<[u8; 20]>,
pub(crate) electronic_ticket_indicator: char,
pub(crate) metadata: ConditionalMetadata,
pub(crate) legs: Vec<Leg>,
pub(crate) security_data: SecurityData,
}
impl Bcbp {
pub fn legs(&self) -> &[Leg] {
&self.legs
}
pub fn security_data(&self) -> &SecurityData {
&self.security_data
}
pub fn electronic_ticket_indicator(&self) -> char {
self.electronic_ticket_indicator
}
pub fn version_number(&self) -> Option<char> {
self.metadata.version_number
}
pub fn passenger_description(&self) -> Option<char> {
self.metadata.passenger_description
}
pub fn passenger_name(&self) -> &str {
&self.passenger_name
}
pub fn source_of_check_in(&self) -> Option<char> {
self.metadata.source_of_check_in
}
pub fn source_of_boarding_pass_issuance(&self) -> Option<char> {
self.metadata.source_of_boarding_pass_issuance
}
pub fn date_of_issue_of_boarding_pass(&self) -> Option<&str> {
self.metadata
.date_of_issue_of_boarding_pass
.as_ref()
.map(|x| x.as_str())
}
pub fn document_type(&self) -> Option<char> {
self.metadata.document_type
}
pub fn airline_designator_of_boarding_pass_issuer(&self) -> Option<&str> {
self.metadata
.airline_designator_of_boarding_pass_issuer
.as_ref()
.map(|x| x.as_str())
}
pub fn baggage_tag_license_plate_numbers(&self) -> Option<&str> {
self.metadata
.baggage_tag_license_plate_numbers
.as_ref()
.map(|x| x.as_str())
}
pub fn first_non_consecutive_baggage_tag_license_plate_numbers(&self) -> Option<&str> {
self.metadata
.first_non_consecutive_baggage_tag_license_plate_numbers
.as_ref()
.map(|x| x.as_str())
}
pub fn second_non_consecutive_baggage_tag_license_plate_numbers(&self) -> Option<&str> {
self.metadata
.second_non_consecutive_baggage_tag_license_plate_numbers
.as_ref()
.map(|x| x.as_str())
}
}