001package org.hl7.fhir.r4.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 Sun, May 6, 2018 17:51-0400 for FHIR v3.4.0
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    @Block()
176    public static class AuthorizationComponent extends BackboneElement implements IBaseBackboneElement {
177        /**
178         * Sequence of procedures which serves to order and provide a link.
179         */
180        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
181        @Description(shortDefinition="Procedure sequence for reference", formalDefinition="Sequence of procedures which serves to order and provide a link." )
182        protected PositiveIntType sequence;
183
184        /**
185         * A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).
186         */
187        @Child(name = "service", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
188        @Description(shortDefinition="Billing Code", formalDefinition="A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI)." )
189        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
190        protected CodeableConcept service;
191
192        /**
193         * Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.
194         */
195        @Child(name = "modifier", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
196        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours." )
197        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
198        protected List<CodeableConcept> modifier;
199
200        /**
201         * The number of repetitions of a service or product.
202         */
203        @Child(name = "quantity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
204        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
205        protected SimpleQuantity quantity;
206
207        /**
208         * The fee for an addittional service or product or charge.
209         */
210        @Child(name = "unitPrice", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
211        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="The fee for an addittional service or product or charge." )
212        protected Money unitPrice;
213
214        /**
215         * Facility where the services were provided.
216         */
217        @Child(name = "facility", type = {Location.class, Organization.class}, order=6, min=0, max=1, modifier=false, summary=false)
218        @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
219        protected Reference facility;
220
221        /**
222         * The actual object that is the target of the reference (Facility where the services were provided.)
223         */
224        protected Resource facilityTarget;
225
226        /**
227         * List of patient diagnosis for which care is sought.
228         */
229        @Child(name = "diagnosis", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
230        @Description(shortDefinition="List of Diagnosis", formalDefinition="List of patient diagnosis for which care is sought." )
231        protected List<DiagnosisComponent> diagnosis;
232
233        private static final long serialVersionUID = -1042732815L;
234
235    /**
236     * Constructor
237     */
238      public AuthorizationComponent() {
239        super();
240      }
241
242    /**
243     * Constructor
244     */
245      public AuthorizationComponent(PositiveIntType sequence, CodeableConcept service) {
246        super();
247        this.sequence = sequence;
248        this.service = service;
249      }
250
251        /**
252         * @return {@link #sequence} (Sequence of procedures which serves to order and provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
253         */
254        public PositiveIntType getSequenceElement() { 
255          if (this.sequence == null)
256            if (Configuration.errorOnAutoCreate())
257              throw new Error("Attempt to auto-create AuthorizationComponent.sequence");
258            else if (Configuration.doAutoCreate())
259              this.sequence = new PositiveIntType(); // bb
260          return this.sequence;
261        }
262
263        public boolean hasSequenceElement() { 
264          return this.sequence != null && !this.sequence.isEmpty();
265        }
266
267        public boolean hasSequence() { 
268          return this.sequence != null && !this.sequence.isEmpty();
269        }
270
271        /**
272         * @param value {@link #sequence} (Sequence of procedures which serves to order and provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
273         */
274        public AuthorizationComponent setSequenceElement(PositiveIntType value) { 
275          this.sequence = value;
276          return this;
277        }
278
279        /**
280         * @return Sequence of procedures which serves to order and provide a link.
281         */
282        public int getSequence() { 
283          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
284        }
285
286        /**
287         * @param value Sequence of procedures which serves to order and provide a link.
288         */
289        public AuthorizationComponent setSequence(int value) { 
290            if (this.sequence == null)
291              this.sequence = new PositiveIntType();
292            this.sequence.setValue(value);
293          return this;
294        }
295
296        /**
297         * @return {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
298         */
299        public CodeableConcept getService() { 
300          if (this.service == null)
301            if (Configuration.errorOnAutoCreate())
302              throw new Error("Attempt to auto-create AuthorizationComponent.service");
303            else if (Configuration.doAutoCreate())
304              this.service = new CodeableConcept(); // cc
305          return this.service;
306        }
307
308        public boolean hasService() { 
309          return this.service != null && !this.service.isEmpty();
310        }
311
312        /**
313         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
314         */
315        public AuthorizationComponent setService(CodeableConcept value) { 
316          this.service = value;
317          return this;
318        }
319
320        /**
321         * @return {@link #modifier} (Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.)
322         */
323        public List<CodeableConcept> getModifier() { 
324          if (this.modifier == null)
325            this.modifier = new ArrayList<CodeableConcept>();
326          return this.modifier;
327        }
328
329        /**
330         * @return Returns a reference to <code>this</code> for easy method chaining
331         */
332        public AuthorizationComponent setModifier(List<CodeableConcept> theModifier) { 
333          this.modifier = theModifier;
334          return this;
335        }
336
337        public boolean hasModifier() { 
338          if (this.modifier == null)
339            return false;
340          for (CodeableConcept item : this.modifier)
341            if (!item.isEmpty())
342              return true;
343          return false;
344        }
345
346        public CodeableConcept addModifier() { //3
347          CodeableConcept t = new CodeableConcept();
348          if (this.modifier == null)
349            this.modifier = new ArrayList<CodeableConcept>();
350          this.modifier.add(t);
351          return t;
352        }
353
354        public AuthorizationComponent addModifier(CodeableConcept t) { //3
355          if (t == null)
356            return this;
357          if (this.modifier == null)
358            this.modifier = new ArrayList<CodeableConcept>();
359          this.modifier.add(t);
360          return this;
361        }
362
363        /**
364         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
365         */
366        public CodeableConcept getModifierFirstRep() { 
367          if (getModifier().isEmpty()) {
368            addModifier();
369          }
370          return getModifier().get(0);
371        }
372
373        /**
374         * @return {@link #quantity} (The number of repetitions of a service or product.)
375         */
376        public SimpleQuantity getQuantity() { 
377          if (this.quantity == null)
378            if (Configuration.errorOnAutoCreate())
379              throw new Error("Attempt to auto-create AuthorizationComponent.quantity");
380            else if (Configuration.doAutoCreate())
381              this.quantity = new SimpleQuantity(); // cc
382          return this.quantity;
383        }
384
385        public boolean hasQuantity() { 
386          return this.quantity != null && !this.quantity.isEmpty();
387        }
388
389        /**
390         * @param value {@link #quantity} (The number of repetitions of a service or product.)
391         */
392        public AuthorizationComponent setQuantity(SimpleQuantity value) { 
393          this.quantity = value;
394          return this;
395        }
396
397        /**
398         * @return {@link #unitPrice} (The fee for an addittional service or product or charge.)
399         */
400        public Money getUnitPrice() { 
401          if (this.unitPrice == null)
402            if (Configuration.errorOnAutoCreate())
403              throw new Error("Attempt to auto-create AuthorizationComponent.unitPrice");
404            else if (Configuration.doAutoCreate())
405              this.unitPrice = new Money(); // cc
406          return this.unitPrice;
407        }
408
409        public boolean hasUnitPrice() { 
410          return this.unitPrice != null && !this.unitPrice.isEmpty();
411        }
412
413        /**
414         * @param value {@link #unitPrice} (The fee for an addittional service or product or charge.)
415         */
416        public AuthorizationComponent setUnitPrice(Money value) { 
417          this.unitPrice = value;
418          return this;
419        }
420
421        /**
422         * @return {@link #facility} (Facility where the services were provided.)
423         */
424        public Reference getFacility() { 
425          if (this.facility == null)
426            if (Configuration.errorOnAutoCreate())
427              throw new Error("Attempt to auto-create AuthorizationComponent.facility");
428            else if (Configuration.doAutoCreate())
429              this.facility = new Reference(); // cc
430          return this.facility;
431        }
432
433        public boolean hasFacility() { 
434          return this.facility != null && !this.facility.isEmpty();
435        }
436
437        /**
438         * @param value {@link #facility} (Facility where the services were provided.)
439         */
440        public AuthorizationComponent setFacility(Reference value) { 
441          this.facility = value;
442          return this;
443        }
444
445        /**
446         * @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.)
447         */
448        public Resource getFacilityTarget() { 
449          return this.facilityTarget;
450        }
451
452        /**
453         * @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.)
454         */
455        public AuthorizationComponent setFacilityTarget(Resource value) { 
456          this.facilityTarget = value;
457          return this;
458        }
459
460        /**
461         * @return {@link #diagnosis} (List of patient diagnosis for which care is sought.)
462         */
463        public List<DiagnosisComponent> getDiagnosis() { 
464          if (this.diagnosis == null)
465            this.diagnosis = new ArrayList<DiagnosisComponent>();
466          return this.diagnosis;
467        }
468
469        /**
470         * @return Returns a reference to <code>this</code> for easy method chaining
471         */
472        public AuthorizationComponent setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
473          this.diagnosis = theDiagnosis;
474          return this;
475        }
476
477        public boolean hasDiagnosis() { 
478          if (this.diagnosis == null)
479            return false;
480          for (DiagnosisComponent item : this.diagnosis)
481            if (!item.isEmpty())
482              return true;
483          return false;
484        }
485
486        public DiagnosisComponent addDiagnosis() { //3
487          DiagnosisComponent t = new DiagnosisComponent();
488          if (this.diagnosis == null)
489            this.diagnosis = new ArrayList<DiagnosisComponent>();
490          this.diagnosis.add(t);
491          return t;
492        }
493
494        public AuthorizationComponent addDiagnosis(DiagnosisComponent t) { //3
495          if (t == null)
496            return this;
497          if (this.diagnosis == null)
498            this.diagnosis = new ArrayList<DiagnosisComponent>();
499          this.diagnosis.add(t);
500          return this;
501        }
502
503        /**
504         * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist
505         */
506        public DiagnosisComponent getDiagnosisFirstRep() { 
507          if (getDiagnosis().isEmpty()) {
508            addDiagnosis();
509          }
510          return getDiagnosis().get(0);
511        }
512
513        protected void listChildren(List<Property> children) {
514          super.listChildren(children);
515          children.add(new Property("sequence", "positiveInt", "Sequence of procedures which serves to order and provide a link.", 0, 1, sequence));
516          children.add(new Property("service", "CodeableConcept", "A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).", 0, 1, service));
517          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
518          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
519          children.add(new Property("unitPrice", "Money", "The fee for an addittional service or product or charge.", 0, 1, unitPrice));
520          children.add(new Property("facility", "Reference(Location|Organization)", "Facility where the services were provided.", 0, 1, facility));
521          children.add(new Property("diagnosis", "", "List of patient diagnosis for which care is sought.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
522        }
523
524        @Override
525        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
526          switch (_hash) {
527          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of procedures which serves to order and provide a link.", 0, 1, sequence);
528          case 1984153269: /*service*/  return new Property("service", "CodeableConcept", "A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).", 0, 1, service);
529          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier);
530          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
531          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "The fee for an addittional service or product or charge.", 0, 1, unitPrice);
532          case 501116579: /*facility*/  return new Property("facility", "Reference(Location|Organization)", "Facility where the services were provided.", 0, 1, facility);
533          case 1196993265: /*diagnosis*/  return new Property("diagnosis", "", "List of patient diagnosis for which care is sought.", 0, java.lang.Integer.MAX_VALUE, diagnosis);
534          default: return super.getNamedProperty(_hash, _name, _checkValid);
535          }
536
537        }
538
539      @Override
540      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
541        switch (hash) {
542        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
543        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
544        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
545        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
546        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
547        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
548        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
549        default: return super.getProperty(hash, name, checkValid);
550        }
551
552      }
553
554      @Override
555      public Base setProperty(int hash, String name, Base value) throws FHIRException {
556        switch (hash) {
557        case 1349547969: // sequence
558          this.sequence = castToPositiveInt(value); // PositiveIntType
559          return value;
560        case 1984153269: // service
561          this.service = castToCodeableConcept(value); // CodeableConcept
562          return value;
563        case -615513385: // modifier
564          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
565          return value;
566        case -1285004149: // quantity
567          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
568          return value;
569        case -486196699: // unitPrice
570          this.unitPrice = castToMoney(value); // Money
571          return value;
572        case 501116579: // facility
573          this.facility = castToReference(value); // Reference
574          return value;
575        case 1196993265: // diagnosis
576          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
577          return value;
578        default: return super.setProperty(hash, name, value);
579        }
580
581      }
582
583      @Override
584      public Base setProperty(String name, Base value) throws FHIRException {
585        if (name.equals("sequence")) {
586          this.sequence = castToPositiveInt(value); // PositiveIntType
587        } else if (name.equals("service")) {
588          this.service = castToCodeableConcept(value); // CodeableConcept
589        } else if (name.equals("modifier")) {
590          this.getModifier().add(castToCodeableConcept(value));
591        } else if (name.equals("quantity")) {
592          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
593        } else if (name.equals("unitPrice")) {
594          this.unitPrice = castToMoney(value); // Money
595        } else if (name.equals("facility")) {
596          this.facility = castToReference(value); // Reference
597        } else if (name.equals("diagnosis")) {
598          this.getDiagnosis().add((DiagnosisComponent) value);
599        } else
600          return super.setProperty(name, value);
601        return value;
602      }
603
604      @Override
605      public Base makeProperty(int hash, String name) throws FHIRException {
606        switch (hash) {
607        case 1349547969:  return getSequenceElement();
608        case 1984153269:  return getService(); 
609        case -615513385:  return addModifier(); 
610        case -1285004149:  return getQuantity(); 
611        case -486196699:  return getUnitPrice(); 
612        case 501116579:  return getFacility(); 
613        case 1196993265:  return addDiagnosis(); 
614        default: return super.makeProperty(hash, name);
615        }
616
617      }
618
619      @Override
620      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
621        switch (hash) {
622        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
623        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
624        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
625        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
626        case -486196699: /*unitPrice*/ return new String[] {"Money"};
627        case 501116579: /*facility*/ return new String[] {"Reference"};
628        case 1196993265: /*diagnosis*/ return new String[] {};
629        default: return super.getTypesForProperty(hash, name);
630        }
631
632      }
633
634      @Override
635      public Base addChild(String name) throws FHIRException {
636        if (name.equals("sequence")) {
637          throw new FHIRException("Cannot call addChild on a primitive type EligibilityRequest.sequence");
638        }
639        else if (name.equals("service")) {
640          this.service = new CodeableConcept();
641          return this.service;
642        }
643        else if (name.equals("modifier")) {
644          return addModifier();
645        }
646        else if (name.equals("quantity")) {
647          this.quantity = new SimpleQuantity();
648          return this.quantity;
649        }
650        else if (name.equals("unitPrice")) {
651          this.unitPrice = new Money();
652          return this.unitPrice;
653        }
654        else if (name.equals("facility")) {
655          this.facility = new Reference();
656          return this.facility;
657        }
658        else if (name.equals("diagnosis")) {
659          return addDiagnosis();
660        }
661        else
662          return super.addChild(name);
663      }
664
665      public AuthorizationComponent copy() {
666        AuthorizationComponent dst = new AuthorizationComponent();
667        copyValues(dst);
668        dst.sequence = sequence == null ? null : sequence.copy();
669        dst.service = service == null ? null : service.copy();
670        if (modifier != null) {
671          dst.modifier = new ArrayList<CodeableConcept>();
672          for (CodeableConcept i : modifier)
673            dst.modifier.add(i.copy());
674        };
675        dst.quantity = quantity == null ? null : quantity.copy();
676        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
677        dst.facility = facility == null ? null : facility.copy();
678        if (diagnosis != null) {
679          dst.diagnosis = new ArrayList<DiagnosisComponent>();
680          for (DiagnosisComponent i : diagnosis)
681            dst.diagnosis.add(i.copy());
682        };
683        return dst;
684      }
685
686      @Override
687      public boolean equalsDeep(Base other_) {
688        if (!super.equalsDeep(other_))
689          return false;
690        if (!(other_ instanceof AuthorizationComponent))
691          return false;
692        AuthorizationComponent o = (AuthorizationComponent) other_;
693        return compareDeep(sequence, o.sequence, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
694           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(facility, o.facility, true)
695           && compareDeep(diagnosis, o.diagnosis, true);
696      }
697
698      @Override
699      public boolean equalsShallow(Base other_) {
700        if (!super.equalsShallow(other_))
701          return false;
702        if (!(other_ instanceof AuthorizationComponent))
703          return false;
704        AuthorizationComponent o = (AuthorizationComponent) other_;
705        return compareValues(sequence, o.sequence, true);
706      }
707
708      public boolean isEmpty() {
709        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, service, modifier
710          , quantity, unitPrice, facility, diagnosis);
711      }
712
713  public String fhirType() {
714    return "EligibilityRequest.authorization";
715
716  }
717
718  }
719
720    @Block()
721    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
722        /**
723         * The diagnosis.
724         */
725        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=1, min=0, max=1, modifier=false, summary=false)
726        @Description(shortDefinition="Patient's diagnosis", formalDefinition="The diagnosis." )
727        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
728        protected Type diagnosis;
729
730        private static final long serialVersionUID = -454532709L;
731
732    /**
733     * Constructor
734     */
735      public DiagnosisComponent() {
736        super();
737      }
738
739        /**
740         * @return {@link #diagnosis} (The diagnosis.)
741         */
742        public Type getDiagnosis() { 
743          return this.diagnosis;
744        }
745
746        /**
747         * @return {@link #diagnosis} (The diagnosis.)
748         */
749        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
750          if (this.diagnosis == null)
751            return null;
752          if (!(this.diagnosis instanceof CodeableConcept))
753            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
754          return (CodeableConcept) this.diagnosis;
755        }
756
757        public boolean hasDiagnosisCodeableConcept() { 
758          return this != null && this.diagnosis instanceof CodeableConcept;
759        }
760
761        /**
762         * @return {@link #diagnosis} (The diagnosis.)
763         */
764        public Reference getDiagnosisReference() throws FHIRException { 
765          if (this.diagnosis == null)
766            return null;
767          if (!(this.diagnosis instanceof Reference))
768            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
769          return (Reference) this.diagnosis;
770        }
771
772        public boolean hasDiagnosisReference() { 
773          return this != null && this.diagnosis instanceof Reference;
774        }
775
776        public boolean hasDiagnosis() { 
777          return this.diagnosis != null && !this.diagnosis.isEmpty();
778        }
779
780        /**
781         * @param value {@link #diagnosis} (The diagnosis.)
782         */
783        public DiagnosisComponent setDiagnosis(Type value) { 
784          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
785            throw new Error("Not the right type for EligibilityRequest.authorization.diagnosis.diagnosis[x]: "+value.fhirType());
786          this.diagnosis = value;
787          return this;
788        }
789
790        protected void listChildren(List<Property> children) {
791          super.listChildren(children);
792          children.add(new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis));
793        }
794
795        @Override
796        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
797          switch (_hash) {
798          case -1487009809: /*diagnosis[x]*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
799          case 1196993265: /*diagnosis*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
800          case 277781616: /*diagnosisCodeableConcept*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
801          case 2050454362: /*diagnosisReference*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
802          default: return super.getNamedProperty(_hash, _name, _checkValid);
803          }
804
805        }
806
807      @Override
808      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
809        switch (hash) {
810        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // Type
811        default: return super.getProperty(hash, name, checkValid);
812        }
813
814      }
815
816      @Override
817      public Base setProperty(int hash, String name, Base value) throws FHIRException {
818        switch (hash) {
819        case 1196993265: // diagnosis
820          this.diagnosis = castToType(value); // Type
821          return value;
822        default: return super.setProperty(hash, name, value);
823        }
824
825      }
826
827      @Override
828      public Base setProperty(String name, Base value) throws FHIRException {
829        if (name.equals("diagnosis[x]")) {
830          this.diagnosis = castToType(value); // Type
831        } else
832          return super.setProperty(name, value);
833        return value;
834      }
835
836      @Override
837      public Base makeProperty(int hash, String name) throws FHIRException {
838        switch (hash) {
839        case -1487009809:  return getDiagnosis(); 
840        case 1196993265:  return getDiagnosis(); 
841        default: return super.makeProperty(hash, name);
842        }
843
844      }
845
846      @Override
847      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
848        switch (hash) {
849        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
850        default: return super.getTypesForProperty(hash, name);
851        }
852
853      }
854
855      @Override
856      public Base addChild(String name) throws FHIRException {
857        if (name.equals("diagnosisCodeableConcept")) {
858          this.diagnosis = new CodeableConcept();
859          return this.diagnosis;
860        }
861        else if (name.equals("diagnosisReference")) {
862          this.diagnosis = new Reference();
863          return this.diagnosis;
864        }
865        else
866          return super.addChild(name);
867      }
868
869      public DiagnosisComponent copy() {
870        DiagnosisComponent dst = new DiagnosisComponent();
871        copyValues(dst);
872        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
873        return dst;
874      }
875
876      @Override
877      public boolean equalsDeep(Base other_) {
878        if (!super.equalsDeep(other_))
879          return false;
880        if (!(other_ instanceof DiagnosisComponent))
881          return false;
882        DiagnosisComponent o = (DiagnosisComponent) other_;
883        return compareDeep(diagnosis, o.diagnosis, true);
884      }
885
886      @Override
887      public boolean equalsShallow(Base other_) {
888        if (!super.equalsShallow(other_))
889          return false;
890        if (!(other_ instanceof DiagnosisComponent))
891          return false;
892        DiagnosisComponent o = (DiagnosisComponent) other_;
893        return true;
894      }
895
896      public boolean isEmpty() {
897        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(diagnosis);
898      }
899
900  public String fhirType() {
901    return "EligibilityRequest.authorization.diagnosis";
902
903  }
904
905  }
906
907    /**
908     * The Response business identifier.
909     */
910    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
911    @Description(shortDefinition="Business Identifier", formalDefinition="The Response business identifier." )
912    protected List<Identifier> identifier;
913
914    /**
915     * The status of the resource instance.
916     */
917    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
918    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
919    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fm-status")
920    protected Enumeration<EligibilityRequestStatus> status;
921
922    /**
923     * Immediate (STAT), best effort (NORMAL), deferred (DEFER).
924     */
925    @Child(name = "priority", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
926    @Description(shortDefinition="Desired processing priority", formalDefinition="Immediate (STAT), best effort (NORMAL), deferred (DEFER)." )
927    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/process-priority")
928    protected CodeableConcept priority;
929
930    /**
931     * Patient Resource.
932     */
933    @Child(name = "patient", type = {Patient.class}, order=3, min=0, max=1, modifier=false, summary=false)
934    @Description(shortDefinition="The subject of the Products and Services", formalDefinition="Patient Resource." )
935    protected Reference patient;
936
937    /**
938     * The actual object that is the target of the reference (Patient Resource.)
939     */
940    protected Patient patientTarget;
941
942    /**
943     * The date or dates when the enclosed suite of services were performed or completed.
944     */
945    @Child(name = "serviced", type = {DateType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
946    @Description(shortDefinition="Estimated date or dates of Service", formalDefinition="The date or dates when the enclosed suite of services were performed or completed." )
947    protected Type serviced;
948
949    /**
950     * The date when this resource was created.
951     */
952    @Child(name = "created", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=false)
953    @Description(shortDefinition="Creation date", formalDefinition="The date when this resource was created." )
954    protected DateTimeType created;
955
956    /**
957     * Person who created the invoice/claim/pre-determination or pre-authorization.
958     */
959    @Child(name = "enterer", type = {Practitioner.class, PractitionerRole.class}, order=6, min=0, max=1, modifier=false, summary=false)
960    @Description(shortDefinition="Author", formalDefinition="Person who created the invoice/claim/pre-determination or pre-authorization." )
961    protected Reference enterer;
962
963    /**
964     * The actual object that is the target of the reference (Person who created the invoice/claim/pre-determination or pre-authorization.)
965     */
966    protected Resource entererTarget;
967
968    /**
969     * The practitioner who is responsible for the services rendered to the patient.
970     */
971    @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=7, min=0, max=1, modifier=false, summary=false)
972    @Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
973    protected Reference provider;
974
975    /**
976     * The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
977     */
978    protected Resource providerTarget;
979
980    /**
981     * The Insurer who is target  of the request.
982     */
983    @Child(name = "insurer", type = {Organization.class}, order=8, min=0, max=1, modifier=false, summary=false)
984    @Description(shortDefinition="Target", formalDefinition="The Insurer who is target  of the request." )
985    protected Reference insurer;
986
987    /**
988     * The actual object that is the target of the reference (The Insurer who is target  of the request.)
989     */
990    protected Organization insurerTarget;
991
992    /**
993     * Facility where the services were provided.
994     */
995    @Child(name = "facility", type = {Location.class}, order=9, min=0, max=1, modifier=false, summary=false)
996    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
997    protected Reference facility;
998
999    /**
1000     * The actual object that is the target of the reference (Facility where the services were provided.)
1001     */
1002    protected Location facilityTarget;
1003
1004    /**
1005     * Financial instrument by which payment information for health care.
1006     */
1007    @Child(name = "coverage", type = {Coverage.class}, order=10, min=0, max=1, modifier=false, summary=false)
1008    @Description(shortDefinition="Insurance or medical plan", formalDefinition="Financial instrument by which payment information for health care." )
1009    protected Reference coverage;
1010
1011    /**
1012     * The actual object that is the target of the reference (Financial instrument by which payment information for health care.)
1013     */
1014    protected Coverage coverageTarget;
1015
1016    /**
1017     * The contract number of a business agreement which describes the terms and conditions.
1018     */
1019    @Child(name = "businessArrangement", type = {StringType.class}, order=11, min=0, max=1, modifier=false, summary=false)
1020    @Description(shortDefinition="Business agreement", formalDefinition="The contract number of a business agreement which describes the terms and conditions." )
1021    protected StringType businessArrangement;
1022
1023    /**
1024     * Dental, Vision, Medical, Pharmacy, Rehab etc.
1025     */
1026    @Child(name = "benefitCategory", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
1027    @Description(shortDefinition="Type of services covered", formalDefinition="Dental, Vision, Medical, Pharmacy, Rehab etc." )
1028    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-category")
1029    protected CodeableConcept benefitCategory;
1030
1031    /**
1032     * Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.
1033     */
1034    @Child(name = "benefitSubCategory", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
1035    @Description(shortDefinition="Detailed services covered within the type", formalDefinition="Dental: basic, major, ortho; Vision exam, glasses, contacts; etc." )
1036    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
1037    protected CodeableConcept benefitSubCategory;
1038
1039    /**
1040     * A list of billable services for which an authorization prior to service delivery may be required by the payor.
1041     */
1042    @Child(name = "authorization", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1043    @Description(shortDefinition="Services which may require prior authorization", formalDefinition="A list of billable services for which an authorization prior to service delivery may be required by the payor." )
1044    protected List<AuthorizationComponent> authorization;
1045
1046    private static final long serialVersionUID = 1941670577L;
1047
1048  /**
1049   * Constructor
1050   */
1051    public EligibilityRequest() {
1052      super();
1053    }
1054
1055    /**
1056     * @return {@link #identifier} (The Response business identifier.)
1057     */
1058    public List<Identifier> getIdentifier() { 
1059      if (this.identifier == null)
1060        this.identifier = new ArrayList<Identifier>();
1061      return this.identifier;
1062    }
1063
1064    /**
1065     * @return Returns a reference to <code>this</code> for easy method chaining
1066     */
1067    public EligibilityRequest setIdentifier(List<Identifier> theIdentifier) { 
1068      this.identifier = theIdentifier;
1069      return this;
1070    }
1071
1072    public boolean hasIdentifier() { 
1073      if (this.identifier == null)
1074        return false;
1075      for (Identifier item : this.identifier)
1076        if (!item.isEmpty())
1077          return true;
1078      return false;
1079    }
1080
1081    public Identifier addIdentifier() { //3
1082      Identifier t = new Identifier();
1083      if (this.identifier == null)
1084        this.identifier = new ArrayList<Identifier>();
1085      this.identifier.add(t);
1086      return t;
1087    }
1088
1089    public EligibilityRequest addIdentifier(Identifier t) { //3
1090      if (t == null)
1091        return this;
1092      if (this.identifier == null)
1093        this.identifier = new ArrayList<Identifier>();
1094      this.identifier.add(t);
1095      return this;
1096    }
1097
1098    /**
1099     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1100     */
1101    public Identifier getIdentifierFirstRep() { 
1102      if (getIdentifier().isEmpty()) {
1103        addIdentifier();
1104      }
1105      return getIdentifier().get(0);
1106    }
1107
1108    /**
1109     * @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
1110     */
1111    public Enumeration<EligibilityRequestStatus> getStatusElement() { 
1112      if (this.status == null)
1113        if (Configuration.errorOnAutoCreate())
1114          throw new Error("Attempt to auto-create EligibilityRequest.status");
1115        else if (Configuration.doAutoCreate())
1116          this.status = new Enumeration<EligibilityRequestStatus>(new EligibilityRequestStatusEnumFactory()); // bb
1117      return this.status;
1118    }
1119
1120    public boolean hasStatusElement() { 
1121      return this.status != null && !this.status.isEmpty();
1122    }
1123
1124    public boolean hasStatus() { 
1125      return this.status != null && !this.status.isEmpty();
1126    }
1127
1128    /**
1129     * @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
1130     */
1131    public EligibilityRequest setStatusElement(Enumeration<EligibilityRequestStatus> value) { 
1132      this.status = value;
1133      return this;
1134    }
1135
1136    /**
1137     * @return The status of the resource instance.
1138     */
1139    public EligibilityRequestStatus getStatus() { 
1140      return this.status == null ? null : this.status.getValue();
1141    }
1142
1143    /**
1144     * @param value The status of the resource instance.
1145     */
1146    public EligibilityRequest setStatus(EligibilityRequestStatus value) { 
1147      if (value == null)
1148        this.status = null;
1149      else {
1150        if (this.status == null)
1151          this.status = new Enumeration<EligibilityRequestStatus>(new EligibilityRequestStatusEnumFactory());
1152        this.status.setValue(value);
1153      }
1154      return this;
1155    }
1156
1157    /**
1158     * @return {@link #priority} (Immediate (STAT), best effort (NORMAL), deferred (DEFER).)
1159     */
1160    public CodeableConcept getPriority() { 
1161      if (this.priority == null)
1162        if (Configuration.errorOnAutoCreate())
1163          throw new Error("Attempt to auto-create EligibilityRequest.priority");
1164        else if (Configuration.doAutoCreate())
1165          this.priority = new CodeableConcept(); // cc
1166      return this.priority;
1167    }
1168
1169    public boolean hasPriority() { 
1170      return this.priority != null && !this.priority.isEmpty();
1171    }
1172
1173    /**
1174     * @param value {@link #priority} (Immediate (STAT), best effort (NORMAL), deferred (DEFER).)
1175     */
1176    public EligibilityRequest setPriority(CodeableConcept value) { 
1177      this.priority = value;
1178      return this;
1179    }
1180
1181    /**
1182     * @return {@link #patient} (Patient Resource.)
1183     */
1184    public Reference getPatient() { 
1185      if (this.patient == null)
1186        if (Configuration.errorOnAutoCreate())
1187          throw new Error("Attempt to auto-create EligibilityRequest.patient");
1188        else if (Configuration.doAutoCreate())
1189          this.patient = new Reference(); // cc
1190      return this.patient;
1191    }
1192
1193    public boolean hasPatient() { 
1194      return this.patient != null && !this.patient.isEmpty();
1195    }
1196
1197    /**
1198     * @param value {@link #patient} (Patient Resource.)
1199     */
1200    public EligibilityRequest setPatient(Reference value) { 
1201      this.patient = value;
1202      return this;
1203    }
1204
1205    /**
1206     * @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.)
1207     */
1208    public Patient getPatientTarget() { 
1209      if (this.patientTarget == null)
1210        if (Configuration.errorOnAutoCreate())
1211          throw new Error("Attempt to auto-create EligibilityRequest.patient");
1212        else if (Configuration.doAutoCreate())
1213          this.patientTarget = new Patient(); // aa
1214      return this.patientTarget;
1215    }
1216
1217    /**
1218     * @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.)
1219     */
1220    public EligibilityRequest setPatientTarget(Patient value) { 
1221      this.patientTarget = value;
1222      return this;
1223    }
1224
1225    /**
1226     * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
1227     */
1228    public Type getServiced() { 
1229      return this.serviced;
1230    }
1231
1232    /**
1233     * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
1234     */
1235    public DateType getServicedDateType() throws FHIRException { 
1236      if (this.serviced == null)
1237        return null;
1238      if (!(this.serviced instanceof DateType))
1239        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
1240      return (DateType) this.serviced;
1241    }
1242
1243    public boolean hasServicedDateType() { 
1244      return this != null && this.serviced instanceof DateType;
1245    }
1246
1247    /**
1248     * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
1249     */
1250    public Period getServicedPeriod() throws FHIRException { 
1251      if (this.serviced == null)
1252        return null;
1253      if (!(this.serviced instanceof Period))
1254        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
1255      return (Period) this.serviced;
1256    }
1257
1258    public boolean hasServicedPeriod() { 
1259      return this != null && this.serviced instanceof Period;
1260    }
1261
1262    public boolean hasServiced() { 
1263      return this.serviced != null && !this.serviced.isEmpty();
1264    }
1265
1266    /**
1267     * @param value {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
1268     */
1269    public EligibilityRequest setServiced(Type value) { 
1270      if (value != null && !(value instanceof DateType || value instanceof Period))
1271        throw new Error("Not the right type for EligibilityRequest.serviced[x]: "+value.fhirType());
1272      this.serviced = value;
1273      return this;
1274    }
1275
1276    /**
1277     * @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
1278     */
1279    public DateTimeType getCreatedElement() { 
1280      if (this.created == null)
1281        if (Configuration.errorOnAutoCreate())
1282          throw new Error("Attempt to auto-create EligibilityRequest.created");
1283        else if (Configuration.doAutoCreate())
1284          this.created = new DateTimeType(); // bb
1285      return this.created;
1286    }
1287
1288    public boolean hasCreatedElement() { 
1289      return this.created != null && !this.created.isEmpty();
1290    }
1291
1292    public boolean hasCreated() { 
1293      return this.created != null && !this.created.isEmpty();
1294    }
1295
1296    /**
1297     * @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
1298     */
1299    public EligibilityRequest setCreatedElement(DateTimeType value) { 
1300      this.created = value;
1301      return this;
1302    }
1303
1304    /**
1305     * @return The date when this resource was created.
1306     */
1307    public Date getCreated() { 
1308      return this.created == null ? null : this.created.getValue();
1309    }
1310
1311    /**
1312     * @param value The date when this resource was created.
1313     */
1314    public EligibilityRequest setCreated(Date value) { 
1315      if (value == null)
1316        this.created = null;
1317      else {
1318        if (this.created == null)
1319          this.created = new DateTimeType();
1320        this.created.setValue(value);
1321      }
1322      return this;
1323    }
1324
1325    /**
1326     * @return {@link #enterer} (Person who created the invoice/claim/pre-determination or pre-authorization.)
1327     */
1328    public Reference getEnterer() { 
1329      if (this.enterer == null)
1330        if (Configuration.errorOnAutoCreate())
1331          throw new Error("Attempt to auto-create EligibilityRequest.enterer");
1332        else if (Configuration.doAutoCreate())
1333          this.enterer = new Reference(); // cc
1334      return this.enterer;
1335    }
1336
1337    public boolean hasEnterer() { 
1338      return this.enterer != null && !this.enterer.isEmpty();
1339    }
1340
1341    /**
1342     * @param value {@link #enterer} (Person who created the invoice/claim/pre-determination or pre-authorization.)
1343     */
1344    public EligibilityRequest setEnterer(Reference value) { 
1345      this.enterer = value;
1346      return this;
1347    }
1348
1349    /**
1350     * @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.)
1351     */
1352    public Resource getEntererTarget() { 
1353      return this.entererTarget;
1354    }
1355
1356    /**
1357     * @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.)
1358     */
1359    public EligibilityRequest setEntererTarget(Resource value) { 
1360      this.entererTarget = value;
1361      return this;
1362    }
1363
1364    /**
1365     * @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
1366     */
1367    public Reference getProvider() { 
1368      if (this.provider == null)
1369        if (Configuration.errorOnAutoCreate())
1370          throw new Error("Attempt to auto-create EligibilityRequest.provider");
1371        else if (Configuration.doAutoCreate())
1372          this.provider = new Reference(); // cc
1373      return this.provider;
1374    }
1375
1376    public boolean hasProvider() { 
1377      return this.provider != null && !this.provider.isEmpty();
1378    }
1379
1380    /**
1381     * @param value {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
1382     */
1383    public EligibilityRequest setProvider(Reference value) { 
1384      this.provider = value;
1385      return this;
1386    }
1387
1388    /**
1389     * @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.)
1390     */
1391    public Resource getProviderTarget() { 
1392      return this.providerTarget;
1393    }
1394
1395    /**
1396     * @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.)
1397     */
1398    public EligibilityRequest setProviderTarget(Resource value) { 
1399      this.providerTarget = value;
1400      return this;
1401    }
1402
1403    /**
1404     * @return {@link #insurer} (The Insurer who is target  of the request.)
1405     */
1406    public Reference getInsurer() { 
1407      if (this.insurer == null)
1408        if (Configuration.errorOnAutoCreate())
1409          throw new Error("Attempt to auto-create EligibilityRequest.insurer");
1410        else if (Configuration.doAutoCreate())
1411          this.insurer = new Reference(); // cc
1412      return this.insurer;
1413    }
1414
1415    public boolean hasInsurer() { 
1416      return this.insurer != null && !this.insurer.isEmpty();
1417    }
1418
1419    /**
1420     * @param value {@link #insurer} (The Insurer who is target  of the request.)
1421     */
1422    public EligibilityRequest setInsurer(Reference value) { 
1423      this.insurer = value;
1424      return this;
1425    }
1426
1427    /**
1428     * @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.)
1429     */
1430    public Organization getInsurerTarget() { 
1431      if (this.insurerTarget == null)
1432        if (Configuration.errorOnAutoCreate())
1433          throw new Error("Attempt to auto-create EligibilityRequest.insurer");
1434        else if (Configuration.doAutoCreate())
1435          this.insurerTarget = new Organization(); // aa
1436      return this.insurerTarget;
1437    }
1438
1439    /**
1440     * @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.)
1441     */
1442    public EligibilityRequest setInsurerTarget(Organization value) { 
1443      this.insurerTarget = value;
1444      return this;
1445    }
1446
1447    /**
1448     * @return {@link #facility} (Facility where the services were provided.)
1449     */
1450    public Reference getFacility() { 
1451      if (this.facility == null)
1452        if (Configuration.errorOnAutoCreate())
1453          throw new Error("Attempt to auto-create EligibilityRequest.facility");
1454        else if (Configuration.doAutoCreate())
1455          this.facility = new Reference(); // cc
1456      return this.facility;
1457    }
1458
1459    public boolean hasFacility() { 
1460      return this.facility != null && !this.facility.isEmpty();
1461    }
1462
1463    /**
1464     * @param value {@link #facility} (Facility where the services were provided.)
1465     */
1466    public EligibilityRequest setFacility(Reference value) { 
1467      this.facility = value;
1468      return this;
1469    }
1470
1471    /**
1472     * @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.)
1473     */
1474    public Location getFacilityTarget() { 
1475      if (this.facilityTarget == null)
1476        if (Configuration.errorOnAutoCreate())
1477          throw new Error("Attempt to auto-create EligibilityRequest.facility");
1478        else if (Configuration.doAutoCreate())
1479          this.facilityTarget = new Location(); // aa
1480      return this.facilityTarget;
1481    }
1482
1483    /**
1484     * @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.)
1485     */
1486    public EligibilityRequest setFacilityTarget(Location value) { 
1487      this.facilityTarget = value;
1488      return this;
1489    }
1490
1491    /**
1492     * @return {@link #coverage} (Financial instrument by which payment information for health care.)
1493     */
1494    public Reference getCoverage() { 
1495      if (this.coverage == null)
1496        if (Configuration.errorOnAutoCreate())
1497          throw new Error("Attempt to auto-create EligibilityRequest.coverage");
1498        else if (Configuration.doAutoCreate())
1499          this.coverage = new Reference(); // cc
1500      return this.coverage;
1501    }
1502
1503    public boolean hasCoverage() { 
1504      return this.coverage != null && !this.coverage.isEmpty();
1505    }
1506
1507    /**
1508     * @param value {@link #coverage} (Financial instrument by which payment information for health care.)
1509     */
1510    public EligibilityRequest setCoverage(Reference value) { 
1511      this.coverage = value;
1512      return this;
1513    }
1514
1515    /**
1516     * @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.)
1517     */
1518    public Coverage getCoverageTarget() { 
1519      if (this.coverageTarget == null)
1520        if (Configuration.errorOnAutoCreate())
1521          throw new Error("Attempt to auto-create EligibilityRequest.coverage");
1522        else if (Configuration.doAutoCreate())
1523          this.coverageTarget = new Coverage(); // aa
1524      return this.coverageTarget;
1525    }
1526
1527    /**
1528     * @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.)
1529     */
1530    public EligibilityRequest setCoverageTarget(Coverage value) { 
1531      this.coverageTarget = value;
1532      return this;
1533    }
1534
1535    /**
1536     * @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
1537     */
1538    public StringType getBusinessArrangementElement() { 
1539      if (this.businessArrangement == null)
1540        if (Configuration.errorOnAutoCreate())
1541          throw new Error("Attempt to auto-create EligibilityRequest.businessArrangement");
1542        else if (Configuration.doAutoCreate())
1543          this.businessArrangement = new StringType(); // bb
1544      return this.businessArrangement;
1545    }
1546
1547    public boolean hasBusinessArrangementElement() { 
1548      return this.businessArrangement != null && !this.businessArrangement.isEmpty();
1549    }
1550
1551    public boolean hasBusinessArrangement() { 
1552      return this.businessArrangement != null && !this.businessArrangement.isEmpty();
1553    }
1554
1555    /**
1556     * @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
1557     */
1558    public EligibilityRequest setBusinessArrangementElement(StringType value) { 
1559      this.businessArrangement = value;
1560      return this;
1561    }
1562
1563    /**
1564     * @return The contract number of a business agreement which describes the terms and conditions.
1565     */
1566    public String getBusinessArrangement() { 
1567      return this.businessArrangement == null ? null : this.businessArrangement.getValue();
1568    }
1569
1570    /**
1571     * @param value The contract number of a business agreement which describes the terms and conditions.
1572     */
1573    public EligibilityRequest setBusinessArrangement(String value) { 
1574      if (Utilities.noString(value))
1575        this.businessArrangement = null;
1576      else {
1577        if (this.businessArrangement == null)
1578          this.businessArrangement = new StringType();
1579        this.businessArrangement.setValue(value);
1580      }
1581      return this;
1582    }
1583
1584    /**
1585     * @return {@link #benefitCategory} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
1586     */
1587    public CodeableConcept getBenefitCategory() { 
1588      if (this.benefitCategory == null)
1589        if (Configuration.errorOnAutoCreate())
1590          throw new Error("Attempt to auto-create EligibilityRequest.benefitCategory");
1591        else if (Configuration.doAutoCreate())
1592          this.benefitCategory = new CodeableConcept(); // cc
1593      return this.benefitCategory;
1594    }
1595
1596    public boolean hasBenefitCategory() { 
1597      return this.benefitCategory != null && !this.benefitCategory.isEmpty();
1598    }
1599
1600    /**
1601     * @param value {@link #benefitCategory} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
1602     */
1603    public EligibilityRequest setBenefitCategory(CodeableConcept value) { 
1604      this.benefitCategory = value;
1605      return this;
1606    }
1607
1608    /**
1609     * @return {@link #benefitSubCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
1610     */
1611    public CodeableConcept getBenefitSubCategory() { 
1612      if (this.benefitSubCategory == null)
1613        if (Configuration.errorOnAutoCreate())
1614          throw new Error("Attempt to auto-create EligibilityRequest.benefitSubCategory");
1615        else if (Configuration.doAutoCreate())
1616          this.benefitSubCategory = new CodeableConcept(); // cc
1617      return this.benefitSubCategory;
1618    }
1619
1620    public boolean hasBenefitSubCategory() { 
1621      return this.benefitSubCategory != null && !this.benefitSubCategory.isEmpty();
1622    }
1623
1624    /**
1625     * @param value {@link #benefitSubCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
1626     */
1627    public EligibilityRequest setBenefitSubCategory(CodeableConcept value) { 
1628      this.benefitSubCategory = value;
1629      return this;
1630    }
1631
1632    /**
1633     * @return {@link #authorization} (A list of billable services for which an authorization prior to service delivery may be required by the payor.)
1634     */
1635    public List<AuthorizationComponent> getAuthorization() { 
1636      if (this.authorization == null)
1637        this.authorization = new ArrayList<AuthorizationComponent>();
1638      return this.authorization;
1639    }
1640
1641    /**
1642     * @return Returns a reference to <code>this</code> for easy method chaining
1643     */
1644    public EligibilityRequest setAuthorization(List<AuthorizationComponent> theAuthorization) { 
1645      this.authorization = theAuthorization;
1646      return this;
1647    }
1648
1649    public boolean hasAuthorization() { 
1650      if (this.authorization == null)
1651        return false;
1652      for (AuthorizationComponent item : this.authorization)
1653        if (!item.isEmpty())
1654          return true;
1655      return false;
1656    }
1657
1658    public AuthorizationComponent addAuthorization() { //3
1659      AuthorizationComponent t = new AuthorizationComponent();
1660      if (this.authorization == null)
1661        this.authorization = new ArrayList<AuthorizationComponent>();
1662      this.authorization.add(t);
1663      return t;
1664    }
1665
1666    public EligibilityRequest addAuthorization(AuthorizationComponent t) { //3
1667      if (t == null)
1668        return this;
1669      if (this.authorization == null)
1670        this.authorization = new ArrayList<AuthorizationComponent>();
1671      this.authorization.add(t);
1672      return this;
1673    }
1674
1675    /**
1676     * @return The first repetition of repeating field {@link #authorization}, creating it if it does not already exist
1677     */
1678    public AuthorizationComponent getAuthorizationFirstRep() { 
1679      if (getAuthorization().isEmpty()) {
1680        addAuthorization();
1681      }
1682      return getAuthorization().get(0);
1683    }
1684
1685      protected void listChildren(List<Property> children) {
1686        super.listChildren(children);
1687        children.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
1688        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
1689        children.add(new Property("priority", "CodeableConcept", "Immediate (STAT), best effort (NORMAL), deferred (DEFER).", 0, 1, priority));
1690        children.add(new Property("patient", "Reference(Patient)", "Patient Resource.", 0, 1, patient));
1691        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));
1692        children.add(new Property("created", "dateTime", "The date when this resource was created.", 0, 1, created));
1693        children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Person who created the invoice/claim/pre-determination or pre-authorization.", 0, 1, enterer));
1694        children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, provider));
1695        children.add(new Property("insurer", "Reference(Organization)", "The Insurer who is target  of the request.", 0, 1, insurer));
1696        children.add(new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
1697        children.add(new Property("coverage", "Reference(Coverage)", "Financial instrument by which payment information for health care.", 0, 1, coverage));
1698        children.add(new Property("businessArrangement", "string", "The contract number of a business agreement which describes the terms and conditions.", 0, 1, businessArrangement));
1699        children.add(new Property("benefitCategory", "CodeableConcept", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, 1, benefitCategory));
1700        children.add(new Property("benefitSubCategory", "CodeableConcept", "Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.", 0, 1, benefitSubCategory));
1701        children.add(new Property("authorization", "", "A list of billable services for which an authorization prior to service delivery may be required by the payor.", 0, java.lang.Integer.MAX_VALUE, authorization));
1702      }
1703
1704      @Override
1705      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1706        switch (_hash) {
1707        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier);
1708        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
1709        case -1165461084: /*priority*/  return new Property("priority", "CodeableConcept", "Immediate (STAT), best effort (NORMAL), deferred (DEFER).", 0, 1, priority);
1710        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "Patient Resource.", 0, 1, patient);
1711        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);
1712        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);
1713        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);
1714        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);
1715        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date when this resource was created.", 0, 1, created);
1716        case -1591951995: /*enterer*/  return new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Person who created the invoice/claim/pre-determination or pre-authorization.", 0, 1, enterer);
1717        case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, provider);
1718        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The Insurer who is target  of the request.", 0, 1, insurer);
1719        case 501116579: /*facility*/  return new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility);
1720        case -351767064: /*coverage*/  return new Property("coverage", "Reference(Coverage)", "Financial instrument by which payment information for health care.", 0, 1, coverage);
1721        case 259920682: /*businessArrangement*/  return new Property("businessArrangement", "string", "The contract number of a business agreement which describes the terms and conditions.", 0, 1, businessArrangement);
1722        case -1023390027: /*benefitCategory*/  return new Property("benefitCategory", "CodeableConcept", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, 1, benefitCategory);
1723        case 1987878471: /*benefitSubCategory*/  return new Property("benefitSubCategory", "CodeableConcept", "Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.", 0, 1, benefitSubCategory);
1724        case -1385570183: /*authorization*/  return new Property("authorization", "", "A list of billable services for which an authorization prior to service delivery may be required by the payor.", 0, java.lang.Integer.MAX_VALUE, authorization);
1725        default: return super.getNamedProperty(_hash, _name, _checkValid);
1726        }
1727
1728      }
1729
1730      @Override
1731      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1732        switch (hash) {
1733        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1734        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<EligibilityRequestStatus>
1735        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
1736        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
1737        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
1738        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
1739        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
1740        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
1741        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
1742        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
1743        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
1744        case 259920682: /*businessArrangement*/ return this.businessArrangement == null ? new Base[0] : new Base[] {this.businessArrangement}; // StringType
1745        case -1023390027: /*benefitCategory*/ return this.benefitCategory == null ? new Base[0] : new Base[] {this.benefitCategory}; // CodeableConcept
1746        case 1987878471: /*benefitSubCategory*/ return this.benefitSubCategory == null ? new Base[0] : new Base[] {this.benefitSubCategory}; // CodeableConcept
1747        case -1385570183: /*authorization*/ return this.authorization == null ? new Base[0] : this.authorization.toArray(new Base[this.authorization.size()]); // AuthorizationComponent
1748        default: return super.getProperty(hash, name, checkValid);
1749        }
1750
1751      }
1752
1753      @Override
1754      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1755        switch (hash) {
1756        case -1618432855: // identifier
1757          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1758          return value;
1759        case -892481550: // status
1760          value = new EligibilityRequestStatusEnumFactory().fromType(castToCode(value));
1761          this.status = (Enumeration) value; // Enumeration<EligibilityRequestStatus>
1762          return value;
1763        case -1165461084: // priority
1764          this.priority = castToCodeableConcept(value); // CodeableConcept
1765          return value;
1766        case -791418107: // patient
1767          this.patient = castToReference(value); // Reference
1768          return value;
1769        case 1379209295: // serviced
1770          this.serviced = castToType(value); // Type
1771          return value;
1772        case 1028554472: // created
1773          this.created = castToDateTime(value); // DateTimeType
1774          return value;
1775        case -1591951995: // enterer
1776          this.enterer = castToReference(value); // Reference
1777          return value;
1778        case -987494927: // provider
1779          this.provider = castToReference(value); // Reference
1780          return value;
1781        case 1957615864: // insurer
1782          this.insurer = castToReference(value); // Reference
1783          return value;
1784        case 501116579: // facility
1785          this.facility = castToReference(value); // Reference
1786          return value;
1787        case -351767064: // coverage
1788          this.coverage = castToReference(value); // Reference
1789          return value;
1790        case 259920682: // businessArrangement
1791          this.businessArrangement = castToString(value); // StringType
1792          return value;
1793        case -1023390027: // benefitCategory
1794          this.benefitCategory = castToCodeableConcept(value); // CodeableConcept
1795          return value;
1796        case 1987878471: // benefitSubCategory
1797          this.benefitSubCategory = castToCodeableConcept(value); // CodeableConcept
1798          return value;
1799        case -1385570183: // authorization
1800          this.getAuthorization().add((AuthorizationComponent) value); // AuthorizationComponent
1801          return value;
1802        default: return super.setProperty(hash, name, value);
1803        }
1804
1805      }
1806
1807      @Override
1808      public Base setProperty(String name, Base value) throws FHIRException {
1809        if (name.equals("identifier")) {
1810          this.getIdentifier().add(castToIdentifier(value));
1811        } else if (name.equals("status")) {
1812          value = new EligibilityRequestStatusEnumFactory().fromType(castToCode(value));
1813          this.status = (Enumeration) value; // Enumeration<EligibilityRequestStatus>
1814        } else if (name.equals("priority")) {
1815          this.priority = castToCodeableConcept(value); // CodeableConcept
1816        } else if (name.equals("patient")) {
1817          this.patient = castToReference(value); // Reference
1818        } else if (name.equals("serviced[x]")) {
1819          this.serviced = castToType(value); // Type
1820        } else if (name.equals("created")) {
1821          this.created = castToDateTime(value); // DateTimeType
1822        } else if (name.equals("enterer")) {
1823          this.enterer = castToReference(value); // Reference
1824        } else if (name.equals("provider")) {
1825          this.provider = castToReference(value); // Reference
1826        } else if (name.equals("insurer")) {
1827          this.insurer = castToReference(value); // Reference
1828        } else if (name.equals("facility")) {
1829          this.facility = castToReference(value); // Reference
1830        } else if (name.equals("coverage")) {
1831          this.coverage = castToReference(value); // Reference
1832        } else if (name.equals("businessArrangement")) {
1833          this.businessArrangement = castToString(value); // StringType
1834        } else if (name.equals("benefitCategory")) {
1835          this.benefitCategory = castToCodeableConcept(value); // CodeableConcept
1836        } else if (name.equals("benefitSubCategory")) {
1837          this.benefitSubCategory = castToCodeableConcept(value); // CodeableConcept
1838        } else if (name.equals("authorization")) {
1839          this.getAuthorization().add((AuthorizationComponent) value);
1840        } else
1841          return super.setProperty(name, value);
1842        return value;
1843      }
1844
1845      @Override
1846      public Base makeProperty(int hash, String name) throws FHIRException {
1847        switch (hash) {
1848        case -1618432855:  return addIdentifier(); 
1849        case -892481550:  return getStatusElement();
1850        case -1165461084:  return getPriority(); 
1851        case -791418107:  return getPatient(); 
1852        case -1927922223:  return getServiced(); 
1853        case 1379209295:  return getServiced(); 
1854        case 1028554472:  return getCreatedElement();
1855        case -1591951995:  return getEnterer(); 
1856        case -987494927:  return getProvider(); 
1857        case 1957615864:  return getInsurer(); 
1858        case 501116579:  return getFacility(); 
1859        case -351767064:  return getCoverage(); 
1860        case 259920682:  return getBusinessArrangementElement();
1861        case -1023390027:  return getBenefitCategory(); 
1862        case 1987878471:  return getBenefitSubCategory(); 
1863        case -1385570183:  return addAuthorization(); 
1864        default: return super.makeProperty(hash, name);
1865        }
1866
1867      }
1868
1869      @Override
1870      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1871        switch (hash) {
1872        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1873        case -892481550: /*status*/ return new String[] {"code"};
1874        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
1875        case -791418107: /*patient*/ return new String[] {"Reference"};
1876        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
1877        case 1028554472: /*created*/ return new String[] {"dateTime"};
1878        case -1591951995: /*enterer*/ return new String[] {"Reference"};
1879        case -987494927: /*provider*/ return new String[] {"Reference"};
1880        case 1957615864: /*insurer*/ return new String[] {"Reference"};
1881        case 501116579: /*facility*/ return new String[] {"Reference"};
1882        case -351767064: /*coverage*/ return new String[] {"Reference"};
1883        case 259920682: /*businessArrangement*/ return new String[] {"string"};
1884        case -1023390027: /*benefitCategory*/ return new String[] {"CodeableConcept"};
1885        case 1987878471: /*benefitSubCategory*/ return new String[] {"CodeableConcept"};
1886        case -1385570183: /*authorization*/ return new String[] {};
1887        default: return super.getTypesForProperty(hash, name);
1888        }
1889
1890      }
1891
1892      @Override
1893      public Base addChild(String name) throws FHIRException {
1894        if (name.equals("identifier")) {
1895          return addIdentifier();
1896        }
1897        else if (name.equals("status")) {
1898          throw new FHIRException("Cannot call addChild on a primitive type EligibilityRequest.status");
1899        }
1900        else if (name.equals("priority")) {
1901          this.priority = new CodeableConcept();
1902          return this.priority;
1903        }
1904        else if (name.equals("patient")) {
1905          this.patient = new Reference();
1906          return this.patient;
1907        }
1908        else if (name.equals("servicedDate")) {
1909          this.serviced = new DateType();
1910          return this.serviced;
1911        }
1912        else if (name.equals("servicedPeriod")) {
1913          this.serviced = new Period();
1914          return this.serviced;
1915        }
1916        else if (name.equals("created")) {
1917          throw new FHIRException("Cannot call addChild on a primitive type EligibilityRequest.created");
1918        }
1919        else if (name.equals("enterer")) {
1920          this.enterer = new Reference();
1921          return this.enterer;
1922        }
1923        else if (name.equals("provider")) {
1924          this.provider = new Reference();
1925          return this.provider;
1926        }
1927        else if (name.equals("insurer")) {
1928          this.insurer = new Reference();
1929          return this.insurer;
1930        }
1931        else if (name.equals("facility")) {
1932          this.facility = new Reference();
1933          return this.facility;
1934        }
1935        else if (name.equals("coverage")) {
1936          this.coverage = new Reference();
1937          return this.coverage;
1938        }
1939        else if (name.equals("businessArrangement")) {
1940          throw new FHIRException("Cannot call addChild on a primitive type EligibilityRequest.businessArrangement");
1941        }
1942        else if (name.equals("benefitCategory")) {
1943          this.benefitCategory = new CodeableConcept();
1944          return this.benefitCategory;
1945        }
1946        else if (name.equals("benefitSubCategory")) {
1947          this.benefitSubCategory = new CodeableConcept();
1948          return this.benefitSubCategory;
1949        }
1950        else if (name.equals("authorization")) {
1951          return addAuthorization();
1952        }
1953        else
1954          return super.addChild(name);
1955      }
1956
1957  public String fhirType() {
1958    return "EligibilityRequest";
1959
1960  }
1961
1962      public EligibilityRequest copy() {
1963        EligibilityRequest dst = new EligibilityRequest();
1964        copyValues(dst);
1965        if (identifier != null) {
1966          dst.identifier = new ArrayList<Identifier>();
1967          for (Identifier i : identifier)
1968            dst.identifier.add(i.copy());
1969        };
1970        dst.status = status == null ? null : status.copy();
1971        dst.priority = priority == null ? null : priority.copy();
1972        dst.patient = patient == null ? null : patient.copy();
1973        dst.serviced = serviced == null ? null : serviced.copy();
1974        dst.created = created == null ? null : created.copy();
1975        dst.enterer = enterer == null ? null : enterer.copy();
1976        dst.provider = provider == null ? null : provider.copy();
1977        dst.insurer = insurer == null ? null : insurer.copy();
1978        dst.facility = facility == null ? null : facility.copy();
1979        dst.coverage = coverage == null ? null : coverage.copy();
1980        dst.businessArrangement = businessArrangement == null ? null : businessArrangement.copy();
1981        dst.benefitCategory = benefitCategory == null ? null : benefitCategory.copy();
1982        dst.benefitSubCategory = benefitSubCategory == null ? null : benefitSubCategory.copy();
1983        if (authorization != null) {
1984          dst.authorization = new ArrayList<AuthorizationComponent>();
1985          for (AuthorizationComponent i : authorization)
1986            dst.authorization.add(i.copy());
1987        };
1988        return dst;
1989      }
1990
1991      protected EligibilityRequest typedCopy() {
1992        return copy();
1993      }
1994
1995      @Override
1996      public boolean equalsDeep(Base other_) {
1997        if (!super.equalsDeep(other_))
1998          return false;
1999        if (!(other_ instanceof EligibilityRequest))
2000          return false;
2001        EligibilityRequest o = (EligibilityRequest) other_;
2002        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(priority, o.priority, true)
2003           && compareDeep(patient, o.patient, true) && compareDeep(serviced, o.serviced, true) && compareDeep(created, o.created, true)
2004           && compareDeep(enterer, o.enterer, true) && compareDeep(provider, o.provider, true) && compareDeep(insurer, o.insurer, true)
2005           && compareDeep(facility, o.facility, true) && compareDeep(coverage, o.coverage, true) && compareDeep(businessArrangement, o.businessArrangement, true)
2006           && compareDeep(benefitCategory, o.benefitCategory, true) && compareDeep(benefitSubCategory, o.benefitSubCategory, true)
2007           && compareDeep(authorization, o.authorization, true);
2008      }
2009
2010      @Override
2011      public boolean equalsShallow(Base other_) {
2012        if (!super.equalsShallow(other_))
2013          return false;
2014        if (!(other_ instanceof EligibilityRequest))
2015          return false;
2016        EligibilityRequest o = (EligibilityRequest) other_;
2017        return compareValues(status, o.status, true) && compareValues(created, o.created, true) && compareValues(businessArrangement, o.businessArrangement, true)
2018          ;
2019      }
2020
2021      public boolean isEmpty() {
2022        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, priority
2023          , patient, serviced, created, enterer, provider, insurer, facility, coverage
2024          , businessArrangement, benefitCategory, benefitSubCategory, authorization);
2025      }
2026
2027  @Override
2028  public ResourceType getResourceType() {
2029    return ResourceType.EligibilityRequest;
2030   }
2031
2032 /**
2033   * Search parameter: <b>identifier</b>
2034   * <p>
2035   * Description: <b>The business identifier of the Eligibility</b><br>
2036   * Type: <b>token</b><br>
2037   * Path: <b>EligibilityRequest.identifier</b><br>
2038   * </p>
2039   */
2040  @SearchParamDefinition(name="identifier", path="EligibilityRequest.identifier", description="The business identifier of the Eligibility", type="token" )
2041  public static final String SP_IDENTIFIER = "identifier";
2042 /**
2043   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2044   * <p>
2045   * Description: <b>The business identifier of the Eligibility</b><br>
2046   * Type: <b>token</b><br>
2047   * Path: <b>EligibilityRequest.identifier</b><br>
2048   * </p>
2049   */
2050  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2051
2052 /**
2053   * Search parameter: <b>provider</b>
2054   * <p>
2055   * Description: <b>The reference to the provider</b><br>
2056   * Type: <b>reference</b><br>
2057   * Path: <b>EligibilityRequest.provider</b><br>
2058   * </p>
2059   */
2060  @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={Organization.class, Practitioner.class, PractitionerRole.class } )
2061  public static final String SP_PROVIDER = "provider";
2062 /**
2063   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
2064   * <p>
2065   * Description: <b>The reference to the provider</b><br>
2066   * Type: <b>reference</b><br>
2067   * Path: <b>EligibilityRequest.provider</b><br>
2068   * </p>
2069   */
2070  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
2071
2072/**
2073   * Constant for fluent queries to be used to add include statements. Specifies
2074   * the path value of "<b>EligibilityRequest:provider</b>".
2075   */
2076  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("EligibilityRequest:provider").toLocked();
2077
2078 /**
2079   * Search parameter: <b>patient</b>
2080   * <p>
2081   * Description: <b>The reference to the patient</b><br>
2082   * Type: <b>reference</b><br>
2083   * Path: <b>EligibilityRequest.patient</b><br>
2084   * </p>
2085   */
2086  @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 } )
2087  public static final String SP_PATIENT = "patient";
2088 /**
2089   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2090   * <p>
2091   * Description: <b>The reference to the patient</b><br>
2092   * Type: <b>reference</b><br>
2093   * Path: <b>EligibilityRequest.patient</b><br>
2094   * </p>
2095   */
2096  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2097
2098/**
2099   * Constant for fluent queries to be used to add include statements. Specifies
2100   * the path value of "<b>EligibilityRequest:patient</b>".
2101   */
2102  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("EligibilityRequest:patient").toLocked();
2103
2104 /**
2105   * Search parameter: <b>created</b>
2106   * <p>
2107   * Description: <b>The creation date for the EOB</b><br>
2108   * Type: <b>date</b><br>
2109   * Path: <b>EligibilityRequest.created</b><br>
2110   * </p>
2111   */
2112  @SearchParamDefinition(name="created", path="EligibilityRequest.created", description="The creation date for the EOB", type="date" )
2113  public static final String SP_CREATED = "created";
2114 /**
2115   * <b>Fluent Client</b> search parameter constant for <b>created</b>
2116   * <p>
2117   * Description: <b>The creation date for the EOB</b><br>
2118   * Type: <b>date</b><br>
2119   * Path: <b>EligibilityRequest.created</b><br>
2120   * </p>
2121   */
2122  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
2123
2124 /**
2125   * Search parameter: <b>enterer</b>
2126   * <p>
2127   * Description: <b>The party who is responsible for the request</b><br>
2128   * Type: <b>reference</b><br>
2129   * Path: <b>EligibilityRequest.enterer</b><br>
2130   * </p>
2131   */
2132  @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, PractitionerRole.class } )
2133  public static final String SP_ENTERER = "enterer";
2134 /**
2135   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
2136   * <p>
2137   * Description: <b>The party who is responsible for the request</b><br>
2138   * Type: <b>reference</b><br>
2139   * Path: <b>EligibilityRequest.enterer</b><br>
2140   * </p>
2141   */
2142  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
2143
2144/**
2145   * Constant for fluent queries to be used to add include statements. Specifies
2146   * the path value of "<b>EligibilityRequest:enterer</b>".
2147   */
2148  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("EligibilityRequest:enterer").toLocked();
2149
2150 /**
2151   * Search parameter: <b>facility</b>
2152   * <p>
2153   * Description: <b>Facility responsible for the goods and services</b><br>
2154   * Type: <b>reference</b><br>
2155   * Path: <b>EligibilityRequest.facility</b><br>
2156   * </p>
2157   */
2158  @SearchParamDefinition(name="facility", path="EligibilityRequest.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class } )
2159  public static final String SP_FACILITY = "facility";
2160 /**
2161   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
2162   * <p>
2163   * Description: <b>Facility responsible for the goods and services</b><br>
2164   * Type: <b>reference</b><br>
2165   * Path: <b>EligibilityRequest.facility</b><br>
2166   * </p>
2167   */
2168  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
2169
2170/**
2171   * Constant for fluent queries to be used to add include statements. Specifies
2172   * the path value of "<b>EligibilityRequest:facility</b>".
2173   */
2174  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("EligibilityRequest:facility").toLocked();
2175
2176 /**
2177   * Search parameter: <b>status</b>
2178   * <p>
2179   * Description: <b>The status of the EligibilityRequest</b><br>
2180   * Type: <b>token</b><br>
2181   * Path: <b>EligibilityRequest.status</b><br>
2182   * </p>
2183   */
2184  @SearchParamDefinition(name="status", path="EligibilityRequest.status", description="The status of the EligibilityRequest", type="token" )
2185  public static final String SP_STATUS = "status";
2186 /**
2187   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2188   * <p>
2189   * Description: <b>The status of the EligibilityRequest</b><br>
2190   * Type: <b>token</b><br>
2191   * Path: <b>EligibilityRequest.status</b><br>
2192   * </p>
2193   */
2194  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2195
2196
2197}
2198