001package org.hl7.fhir.r5.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r5
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.ICompositeType;
058
059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
060import org.hl7.fhir.utilities.Utilities;
061import ca.uhn.fhir.model.api.annotation.ResourceDef;
062import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
063import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
064import ca.uhn.fhir.model.api.annotation.Child;
065import ca.uhn.fhir.model.api.annotation.ChildOrder;
066import ca.uhn.fhir.model.api.annotation.Description;
067import ca.uhn.fhir.model.api.annotation.Block;
068/**
069 * This resource provides the status of the payment for goods and services rendered, and the request and response resource references.
070 */
071@ResourceDef(name="PaymentNotice", profile="http://hl7.org/fhir/StructureDefinition/PaymentNotice")
072public class PaymentNotice extends DomainResource {
073
074    public enum PaymentNoticeStatus {
075        /**
076         * The instance is currently in-force.
077         */
078        ACTIVE, 
079        /**
080         * The instance is withdrawn, rescinded or reversed.
081         */
082        CANCELLED, 
083        /**
084         * A new instance the contents of which is not complete.
085         */
086        DRAFT, 
087        /**
088         * The instance was entered in error.
089         */
090        ENTEREDINERROR, 
091        /**
092         * added to help the parsers with the generic types
093         */
094        NULL;
095        public static PaymentNoticeStatus fromCode(String codeString) throws FHIRException {
096            if (codeString == null || "".equals(codeString))
097                return null;
098        if ("active".equals(codeString))
099          return ACTIVE;
100        if ("cancelled".equals(codeString))
101          return CANCELLED;
102        if ("draft".equals(codeString))
103          return DRAFT;
104        if ("entered-in-error".equals(codeString))
105          return ENTEREDINERROR;
106        if (Configuration.isAcceptInvalidEnums())
107          return null;
108        else
109          throw new FHIRException("Unknown PaymentNoticeStatus code '"+codeString+"'");
110        }
111        public String toCode() {
112          switch (this) {
113            case ACTIVE: return "active";
114            case CANCELLED: return "cancelled";
115            case DRAFT: return "draft";
116            case ENTEREDINERROR: return "entered-in-error";
117            default: return "?";
118          }
119        }
120        public String getSystem() {
121          switch (this) {
122            case ACTIVE: return "http://hl7.org/fhir/fm-status";
123            case CANCELLED: return "http://hl7.org/fhir/fm-status";
124            case DRAFT: return "http://hl7.org/fhir/fm-status";
125            case ENTEREDINERROR: return "http://hl7.org/fhir/fm-status";
126            default: return "?";
127          }
128        }
129        public String getDefinition() {
130          switch (this) {
131            case ACTIVE: return "The instance is currently in-force.";
132            case CANCELLED: return "The instance is withdrawn, rescinded or reversed.";
133            case DRAFT: return "A new instance the contents of which is not complete.";
134            case ENTEREDINERROR: return "The instance was entered in error.";
135            default: return "?";
136          }
137        }
138        public String getDisplay() {
139          switch (this) {
140            case ACTIVE: return "Active";
141            case CANCELLED: return "Cancelled";
142            case DRAFT: return "Draft";
143            case ENTEREDINERROR: return "Entered in Error";
144            default: return "?";
145          }
146        }
147    }
148
149  public static class PaymentNoticeStatusEnumFactory implements EnumFactory<PaymentNoticeStatus> {
150    public PaymentNoticeStatus fromCode(String codeString) throws IllegalArgumentException {
151      if (codeString == null || "".equals(codeString))
152            if (codeString == null || "".equals(codeString))
153                return null;
154        if ("active".equals(codeString))
155          return PaymentNoticeStatus.ACTIVE;
156        if ("cancelled".equals(codeString))
157          return PaymentNoticeStatus.CANCELLED;
158        if ("draft".equals(codeString))
159          return PaymentNoticeStatus.DRAFT;
160        if ("entered-in-error".equals(codeString))
161          return PaymentNoticeStatus.ENTEREDINERROR;
162        throw new IllegalArgumentException("Unknown PaymentNoticeStatus code '"+codeString+"'");
163        }
164        public Enumeration<PaymentNoticeStatus> fromType(Base code) throws FHIRException {
165          if (code == null)
166            return null;
167          if (code.isEmpty())
168            return new Enumeration<PaymentNoticeStatus>(this);
169          String codeString = ((PrimitiveType) code).asStringValue();
170          if (codeString == null || "".equals(codeString))
171            return null;
172        if ("active".equals(codeString))
173          return new Enumeration<PaymentNoticeStatus>(this, PaymentNoticeStatus.ACTIVE);
174        if ("cancelled".equals(codeString))
175          return new Enumeration<PaymentNoticeStatus>(this, PaymentNoticeStatus.CANCELLED);
176        if ("draft".equals(codeString))
177          return new Enumeration<PaymentNoticeStatus>(this, PaymentNoticeStatus.DRAFT);
178        if ("entered-in-error".equals(codeString))
179          return new Enumeration<PaymentNoticeStatus>(this, PaymentNoticeStatus.ENTEREDINERROR);
180        throw new FHIRException("Unknown PaymentNoticeStatus code '"+codeString+"'");
181        }
182    public String toCode(PaymentNoticeStatus code) {
183      if (code == PaymentNoticeStatus.ACTIVE)
184        return "active";
185      if (code == PaymentNoticeStatus.CANCELLED)
186        return "cancelled";
187      if (code == PaymentNoticeStatus.DRAFT)
188        return "draft";
189      if (code == PaymentNoticeStatus.ENTEREDINERROR)
190        return "entered-in-error";
191      return "?";
192      }
193    public String toSystem(PaymentNoticeStatus code) {
194      return code.getSystem();
195      }
196    }
197
198    /**
199     * A unique identifier assigned to this payment notice.
200     */
201    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
202    @Description(shortDefinition="Business Identifier for the payment noctice", formalDefinition="A unique identifier assigned to this payment notice." )
203    protected List<Identifier> identifier;
204
205    /**
206     * The status of the resource instance.
207     */
208    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
209    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
210    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fm-status")
211    protected Enumeration<PaymentNoticeStatus> status;
212
213    /**
214     * Reference of resource for which payment is being made.
215     */
216    @Child(name = "request", type = {Reference.class}, order=2, min=0, max=1, modifier=false, summary=false)
217    @Description(shortDefinition="Request reference", formalDefinition="Reference of resource for which payment is being made." )
218    protected Reference request;
219
220    /**
221     * Reference of response to resource for which payment is being made.
222     */
223    @Child(name = "response", type = {Reference.class}, order=3, min=0, max=1, modifier=false, summary=false)
224    @Description(shortDefinition="Response reference", formalDefinition="Reference of response to resource for which payment is being made." )
225    protected Reference response;
226
227    /**
228     * The date when this resource was created.
229     */
230    @Child(name = "created", type = {DateTimeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
231    @Description(shortDefinition="Creation date", formalDefinition="The date when this resource was created." )
232    protected DateTimeType created;
233
234    /**
235     * The practitioner who is responsible for the services rendered to the patient.
236     */
237    @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=5, min=0, max=1, modifier=false, summary=false)
238    @Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
239    protected Reference provider;
240
241    /**
242     * A reference to the payment which is the subject of this notice.
243     */
244    @Child(name = "payment", type = {PaymentReconciliation.class}, order=6, min=1, max=1, modifier=false, summary=true)
245    @Description(shortDefinition="Payment reference", formalDefinition="A reference to the payment which is the subject of this notice." )
246    protected Reference payment;
247
248    /**
249     * The date when the above payment action occurred.
250     */
251    @Child(name = "paymentDate", type = {DateType.class}, order=7, min=0, max=1, modifier=false, summary=false)
252    @Description(shortDefinition="Payment or clearing date", formalDefinition="The date when the above payment action occurred." )
253    protected DateType paymentDate;
254
255    /**
256     * The party who will receive or has received payment that is the subject of this notification.
257     */
258    @Child(name = "payee", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=8, min=0, max=1, modifier=false, summary=false)
259    @Description(shortDefinition="Party being paid", formalDefinition="The party who will receive or has received payment that is the subject of this notification." )
260    protected Reference payee;
261
262    /**
263     * The party who is notified of the payment status.
264     */
265    @Child(name = "recipient", type = {Organization.class}, order=9, min=1, max=1, modifier=false, summary=true)
266    @Description(shortDefinition="Party being notified", formalDefinition="The party who is notified of the payment status." )
267    protected Reference recipient;
268
269    /**
270     * The amount sent to the payee.
271     */
272    @Child(name = "amount", type = {Money.class}, order=10, min=1, max=1, modifier=false, summary=true)
273    @Description(shortDefinition="Monetary amount of the payment", formalDefinition="The amount sent to the payee." )
274    protected Money amount;
275
276    /**
277     * A code indicating whether payment has been sent or cleared.
278     */
279    @Child(name = "paymentStatus", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=false)
280    @Description(shortDefinition="Issued or cleared Status of the payment", formalDefinition="A code indicating whether payment has been sent or cleared." )
281    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-status")
282    protected CodeableConcept paymentStatus;
283
284    private static final long serialVersionUID = 1533089621L;
285
286  /**
287   * Constructor
288   */
289    public PaymentNotice() {
290      super();
291    }
292
293  /**
294   * Constructor
295   */
296    public PaymentNotice(Enumeration<PaymentNoticeStatus> status, DateTimeType created, Reference payment, Reference recipient, Money amount) {
297      super();
298      this.status = status;
299      this.created = created;
300      this.payment = payment;
301      this.recipient = recipient;
302      this.amount = amount;
303    }
304
305    /**
306     * @return {@link #identifier} (A unique identifier assigned to this payment notice.)
307     */
308    public List<Identifier> getIdentifier() { 
309      if (this.identifier == null)
310        this.identifier = new ArrayList<Identifier>();
311      return this.identifier;
312    }
313
314    /**
315     * @return Returns a reference to <code>this</code> for easy method chaining
316     */
317    public PaymentNotice setIdentifier(List<Identifier> theIdentifier) { 
318      this.identifier = theIdentifier;
319      return this;
320    }
321
322    public boolean hasIdentifier() { 
323      if (this.identifier == null)
324        return false;
325      for (Identifier item : this.identifier)
326        if (!item.isEmpty())
327          return true;
328      return false;
329    }
330
331    public Identifier addIdentifier() { //3
332      Identifier t = new Identifier();
333      if (this.identifier == null)
334        this.identifier = new ArrayList<Identifier>();
335      this.identifier.add(t);
336      return t;
337    }
338
339    public PaymentNotice addIdentifier(Identifier t) { //3
340      if (t == null)
341        return this;
342      if (this.identifier == null)
343        this.identifier = new ArrayList<Identifier>();
344      this.identifier.add(t);
345      return this;
346    }
347
348    /**
349     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
350     */
351    public Identifier getIdentifierFirstRep() { 
352      if (getIdentifier().isEmpty()) {
353        addIdentifier();
354      }
355      return getIdentifier().get(0);
356    }
357
358    /**
359     * @return {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
360     */
361    public Enumeration<PaymentNoticeStatus> getStatusElement() { 
362      if (this.status == null)
363        if (Configuration.errorOnAutoCreate())
364          throw new Error("Attempt to auto-create PaymentNotice.status");
365        else if (Configuration.doAutoCreate())
366          this.status = new Enumeration<PaymentNoticeStatus>(new PaymentNoticeStatusEnumFactory()); // bb
367      return this.status;
368    }
369
370    public boolean hasStatusElement() { 
371      return this.status != null && !this.status.isEmpty();
372    }
373
374    public boolean hasStatus() { 
375      return this.status != null && !this.status.isEmpty();
376    }
377
378    /**
379     * @param value {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
380     */
381    public PaymentNotice setStatusElement(Enumeration<PaymentNoticeStatus> value) { 
382      this.status = value;
383      return this;
384    }
385
386    /**
387     * @return The status of the resource instance.
388     */
389    public PaymentNoticeStatus getStatus() { 
390      return this.status == null ? null : this.status.getValue();
391    }
392
393    /**
394     * @param value The status of the resource instance.
395     */
396    public PaymentNotice setStatus(PaymentNoticeStatus value) { 
397        if (this.status == null)
398          this.status = new Enumeration<PaymentNoticeStatus>(new PaymentNoticeStatusEnumFactory());
399        this.status.setValue(value);
400      return this;
401    }
402
403    /**
404     * @return {@link #request} (Reference of resource for which payment is being made.)
405     */
406    public Reference getRequest() { 
407      if (this.request == null)
408        if (Configuration.errorOnAutoCreate())
409          throw new Error("Attempt to auto-create PaymentNotice.request");
410        else if (Configuration.doAutoCreate())
411          this.request = new Reference(); // cc
412      return this.request;
413    }
414
415    public boolean hasRequest() { 
416      return this.request != null && !this.request.isEmpty();
417    }
418
419    /**
420     * @param value {@link #request} (Reference of resource for which payment is being made.)
421     */
422    public PaymentNotice setRequest(Reference value) { 
423      this.request = value;
424      return this;
425    }
426
427    /**
428     * @return {@link #response} (Reference of response to resource for which payment is being made.)
429     */
430    public Reference getResponse() { 
431      if (this.response == null)
432        if (Configuration.errorOnAutoCreate())
433          throw new Error("Attempt to auto-create PaymentNotice.response");
434        else if (Configuration.doAutoCreate())
435          this.response = new Reference(); // cc
436      return this.response;
437    }
438
439    public boolean hasResponse() { 
440      return this.response != null && !this.response.isEmpty();
441    }
442
443    /**
444     * @param value {@link #response} (Reference of response to resource for which payment is being made.)
445     */
446    public PaymentNotice setResponse(Reference value) { 
447      this.response = value;
448      return this;
449    }
450
451    /**
452     * @return {@link #created} (The date when this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
453     */
454    public DateTimeType getCreatedElement() { 
455      if (this.created == null)
456        if (Configuration.errorOnAutoCreate())
457          throw new Error("Attempt to auto-create PaymentNotice.created");
458        else if (Configuration.doAutoCreate())
459          this.created = new DateTimeType(); // bb
460      return this.created;
461    }
462
463    public boolean hasCreatedElement() { 
464      return this.created != null && !this.created.isEmpty();
465    }
466
467    public boolean hasCreated() { 
468      return this.created != null && !this.created.isEmpty();
469    }
470
471    /**
472     * @param value {@link #created} (The date when this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
473     */
474    public PaymentNotice setCreatedElement(DateTimeType value) { 
475      this.created = value;
476      return this;
477    }
478
479    /**
480     * @return The date when this resource was created.
481     */
482    public Date getCreated() { 
483      return this.created == null ? null : this.created.getValue();
484    }
485
486    /**
487     * @param value The date when this resource was created.
488     */
489    public PaymentNotice setCreated(Date value) { 
490        if (this.created == null)
491          this.created = new DateTimeType();
492        this.created.setValue(value);
493      return this;
494    }
495
496    /**
497     * @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
498     */
499    public Reference getProvider() { 
500      if (this.provider == null)
501        if (Configuration.errorOnAutoCreate())
502          throw new Error("Attempt to auto-create PaymentNotice.provider");
503        else if (Configuration.doAutoCreate())
504          this.provider = new Reference(); // cc
505      return this.provider;
506    }
507
508    public boolean hasProvider() { 
509      return this.provider != null && !this.provider.isEmpty();
510    }
511
512    /**
513     * @param value {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
514     */
515    public PaymentNotice setProvider(Reference value) { 
516      this.provider = value;
517      return this;
518    }
519
520    /**
521     * @return {@link #payment} (A reference to the payment which is the subject of this notice.)
522     */
523    public Reference getPayment() { 
524      if (this.payment == null)
525        if (Configuration.errorOnAutoCreate())
526          throw new Error("Attempt to auto-create PaymentNotice.payment");
527        else if (Configuration.doAutoCreate())
528          this.payment = new Reference(); // cc
529      return this.payment;
530    }
531
532    public boolean hasPayment() { 
533      return this.payment != null && !this.payment.isEmpty();
534    }
535
536    /**
537     * @param value {@link #payment} (A reference to the payment which is the subject of this notice.)
538     */
539    public PaymentNotice setPayment(Reference value) { 
540      this.payment = value;
541      return this;
542    }
543
544    /**
545     * @return {@link #paymentDate} (The date when the above payment action occurred.). This is the underlying object with id, value and extensions. The accessor "getPaymentDate" gives direct access to the value
546     */
547    public DateType getPaymentDateElement() { 
548      if (this.paymentDate == null)
549        if (Configuration.errorOnAutoCreate())
550          throw new Error("Attempt to auto-create PaymentNotice.paymentDate");
551        else if (Configuration.doAutoCreate())
552          this.paymentDate = new DateType(); // bb
553      return this.paymentDate;
554    }
555
556    public boolean hasPaymentDateElement() { 
557      return this.paymentDate != null && !this.paymentDate.isEmpty();
558    }
559
560    public boolean hasPaymentDate() { 
561      return this.paymentDate != null && !this.paymentDate.isEmpty();
562    }
563
564    /**
565     * @param value {@link #paymentDate} (The date when the above payment action occurred.). This is the underlying object with id, value and extensions. The accessor "getPaymentDate" gives direct access to the value
566     */
567    public PaymentNotice setPaymentDateElement(DateType value) { 
568      this.paymentDate = value;
569      return this;
570    }
571
572    /**
573     * @return The date when the above payment action occurred.
574     */
575    public Date getPaymentDate() { 
576      return this.paymentDate == null ? null : this.paymentDate.getValue();
577    }
578
579    /**
580     * @param value The date when the above payment action occurred.
581     */
582    public PaymentNotice setPaymentDate(Date value) { 
583      if (value == null)
584        this.paymentDate = null;
585      else {
586        if (this.paymentDate == null)
587          this.paymentDate = new DateType();
588        this.paymentDate.setValue(value);
589      }
590      return this;
591    }
592
593    /**
594     * @return {@link #payee} (The party who will receive or has received payment that is the subject of this notification.)
595     */
596    public Reference getPayee() { 
597      if (this.payee == null)
598        if (Configuration.errorOnAutoCreate())
599          throw new Error("Attempt to auto-create PaymentNotice.payee");
600        else if (Configuration.doAutoCreate())
601          this.payee = new Reference(); // cc
602      return this.payee;
603    }
604
605    public boolean hasPayee() { 
606      return this.payee != null && !this.payee.isEmpty();
607    }
608
609    /**
610     * @param value {@link #payee} (The party who will receive or has received payment that is the subject of this notification.)
611     */
612    public PaymentNotice setPayee(Reference value) { 
613      this.payee = value;
614      return this;
615    }
616
617    /**
618     * @return {@link #recipient} (The party who is notified of the payment status.)
619     */
620    public Reference getRecipient() { 
621      if (this.recipient == null)
622        if (Configuration.errorOnAutoCreate())
623          throw new Error("Attempt to auto-create PaymentNotice.recipient");
624        else if (Configuration.doAutoCreate())
625          this.recipient = new Reference(); // cc
626      return this.recipient;
627    }
628
629    public boolean hasRecipient() { 
630      return this.recipient != null && !this.recipient.isEmpty();
631    }
632
633    /**
634     * @param value {@link #recipient} (The party who is notified of the payment status.)
635     */
636    public PaymentNotice setRecipient(Reference value) { 
637      this.recipient = value;
638      return this;
639    }
640
641    /**
642     * @return {@link #amount} (The amount sent to the payee.)
643     */
644    public Money getAmount() { 
645      if (this.amount == null)
646        if (Configuration.errorOnAutoCreate())
647          throw new Error("Attempt to auto-create PaymentNotice.amount");
648        else if (Configuration.doAutoCreate())
649          this.amount = new Money(); // cc
650      return this.amount;
651    }
652
653    public boolean hasAmount() { 
654      return this.amount != null && !this.amount.isEmpty();
655    }
656
657    /**
658     * @param value {@link #amount} (The amount sent to the payee.)
659     */
660    public PaymentNotice setAmount(Money value) { 
661      this.amount = value;
662      return this;
663    }
664
665    /**
666     * @return {@link #paymentStatus} (A code indicating whether payment has been sent or cleared.)
667     */
668    public CodeableConcept getPaymentStatus() { 
669      if (this.paymentStatus == null)
670        if (Configuration.errorOnAutoCreate())
671          throw new Error("Attempt to auto-create PaymentNotice.paymentStatus");
672        else if (Configuration.doAutoCreate())
673          this.paymentStatus = new CodeableConcept(); // cc
674      return this.paymentStatus;
675    }
676
677    public boolean hasPaymentStatus() { 
678      return this.paymentStatus != null && !this.paymentStatus.isEmpty();
679    }
680
681    /**
682     * @param value {@link #paymentStatus} (A code indicating whether payment has been sent or cleared.)
683     */
684    public PaymentNotice setPaymentStatus(CodeableConcept value) { 
685      this.paymentStatus = value;
686      return this;
687    }
688
689      protected void listChildren(List<Property> children) {
690        super.listChildren(children);
691        children.add(new Property("identifier", "Identifier", "A unique identifier assigned to this payment notice.", 0, java.lang.Integer.MAX_VALUE, identifier));
692        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
693        children.add(new Property("request", "Reference(Any)", "Reference of resource for which payment is being made.", 0, 1, request));
694        children.add(new Property("response", "Reference(Any)", "Reference of response to resource for which payment is being made.", 0, 1, response));
695        children.add(new Property("created", "dateTime", "The date when this resource was created.", 0, 1, created));
696        children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, provider));
697        children.add(new Property("payment", "Reference(PaymentReconciliation)", "A reference to the payment which is the subject of this notice.", 0, 1, payment));
698        children.add(new Property("paymentDate", "date", "The date when the above payment action occurred.", 0, 1, paymentDate));
699        children.add(new Property("payee", "Reference(Practitioner|PractitionerRole|Organization)", "The party who will receive or has received payment that is the subject of this notification.", 0, 1, payee));
700        children.add(new Property("recipient", "Reference(Organization)", "The party who is notified of the payment status.", 0, 1, recipient));
701        children.add(new Property("amount", "Money", "The amount sent to the payee.", 0, 1, amount));
702        children.add(new Property("paymentStatus", "CodeableConcept", "A code indicating whether payment has been sent or cleared.", 0, 1, paymentStatus));
703      }
704
705      @Override
706      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
707        switch (_hash) {
708        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A unique identifier assigned to this payment notice.", 0, java.lang.Integer.MAX_VALUE, identifier);
709        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
710        case 1095692943: /*request*/  return new Property("request", "Reference(Any)", "Reference of resource for which payment is being made.", 0, 1, request);
711        case -340323263: /*response*/  return new Property("response", "Reference(Any)", "Reference of response to resource for which payment is being made.", 0, 1, response);
712        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date when this resource was created.", 0, 1, created);
713        case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, provider);
714        case -786681338: /*payment*/  return new Property("payment", "Reference(PaymentReconciliation)", "A reference to the payment which is the subject of this notice.", 0, 1, payment);
715        case -1540873516: /*paymentDate*/  return new Property("paymentDate", "date", "The date when the above payment action occurred.", 0, 1, paymentDate);
716        case 106443592: /*payee*/  return new Property("payee", "Reference(Practitioner|PractitionerRole|Organization)", "The party who will receive or has received payment that is the subject of this notification.", 0, 1, payee);
717        case 820081177: /*recipient*/  return new Property("recipient", "Reference(Organization)", "The party who is notified of the payment status.", 0, 1, recipient);
718        case -1413853096: /*amount*/  return new Property("amount", "Money", "The amount sent to the payee.", 0, 1, amount);
719        case 1430704536: /*paymentStatus*/  return new Property("paymentStatus", "CodeableConcept", "A code indicating whether payment has been sent or cleared.", 0, 1, paymentStatus);
720        default: return super.getNamedProperty(_hash, _name, _checkValid);
721        }
722
723      }
724
725      @Override
726      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
727        switch (hash) {
728        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
729        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PaymentNoticeStatus>
730        case 1095692943: /*request*/ return this.request == null ? new Base[0] : new Base[] {this.request}; // Reference
731        case -340323263: /*response*/ return this.response == null ? new Base[0] : new Base[] {this.response}; // Reference
732        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
733        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
734        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // Reference
735        case -1540873516: /*paymentDate*/ return this.paymentDate == null ? new Base[0] : new Base[] {this.paymentDate}; // DateType
736        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // Reference
737        case 820081177: /*recipient*/ return this.recipient == null ? new Base[0] : new Base[] {this.recipient}; // Reference
738        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
739        case 1430704536: /*paymentStatus*/ return this.paymentStatus == null ? new Base[0] : new Base[] {this.paymentStatus}; // CodeableConcept
740        default: return super.getProperty(hash, name, checkValid);
741        }
742
743      }
744
745      @Override
746      public Base setProperty(int hash, String name, Base value) throws FHIRException {
747        switch (hash) {
748        case -1618432855: // identifier
749          this.getIdentifier().add(castToIdentifier(value)); // Identifier
750          return value;
751        case -892481550: // status
752          value = new PaymentNoticeStatusEnumFactory().fromType(castToCode(value));
753          this.status = (Enumeration) value; // Enumeration<PaymentNoticeStatus>
754          return value;
755        case 1095692943: // request
756          this.request = castToReference(value); // Reference
757          return value;
758        case -340323263: // response
759          this.response = castToReference(value); // Reference
760          return value;
761        case 1028554472: // created
762          this.created = castToDateTime(value); // DateTimeType
763          return value;
764        case -987494927: // provider
765          this.provider = castToReference(value); // Reference
766          return value;
767        case -786681338: // payment
768          this.payment = castToReference(value); // Reference
769          return value;
770        case -1540873516: // paymentDate
771          this.paymentDate = castToDate(value); // DateType
772          return value;
773        case 106443592: // payee
774          this.payee = castToReference(value); // Reference
775          return value;
776        case 820081177: // recipient
777          this.recipient = castToReference(value); // Reference
778          return value;
779        case -1413853096: // amount
780          this.amount = castToMoney(value); // Money
781          return value;
782        case 1430704536: // paymentStatus
783          this.paymentStatus = castToCodeableConcept(value); // CodeableConcept
784          return value;
785        default: return super.setProperty(hash, name, value);
786        }
787
788      }
789
790      @Override
791      public Base setProperty(String name, Base value) throws FHIRException {
792        if (name.equals("identifier")) {
793          this.getIdentifier().add(castToIdentifier(value));
794        } else if (name.equals("status")) {
795          value = new PaymentNoticeStatusEnumFactory().fromType(castToCode(value));
796          this.status = (Enumeration) value; // Enumeration<PaymentNoticeStatus>
797        } else if (name.equals("request")) {
798          this.request = castToReference(value); // Reference
799        } else if (name.equals("response")) {
800          this.response = castToReference(value); // Reference
801        } else if (name.equals("created")) {
802          this.created = castToDateTime(value); // DateTimeType
803        } else if (name.equals("provider")) {
804          this.provider = castToReference(value); // Reference
805        } else if (name.equals("payment")) {
806          this.payment = castToReference(value); // Reference
807        } else if (name.equals("paymentDate")) {
808          this.paymentDate = castToDate(value); // DateType
809        } else if (name.equals("payee")) {
810          this.payee = castToReference(value); // Reference
811        } else if (name.equals("recipient")) {
812          this.recipient = castToReference(value); // Reference
813        } else if (name.equals("amount")) {
814          this.amount = castToMoney(value); // Money
815        } else if (name.equals("paymentStatus")) {
816          this.paymentStatus = castToCodeableConcept(value); // CodeableConcept
817        } else
818          return super.setProperty(name, value);
819        return value;
820      }
821
822      @Override
823      public Base makeProperty(int hash, String name) throws FHIRException {
824        switch (hash) {
825        case -1618432855:  return addIdentifier(); 
826        case -892481550:  return getStatusElement();
827        case 1095692943:  return getRequest();
828        case -340323263:  return getResponse();
829        case 1028554472:  return getCreatedElement();
830        case -987494927:  return getProvider();
831        case -786681338:  return getPayment();
832        case -1540873516:  return getPaymentDateElement();
833        case 106443592:  return getPayee();
834        case 820081177:  return getRecipient();
835        case -1413853096:  return getAmount();
836        case 1430704536:  return getPaymentStatus();
837        default: return super.makeProperty(hash, name);
838        }
839
840      }
841
842      @Override
843      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
844        switch (hash) {
845        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
846        case -892481550: /*status*/ return new String[] {"code"};
847        case 1095692943: /*request*/ return new String[] {"Reference"};
848        case -340323263: /*response*/ return new String[] {"Reference"};
849        case 1028554472: /*created*/ return new String[] {"dateTime"};
850        case -987494927: /*provider*/ return new String[] {"Reference"};
851        case -786681338: /*payment*/ return new String[] {"Reference"};
852        case -1540873516: /*paymentDate*/ return new String[] {"date"};
853        case 106443592: /*payee*/ return new String[] {"Reference"};
854        case 820081177: /*recipient*/ return new String[] {"Reference"};
855        case -1413853096: /*amount*/ return new String[] {"Money"};
856        case 1430704536: /*paymentStatus*/ return new String[] {"CodeableConcept"};
857        default: return super.getTypesForProperty(hash, name);
858        }
859
860      }
861
862      @Override
863      public Base addChild(String name) throws FHIRException {
864        if (name.equals("identifier")) {
865          return addIdentifier();
866        }
867        else if (name.equals("status")) {
868          throw new FHIRException("Cannot call addChild on a primitive type PaymentNotice.status");
869        }
870        else if (name.equals("request")) {
871          this.request = new Reference();
872          return this.request;
873        }
874        else if (name.equals("response")) {
875          this.response = new Reference();
876          return this.response;
877        }
878        else if (name.equals("created")) {
879          throw new FHIRException("Cannot call addChild on a primitive type PaymentNotice.created");
880        }
881        else if (name.equals("provider")) {
882          this.provider = new Reference();
883          return this.provider;
884        }
885        else if (name.equals("payment")) {
886          this.payment = new Reference();
887          return this.payment;
888        }
889        else if (name.equals("paymentDate")) {
890          throw new FHIRException("Cannot call addChild on a primitive type PaymentNotice.paymentDate");
891        }
892        else if (name.equals("payee")) {
893          this.payee = new Reference();
894          return this.payee;
895        }
896        else if (name.equals("recipient")) {
897          this.recipient = new Reference();
898          return this.recipient;
899        }
900        else if (name.equals("amount")) {
901          this.amount = new Money();
902          return this.amount;
903        }
904        else if (name.equals("paymentStatus")) {
905          this.paymentStatus = new CodeableConcept();
906          return this.paymentStatus;
907        }
908        else
909          return super.addChild(name);
910      }
911
912  public String fhirType() {
913    return "PaymentNotice";
914
915  }
916
917      public PaymentNotice copy() {
918        PaymentNotice dst = new PaymentNotice();
919        copyValues(dst);
920        return dst;
921      }
922
923      public void copyValues(PaymentNotice dst) {
924        super.copyValues(dst);
925        if (identifier != null) {
926          dst.identifier = new ArrayList<Identifier>();
927          for (Identifier i : identifier)
928            dst.identifier.add(i.copy());
929        };
930        dst.status = status == null ? null : status.copy();
931        dst.request = request == null ? null : request.copy();
932        dst.response = response == null ? null : response.copy();
933        dst.created = created == null ? null : created.copy();
934        dst.provider = provider == null ? null : provider.copy();
935        dst.payment = payment == null ? null : payment.copy();
936        dst.paymentDate = paymentDate == null ? null : paymentDate.copy();
937        dst.payee = payee == null ? null : payee.copy();
938        dst.recipient = recipient == null ? null : recipient.copy();
939        dst.amount = amount == null ? null : amount.copy();
940        dst.paymentStatus = paymentStatus == null ? null : paymentStatus.copy();
941      }
942
943      protected PaymentNotice typedCopy() {
944        return copy();
945      }
946
947      @Override
948      public boolean equalsDeep(Base other_) {
949        if (!super.equalsDeep(other_))
950          return false;
951        if (!(other_ instanceof PaymentNotice))
952          return false;
953        PaymentNotice o = (PaymentNotice) other_;
954        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(request, o.request, true)
955           && compareDeep(response, o.response, true) && compareDeep(created, o.created, true) && compareDeep(provider, o.provider, true)
956           && compareDeep(payment, o.payment, true) && compareDeep(paymentDate, o.paymentDate, true) && compareDeep(payee, o.payee, true)
957           && compareDeep(recipient, o.recipient, true) && compareDeep(amount, o.amount, true) && compareDeep(paymentStatus, o.paymentStatus, true)
958          ;
959      }
960
961      @Override
962      public boolean equalsShallow(Base other_) {
963        if (!super.equalsShallow(other_))
964          return false;
965        if (!(other_ instanceof PaymentNotice))
966          return false;
967        PaymentNotice o = (PaymentNotice) other_;
968        return compareValues(status, o.status, true) && compareValues(created, o.created, true) && compareValues(paymentDate, o.paymentDate, true)
969          ;
970      }
971
972      public boolean isEmpty() {
973        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, request
974          , response, created, provider, payment, paymentDate, payee, recipient, amount
975          , paymentStatus);
976      }
977
978  @Override
979  public ResourceType getResourceType() {
980    return ResourceType.PaymentNotice;
981   }
982
983 /**
984   * Search parameter: <b>identifier</b>
985   * <p>
986   * Description: <b>The business identifier of the notice</b><br>
987   * Type: <b>token</b><br>
988   * Path: <b>PaymentNotice.identifier</b><br>
989   * </p>
990   */
991  @SearchParamDefinition(name="identifier", path="PaymentNotice.identifier", description="The business identifier of the notice", type="token" )
992  public static final String SP_IDENTIFIER = "identifier";
993 /**
994   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
995   * <p>
996   * Description: <b>The business identifier of the notice</b><br>
997   * Type: <b>token</b><br>
998   * Path: <b>PaymentNotice.identifier</b><br>
999   * </p>
1000   */
1001  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1002
1003 /**
1004   * Search parameter: <b>request</b>
1005   * <p>
1006   * Description: <b>The Claim</b><br>
1007   * Type: <b>reference</b><br>
1008   * Path: <b>PaymentNotice.request</b><br>
1009   * </p>
1010   */
1011  @SearchParamDefinition(name="request", path="PaymentNotice.request", description="The Claim", type="reference" )
1012  public static final String SP_REQUEST = "request";
1013 /**
1014   * <b>Fluent Client</b> search parameter constant for <b>request</b>
1015   * <p>
1016   * Description: <b>The Claim</b><br>
1017   * Type: <b>reference</b><br>
1018   * Path: <b>PaymentNotice.request</b><br>
1019   * </p>
1020   */
1021  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST);
1022
1023/**
1024   * Constant for fluent queries to be used to add include statements. Specifies
1025   * the path value of "<b>PaymentNotice:request</b>".
1026   */
1027  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST = new ca.uhn.fhir.model.api.Include("PaymentNotice:request").toLocked();
1028
1029 /**
1030   * Search parameter: <b>provider</b>
1031   * <p>
1032   * Description: <b>The reference to the provider</b><br>
1033   * Type: <b>reference</b><br>
1034   * Path: <b>PaymentNotice.provider</b><br>
1035   * </p>
1036   */
1037  @SearchParamDefinition(name="provider", path="PaymentNotice.provider", description="The reference to the provider", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Organization.class, Practitioner.class, PractitionerRole.class } )
1038  public static final String SP_PROVIDER = "provider";
1039 /**
1040   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
1041   * <p>
1042   * Description: <b>The reference to the provider</b><br>
1043   * Type: <b>reference</b><br>
1044   * Path: <b>PaymentNotice.provider</b><br>
1045   * </p>
1046   */
1047  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
1048
1049/**
1050   * Constant for fluent queries to be used to add include statements. Specifies
1051   * the path value of "<b>PaymentNotice:provider</b>".
1052   */
1053  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("PaymentNotice:provider").toLocked();
1054
1055 /**
1056   * Search parameter: <b>created</b>
1057   * <p>
1058   * Description: <b>Creation date fro the notice</b><br>
1059   * Type: <b>date</b><br>
1060   * Path: <b>PaymentNotice.created</b><br>
1061   * </p>
1062   */
1063  @SearchParamDefinition(name="created", path="PaymentNotice.created", description="Creation date fro the notice", type="date" )
1064  public static final String SP_CREATED = "created";
1065 /**
1066   * <b>Fluent Client</b> search parameter constant for <b>created</b>
1067   * <p>
1068   * Description: <b>Creation date fro the notice</b><br>
1069   * Type: <b>date</b><br>
1070   * Path: <b>PaymentNotice.created</b><br>
1071   * </p>
1072   */
1073  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
1074
1075 /**
1076   * Search parameter: <b>response</b>
1077   * <p>
1078   * Description: <b>The ClaimResponse</b><br>
1079   * Type: <b>reference</b><br>
1080   * Path: <b>PaymentNotice.response</b><br>
1081   * </p>
1082   */
1083  @SearchParamDefinition(name="response", path="PaymentNotice.response", description="The ClaimResponse", type="reference" )
1084  public static final String SP_RESPONSE = "response";
1085 /**
1086   * <b>Fluent Client</b> search parameter constant for <b>response</b>
1087   * <p>
1088   * Description: <b>The ClaimResponse</b><br>
1089   * Type: <b>reference</b><br>
1090   * Path: <b>PaymentNotice.response</b><br>
1091   * </p>
1092   */
1093  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RESPONSE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RESPONSE);
1094
1095/**
1096   * Constant for fluent queries to be used to add include statements. Specifies
1097   * the path value of "<b>PaymentNotice:response</b>".
1098   */
1099  public static final ca.uhn.fhir.model.api.Include INCLUDE_RESPONSE = new ca.uhn.fhir.model.api.Include("PaymentNotice:response").toLocked();
1100
1101 /**
1102   * Search parameter: <b>payment-status</b>
1103   * <p>
1104   * Description: <b>The type of payment notice</b><br>
1105   * Type: <b>token</b><br>
1106   * Path: <b>PaymentNotice.paymentStatus</b><br>
1107   * </p>
1108   */
1109  @SearchParamDefinition(name="payment-status", path="PaymentNotice.paymentStatus", description="The type of payment notice", type="token" )
1110  public static final String SP_PAYMENT_STATUS = "payment-status";
1111 /**
1112   * <b>Fluent Client</b> search parameter constant for <b>payment-status</b>
1113   * <p>
1114   * Description: <b>The type of payment notice</b><br>
1115   * Type: <b>token</b><br>
1116   * Path: <b>PaymentNotice.paymentStatus</b><br>
1117   * </p>
1118   */
1119  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PAYMENT_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PAYMENT_STATUS);
1120
1121 /**
1122   * Search parameter: <b>status</b>
1123   * <p>
1124   * Description: <b>The status of the payment notice</b><br>
1125   * Type: <b>token</b><br>
1126   * Path: <b>PaymentNotice.status</b><br>
1127   * </p>
1128   */
1129  @SearchParamDefinition(name="status", path="PaymentNotice.status", description="The status of the payment notice", type="token" )
1130  public static final String SP_STATUS = "status";
1131 /**
1132   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1133   * <p>
1134   * Description: <b>The status of the payment notice</b><br>
1135   * Type: <b>token</b><br>
1136   * Path: <b>PaymentNotice.status</b><br>
1137   * </p>
1138   */
1139  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1140
1141
1142}
1143