fhir-types 0.1.115

Generated per-version FHIR types and terminology operation contracts
Documentation
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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
// @generated by fhir-codegen from hl7.fhir.r5.core 5.0.0. DO NOT EDIT.
// Change the emitter (tools/fhir-codegen) and regenerate.
// SPDX-FileCopyrightText: Cadasto B.V.
// SPDX-License-Identifier: Apache-2.0
//! PaymentNotice request

/// PaymentNotice request
///
/// This resource provides the status of the payment for goods and services
/// rendered, and the request and response resource references.
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct PaymentNotice {
    /// Logical id of this artifact
    ///
    /// The logical id of the resource, as used in the URL for the resource. Once
    /// assigned, this value never changes.
    pub id: Option<std::string::String>,
    /// Metadata about the resource
    ///
    /// The metadata about the resource. This is content that is maintained by the
    /// infrastructure. Changes to the content might not always be associated with
    /// version changes to the resource.
    pub meta: Option<super::meta::Meta>,
    /// A set of rules under which this content was created
    ///
    /// A reference to a set of rules that were followed when the resource was
    /// constructed, and which must be understood when processing the content.
    /// Often, this is a reference to an implementation guide that defines the
    /// special rules along with other profiles etc.
    pub implicit_rules: Option<super::primitives::Uri>,
    /// Language of the resource content
    ///
    /// The base language in which the resource is written.
    pub language: Option<super::primitives::Code>,
    /// Text summary of the resource, for human interpretation
    ///
    /// A human-readable narrative that contains a summary of the resource and can
    /// be used to represent the content of the resource to a human. The narrative
    /// need not encode all the structured data, but is required to contain
    /// sufficient detail to make it "clinically safe" for a human to just read the
    /// narrative. Resource definitions may define what content should be
    /// represented in the narrative to ensure clinical safety.
    pub text: Option<super::narrative::Narrative>,
    /// Contained, inline Resources
    ///
    /// These resources do not have an independent existence apart from the resource
    /// that contains them - they cannot be identified independently, nor can they
    /// have their own independent transaction scope. This is allowed to be a
    /// Parameters resource if and only if it is referenced by a resource that
    /// provides context/meaning.
    pub contained: Vec<super::resource::Resource>,
    /// Additional content defined by implementations
    ///
    /// May be used to represent additional information that is not part of the
    /// basic definition of the resource. To make the use of extensions safe and
    /// managable, there is a strict set of governance applied to the definition and
    /// use of extensions. Though any implementer can define an extension, there is
    /// a set of requirements that SHALL be met as part of the definition of the
    /// extension.
    pub extension: Vec<super::extension::Extension>,
    /// Extensions that cannot be ignored
    ///
    /// May be used to represent additional information that is not part of the
    /// basic definition of the resource and that modifies the understanding of the
    /// element that contains it and/or the understanding of the containing
    /// element's descendants. Usually modifier elements provide negation or
    /// qualification. To make the use of extensions safe and managable, there is a
    /// strict set of governance applied to the definition and use of extensions.
    /// Though any implementer is allowed to define an extension, there is a set of
    /// requirements that SHALL be met as part of the definition of the extension.
    /// Applications processing a resource are required to check for modifier
    /// extensions. Modifier extensions SHALL NOT change the meaning of any elements
    /// on Resource or DomainResource (including cannot change the meaning of
    /// modifierExtension itself).
    pub modifier_extension: Vec<super::extension::Extension>,
    /// Business Identifier for the payment notice
    ///
    /// A unique identifier assigned to this payment notice.
    pub identifier: Vec<super::identifier::Identifier>,
    /// active | cancelled | draft | entered-in-error
    ///
    /// The status of the resource instance.
    pub status: super::primitives::Code,
    /// Request reference
    ///
    /// Reference of resource for which payment is being made.
    pub request: Option<super::reference::Reference>,
    /// Response reference
    ///
    /// Reference of response to resource for which payment is being made.
    pub response: Option<super::reference::Reference>,
    /// Creation date
    ///
    /// The date when this resource was created.
    pub created: super::primitives::DateTime,
    /// Responsible practitioner
    ///
    /// The party who reports the payment notice.
    pub reporter: Option<super::reference::Reference>,
    /// Payment reference
    ///
    /// A reference to the payment which is the subject of this notice.
    pub payment: Option<super::reference::Reference>,
    /// Payment or clearing date
    ///
    /// The date when the above payment action occurred.
    pub payment_date: Option<super::primitives::Date>,
    /// Party being paid
    ///
    /// The party who will receive or has received payment that is the subject of
    /// this notification.
    pub payee: Option<super::reference::Reference>,
    /// Party being notified
    ///
    /// The party who is notified of the payment status.
    pub recipient: super::reference::Reference,
    /// Monetary amount of the payment
    ///
    /// The amount sent to the payee.
    pub amount: super::money::Money,
    /// Issued or cleared Status of the payment
    ///
    /// A code indicating whether payment has been sent or cleared.
    pub payment_status: Option<super::codeable_concept::CodeableConcept>,
}

