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