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