001package org.hl7.fhir.dstu3.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 Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
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}, 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 Practitioner providerTarget;
251
252    /**
253     * The organization which is responsible for the services rendered to the patient.
254     */
255    @Child(name = "organization", type = {Organization.class}, order=8, min=0, max=1, modifier=false, summary=false)
256    @Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
257    protected Reference organization;
258
259    /**
260     * The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
261     */
262    protected Organization organizationTarget;
263
264    /**
265     * The payment status, typically paid: payment sent, cleared: payment received.
266     */
267    @Child(name = "paymentStatus", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=false)
268    @Description(shortDefinition="Whether payment has been sent or cleared", formalDefinition="The payment status, typically paid: payment sent, cleared: payment received." )
269    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-status")
270    protected CodeableConcept paymentStatus;
271
272    private static final long serialVersionUID = 37278603L;
273
274  /**
275   * Constructor
276   */
277    public PaymentNotice() {
278      super();
279    }
280
281    /**
282     * @return {@link #identifier} (The notice business identifier.)
283     */
284    public List<Identifier> getIdentifier() { 
285      if (this.identifier == null)
286        this.identifier = new ArrayList<Identifier>();
287      return this.identifier;
288    }
289
290    /**
291     * @return Returns a reference to <code>this</code> for easy method chaining
292     */
293    public PaymentNotice setIdentifier(List<Identifier> theIdentifier) { 
294      this.identifier = theIdentifier;
295      return this;
296    }
297
298    public boolean hasIdentifier() { 
299      if (this.identifier == null)
300        return false;
301      for (Identifier item : this.identifier)
302        if (!item.isEmpty())
303          return true;
304      return false;
305    }
306
307    public Identifier addIdentifier() { //3
308      Identifier t = new Identifier();
309      if (this.identifier == null)
310        this.identifier = new ArrayList<Identifier>();
311      this.identifier.add(t);
312      return t;
313    }
314
315    public PaymentNotice addIdentifier(Identifier t) { //3
316      if (t == null)
317        return this;
318      if (this.identifier == null)
319        this.identifier = new ArrayList<Identifier>();
320      this.identifier.add(t);
321      return this;
322    }
323
324    /**
325     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
326     */
327    public Identifier getIdentifierFirstRep() { 
328      if (getIdentifier().isEmpty()) {
329        addIdentifier();
330      }
331      return getIdentifier().get(0);
332    }
333
334    /**
335     * @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
336     */
337    public Enumeration<PaymentNoticeStatus> getStatusElement() { 
338      if (this.status == null)
339        if (Configuration.errorOnAutoCreate())
340          throw new Error("Attempt to auto-create PaymentNotice.status");
341        else if (Configuration.doAutoCreate())
342          this.status = new Enumeration<PaymentNoticeStatus>(new PaymentNoticeStatusEnumFactory()); // bb
343      return this.status;
344    }
345
346    public boolean hasStatusElement() { 
347      return this.status != null && !this.status.isEmpty();
348    }
349
350    public boolean hasStatus() { 
351      return this.status != null && !this.status.isEmpty();
352    }
353
354    /**
355     * @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
356     */
357    public PaymentNotice setStatusElement(Enumeration<PaymentNoticeStatus> value) { 
358      this.status = value;
359      return this;
360    }
361
362    /**
363     * @return The status of the resource instance.
364     */
365    public PaymentNoticeStatus getStatus() { 
366      return this.status == null ? null : this.status.getValue();
367    }
368
369    /**
370     * @param value The status of the resource instance.
371     */
372    public PaymentNotice setStatus(PaymentNoticeStatus value) { 
373      if (value == null)
374        this.status = null;
375      else {
376        if (this.status == null)
377          this.status = new Enumeration<PaymentNoticeStatus>(new PaymentNoticeStatusEnumFactory());
378        this.status.setValue(value);
379      }
380      return this;
381    }
382
383    /**
384     * @return {@link #request} (Reference of resource for which payment is being made.)
385     */
386    public Reference getRequest() { 
387      if (this.request == null)
388        if (Configuration.errorOnAutoCreate())
389          throw new Error("Attempt to auto-create PaymentNotice.request");
390        else if (Configuration.doAutoCreate())
391          this.request = new Reference(); // cc
392      return this.request;
393    }
394
395    public boolean hasRequest() { 
396      return this.request != null && !this.request.isEmpty();
397    }
398
399    /**
400     * @param value {@link #request} (Reference of resource for which payment is being made.)
401     */
402    public PaymentNotice setRequest(Reference value) { 
403      this.request = value;
404      return this;
405    }
406
407    /**
408     * @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.)
409     */
410    public Resource getRequestTarget() { 
411      return this.requestTarget;
412    }
413
414    /**
415     * @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.)
416     */
417    public PaymentNotice setRequestTarget(Resource value) { 
418      this.requestTarget = value;
419      return this;
420    }
421
422    /**
423     * @return {@link #response} (Reference of response to resource for which payment is being made.)
424     */
425    public Reference getResponse() { 
426      if (this.response == null)
427        if (Configuration.errorOnAutoCreate())
428          throw new Error("Attempt to auto-create PaymentNotice.response");
429        else if (Configuration.doAutoCreate())
430          this.response = new Reference(); // cc
431      return this.response;
432    }
433
434    public boolean hasResponse() { 
435      return this.response != null && !this.response.isEmpty();
436    }
437
438    /**
439     * @param value {@link #response} (Reference of response to resource for which payment is being made.)
440     */
441    public PaymentNotice setResponse(Reference value) { 
442      this.response = value;
443      return this;
444    }
445
446    /**
447     * @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.)
448     */
449    public Resource getResponseTarget() { 
450      return this.responseTarget;
451    }
452
453    /**
454     * @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.)
455     */
456    public PaymentNotice setResponseTarget(Resource value) { 
457      this.responseTarget = value;
458      return this;
459    }
460
461    /**
462     * @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
463     */
464    public DateType getStatusDateElement() { 
465      if (this.statusDate == null)
466        if (Configuration.errorOnAutoCreate())
467          throw new Error("Attempt to auto-create PaymentNotice.statusDate");
468        else if (Configuration.doAutoCreate())
469          this.statusDate = new DateType(); // bb
470      return this.statusDate;
471    }
472
473    public boolean hasStatusDateElement() { 
474      return this.statusDate != null && !this.statusDate.isEmpty();
475    }
476
477    public boolean hasStatusDate() { 
478      return this.statusDate != null && !this.statusDate.isEmpty();
479    }
480
481    /**
482     * @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
483     */
484    public PaymentNotice setStatusDateElement(DateType value) { 
485      this.statusDate = value;
486      return this;
487    }
488
489    /**
490     * @return The date when the above payment action occurrred.
491     */
492    public Date getStatusDate() { 
493      return this.statusDate == null ? null : this.statusDate.getValue();
494    }
495
496    /**
497     * @param value The date when the above payment action occurrred.
498     */
499    public PaymentNotice setStatusDate(Date value) { 
500      if (value == null)
501        this.statusDate = null;
502      else {
503        if (this.statusDate == null)
504          this.statusDate = new DateType();
505        this.statusDate.setValue(value);
506      }
507      return this;
508    }
509
510    /**
511     * @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
512     */
513    public DateTimeType getCreatedElement() { 
514      if (this.created == null)
515        if (Configuration.errorOnAutoCreate())
516          throw new Error("Attempt to auto-create PaymentNotice.created");
517        else if (Configuration.doAutoCreate())
518          this.created = new DateTimeType(); // bb
519      return this.created;
520    }
521
522    public boolean hasCreatedElement() { 
523      return this.created != null && !this.created.isEmpty();
524    }
525
526    public boolean hasCreated() { 
527      return this.created != null && !this.created.isEmpty();
528    }
529
530    /**
531     * @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
532     */
533    public PaymentNotice setCreatedElement(DateTimeType value) { 
534      this.created = value;
535      return this;
536    }
537
538    /**
539     * @return The date when this resource was created.
540     */
541    public Date getCreated() { 
542      return this.created == null ? null : this.created.getValue();
543    }
544
545    /**
546     * @param value The date when this resource was created.
547     */
548    public PaymentNotice setCreated(Date value) { 
549      if (value == null)
550        this.created = null;
551      else {
552        if (this.created == null)
553          this.created = new DateTimeType();
554        this.created.setValue(value);
555      }
556      return this;
557    }
558
559    /**
560     * @return {@link #target} (The Insurer who is target  of the request.)
561     */
562    public Reference getTarget() { 
563      if (this.target == null)
564        if (Configuration.errorOnAutoCreate())
565          throw new Error("Attempt to auto-create PaymentNotice.target");
566        else if (Configuration.doAutoCreate())
567          this.target = new Reference(); // cc
568      return this.target;
569    }
570
571    public boolean hasTarget() { 
572      return this.target != null && !this.target.isEmpty();
573    }
574
575    /**
576     * @param value {@link #target} (The Insurer who is target  of the request.)
577     */
578    public PaymentNotice setTarget(Reference value) { 
579      this.target = value;
580      return this;
581    }
582
583    /**
584     * @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.)
585     */
586    public Organization getTargetTarget() { 
587      if (this.targetTarget == null)
588        if (Configuration.errorOnAutoCreate())
589          throw new Error("Attempt to auto-create PaymentNotice.target");
590        else if (Configuration.doAutoCreate())
591          this.targetTarget = new Organization(); // aa
592      return this.targetTarget;
593    }
594
595    /**
596     * @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.)
597     */
598    public PaymentNotice setTargetTarget(Organization value) { 
599      this.targetTarget = value;
600      return this;
601    }
602
603    /**
604     * @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
605     */
606    public Reference getProvider() { 
607      if (this.provider == null)
608        if (Configuration.errorOnAutoCreate())
609          throw new Error("Attempt to auto-create PaymentNotice.provider");
610        else if (Configuration.doAutoCreate())
611          this.provider = new Reference(); // cc
612      return this.provider;
613    }
614
615    public boolean hasProvider() { 
616      return this.provider != null && !this.provider.isEmpty();
617    }
618
619    /**
620     * @param value {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
621     */
622    public PaymentNotice setProvider(Reference value) { 
623      this.provider = value;
624      return this;
625    }
626
627    /**
628     * @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.)
629     */
630    public Practitioner getProviderTarget() { 
631      if (this.providerTarget == null)
632        if (Configuration.errorOnAutoCreate())
633          throw new Error("Attempt to auto-create PaymentNotice.provider");
634        else if (Configuration.doAutoCreate())
635          this.providerTarget = new Practitioner(); // aa
636      return this.providerTarget;
637    }
638
639    /**
640     * @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.)
641     */
642    public PaymentNotice setProviderTarget(Practitioner value) { 
643      this.providerTarget = value;
644      return this;
645    }
646
647    /**
648     * @return {@link #organization} (The organization which is responsible for the services rendered to the patient.)
649     */
650    public Reference getOrganization() { 
651      if (this.organization == null)
652        if (Configuration.errorOnAutoCreate())
653          throw new Error("Attempt to auto-create PaymentNotice.organization");
654        else if (Configuration.doAutoCreate())
655          this.organization = new Reference(); // cc
656      return this.organization;
657    }
658
659    public boolean hasOrganization() { 
660      return this.organization != null && !this.organization.isEmpty();
661    }
662
663    /**
664     * @param value {@link #organization} (The organization which is responsible for the services rendered to the patient.)
665     */
666    public PaymentNotice setOrganization(Reference value) { 
667      this.organization = value;
668      return this;
669    }
670
671    /**
672     * @return {@link #organization} 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 organization which is responsible for the services rendered to the patient.)
673     */
674    public Organization getOrganizationTarget() { 
675      if (this.organizationTarget == null)
676        if (Configuration.errorOnAutoCreate())
677          throw new Error("Attempt to auto-create PaymentNotice.organization");
678        else if (Configuration.doAutoCreate())
679          this.organizationTarget = new Organization(); // aa
680      return this.organizationTarget;
681    }
682
683    /**
684     * @param value {@link #organization} 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 organization which is responsible for the services rendered to the patient.)
685     */
686    public PaymentNotice setOrganizationTarget(Organization value) { 
687      this.organizationTarget = value;
688      return this;
689    }
690
691    /**
692     * @return {@link #paymentStatus} (The payment status, typically paid: payment sent, cleared: payment received.)
693     */
694    public CodeableConcept getPaymentStatus() { 
695      if (this.paymentStatus == null)
696        if (Configuration.errorOnAutoCreate())
697          throw new Error("Attempt to auto-create PaymentNotice.paymentStatus");
698        else if (Configuration.doAutoCreate())
699          this.paymentStatus = new CodeableConcept(); // cc
700      return this.paymentStatus;
701    }
702
703    public boolean hasPaymentStatus() { 
704      return this.paymentStatus != null && !this.paymentStatus.isEmpty();
705    }
706
707    /**
708     * @param value {@link #paymentStatus} (The payment status, typically paid: payment sent, cleared: payment received.)
709     */
710    public PaymentNotice setPaymentStatus(CodeableConcept value) { 
711      this.paymentStatus = value;
712      return this;
713    }
714
715      protected void listChildren(List<Property> childrenList) {
716        super.listChildren(childrenList);
717        childrenList.add(new Property("identifier", "Identifier", "The notice business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
718        childrenList.add(new Property("status", "code", "The status of the resource instance.", 0, java.lang.Integer.MAX_VALUE, status));
719        childrenList.add(new Property("request", "Reference(Any)", "Reference of resource for which payment is being made.", 0, java.lang.Integer.MAX_VALUE, request));
720        childrenList.add(new Property("response", "Reference(Any)", "Reference of response to resource for which payment is being made.", 0, java.lang.Integer.MAX_VALUE, response));
721        childrenList.add(new Property("statusDate", "date", "The date when the above payment action occurrred.", 0, java.lang.Integer.MAX_VALUE, statusDate));
722        childrenList.add(new Property("created", "dateTime", "The date when this resource was created.", 0, java.lang.Integer.MAX_VALUE, created));
723        childrenList.add(new Property("target", "Reference(Organization)", "The Insurer who is target  of the request.", 0, java.lang.Integer.MAX_VALUE, target));
724        childrenList.add(new Property("provider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, provider));
725        childrenList.add(new Property("organization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, organization));
726        childrenList.add(new Property("paymentStatus", "CodeableConcept", "The payment status, typically paid: payment sent, cleared: payment received.", 0, java.lang.Integer.MAX_VALUE, paymentStatus));
727      }
728
729      @Override
730      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
731        switch (hash) {
732        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
733        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PaymentNoticeStatus>
734        case 1095692943: /*request*/ return this.request == null ? new Base[0] : new Base[] {this.request}; // Reference
735        case -340323263: /*response*/ return this.response == null ? new Base[0] : new Base[] {this.response}; // Reference
736        case 247524032: /*statusDate*/ return this.statusDate == null ? new Base[0] : new Base[] {this.statusDate}; // DateType
737        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
738        case -880905839: /*target*/ return this.target == null ? new Base[0] : new Base[] {this.target}; // Reference
739        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
740        case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : new Base[] {this.organization}; // Reference
741        case 1430704536: /*paymentStatus*/ return this.paymentStatus == null ? new Base[0] : new Base[] {this.paymentStatus}; // CodeableConcept
742        default: return super.getProperty(hash, name, checkValid);
743        }
744
745      }
746
747      @Override
748      public Base setProperty(int hash, String name, Base value) throws FHIRException {
749        switch (hash) {
750        case -1618432855: // identifier
751          this.getIdentifier().add(castToIdentifier(value)); // Identifier
752          return value;
753        case -892481550: // status
754          value = new PaymentNoticeStatusEnumFactory().fromType(castToCode(value));
755          this.status = (Enumeration) value; // Enumeration<PaymentNoticeStatus>
756          return value;
757        case 1095692943: // request
758          this.request = castToReference(value); // Reference
759          return value;
760        case -340323263: // response
761          this.response = castToReference(value); // Reference
762          return value;
763        case 247524032: // statusDate
764          this.statusDate = castToDate(value); // DateType
765          return value;
766        case 1028554472: // created
767          this.created = castToDateTime(value); // DateTimeType
768          return value;
769        case -880905839: // target
770          this.target = castToReference(value); // Reference
771          return value;
772        case -987494927: // provider
773          this.provider = castToReference(value); // Reference
774          return value;
775        case 1178922291: // organization
776          this.organization = castToReference(value); // Reference
777          return value;
778        case 1430704536: // paymentStatus
779          this.paymentStatus = castToCodeableConcept(value); // CodeableConcept
780          return value;
781        default: return super.setProperty(hash, name, value);
782        }
783
784      }
785
786      @Override
787      public Base setProperty(String name, Base value) throws FHIRException {
788        if (name.equals("identifier")) {
789          this.getIdentifier().add(castToIdentifier(value));
790        } else if (name.equals("status")) {
791          value = new PaymentNoticeStatusEnumFactory().fromType(castToCode(value));
792          this.status = (Enumeration) value; // Enumeration<PaymentNoticeStatus>
793        } else if (name.equals("request")) {
794          this.request = castToReference(value); // Reference
795        } else if (name.equals("response")) {
796          this.response = castToReference(value); // Reference
797        } else if (name.equals("statusDate")) {
798          this.statusDate = castToDate(value); // DateType
799        } else if (name.equals("created")) {
800          this.created = castToDateTime(value); // DateTimeType
801        } else if (name.equals("target")) {
802          this.target = castToReference(value); // Reference
803        } else if (name.equals("provider")) {
804          this.provider = castToReference(value); // Reference
805        } else if (name.equals("organization")) {
806          this.organization = castToReference(value); // Reference
807        } else if (name.equals("paymentStatus")) {
808          this.paymentStatus = castToCodeableConcept(value); // CodeableConcept
809        } else
810          return super.setProperty(name, value);
811        return value;
812      }
813
814      @Override
815      public Base makeProperty(int hash, String name) throws FHIRException {
816        switch (hash) {
817        case -1618432855:  return addIdentifier(); 
818        case -892481550:  return getStatusElement();
819        case 1095692943:  return getRequest(); 
820        case -340323263:  return getResponse(); 
821        case 247524032:  return getStatusDateElement();
822        case 1028554472:  return getCreatedElement();
823        case -880905839:  return getTarget(); 
824        case -987494927:  return getProvider(); 
825        case 1178922291:  return getOrganization(); 
826        case 1430704536:  return getPaymentStatus(); 
827        default: return super.makeProperty(hash, name);
828        }
829
830      }
831
832      @Override
833      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
834        switch (hash) {
835        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
836        case -892481550: /*status*/ return new String[] {"code"};
837        case 1095692943: /*request*/ return new String[] {"Reference"};
838        case -340323263: /*response*/ return new String[] {"Reference"};
839        case 247524032: /*statusDate*/ return new String[] {"date"};
840        case 1028554472: /*created*/ return new String[] {"dateTime"};
841        case -880905839: /*target*/ return new String[] {"Reference"};
842        case -987494927: /*provider*/ return new String[] {"Reference"};
843        case 1178922291: /*organization*/ return new String[] {"Reference"};
844        case 1430704536: /*paymentStatus*/ return new String[] {"CodeableConcept"};
845        default: return super.getTypesForProperty(hash, name);
846        }
847
848      }
849
850      @Override
851      public Base addChild(String name) throws FHIRException {
852        if (name.equals("identifier")) {
853          return addIdentifier();
854        }
855        else if (name.equals("status")) {
856          throw new FHIRException("Cannot call addChild on a primitive type PaymentNotice.status");
857        }
858        else if (name.equals("request")) {
859          this.request = new Reference();
860          return this.request;
861        }
862        else if (name.equals("response")) {
863          this.response = new Reference();
864          return this.response;
865        }
866        else if (name.equals("statusDate")) {
867          throw new FHIRException("Cannot call addChild on a primitive type PaymentNotice.statusDate");
868        }
869        else if (name.equals("created")) {
870          throw new FHIRException("Cannot call addChild on a primitive type PaymentNotice.created");
871        }
872        else if (name.equals("target")) {
873          this.target = new Reference();
874          return this.target;
875        }
876        else if (name.equals("provider")) {
877          this.provider = new Reference();
878          return this.provider;
879        }
880        else if (name.equals("organization")) {
881          this.organization = new Reference();
882          return this.organization;
883        }
884        else if (name.equals("paymentStatus")) {
885          this.paymentStatus = new CodeableConcept();
886          return this.paymentStatus;
887        }
888        else
889          return super.addChild(name);
890      }
891
892  public String fhirType() {
893    return "PaymentNotice";
894
895  }
896
897      public PaymentNotice copy() {
898        PaymentNotice dst = new PaymentNotice();
899        copyValues(dst);
900        if (identifier != null) {
901          dst.identifier = new ArrayList<Identifier>();
902          for (Identifier i : identifier)
903            dst.identifier.add(i.copy());
904        };
905        dst.status = status == null ? null : status.copy();
906        dst.request = request == null ? null : request.copy();
907        dst.response = response == null ? null : response.copy();
908        dst.statusDate = statusDate == null ? null : statusDate.copy();
909        dst.created = created == null ? null : created.copy();
910        dst.target = target == null ? null : target.copy();
911        dst.provider = provider == null ? null : provider.copy();
912        dst.organization = organization == null ? null : organization.copy();
913        dst.paymentStatus = paymentStatus == null ? null : paymentStatus.copy();
914        return dst;
915      }
916
917      protected PaymentNotice typedCopy() {
918        return copy();
919      }
920
921      @Override
922      public boolean equalsDeep(Base other) {
923        if (!super.equalsDeep(other))
924          return false;
925        if (!(other instanceof PaymentNotice))
926          return false;
927        PaymentNotice o = (PaymentNotice) other;
928        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(request, o.request, true)
929           && compareDeep(response, o.response, true) && compareDeep(statusDate, o.statusDate, true) && compareDeep(created, o.created, true)
930           && compareDeep(target, o.target, true) && compareDeep(provider, o.provider, true) && compareDeep(organization, o.organization, true)
931           && compareDeep(paymentStatus, o.paymentStatus, true);
932      }
933
934      @Override
935      public boolean equalsShallow(Base other) {
936        if (!super.equalsShallow(other))
937          return false;
938        if (!(other instanceof PaymentNotice))
939          return false;
940        PaymentNotice o = (PaymentNotice) other;
941        return compareValues(status, o.status, true) && compareValues(statusDate, o.statusDate, true) && compareValues(created, o.created, true)
942          ;
943      }
944
945      public boolean isEmpty() {
946        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, request
947          , response, statusDate, created, target, provider, organization, paymentStatus
948          );
949      }
950
951  @Override
952  public ResourceType getResourceType() {
953    return ResourceType.PaymentNotice;
954   }
955
956 /**
957   * Search parameter: <b>identifier</b>
958   * <p>
959   * Description: <b>The business identifier of the notice</b><br>
960   * Type: <b>token</b><br>
961   * Path: <b>PaymentNotice.identifier</b><br>
962   * </p>
963   */
964  @SearchParamDefinition(name="identifier", path="PaymentNotice.identifier", description="The business identifier of the notice", type="token" )
965  public static final String SP_IDENTIFIER = "identifier";
966 /**
967   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
968   * <p>
969   * Description: <b>The business identifier of the notice</b><br>
970   * Type: <b>token</b><br>
971   * Path: <b>PaymentNotice.identifier</b><br>
972   * </p>
973   */
974  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
975
976 /**
977   * Search parameter: <b>request</b>
978   * <p>
979   * Description: <b>The Claim</b><br>
980   * Type: <b>reference</b><br>
981   * Path: <b>PaymentNotice.request</b><br>
982   * </p>
983   */
984  @SearchParamDefinition(name="request", path="PaymentNotice.request", description="The Claim", type="reference" )
985  public static final String SP_REQUEST = "request";
986 /**
987   * <b>Fluent Client</b> search parameter constant for <b>request</b>
988   * <p>
989   * Description: <b>The Claim</b><br>
990   * Type: <b>reference</b><br>
991   * Path: <b>PaymentNotice.request</b><br>
992   * </p>
993   */
994  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST);
995
996/**
997   * Constant for fluent queries to be used to add include statements. Specifies
998   * the path value of "<b>PaymentNotice:request</b>".
999   */
1000  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST = new ca.uhn.fhir.model.api.Include("PaymentNotice:request").toLocked();
1001
1002 /**
1003   * Search parameter: <b>provider</b>
1004   * <p>
1005   * Description: <b>The reference to the provider</b><br>
1006   * Type: <b>reference</b><br>
1007   * Path: <b>PaymentNotice.provider</b><br>
1008   * </p>
1009   */
1010  @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={Practitioner.class } )
1011  public static final String SP_PROVIDER = "provider";
1012 /**
1013   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
1014   * <p>
1015   * Description: <b>The reference to the provider</b><br>
1016   * Type: <b>reference</b><br>
1017   * Path: <b>PaymentNotice.provider</b><br>
1018   * </p>
1019   */
1020  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
1021
1022/**
1023   * Constant for fluent queries to be used to add include statements. Specifies
1024   * the path value of "<b>PaymentNotice:provider</b>".
1025   */
1026  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("PaymentNotice:provider").toLocked();
1027
1028 /**
1029   * Search parameter: <b>created</b>
1030   * <p>
1031   * Description: <b>Creation date fro the notice</b><br>
1032   * Type: <b>date</b><br>
1033   * Path: <b>PaymentNotice.created</b><br>
1034   * </p>
1035   */
1036  @SearchParamDefinition(name="created", path="PaymentNotice.created", description="Creation date fro the notice", type="date" )
1037  public static final String SP_CREATED = "created";
1038 /**
1039   * <b>Fluent Client</b> search parameter constant for <b>created</b>
1040   * <p>
1041   * Description: <b>Creation date fro the notice</b><br>
1042   * Type: <b>date</b><br>
1043   * Path: <b>PaymentNotice.created</b><br>
1044   * </p>
1045   */
1046  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
1047
1048 /**
1049   * Search parameter: <b>response</b>
1050   * <p>
1051   * Description: <b>The ClaimResponse</b><br>
1052   * Type: <b>reference</b><br>
1053   * Path: <b>PaymentNotice.response</b><br>
1054   * </p>
1055   */
1056  @SearchParamDefinition(name="response", path="PaymentNotice.response", description="The ClaimResponse", type="reference" )
1057  public static final String SP_RESPONSE = "response";
1058 /**
1059   * <b>Fluent Client</b> search parameter constant for <b>response</b>
1060   * <p>
1061   * Description: <b>The ClaimResponse</b><br>
1062   * Type: <b>reference</b><br>
1063   * Path: <b>PaymentNotice.response</b><br>
1064   * </p>
1065   */
1066  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RESPONSE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RESPONSE);
1067
1068/**
1069   * Constant for fluent queries to be used to add include statements. Specifies
1070   * the path value of "<b>PaymentNotice:response</b>".
1071   */
1072  public static final ca.uhn.fhir.model.api.Include INCLUDE_RESPONSE = new ca.uhn.fhir.model.api.Include("PaymentNotice:response").toLocked();
1073
1074 /**
1075   * Search parameter: <b>organization</b>
1076   * <p>
1077   * Description: <b>The organization who generated this resource</b><br>
1078   * Type: <b>reference</b><br>
1079   * Path: <b>PaymentNotice.organization</b><br>
1080   * </p>
1081   */
1082  @SearchParamDefinition(name="organization", path="PaymentNotice.organization", description="The organization who generated this resource", type="reference", target={Organization.class } )
1083  public static final String SP_ORGANIZATION = "organization";
1084 /**
1085   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
1086   * <p>
1087   * Description: <b>The organization who generated this resource</b><br>
1088   * Type: <b>reference</b><br>
1089   * Path: <b>PaymentNotice.organization</b><br>
1090   * </p>
1091   */
1092  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
1093
1094/**
1095   * Constant for fluent queries to be used to add include statements. Specifies
1096   * the path value of "<b>PaymentNotice:organization</b>".
1097   */
1098  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("PaymentNotice:organization").toLocked();
1099
1100 /**
1101   * Search parameter: <b>payment-status</b>
1102   * <p>
1103   * Description: <b>The type of payment notice</b><br>
1104   * Type: <b>token</b><br>
1105   * Path: <b>PaymentNotice.paymentStatus</b><br>
1106   * </p>
1107   */
1108  @SearchParamDefinition(name="payment-status", path="PaymentNotice.paymentStatus", description="The type of payment notice", type="token" )
1109  public static final String SP_PAYMENT_STATUS = "payment-status";
1110 /**
1111   * <b>Fluent Client</b> search parameter constant for <b>payment-status</b>
1112   * <p>
1113   * Description: <b>The type of payment notice</b><br>
1114   * Type: <b>token</b><br>
1115   * Path: <b>PaymentNotice.paymentStatus</b><br>
1116   * </p>
1117   */
1118  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PAYMENT_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PAYMENT_STATUS);
1119
1120 /**
1121   * Search parameter: <b>statusdate</b>
1122   * <p>
1123   * Description: <b>The date of the payment action</b><br>
1124   * Type: <b>date</b><br>
1125   * Path: <b>PaymentNotice.statusDate</b><br>
1126   * </p>
1127   */
1128  @SearchParamDefinition(name="statusdate", path="PaymentNotice.statusDate", description="The date of the payment action", type="date" )
1129  public static final String SP_STATUSDATE = "statusdate";
1130 /**
1131   * <b>Fluent Client</b> search parameter constant for <b>statusdate</b>
1132   * <p>
1133   * Description: <b>The date of the payment action</b><br>
1134   * Type: <b>date</b><br>
1135   * Path: <b>PaymentNotice.statusDate</b><br>
1136   * </p>
1137   */
1138  public static final ca.uhn.fhir.rest.gclient.DateClientParam STATUSDATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_STATUSDATE);
1139
1140
1141}
1142