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