001package org.hl7.fhir.dstu3.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
035import java.util.ArrayList;
036import java.util.Date;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.exceptions.FHIRFormatError;
041import org.hl7.fhir.utilities.Utilities;
042
043import ca.uhn.fhir.model.api.annotation.Child;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.ResourceDef;
046import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
047/**
048 * The EligibilityRequest provides patient and insurance coverage information to an insurer for them to respond, in the form of an EligibilityResponse, with information regarding whether the stated coverage is valid and in-force and optionally to provide the insurance details of the policy.
049 */
050@ResourceDef(name="EligibilityRequest", profile="http://hl7.org/fhir/Profile/EligibilityRequest")
051public class EligibilityRequest extends DomainResource {
052
053    public enum EligibilityRequestStatus {
054        /**
055         * The instance is currently in-force.
056         */
057        ACTIVE, 
058        /**
059         * The instance is withdrawn, rescinded or reversed.
060         */
061        CANCELLED, 
062        /**
063         * A new instance the contents of which is not complete.
064         */
065        DRAFT, 
066        /**
067         * The instance was entered in error.
068         */
069        ENTEREDINERROR, 
070        /**
071         * added to help the parsers with the generic types
072         */
073        NULL;
074        public static EligibilityRequestStatus fromCode(String codeString) throws FHIRException {
075            if (codeString == null || "".equals(codeString))
076                return null;
077        if ("active".equals(codeString))
078          return ACTIVE;
079        if ("cancelled".equals(codeString))
080          return CANCELLED;
081        if ("draft".equals(codeString))
082          return DRAFT;
083        if ("entered-in-error".equals(codeString))
084          return ENTEREDINERROR;
085        if (Configuration.isAcceptInvalidEnums())
086          return null;
087        else
088          throw new FHIRException("Unknown EligibilityRequestStatus code '"+codeString+"'");
089        }
090        public String toCode() {
091          switch (this) {
092            case ACTIVE: return "active";
093            case CANCELLED: return "cancelled";
094            case DRAFT: return "draft";
095            case ENTEREDINERROR: return "entered-in-error";
096            case NULL: return null;
097            default: return "?";
098          }
099        }
100        public String getSystem() {
101          switch (this) {
102            case ACTIVE: return "http://hl7.org/fhir/fm-status";
103            case CANCELLED: return "http://hl7.org/fhir/fm-status";
104            case DRAFT: return "http://hl7.org/fhir/fm-status";
105            case ENTEREDINERROR: return "http://hl7.org/fhir/fm-status";
106            case NULL: return null;
107            default: return "?";
108          }
109        }
110        public String getDefinition() {
111          switch (this) {
112            case ACTIVE: return "The instance is currently in-force.";
113            case CANCELLED: return "The instance is withdrawn, rescinded or reversed.";
114            case DRAFT: return "A new instance the contents of which is not complete.";
115            case ENTEREDINERROR: return "The instance was entered in error.";
116            case NULL: return null;
117            default: return "?";
118          }
119        }
120        public String getDisplay() {
121          switch (this) {
122            case ACTIVE: return "Active";
123            case CANCELLED: return "Cancelled";
124            case DRAFT: return "Draft";
125            case ENTEREDINERROR: return "Entered in Error";
126            case NULL: return null;
127            default: return "?";
128          }
129        }
130    }
131
132  public static class EligibilityRequestStatusEnumFactory implements EnumFactory<EligibilityRequestStatus> {
133    public EligibilityRequestStatus fromCode(String codeString) throws IllegalArgumentException {
134      if (codeString == null || "".equals(codeString))
135            if (codeString == null || "".equals(codeString))
136                return null;
137        if ("active".equals(codeString))
138          return EligibilityRequestStatus.ACTIVE;
139        if ("cancelled".equals(codeString))
140          return EligibilityRequestStatus.CANCELLED;
141        if ("draft".equals(codeString))
142          return EligibilityRequestStatus.DRAFT;
143        if ("entered-in-error".equals(codeString))
144          return EligibilityRequestStatus.ENTEREDINERROR;
145        throw new IllegalArgumentException("Unknown EligibilityRequestStatus code '"+codeString+"'");
146        }
147        public Enumeration<EligibilityRequestStatus> fromType(PrimitiveType<?> code) throws FHIRException {
148          if (code == null)
149            return null;
150          if (code.isEmpty())
151            return new Enumeration<EligibilityRequestStatus>(this);
152          String codeString = code.asStringValue();
153          if (codeString == null || "".equals(codeString))
154            return null;
155        if ("active".equals(codeString))
156          return new Enumeration<EligibilityRequestStatus>(this, EligibilityRequestStatus.ACTIVE);
157        if ("cancelled".equals(codeString))
158          return new Enumeration<EligibilityRequestStatus>(this, EligibilityRequestStatus.CANCELLED);
159        if ("draft".equals(codeString))
160          return new Enumeration<EligibilityRequestStatus>(this, EligibilityRequestStatus.DRAFT);
161        if ("entered-in-error".equals(codeString))
162          return new Enumeration<EligibilityRequestStatus>(this, EligibilityRequestStatus.ENTEREDINERROR);
163        throw new FHIRException("Unknown EligibilityRequestStatus code '"+codeString+"'");
164        }
165    public String toCode(EligibilityRequestStatus code) {
166      if (code == EligibilityRequestStatus.ACTIVE)
167        return "active";
168      if (code == EligibilityRequestStatus.CANCELLED)
169        return "cancelled";
170      if (code == EligibilityRequestStatus.DRAFT)
171        return "draft";
172      if (code == EligibilityRequestStatus.ENTEREDINERROR)
173        return "entered-in-error";
174      return "?";
175      }
176    public String toSystem(EligibilityRequestStatus code) {
177      return code.getSystem();
178      }
179    }
180
181    /**
182     * The Response business identifier.
183     */
184    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
185    @Description(shortDefinition="Business Identifier", formalDefinition="The Response business identifier." )
186    protected List<Identifier> identifier;
187
188    /**
189     * The status of the resource instance.
190     */
191    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
192    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
193    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fm-status")
194    protected Enumeration<EligibilityRequestStatus> status;
195
196    /**
197     * Immediate (STAT), best effort (NORMAL), deferred (DEFER).
198     */
199    @Child(name = "priority", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
200    @Description(shortDefinition="Desired processing priority", formalDefinition="Immediate (STAT), best effort (NORMAL), deferred (DEFER)." )
201    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/process-priority")
202    protected CodeableConcept priority;
203
204    /**
205     * Patient Resource.
206     */
207    @Child(name = "patient", type = {Patient.class}, order=3, min=0, max=1, modifier=false, summary=false)
208    @Description(shortDefinition="The subject of the Products and Services", formalDefinition="Patient Resource." )
209    protected Reference patient;
210
211    /**
212     * The actual object that is the target of the reference (Patient Resource.)
213     */
214    protected Patient patientTarget;
215
216    /**
217     * The date or dates when the enclosed suite of services were performed or completed.
218     */
219    @Child(name = "serviced", type = {DateType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
220    @Description(shortDefinition="Estimated date or dates of Service", formalDefinition="The date or dates when the enclosed suite of services were performed or completed." )
221    protected Type serviced;
222
223    /**
224     * The date when this resource was created.
225     */
226    @Child(name = "created", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=false)
227    @Description(shortDefinition="Creation date", formalDefinition="The date when this resource was created." )
228    protected DateTimeType created;
229
230    /**
231     * Person who created the invoice/claim/pre-determination or pre-authorization.
232     */
233    @Child(name = "enterer", type = {Practitioner.class}, order=6, min=0, max=1, modifier=false, summary=false)
234    @Description(shortDefinition="Author", formalDefinition="Person who created the invoice/claim/pre-determination or pre-authorization." )
235    protected Reference enterer;
236
237    /**
238     * The actual object that is the target of the reference (Person who created the invoice/claim/pre-determination or pre-authorization.)
239     */
240    protected Practitioner entererTarget;
241
242    /**
243     * The practitioner who is responsible for the services rendered to the patient.
244     */
245    @Child(name = "provider", type = {Practitioner.class}, order=7, min=0, max=1, modifier=false, summary=false)
246    @Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
247    protected Reference provider;
248
249    /**
250     * The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
251     */
252    protected Practitioner providerTarget;
253
254    /**
255     * The organization which is responsible for the services rendered to the patient.
256     */
257    @Child(name = "organization", type = {Organization.class}, order=8, min=0, max=1, modifier=false, summary=false)
258    @Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
259    protected Reference organization;
260
261    /**
262     * The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
263     */
264    protected Organization organizationTarget;
265
266    /**
267     * The Insurer who is target  of the request.
268     */
269    @Child(name = "insurer", type = {Organization.class}, order=9, min=0, max=1, modifier=false, summary=false)
270    @Description(shortDefinition="Target", formalDefinition="The Insurer who is target  of the request." )
271    protected Reference insurer;
272
273    /**
274     * The actual object that is the target of the reference (The Insurer who is target  of the request.)
275     */
276    protected Organization insurerTarget;
277
278    /**
279     * Facility where the services were provided.
280     */
281    @Child(name = "facility", type = {Location.class}, order=10, min=0, max=1, modifier=false, summary=false)
282    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
283    protected Reference facility;
284
285    /**
286     * The actual object that is the target of the reference (Facility where the services were provided.)
287     */
288    protected Location facilityTarget;
289
290    /**
291     * Financial instrument by which payment information for health care.
292     */
293    @Child(name = "coverage", type = {Coverage.class}, order=11, min=0, max=1, modifier=false, summary=false)
294    @Description(shortDefinition="Insurance or medical plan", formalDefinition="Financial instrument by which payment information for health care." )
295    protected Reference coverage;
296
297    /**
298     * The actual object that is the target of the reference (Financial instrument by which payment information for health care.)
299     */
300    protected Coverage coverageTarget;
301
302    /**
303     * The contract number of a business agreement which describes the terms and conditions.
304     */
305    @Child(name = "businessArrangement", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=false)
306    @Description(shortDefinition="Business agreement", formalDefinition="The contract number of a business agreement which describes the terms and conditions." )
307    protected StringType businessArrangement;
308
309    /**
310     * Dental, Vision, Medical, Pharmacy, Rehab etc.
311     */
312    @Child(name = "benefitCategory", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
313    @Description(shortDefinition="Type of services covered", formalDefinition="Dental, Vision, Medical, Pharmacy, Rehab etc." )
314    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-category")
315    protected CodeableConcept benefitCategory;
316
317    /**
318     * Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.
319     */
320    @Child(name = "benefitSubCategory", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false)
321    @Description(shortDefinition="Detailed services covered within the type", formalDefinition="Dental: basic, major, ortho; Vision exam, glasses, contacts; etc." )
322    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
323    protected CodeableConcept benefitSubCategory;
324
325    private static final long serialVersionUID = 899259023L;
326
327  /**
328   * Constructor
329   */
330    public EligibilityRequest() {
331      super();
332    }
333
334    /**
335     * @return {@link #identifier} (The Response business identifier.)
336     */
337    public List<Identifier> getIdentifier() { 
338      if (this.identifier == null)
339        this.identifier = new ArrayList<Identifier>();
340      return this.identifier;
341    }
342
343    /**
344     * @return Returns a reference to <code>this</code> for easy method chaining
345     */
346    public EligibilityRequest setIdentifier(List<Identifier> theIdentifier) { 
347      this.identifier = theIdentifier;
348      return this;
349    }
350
351    public boolean hasIdentifier() { 
352      if (this.identifier == null)
353        return false;
354      for (Identifier item : this.identifier)
355        if (!item.isEmpty())
356          return true;
357      return false;
358    }
359
360    public Identifier addIdentifier() { //3
361      Identifier t = new Identifier();
362      if (this.identifier == null)
363        this.identifier = new ArrayList<Identifier>();
364      this.identifier.add(t);
365      return t;
366    }
367
368    public EligibilityRequest addIdentifier(Identifier t) { //3
369      if (t == null)
370        return this;
371      if (this.identifier == null)
372        this.identifier = new ArrayList<Identifier>();
373      this.identifier.add(t);
374      return this;
375    }
376
377    /**
378     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
379     */
380    public Identifier getIdentifierFirstRep() { 
381      if (getIdentifier().isEmpty()) {
382        addIdentifier();
383      }
384      return getIdentifier().get(0);
385    }
386
387    /**
388     * @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
389     */
390    public Enumeration<EligibilityRequestStatus> getStatusElement() { 
391      if (this.status == null)
392        if (Configuration.errorOnAutoCreate())
393          throw new Error("Attempt to auto-create EligibilityRequest.status");
394        else if (Configuration.doAutoCreate())
395          this.status = new Enumeration<EligibilityRequestStatus>(new EligibilityRequestStatusEnumFactory()); // bb
396      return this.status;
397    }
398
399    public boolean hasStatusElement() { 
400      return this.status != null && !this.status.isEmpty();
401    }
402
403    public boolean hasStatus() { 
404      return this.status != null && !this.status.isEmpty();
405    }
406
407    /**
408     * @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
409     */
410    public EligibilityRequest setStatusElement(Enumeration<EligibilityRequestStatus> value) { 
411      this.status = value;
412      return this;
413    }
414
415    /**
416     * @return The status of the resource instance.
417     */
418    public EligibilityRequestStatus getStatus() { 
419      return this.status == null ? null : this.status.getValue();
420    }
421
422    /**
423     * @param value The status of the resource instance.
424     */
425    public EligibilityRequest setStatus(EligibilityRequestStatus value) { 
426      if (value == null)
427        this.status = null;
428      else {
429        if (this.status == null)
430          this.status = new Enumeration<EligibilityRequestStatus>(new EligibilityRequestStatusEnumFactory());
431        this.status.setValue(value);
432      }
433      return this;
434    }
435
436    /**
437     * @return {@link #priority} (Immediate (STAT), best effort (NORMAL), deferred (DEFER).)
438     */
439    public CodeableConcept getPriority() { 
440      if (this.priority == null)
441        if (Configuration.errorOnAutoCreate())
442          throw new Error("Attempt to auto-create EligibilityRequest.priority");
443        else if (Configuration.doAutoCreate())
444          this.priority = new CodeableConcept(); // cc
445      return this.priority;
446    }
447
448    public boolean hasPriority() { 
449      return this.priority != null && !this.priority.isEmpty();
450    }
451
452    /**
453     * @param value {@link #priority} (Immediate (STAT), best effort (NORMAL), deferred (DEFER).)
454     */
455    public EligibilityRequest setPriority(CodeableConcept value)  { 
456      this.priority = value;
457      return this;
458    }
459
460    /**
461     * @return {@link #patient} (Patient Resource.)
462     */
463    public Reference getPatient() { 
464      if (this.patient == null)
465        if (Configuration.errorOnAutoCreate())
466          throw new Error("Attempt to auto-create EligibilityRequest.patient");
467        else if (Configuration.doAutoCreate())
468          this.patient = new Reference(); // cc
469      return this.patient;
470    }
471
472    public boolean hasPatient() { 
473      return this.patient != null && !this.patient.isEmpty();
474    }
475
476    /**
477     * @param value {@link #patient} (Patient Resource.)
478     */
479    public EligibilityRequest setPatient(Reference value)  { 
480      this.patient = value;
481      return this;
482    }
483
484    /**
485     * @return {@link #patient} 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. (Patient Resource.)
486     */
487    public Patient getPatientTarget() { 
488      if (this.patientTarget == null)
489        if (Configuration.errorOnAutoCreate())
490          throw new Error("Attempt to auto-create EligibilityRequest.patient");
491        else if (Configuration.doAutoCreate())
492          this.patientTarget = new Patient(); // aa
493      return this.patientTarget;
494    }
495
496    /**
497     * @param value {@link #patient} 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. (Patient Resource.)
498     */
499    public EligibilityRequest setPatientTarget(Patient value) { 
500      this.patientTarget = value;
501      return this;
502    }
503
504    /**
505     * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
506     */
507    public Type getServiced() { 
508      return this.serviced;
509    }
510
511    /**
512     * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
513     */
514    public DateType getServicedDateType() throws FHIRException { 
515      if (this.serviced == null)
516        return null;
517      if (!(this.serviced instanceof DateType))
518        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
519      return (DateType) this.serviced;
520    }
521
522    public boolean hasServicedDateType() { 
523      return this != null && this.serviced instanceof DateType;
524    }
525
526    /**
527     * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
528     */
529    public Period getServicedPeriod() throws FHIRException { 
530      if (this.serviced == null)
531        return null;
532      if (!(this.serviced instanceof Period))
533        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
534      return (Period) this.serviced;
535    }
536
537    public boolean hasServicedPeriod() { 
538      return this != null && this.serviced instanceof Period;
539    }
540
541    public boolean hasServiced() { 
542      return this.serviced != null && !this.serviced.isEmpty();
543    }
544
545    /**
546     * @param value {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
547     */
548    public EligibilityRequest setServiced(Type value) throws FHIRFormatError { 
549      if (value != null && !(value instanceof DateType || value instanceof Period))
550        throw new FHIRFormatError("Not the right type for EligibilityRequest.serviced[x]: "+value.fhirType());
551      this.serviced = value;
552      return this;
553    }
554
555    /**
556     * @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
557     */
558    public DateTimeType getCreatedElement() { 
559      if (this.created == null)
560        if (Configuration.errorOnAutoCreate())
561          throw new Error("Attempt to auto-create EligibilityRequest.created");
562        else if (Configuration.doAutoCreate())
563          this.created = new DateTimeType(); // bb
564      return this.created;
565    }
566
567    public boolean hasCreatedElement() { 
568      return this.created != null && !this.created.isEmpty();
569    }
570
571    public boolean hasCreated() { 
572      return this.created != null && !this.created.isEmpty();
573    }
574
575    /**
576     * @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
577     */
578    public EligibilityRequest setCreatedElement(DateTimeType value) { 
579      this.created = value;
580      return this;
581    }
582
583    /**
584     * @return The date when this resource was created.
585     */
586    public Date getCreated() { 
587      return this.created == null ? null : this.created.getValue();
588    }
589
590    /**
591     * @param value The date when this resource was created.
592     */
593    public EligibilityRequest setCreated(Date value) { 
594      if (value == null)
595        this.created = null;
596      else {
597        if (this.created == null)
598          this.created = new DateTimeType();
599        this.created.setValue(value);
600      }
601      return this;
602    }
603
604    /**
605     * @return {@link #enterer} (Person who created the invoice/claim/pre-determination or pre-authorization.)
606     */
607    public Reference getEnterer() { 
608      if (this.enterer == null)
609        if (Configuration.errorOnAutoCreate())
610          throw new Error("Attempt to auto-create EligibilityRequest.enterer");
611        else if (Configuration.doAutoCreate())
612          this.enterer = new Reference(); // cc
613      return this.enterer;
614    }
615
616    public boolean hasEnterer() { 
617      return this.enterer != null && !this.enterer.isEmpty();
618    }
619
620    /**
621     * @param value {@link #enterer} (Person who created the invoice/claim/pre-determination or pre-authorization.)
622     */
623    public EligibilityRequest setEnterer(Reference value)  { 
624      this.enterer = value;
625      return this;
626    }
627
628    /**
629     * @return {@link #enterer} 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. (Person who created the invoice/claim/pre-determination or pre-authorization.)
630     */
631    public Practitioner getEntererTarget() { 
632      if (this.entererTarget == null)
633        if (Configuration.errorOnAutoCreate())
634          throw new Error("Attempt to auto-create EligibilityRequest.enterer");
635        else if (Configuration.doAutoCreate())
636          this.entererTarget = new Practitioner(); // aa
637      return this.entererTarget;
638    }
639
640    /**
641     * @param value {@link #enterer} 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. (Person who created the invoice/claim/pre-determination or pre-authorization.)
642     */
643    public EligibilityRequest setEntererTarget(Practitioner value) { 
644      this.entererTarget = value;
645      return this;
646    }
647
648    /**
649     * @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
650     */
651    public Reference getProvider() { 
652      if (this.provider == null)
653        if (Configuration.errorOnAutoCreate())
654          throw new Error("Attempt to auto-create EligibilityRequest.provider");
655        else if (Configuration.doAutoCreate())
656          this.provider = new Reference(); // cc
657      return this.provider;
658    }
659
660    public boolean hasProvider() { 
661      return this.provider != null && !this.provider.isEmpty();
662    }
663
664    /**
665     * @param value {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
666     */
667    public EligibilityRequest setProvider(Reference value)  { 
668      this.provider = value;
669      return this;
670    }
671
672    /**
673     * @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.)
674     */
675    public Practitioner getProviderTarget() { 
676      if (this.providerTarget == null)
677        if (Configuration.errorOnAutoCreate())
678          throw new Error("Attempt to auto-create EligibilityRequest.provider");
679        else if (Configuration.doAutoCreate())
680          this.providerTarget = new Practitioner(); // aa
681      return this.providerTarget;
682    }
683
684    /**
685     * @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.)
686     */
687    public EligibilityRequest setProviderTarget(Practitioner value) { 
688      this.providerTarget = value;
689      return this;
690    }
691
692    /**
693     * @return {@link #organization} (The organization which is responsible for the services rendered to the patient.)
694     */
695    public Reference getOrganization() { 
696      if (this.organization == null)
697        if (Configuration.errorOnAutoCreate())
698          throw new Error("Attempt to auto-create EligibilityRequest.organization");
699        else if (Configuration.doAutoCreate())
700          this.organization = new Reference(); // cc
701      return this.organization;
702    }
703
704    public boolean hasOrganization() { 
705      return this.organization != null && !this.organization.isEmpty();
706    }
707
708    /**
709     * @param value {@link #organization} (The organization which is responsible for the services rendered to the patient.)
710     */
711    public EligibilityRequest setOrganization(Reference value)  { 
712      this.organization = value;
713      return this;
714    }
715
716    /**
717     * @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.)
718     */
719    public Organization getOrganizationTarget() { 
720      if (this.organizationTarget == null)
721        if (Configuration.errorOnAutoCreate())
722          throw new Error("Attempt to auto-create EligibilityRequest.organization");
723        else if (Configuration.doAutoCreate())
724          this.organizationTarget = new Organization(); // aa
725      return this.organizationTarget;
726    }
727
728    /**
729     * @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.)
730     */
731    public EligibilityRequest setOrganizationTarget(Organization value) { 
732      this.organizationTarget = value;
733      return this;
734    }
735
736    /**
737     * @return {@link #insurer} (The Insurer who is target  of the request.)
738     */
739    public Reference getInsurer() { 
740      if (this.insurer == null)
741        if (Configuration.errorOnAutoCreate())
742          throw new Error("Attempt to auto-create EligibilityRequest.insurer");
743        else if (Configuration.doAutoCreate())
744          this.insurer = new Reference(); // cc
745      return this.insurer;
746    }
747
748    public boolean hasInsurer() { 
749      return this.insurer != null && !this.insurer.isEmpty();
750    }
751
752    /**
753     * @param value {@link #insurer} (The Insurer who is target  of the request.)
754     */
755    public EligibilityRequest setInsurer(Reference value)  { 
756      this.insurer = value;
757      return this;
758    }
759
760    /**
761     * @return {@link #insurer} 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.)
762     */
763    public Organization getInsurerTarget() { 
764      if (this.insurerTarget == null)
765        if (Configuration.errorOnAutoCreate())
766          throw new Error("Attempt to auto-create EligibilityRequest.insurer");
767        else if (Configuration.doAutoCreate())
768          this.insurerTarget = new Organization(); // aa
769      return this.insurerTarget;
770    }
771
772    /**
773     * @param value {@link #insurer} 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.)
774     */
775    public EligibilityRequest setInsurerTarget(Organization value) { 
776      this.insurerTarget = value;
777      return this;
778    }
779
780    /**
781     * @return {@link #facility} (Facility where the services were provided.)
782     */
783    public Reference getFacility() { 
784      if (this.facility == null)
785        if (Configuration.errorOnAutoCreate())
786          throw new Error("Attempt to auto-create EligibilityRequest.facility");
787        else if (Configuration.doAutoCreate())
788          this.facility = new Reference(); // cc
789      return this.facility;
790    }
791
792    public boolean hasFacility() { 
793      return this.facility != null && !this.facility.isEmpty();
794    }
795
796    /**
797     * @param value {@link #facility} (Facility where the services were provided.)
798     */
799    public EligibilityRequest setFacility(Reference value)  { 
800      this.facility = value;
801      return this;
802    }
803
804    /**
805     * @return {@link #facility} 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. (Facility where the services were provided.)
806     */
807    public Location getFacilityTarget() { 
808      if (this.facilityTarget == null)
809        if (Configuration.errorOnAutoCreate())
810          throw new Error("Attempt to auto-create EligibilityRequest.facility");
811        else if (Configuration.doAutoCreate())
812          this.facilityTarget = new Location(); // aa
813      return this.facilityTarget;
814    }
815
816    /**
817     * @param value {@link #facility} 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. (Facility where the services were provided.)
818     */
819    public EligibilityRequest setFacilityTarget(Location value) { 
820      this.facilityTarget = value;
821      return this;
822    }
823
824    /**
825     * @return {@link #coverage} (Financial instrument by which payment information for health care.)
826     */
827    public Reference getCoverage() { 
828      if (this.coverage == null)
829        if (Configuration.errorOnAutoCreate())
830          throw new Error("Attempt to auto-create EligibilityRequest.coverage");
831        else if (Configuration.doAutoCreate())
832          this.coverage = new Reference(); // cc
833      return this.coverage;
834    }
835
836    public boolean hasCoverage() { 
837      return this.coverage != null && !this.coverage.isEmpty();
838    }
839
840    /**
841     * @param value {@link #coverage} (Financial instrument by which payment information for health care.)
842     */
843    public EligibilityRequest setCoverage(Reference value)  { 
844      this.coverage = value;
845      return this;
846    }
847
848    /**
849     * @return {@link #coverage} 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. (Financial instrument by which payment information for health care.)
850     */
851    public Coverage getCoverageTarget() { 
852      if (this.coverageTarget == null)
853        if (Configuration.errorOnAutoCreate())
854          throw new Error("Attempt to auto-create EligibilityRequest.coverage");
855        else if (Configuration.doAutoCreate())
856          this.coverageTarget = new Coverage(); // aa
857      return this.coverageTarget;
858    }
859
860    /**
861     * @param value {@link #coverage} 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. (Financial instrument by which payment information for health care.)
862     */
863    public EligibilityRequest setCoverageTarget(Coverage value) { 
864      this.coverageTarget = value;
865      return this;
866    }
867
868    /**
869     * @return {@link #businessArrangement} (The contract number of a business agreement which describes the terms and conditions.). This is the underlying object with id, value and extensions. The accessor "getBusinessArrangement" gives direct access to the value
870     */
871    public StringType getBusinessArrangementElement() { 
872      if (this.businessArrangement == null)
873        if (Configuration.errorOnAutoCreate())
874          throw new Error("Attempt to auto-create EligibilityRequest.businessArrangement");
875        else if (Configuration.doAutoCreate())
876          this.businessArrangement = new StringType(); // bb
877      return this.businessArrangement;
878    }
879
880    public boolean hasBusinessArrangementElement() { 
881      return this.businessArrangement != null && !this.businessArrangement.isEmpty();
882    }
883
884    public boolean hasBusinessArrangement() { 
885      return this.businessArrangement != null && !this.businessArrangement.isEmpty();
886    }
887
888    /**
889     * @param value {@link #businessArrangement} (The contract number of a business agreement which describes the terms and conditions.). This is the underlying object with id, value and extensions. The accessor "getBusinessArrangement" gives direct access to the value
890     */
891    public EligibilityRequest setBusinessArrangementElement(StringType value) { 
892      this.businessArrangement = value;
893      return this;
894    }
895
896    /**
897     * @return The contract number of a business agreement which describes the terms and conditions.
898     */
899    public String getBusinessArrangement() { 
900      return this.businessArrangement == null ? null : this.businessArrangement.getValue();
901    }
902
903    /**
904     * @param value The contract number of a business agreement which describes the terms and conditions.
905     */
906    public EligibilityRequest setBusinessArrangement(String value) { 
907      if (Utilities.noString(value))
908        this.businessArrangement = null;
909      else {
910        if (this.businessArrangement == null)
911          this.businessArrangement = new StringType();
912        this.businessArrangement.setValue(value);
913      }
914      return this;
915    }
916
917    /**
918     * @return {@link #benefitCategory} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
919     */
920    public CodeableConcept getBenefitCategory() { 
921      if (this.benefitCategory == null)
922        if (Configuration.errorOnAutoCreate())
923          throw new Error("Attempt to auto-create EligibilityRequest.benefitCategory");
924        else if (Configuration.doAutoCreate())
925          this.benefitCategory = new CodeableConcept(); // cc
926      return this.benefitCategory;
927    }
928
929    public boolean hasBenefitCategory() { 
930      return this.benefitCategory != null && !this.benefitCategory.isEmpty();
931    }
932
933    /**
934     * @param value {@link #benefitCategory} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
935     */
936    public EligibilityRequest setBenefitCategory(CodeableConcept value)  { 
937      this.benefitCategory = value;
938      return this;
939    }
940
941    /**
942     * @return {@link #benefitSubCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
943     */
944    public CodeableConcept getBenefitSubCategory() { 
945      if (this.benefitSubCategory == null)
946        if (Configuration.errorOnAutoCreate())
947          throw new Error("Attempt to auto-create EligibilityRequest.benefitSubCategory");
948        else if (Configuration.doAutoCreate())
949          this.benefitSubCategory = new CodeableConcept(); // cc
950      return this.benefitSubCategory;
951    }
952
953    public boolean hasBenefitSubCategory() { 
954      return this.benefitSubCategory != null && !this.benefitSubCategory.isEmpty();
955    }
956
957    /**
958     * @param value {@link #benefitSubCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
959     */
960    public EligibilityRequest setBenefitSubCategory(CodeableConcept value)  { 
961      this.benefitSubCategory = value;
962      return this;
963    }
964
965      protected void listChildren(List<Property> children) {
966        super.listChildren(children);
967        children.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
968        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
969        children.add(new Property("priority", "CodeableConcept", "Immediate (STAT), best effort (NORMAL), deferred (DEFER).", 0, 1, priority));
970        children.add(new Property("patient", "Reference(Patient)", "Patient Resource.", 0, 1, patient));
971        children.add(new Property("serviced[x]", "date|Period", "The date or dates when the enclosed suite of services were performed or completed.", 0, 1, serviced));
972        children.add(new Property("created", "dateTime", "The date when this resource was created.", 0, 1, created));
973        children.add(new Property("enterer", "Reference(Practitioner)", "Person who created the invoice/claim/pre-determination or pre-authorization.", 0, 1, enterer));
974        children.add(new Property("provider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, provider));
975        children.add(new Property("organization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, 1, organization));
976        children.add(new Property("insurer", "Reference(Organization)", "The Insurer who is target  of the request.", 0, 1, insurer));
977        children.add(new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
978        children.add(new Property("coverage", "Reference(Coverage)", "Financial instrument by which payment information for health care.", 0, 1, coverage));
979        children.add(new Property("businessArrangement", "string", "The contract number of a business agreement which describes the terms and conditions.", 0, 1, businessArrangement));
980        children.add(new Property("benefitCategory", "CodeableConcept", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, 1, benefitCategory));
981        children.add(new Property("benefitSubCategory", "CodeableConcept", "Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.", 0, 1, benefitSubCategory));
982      }
983
984      @Override
985      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
986        switch (_hash) {
987        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier);
988        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
989        case -1165461084: /*priority*/  return new Property("priority", "CodeableConcept", "Immediate (STAT), best effort (NORMAL), deferred (DEFER).", 0, 1, priority);
990        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "Patient Resource.", 0, 1, patient);
991        case -1927922223: /*serviced[x]*/  return new Property("serviced[x]", "date|Period", "The date or dates when the enclosed suite of services were performed or completed.", 0, 1, serviced);
992        case 1379209295: /*serviced*/  return new Property("serviced[x]", "date|Period", "The date or dates when the enclosed suite of services were performed or completed.", 0, 1, serviced);
993        case 363246749: /*servicedDate*/  return new Property("serviced[x]", "date|Period", "The date or dates when the enclosed suite of services were performed or completed.", 0, 1, serviced);
994        case 1534966512: /*servicedPeriod*/  return new Property("serviced[x]", "date|Period", "The date or dates when the enclosed suite of services were performed or completed.", 0, 1, serviced);
995        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date when this resource was created.", 0, 1, created);
996        case -1591951995: /*enterer*/  return new Property("enterer", "Reference(Practitioner)", "Person who created the invoice/claim/pre-determination or pre-authorization.", 0, 1, enterer);
997        case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, provider);
998        case 1178922291: /*organization*/  return new Property("organization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, 1, organization);
999        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The Insurer who is target  of the request.", 0, 1, insurer);
1000        case 501116579: /*facility*/  return new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility);
1001        case -351767064: /*coverage*/  return new Property("coverage", "Reference(Coverage)", "Financial instrument by which payment information for health care.", 0, 1, coverage);
1002        case 259920682: /*businessArrangement*/  return new Property("businessArrangement", "string", "The contract number of a business agreement which describes the terms and conditions.", 0, 1, businessArrangement);
1003        case -1023390027: /*benefitCategory*/  return new Property("benefitCategory", "CodeableConcept", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, 1, benefitCategory);
1004        case 1987878471: /*benefitSubCategory*/  return new Property("benefitSubCategory", "CodeableConcept", "Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.", 0, 1, benefitSubCategory);
1005        default: return super.getNamedProperty(_hash, _name, _checkValid);
1006        }
1007
1008      }
1009
1010      @Override
1011      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1012        switch (hash) {
1013        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1014        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<EligibilityRequestStatus>
1015        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
1016        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
1017        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
1018        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
1019        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
1020        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
1021        case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : new Base[] {this.organization}; // Reference
1022        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
1023        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
1024        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
1025        case 259920682: /*businessArrangement*/ return this.businessArrangement == null ? new Base[0] : new Base[] {this.businessArrangement}; // StringType
1026        case -1023390027: /*benefitCategory*/ return this.benefitCategory == null ? new Base[0] : new Base[] {this.benefitCategory}; // CodeableConcept
1027        case 1987878471: /*benefitSubCategory*/ return this.benefitSubCategory == null ? new Base[0] : new Base[] {this.benefitSubCategory}; // CodeableConcept
1028        default: return super.getProperty(hash, name, checkValid);
1029        }
1030
1031      }
1032
1033      @Override
1034      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1035        switch (hash) {
1036        case -1618432855: // identifier
1037          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1038          return value;
1039        case -892481550: // status
1040          value = new EligibilityRequestStatusEnumFactory().fromType(castToCode(value));
1041          this.status = (Enumeration) value; // Enumeration<EligibilityRequestStatus>
1042          return value;
1043        case -1165461084: // priority
1044          this.priority = castToCodeableConcept(value); // CodeableConcept
1045          return value;
1046        case -791418107: // patient
1047          this.patient = castToReference(value); // Reference
1048          return value;
1049        case 1379209295: // serviced
1050          this.serviced = castToType(value); // Type
1051          return value;
1052        case 1028554472: // created
1053          this.created = castToDateTime(value); // DateTimeType
1054          return value;
1055        case -1591951995: // enterer
1056          this.enterer = castToReference(value); // Reference
1057          return value;
1058        case -987494927: // provider
1059          this.provider = castToReference(value); // Reference
1060          return value;
1061        case 1178922291: // organization
1062          this.organization = castToReference(value); // Reference
1063          return value;
1064        case 1957615864: // insurer
1065          this.insurer = castToReference(value); // Reference
1066          return value;
1067        case 501116579: // facility
1068          this.facility = castToReference(value); // Reference
1069          return value;
1070        case -351767064: // coverage
1071          this.coverage = castToReference(value); // Reference
1072          return value;
1073        case 259920682: // businessArrangement
1074          this.businessArrangement = castToString(value); // StringType
1075          return value;
1076        case -1023390027: // benefitCategory
1077          this.benefitCategory = castToCodeableConcept(value); // CodeableConcept
1078          return value;
1079        case 1987878471: // benefitSubCategory
1080          this.benefitSubCategory = castToCodeableConcept(value); // CodeableConcept
1081          return value;
1082        default: return super.setProperty(hash, name, value);
1083        }
1084
1085      }
1086
1087      @Override
1088      public Base setProperty(String name, Base value) throws FHIRException {
1089        if (name.equals("identifier")) {
1090          this.getIdentifier().add(castToIdentifier(value));
1091        } else if (name.equals("status")) {
1092          value = new EligibilityRequestStatusEnumFactory().fromType(castToCode(value));
1093          this.status = (Enumeration) value; // Enumeration<EligibilityRequestStatus>
1094        } else if (name.equals("priority")) {
1095          this.priority = castToCodeableConcept(value); // CodeableConcept
1096        } else if (name.equals("patient")) {
1097          this.patient = castToReference(value); // Reference
1098        } else if (name.equals("serviced[x]")) {
1099          this.serviced = castToType(value); // Type
1100        } else if (name.equals("created")) {
1101          this.created = castToDateTime(value); // DateTimeType
1102        } else if (name.equals("enterer")) {
1103          this.enterer = castToReference(value); // Reference
1104        } else if (name.equals("provider")) {
1105          this.provider = castToReference(value); // Reference
1106        } else if (name.equals("organization")) {
1107          this.organization = castToReference(value); // Reference
1108        } else if (name.equals("insurer")) {
1109          this.insurer = castToReference(value); // Reference
1110        } else if (name.equals("facility")) {
1111          this.facility = castToReference(value); // Reference
1112        } else if (name.equals("coverage")) {
1113          this.coverage = castToReference(value); // Reference
1114        } else if (name.equals("businessArrangement")) {
1115          this.businessArrangement = castToString(value); // StringType
1116        } else if (name.equals("benefitCategory")) {
1117          this.benefitCategory = castToCodeableConcept(value); // CodeableConcept
1118        } else if (name.equals("benefitSubCategory")) {
1119          this.benefitSubCategory = castToCodeableConcept(value); // CodeableConcept
1120        } else
1121          return super.setProperty(name, value);
1122        return value;
1123      }
1124
1125      @Override
1126      public Base makeProperty(int hash, String name) throws FHIRException {
1127        switch (hash) {
1128        case -1618432855:  return addIdentifier(); 
1129        case -892481550:  return getStatusElement();
1130        case -1165461084:  return getPriority(); 
1131        case -791418107:  return getPatient(); 
1132        case -1927922223:  return getServiced(); 
1133        case 1379209295:  return getServiced(); 
1134        case 1028554472:  return getCreatedElement();
1135        case -1591951995:  return getEnterer(); 
1136        case -987494927:  return getProvider(); 
1137        case 1178922291:  return getOrganization(); 
1138        case 1957615864:  return getInsurer(); 
1139        case 501116579:  return getFacility(); 
1140        case -351767064:  return getCoverage(); 
1141        case 259920682:  return getBusinessArrangementElement();
1142        case -1023390027:  return getBenefitCategory(); 
1143        case 1987878471:  return getBenefitSubCategory(); 
1144        default: return super.makeProperty(hash, name);
1145        }
1146
1147      }
1148
1149      @Override
1150      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1151        switch (hash) {
1152        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1153        case -892481550: /*status*/ return new String[] {"code"};
1154        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
1155        case -791418107: /*patient*/ return new String[] {"Reference"};
1156        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
1157        case 1028554472: /*created*/ return new String[] {"dateTime"};
1158        case -1591951995: /*enterer*/ return new String[] {"Reference"};
1159        case -987494927: /*provider*/ return new String[] {"Reference"};
1160        case 1178922291: /*organization*/ return new String[] {"Reference"};
1161        case 1957615864: /*insurer*/ return new String[] {"Reference"};
1162        case 501116579: /*facility*/ return new String[] {"Reference"};
1163        case -351767064: /*coverage*/ return new String[] {"Reference"};
1164        case 259920682: /*businessArrangement*/ return new String[] {"string"};
1165        case -1023390027: /*benefitCategory*/ return new String[] {"CodeableConcept"};
1166        case 1987878471: /*benefitSubCategory*/ return new String[] {"CodeableConcept"};
1167        default: return super.getTypesForProperty(hash, name);
1168        }
1169
1170      }
1171
1172      @Override
1173      public Base addChild(String name) throws FHIRException {
1174        if (name.equals("identifier")) {
1175          return addIdentifier();
1176        }
1177        else if (name.equals("status")) {
1178          throw new FHIRException("Cannot call addChild on a primitive type EligibilityRequest.status");
1179        }
1180        else if (name.equals("priority")) {
1181          this.priority = new CodeableConcept();
1182          return this.priority;
1183        }
1184        else if (name.equals("patient")) {
1185          this.patient = new Reference();
1186          return this.patient;
1187        }
1188        else if (name.equals("servicedDate")) {
1189          this.serviced = new DateType();
1190          return this.serviced;
1191        }
1192        else if (name.equals("servicedPeriod")) {
1193          this.serviced = new Period();
1194          return this.serviced;
1195        }
1196        else if (name.equals("created")) {
1197          throw new FHIRException("Cannot call addChild on a primitive type EligibilityRequest.created");
1198        }
1199        else if (name.equals("enterer")) {
1200          this.enterer = new Reference();
1201          return this.enterer;
1202        }
1203        else if (name.equals("provider")) {
1204          this.provider = new Reference();
1205          return this.provider;
1206        }
1207        else if (name.equals("organization")) {
1208          this.organization = new Reference();
1209          return this.organization;
1210        }
1211        else if (name.equals("insurer")) {
1212          this.insurer = new Reference();
1213          return this.insurer;
1214        }
1215        else if (name.equals("facility")) {
1216          this.facility = new Reference();
1217          return this.facility;
1218        }
1219        else if (name.equals("coverage")) {
1220          this.coverage = new Reference();
1221          return this.coverage;
1222        }
1223        else if (name.equals("businessArrangement")) {
1224          throw new FHIRException("Cannot call addChild on a primitive type EligibilityRequest.businessArrangement");
1225        }
1226        else if (name.equals("benefitCategory")) {
1227          this.benefitCategory = new CodeableConcept();
1228          return this.benefitCategory;
1229        }
1230        else if (name.equals("benefitSubCategory")) {
1231          this.benefitSubCategory = new CodeableConcept();
1232          return this.benefitSubCategory;
1233        }
1234        else
1235          return super.addChild(name);
1236      }
1237
1238  public String fhirType() {
1239    return "EligibilityRequest";
1240
1241  }
1242
1243      public EligibilityRequest copy() {
1244        EligibilityRequest dst = new EligibilityRequest();
1245        copyValues(dst);
1246        if (identifier != null) {
1247          dst.identifier = new ArrayList<Identifier>();
1248          for (Identifier i : identifier)
1249            dst.identifier.add(i.copy());
1250        };
1251        dst.status = status == null ? null : status.copy();
1252        dst.priority = priority == null ? null : priority.copy();
1253        dst.patient = patient == null ? null : patient.copy();
1254        dst.serviced = serviced == null ? null : serviced.copy();
1255        dst.created = created == null ? null : created.copy();
1256        dst.enterer = enterer == null ? null : enterer.copy();
1257        dst.provider = provider == null ? null : provider.copy();
1258        dst.organization = organization == null ? null : organization.copy();
1259        dst.insurer = insurer == null ? null : insurer.copy();
1260        dst.facility = facility == null ? null : facility.copy();
1261        dst.coverage = coverage == null ? null : coverage.copy();
1262        dst.businessArrangement = businessArrangement == null ? null : businessArrangement.copy();
1263        dst.benefitCategory = benefitCategory == null ? null : benefitCategory.copy();
1264        dst.benefitSubCategory = benefitSubCategory == null ? null : benefitSubCategory.copy();
1265        return dst;
1266      }
1267
1268      protected EligibilityRequest typedCopy() {
1269        return copy();
1270      }
1271
1272      @Override
1273      public boolean equalsDeep(Base other_) {
1274        if (!super.equalsDeep(other_))
1275          return false;
1276        if (!(other_ instanceof EligibilityRequest))
1277          return false;
1278        EligibilityRequest o = (EligibilityRequest) other_;
1279        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(priority, o.priority, true)
1280           && compareDeep(patient, o.patient, true) && compareDeep(serviced, o.serviced, true) && compareDeep(created, o.created, true)
1281           && compareDeep(enterer, o.enterer, true) && compareDeep(provider, o.provider, true) && compareDeep(organization, o.organization, true)
1282           && compareDeep(insurer, o.insurer, true) && compareDeep(facility, o.facility, true) && compareDeep(coverage, o.coverage, true)
1283           && compareDeep(businessArrangement, o.businessArrangement, true) && compareDeep(benefitCategory, o.benefitCategory, true)
1284           && compareDeep(benefitSubCategory, o.benefitSubCategory, true);
1285      }
1286
1287      @Override
1288      public boolean equalsShallow(Base other_) {
1289        if (!super.equalsShallow(other_))
1290          return false;
1291        if (!(other_ instanceof EligibilityRequest))
1292          return false;
1293        EligibilityRequest o = (EligibilityRequest) other_;
1294        return compareValues(status, o.status, true) && compareValues(created, o.created, true) && compareValues(businessArrangement, o.businessArrangement, true)
1295          ;
1296      }
1297
1298      public boolean isEmpty() {
1299        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, priority
1300          , patient, serviced, created, enterer, provider, organization, insurer, facility
1301          , coverage, businessArrangement, benefitCategory, benefitSubCategory);
1302      }
1303
1304  @Override
1305  public ResourceType getResourceType() {
1306    return ResourceType.EligibilityRequest;
1307   }
1308
1309 /**
1310   * Search parameter: <b>identifier</b>
1311   * <p>
1312   * Description: <b>The business identifier of the Eligibility</b><br>
1313   * Type: <b>token</b><br>
1314   * Path: <b>EligibilityRequest.identifier</b><br>
1315   * </p>
1316   */
1317  @SearchParamDefinition(name="identifier", path="EligibilityRequest.identifier", description="The business identifier of the Eligibility", type="token" )
1318  public static final String SP_IDENTIFIER = "identifier";
1319 /**
1320   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1321   * <p>
1322   * Description: <b>The business identifier of the Eligibility</b><br>
1323   * Type: <b>token</b><br>
1324   * Path: <b>EligibilityRequest.identifier</b><br>
1325   * </p>
1326   */
1327  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1328
1329 /**
1330   * Search parameter: <b>provider</b>
1331   * <p>
1332   * Description: <b>The reference to the provider</b><br>
1333   * Type: <b>reference</b><br>
1334   * Path: <b>EligibilityRequest.provider</b><br>
1335   * </p>
1336   */
1337  @SearchParamDefinition(name="provider", path="EligibilityRequest.provider", description="The reference to the provider", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class } )
1338  public static final String SP_PROVIDER = "provider";
1339 /**
1340   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
1341   * <p>
1342   * Description: <b>The reference to the provider</b><br>
1343   * Type: <b>reference</b><br>
1344   * Path: <b>EligibilityRequest.provider</b><br>
1345   * </p>
1346   */
1347  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
1348
1349/**
1350   * Constant for fluent queries to be used to add include statements. Specifies
1351   * the path value of "<b>EligibilityRequest:provider</b>".
1352   */
1353  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("EligibilityRequest:provider").toLocked();
1354
1355 /**
1356   * Search parameter: <b>patient</b>
1357   * <p>
1358   * Description: <b>The reference to the patient</b><br>
1359   * Type: <b>reference</b><br>
1360   * Path: <b>EligibilityRequest.patient</b><br>
1361   * </p>
1362   */
1363  @SearchParamDefinition(name="patient", path="EligibilityRequest.patient", description="The reference to the patient", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
1364  public static final String SP_PATIENT = "patient";
1365 /**
1366   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1367   * <p>
1368   * Description: <b>The reference to the patient</b><br>
1369   * Type: <b>reference</b><br>
1370   * Path: <b>EligibilityRequest.patient</b><br>
1371   * </p>
1372   */
1373  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1374
1375/**
1376   * Constant for fluent queries to be used to add include statements. Specifies
1377   * the path value of "<b>EligibilityRequest:patient</b>".
1378   */
1379  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("EligibilityRequest:patient").toLocked();
1380
1381 /**
1382   * Search parameter: <b>created</b>
1383   * <p>
1384   * Description: <b>The creation date for the EOB</b><br>
1385   * Type: <b>date</b><br>
1386   * Path: <b>EligibilityRequest.created</b><br>
1387   * </p>
1388   */
1389  @SearchParamDefinition(name="created", path="EligibilityRequest.created", description="The creation date for the EOB", type="date" )
1390  public static final String SP_CREATED = "created";
1391 /**
1392   * <b>Fluent Client</b> search parameter constant for <b>created</b>
1393   * <p>
1394   * Description: <b>The creation date for the EOB</b><br>
1395   * Type: <b>date</b><br>
1396   * Path: <b>EligibilityRequest.created</b><br>
1397   * </p>
1398   */
1399  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
1400
1401 /**
1402   * Search parameter: <b>organization</b>
1403   * <p>
1404   * Description: <b>The reference to the providing organization</b><br>
1405   * Type: <b>reference</b><br>
1406   * Path: <b>EligibilityRequest.organization</b><br>
1407   * </p>
1408   */
1409  @SearchParamDefinition(name="organization", path="EligibilityRequest.organization", description="The reference to the providing organization", type="reference", target={Organization.class } )
1410  public static final String SP_ORGANIZATION = "organization";
1411 /**
1412   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
1413   * <p>
1414   * Description: <b>The reference to the providing organization</b><br>
1415   * Type: <b>reference</b><br>
1416   * Path: <b>EligibilityRequest.organization</b><br>
1417   * </p>
1418   */
1419  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
1420
1421/**
1422   * Constant for fluent queries to be used to add include statements. Specifies
1423   * the path value of "<b>EligibilityRequest:organization</b>".
1424   */
1425  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("EligibilityRequest:organization").toLocked();
1426
1427 /**
1428   * Search parameter: <b>enterer</b>
1429   * <p>
1430   * Description: <b>The party who is responsible for the request</b><br>
1431   * Type: <b>reference</b><br>
1432   * Path: <b>EligibilityRequest.enterer</b><br>
1433   * </p>
1434   */
1435  @SearchParamDefinition(name="enterer", path="EligibilityRequest.enterer", description="The party who is responsible for the request", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class } )
1436  public static final String SP_ENTERER = "enterer";
1437 /**
1438   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
1439   * <p>
1440   * Description: <b>The party who is responsible for the request</b><br>
1441   * Type: <b>reference</b><br>
1442   * Path: <b>EligibilityRequest.enterer</b><br>
1443   * </p>
1444   */
1445  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
1446
1447/**
1448   * Constant for fluent queries to be used to add include statements. Specifies
1449   * the path value of "<b>EligibilityRequest:enterer</b>".
1450   */
1451  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("EligibilityRequest:enterer").toLocked();
1452
1453 /**
1454   * Search parameter: <b>facility</b>
1455   * <p>
1456   * Description: <b>Facility responsible for the goods and services</b><br>
1457   * Type: <b>reference</b><br>
1458   * Path: <b>EligibilityRequest.facility</b><br>
1459   * </p>
1460   */
1461  @SearchParamDefinition(name="facility", path="EligibilityRequest.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class } )
1462  public static final String SP_FACILITY = "facility";
1463 /**
1464   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
1465   * <p>
1466   * Description: <b>Facility responsible for the goods and services</b><br>
1467   * Type: <b>reference</b><br>
1468   * Path: <b>EligibilityRequest.facility</b><br>
1469   * </p>
1470   */
1471  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
1472
1473/**
1474   * Constant for fluent queries to be used to add include statements. Specifies
1475   * the path value of "<b>EligibilityRequest:facility</b>".
1476   */
1477  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("EligibilityRequest:facility").toLocked();
1478
1479
1480}