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