impl super::super::codec::Json for PaymentNotice {
    fn to_json(&self) -> Result<super::super::codec::Object, super::super::codec::EncodeError> {
        let mut object = super::super::codec::Object::new();
        object.insert(
            std::string::String::from("resourceType"),
            super::super::codec::Value::String(std::string::String::from("PaymentNotice")),
        );
        if let Some(v) = &self.id {
            object.insert(
                std::string::String::from("id"),
                super::super::codec::Value::String(v.clone()),
            );
        }
        if let Some(item) = &self.meta {
            object.insert(
                std::string::String::from("meta"),
                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
            );
        }
        if let Some(item) = &self.implicit_rules {
            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
                object.insert(std::string::String::from("implicitRules"), v);
            }
            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
                object.insert(std::string::String::from("_implicitRules"), e);
            }
        }
        if let Some(item) = &self.language {
            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
                object.insert(std::string::String::from("language"), v);
            }
            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
                object.insert(std::string::String::from("_language"), e);
            }
        }
        if let Some(item) = &self.text {
            object.insert(
                std::string::String::from("text"),
                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
            );
        }
        if !self.contained.is_empty() {
            let mut items = Vec::with_capacity(self.contained.len());
            for item in &self.contained {
                items.push(super::super::codec::Value::Object(
                    super::super::codec::Json::to_json(item)?,
                ));
            }
            object.insert(
                std::string::String::from("contained"),
                super::super::codec::Value::Array(items),
            );
        }
        if !self.extension.is_empty() {
            let mut items = Vec::with_capacity(self.extension.len());
            for item in &self.extension {
                items.push(super::super::codec::Value::Object(
                    super::super::codec::Json::to_json(item)?,
                ));
            }
            object.insert(
                std::string::String::from("extension"),
                super::super::codec::Value::Array(items),
            );
        }
        if !self.modifier_extension.is_empty() {
            let mut items = Vec::with_capacity(self.modifier_extension.len());
            for item in &self.modifier_extension {
                items.push(super::super::codec::Value::Object(
                    super::super::codec::Json::to_json(item)?,
                ));
            }
            object.insert(
                std::string::String::from("modifierExtension"),
                super::super::codec::Value::Array(items),
            );
        }
        if !self.identifier.is_empty() {
            let mut items = Vec::with_capacity(self.identifier.len());
            for item in &self.identifier {
                items.push(super::super::codec::Value::Object(
                    super::super::codec::Json::to_json(item)?,
                ));
            }
            object.insert(
                std::string::String::from("identifier"),
                super::super::codec::Value::Array(items),
            );
        }
        if let Some(v) = super::super::codec::Primitive::value_json(&self.status)? {
            object.insert(std::string::String::from("status"), v);
        }
        if let Some(e) = super::super::codec::Primitive::element_json(&self.status)? {
            object.insert(std::string::String::from("_status"), e);
        }
        if let Some(item) = &self.request {
            object.insert(
                std::string::String::from("request"),
                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
            );
        }
        if let Some(item) = &self.response {
            object.insert(
                std::string::String::from("response"),
                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
            );
        }
        if let Some(v) = super::super::codec::Primitive::value_json(&self.created)? {
            object.insert(std::string::String::from("created"), v);
        }
        if let Some(e) = super::super::codec::Primitive::element_json(&self.created)? {
            object.insert(std::string::String::from("_created"), e);
        }
        if let Some(item) = &self.reporter {
            object.insert(
                std::string::String::from("reporter"),
                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
            );
        }
        if let Some(item) = &self.payment {
            object.insert(
                std::string::String::from("payment"),
                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
            );
        }
        if let Some(item) = &self.payment_date {
            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
                object.insert(std::string::String::from("paymentDate"), v);
            }
            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
                object.insert(std::string::String::from("_paymentDate"), e);
            }
        }
        if let Some(item) = &self.payee {
            object.insert(
                std::string::String::from("payee"),
                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
            );
        }
        object.insert(
            std::string::String::from("recipient"),
            super::super::codec::Value::Object(super::super::codec::Json::to_json(
                &self.recipient,
            )?),
        );
        object.insert(
            std::string::String::from("amount"),
            super::super::codec::Value::Object(super::super::codec::Json::to_json(&self.amount)?),
        );
        if let Some(item) = &self.payment_status {
            object.insert(
                std::string::String::from("paymentStatus"),
                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
            );
        }
        Ok(object)
    }

    fn from_json(
        object: &super::super::codec::Object,
        path: &mut super::super::codec::Path,
    ) -> Result<Self, super::super::codec::DecodeError> {
        let mut raw_id: Option<&super::super::codec::Value> = None;
        let mut raw_meta: Option<&super::super::codec::Value> = None;
        let mut raw_implicit_rules: Option<&super::super::codec::Value> = None;
        let mut raw_implicit_rules_element: Option<&super::super::codec::Value> = None;
        let mut raw_language: Option<&super::super::codec::Value> = None;
        let mut raw_language_element: Option<&super::super::codec::Value> = None;
        let mut raw_text: Option<&super::super::codec::Value> = None;
        let mut raw_contained: Option<&super::super::codec::Value> = None;
        let mut raw_extension: Option<&super::super::codec::Value> = None;
        let mut raw_modifier_extension: Option<&super::super::codec::Value> = None;
        let mut raw_identifier: Option<&super::super::codec::Value> = None;
        let mut raw_status: Option<&super::super::codec::Value> = None;
        let mut raw_status_element: Option<&super::super::codec::Value> = None;
        let mut raw_request: Option<&super::super::codec::Value> = None;
        let mut raw_response: Option<&super::super::codec::Value> = None;
        let mut raw_created: Option<&super::super::codec::Value> = None;
        let mut raw_created_element: Option<&super::super::codec::Value> = None;
        let mut raw_reporter: Option<&super::super::codec::Value> = None;
        let mut raw_payment: Option<&super::super::codec::Value> = None;
        let mut raw_payment_date: Option<&super::super::codec::Value> = None;
        let mut raw_payment_date_element: Option<&super::super::codec::Value> = None;
        let mut raw_payee: Option<&super::super::codec::Value> = None;
        let mut raw_recipient: Option<&super::super::codec::Value> = None;
        let mut raw_amount: Option<&super::super::codec::Value> = None;
        let mut raw_payment_status: Option<&super::super::codec::Value> = None;
        for (key, value) in object {
            match key.as_str() {
                "resourceType" => {
                    if value.as_str() != Some("PaymentNotice") {
                        return Err(path.error(super::super::codec::DecodeErrorKind::ResourceType));
                    }
                }
                "id" => {
                    raw_id = Some(value);
                }
                "meta" => {
                    raw_meta = Some(value);
                }
                "implicitRules" => {
                    raw_implicit_rules = Some(value);
                }
                "_implicitRules" => {
                    raw_implicit_rules_element = Some(value);
                }
                "language" => {
                    raw_language = Some(value);
                }
                "_language" => {
                    raw_language_element = Some(value);
                }
                "text" => {
                    raw_text = Some(value);
                }
                "contained" => {
                    raw_contained = Some(value);
                }
                "extension" => {
                    raw_extension = Some(value);
                }
                "modifierExtension" => {
                    raw_modifier_extension = Some(value);
                }
                "identifier" => {
                    raw_identifier = Some(value);
                }
                "status" => {
                    raw_status = Some(value);
                }
                "_status" => {
                    raw_status_element = Some(value);
                }
                "request" => {
                    raw_request = Some(value);
                }
                "response" => {
                    raw_response = Some(value);
                }
                "created" => {
                    raw_created = Some(value);
                }
                "_created" => {
                    raw_created_element = Some(value);
                }
                "reporter" => {
                    raw_reporter = Some(value);
                }
                "payment" => {
                    raw_payment = Some(value);
                }
                "paymentDate" => {
                    raw_payment_date = Some(value);
                }
                "_paymentDate" => {
                    raw_payment_date_element = Some(value);
                }
                "payee" => {
                    raw_payee = Some(value);
                }
                "recipient" => {
                    raw_recipient = Some(value);
                }
                "amount" => {
                    raw_amount = Some(value);
                }
                "paymentStatus" => {
                    raw_payment_status = Some(value);
                }
                other => {
                    return path.with(other, |path| {
                        Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty))
                    });
                }
            }
        }
        let field_id = raw_id
            .map(|value| {
                path.with("id", |path| {
                    let value = super::super::codec::expect_single(value, path)?;
                    super::primitives::checked_id(
                        super::super::codec::expect_string(value, path)?,
                        path,
                    )
                })
            })
            .transpose()?;
        let field_meta = raw_meta
            .map(|value| {
                path.with("meta", |path| {
                    super::super::codec::Json::from_json(
                        super::super::codec::expect_object(
                            super::super::codec::expect_single(value, path)?,
                            path,
                        )?,
                        path,
                    )
                })
            })
            .transpose()?;
        let field_implicit_rules = match (raw_implicit_rules, raw_implicit_rules_element) {
            (None, None) => None,
            (value, element) => Some(path.with("implicitRules", |path| {
                super::super::codec::Primitive::from_json_parts(value, element, path)
            })?),
        };
        let field_language = match (raw_language, raw_language_element) {
            (None, None) => None,
            (value, element) => Some(path.with("language", |path| {
                super::super::codec::Primitive::from_json_parts(value, element, path)
            })?),
        };
        let field_text = raw_text
            .map(|value| {
                path.with("text", |path| {
                    super::super::codec::Json::from_json(
                        super::super::codec::expect_object(
                            super::super::codec::expect_single(value, path)?,
                            path,
                        )?,
                        path,
                    )
                })
            })
            .transpose()?;
        let mut field_contained = Vec::new();
        if let Some(raw) = raw_contained {
            for (index, value) in super::super::codec::expect_array(raw, path)?
                .iter()
                .enumerate()
            {
                field_contained.push(path.with_index("contained", index, |path| {
                    super::super::codec::Json::from_json(
                        super::super::codec::expect_object(value, path)?,
                        path,
                    )
                })?);
            }
        }
        let mut field_extension = Vec::new();
        if let Some(raw) = raw_extension {
            for (index, value) in super::super::codec::expect_array(raw, path)?
                .iter()
                .enumerate()
            {
                field_extension.push(path.with_index("extension", index, |path| {
                    super::super::codec::Json::from_json(
                        super::super::codec::expect_object(value, path)?,
                        path,
                    )
                })?);
            }
        }
        let mut field_modifier_extension = Vec::new();
        if let Some(raw) = raw_modifier_extension {
            for (index, value) in super::super::codec::expect_array(raw, path)?
                .iter()
                .enumerate()
            {
                field_modifier_extension.push(path.with_index(
                    "modifierExtension",
                    index,
                    |path| {
                        super::super::codec::Json::from_json(
                            super::super::codec::expect_object(value, path)?,
                            path,
                        )
                    },
                )?);
            }
        }
        let mut field_identifier = Vec::new();
        if let Some(raw) = raw_identifier {
            for (index, value) in super::super::codec::expect_array(raw, path)?
                .iter()
                .enumerate()
            {
                field_identifier.push(path.with_index("identifier", index, |path| {
                    super::super::codec::Json::from_json(
                        super::super::codec::expect_object(value, path)?,
                        path,
                    )
                })?);
            }
        }
        let field_status = path.with("status", |path| {
            super::super::codec::Primitive::from_json_parts(raw_status, raw_status_element, path)
        })?;
        let field_request = raw_request
            .map(|value| {
                path.with("request", |path| {
                    super::super::codec::Json::from_json(
                        super::super::codec::expect_object(
                            super::super::codec::expect_single(value, path)?,
                            path,
                        )?,
                        path,
                    )
                })
            })
            .transpose()?;
        let field_response = raw_response
            .map(|value| {
                path.with("response", |path| {
                    super::super::codec::Json::from_json(
                        super::super::codec::expect_object(
                            super::super::codec::expect_single(value, path)?,
                            path,
                        )?,
                        path,
                    )
                })
            })
            .transpose()?;
        let field_created = path.with("created", |path| {
            super::super::codec::Primitive::from_json_parts(raw_created, raw_created_element, path)
        })?;
        let field_reporter = raw_reporter
            .map(|value| {
                path.with("reporter", |path| {
                    super::super::codec::Json::from_json(
                        super::super::codec::expect_object(
                            super::super::codec::expect_single(value, path)?,
                            path,
                        )?,
                        path,
                    )
                })
            })
            .transpose()?;
        let field_payment = raw_payment
            .map(|value| {
                path.with("payment", |path| {
                    super::super::codec::Json::from_json(
                        super::super::codec::expect_object(
                            super::super::codec::expect_single(value, path)?,
                            path,
                        )?,
                        path,
                    )
                })
            })
            .transpose()?;
        let field_payment_date = match (raw_payment_date, raw_payment_date_element) {
            (None, None) => None,
            (value, element) => Some(path.with("paymentDate", |path| {
                super::super::codec::Primitive::from_json_parts(value, element, path)
            })?),
        };
        let field_payee = raw_payee
            .map(|value| {
                path.with("payee", |path| {
                    super::super::codec::Json::from_json(
                        super::super::codec::expect_object(
                            super::super::codec::expect_single(value, path)?,
                            path,
                        )?,
                        path,
                    )
                })
            })
            .transpose()?;
        let field_recipient = path.with("recipient", |path| {
            let value = raw_recipient
                .ok_or_else(|| path.error(super::super::codec::DecodeErrorKind::MissingProperty))?;
            super::super::codec::Json::from_json(
                super::super::codec::expect_object(
                    super::super::codec::expect_single(value, path)?,
                    path,
                )?,
                path,
            )
        })?;
        let field_amount = path.with("amount", |path| {
            let value = raw_amount
                .ok_or_else(|| path.error(super::super::codec::DecodeErrorKind::MissingProperty))?;
            super::super::codec::Json::from_json(
                super::super::codec::expect_object(
                    super::super::codec::expect_single(value, path)?,
                    path,
                )?,
                path,
            )
        })?;
        let field_payment_status = raw_payment_status
            .map(|value| {
                path.with("paymentStatus", |path| {
                    super::super::codec::Json::from_json(
                        super::super::codec::expect_object(
                            super::super::codec::expect_single(value, path)?,
                            path,
                        )?,
                        path,
                    )
                })
            })
            .transpose()?;
        Ok(Self {
            id: field_id,
            meta: field_meta,
            implicit_rules: field_implicit_rules,
            language: field_language,
            text: field_text,
            contained: field_contained,
            extension: field_extension,
            modifier_extension: field_modifier_extension,
            identifier: field_identifier,
            status: field_status,
            request: field_request,
            response: field_response,
            created: field_created,
            reporter: field_reporter,
            payment: field_payment,
            payment_date: field_payment_date,
            payee: field_payee,
            recipient: field_recipient,
            amount: field_amount,
            payment_status: field_payment_status,
        })
    }
}

