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