impl serde::Serialize for PaymentNotice {
    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        let mut map = serde::Serializer::serialize_map(serializer, None)?;
        super::super::codec::element_entry(&mut map, "_created", &self.created)?;
        if let Some(item) = &self.implicit_rules {
            super::super::codec::element_entry(&mut map, "_implicitRules", item)?;
        }
        if let Some(item) = &self.language {
            super::super::codec::element_entry(&mut map, "_language", item)?;
        }
        if let Some(item) = &self.payment_date {
            super::super::codec::element_entry(&mut map, "_paymentDate", item)?;
        }
        super::super::codec::element_entry(&mut map, "_status", &self.status)?;
        serde::ser::SerializeMap::serialize_entry(&mut map, "amount", &self.amount)?;
        if !self.contained.is_empty() {
            serde::ser::SerializeMap::serialize_entry(&mut map, "contained", &self.contained)?;
        }
        super::super::codec::value_entry(&mut map, "created", &self.created)?;
        if !self.extension.is_empty() {
            serde::ser::SerializeMap::serialize_entry(&mut map, "extension", &self.extension)?;
        }
        if let Some(v) = &self.id {
            serde::ser::SerializeMap::serialize_entry(&mut map, "id", v)?;
        }
        if !self.identifier.is_empty() {
            serde::ser::SerializeMap::serialize_entry(&mut map, "identifier", &self.identifier)?;
        }
        if let Some(item) = &self.implicit_rules {
            super::super::codec::value_entry(&mut map, "implicitRules", item)?;
        }
        if let Some(item) = &self.language {
            super::super::codec::value_entry(&mut map, "language", item)?;
        }
        if let Some(item) = &self.meta {
            serde::ser::SerializeMap::serialize_entry(&mut map, "meta", item)?;
        }
        if !self.modifier_extension.is_empty() {
            serde::ser::SerializeMap::serialize_entry(
                &mut map,
                "modifierExtension",
                &self.modifier_extension,
            )?;
        }
        if let Some(item) = &self.payee {
            serde::ser::SerializeMap::serialize_entry(&mut map, "payee", item)?;
        }
        if let Some(item) = &self.payment {
            serde::ser::SerializeMap::serialize_entry(&mut map, "payment", item)?;
        }
        if let Some(item) = &self.payment_date {
            super::super::codec::value_entry(&mut map, "paymentDate", item)?;
        }
        if let Some(item) = &self.payment_status {
            serde::ser::SerializeMap::serialize_entry(&mut map, "paymentStatus", item)?;
        }
        serde::ser::SerializeMap::serialize_entry(&mut map, "recipient", &self.recipient)?;
        if let Some(item) = &self.reporter {
            serde::ser::SerializeMap::serialize_entry(&mut map, "reporter", item)?;
        }
        if let Some(item) = &self.request {
            serde::ser::SerializeMap::serialize_entry(&mut map, "request", item)?;
        }
        serde::ser::SerializeMap::serialize_entry(&mut map, "resourceType", "PaymentNotice")?;
        if let Some(item) = &self.response {
            serde::ser::SerializeMap::serialize_entry(&mut map, "response", item)?;
        }
        super::super::codec::value_entry(&mut map, "status", &self.status)?;
        if let Some(item) = &self.text {
            serde::ser::SerializeMap::serialize_entry(&mut map, "text", item)?;
        }
        serde::ser::SerializeMap::end(map)
    }
}

impl<'de> serde::Deserialize<'de> for PaymentNotice {
    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        let value = <super::super::codec::Value as serde::Deserialize>::deserialize(deserializer)?;
        let mut path = super::super::codec::Path::root("PaymentNotice");
        let object =
            super::super::codec::expect_object(&value, &path).map_err(serde::de::Error::custom)?;
        super::super::codec::Json::from_json(object, &mut path).map_err(serde::de::Error::custom)
    }
}