001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import org.hl7.fhir.dstu3.model.Enumerations.*;
038import ca.uhn.fhir.model.api.annotation.ResourceDef;
039import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.ChildOrder;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.Block;
044import org.hl7.fhir.instance.model.api.*;
045import org.hl7.fhir.exceptions.FHIRException;
046import org.hl7.fhir.exceptions.FHIRFormatError;
047/**
048 * This resource provides eligibility and plan details from the processing of an Eligibility resource.
049 */
050@ResourceDef(name="EligibilityResponse", profile="http://hl7.org/fhir/StructureDefinition/EligibilityResponse")
051public class EligibilityResponse extends DomainResource {
052
053    public enum EligibilityResponseStatus {
054        /**
055         * The instance is currently in-force.
056         */
057        ACTIVE, 
058        /**
059         * The instance is withdrawn, rescinded or reversed.
060         */
061        CANCELLED, 
062        /**
063         * A new instance the contents of which is not complete.
064         */
065        DRAFT, 
066        /**
067         * The instance was entered in error.
068         */
069        ENTEREDINERROR, 
070        /**
071         * added to help the parsers with the generic types
072         */
073        NULL;
074        public static EligibilityResponseStatus fromCode(String codeString) throws FHIRException {
075            if (codeString == null || "".equals(codeString))
076                return null;
077        if ("active".equals(codeString))
078          return ACTIVE;
079        if ("cancelled".equals(codeString))
080          return CANCELLED;
081        if ("draft".equals(codeString))
082          return DRAFT;
083        if ("entered-in-error".equals(codeString))
084          return ENTEREDINERROR;
085        if (Configuration.isAcceptInvalidEnums())
086          return null;
087        else
088          throw new FHIRException("Unknown EligibilityResponseStatus code '"+codeString+"'");
089        }
090        public String toCode() {
091          switch (this) {
092            case ACTIVE: return "active";
093            case CANCELLED: return "cancelled";
094            case DRAFT: return "draft";
095            case ENTEREDINERROR: return "entered-in-error";
096            default: return "?";
097          }
098        }
099        public String getSystem() {
100          switch (this) {
101            case ACTIVE: return "http://hl7.org/fhir/fm-status";
102            case CANCELLED: return "http://hl7.org/fhir/fm-status";
103            case DRAFT: return "http://hl7.org/fhir/fm-status";
104            case ENTEREDINERROR: return "http://hl7.org/fhir/fm-status";
105            default: return "?";
106          }
107        }
108        public String getDefinition() {
109          switch (this) {
110            case ACTIVE: return "The instance is currently in-force.";
111            case CANCELLED: return "The instance is withdrawn, rescinded or reversed.";
112            case DRAFT: return "A new instance the contents of which is not complete.";
113            case ENTEREDINERROR: return "The instance was entered in error.";
114            default: return "?";
115          }
116        }
117        public String getDisplay() {
118          switch (this) {
119            case ACTIVE: return "Active";
120            case CANCELLED: return "Cancelled";
121            case DRAFT: return "Draft";
122            case ENTEREDINERROR: return "Entered in Error";
123            default: return "?";
124          }
125        }
126    }
127
128  public static class EligibilityResponseStatusEnumFactory implements EnumFactory<EligibilityResponseStatus> {
129    public EligibilityResponseStatus fromCode(String codeString) throws IllegalArgumentException {
130      if (codeString == null || "".equals(codeString))
131            if (codeString == null || "".equals(codeString))
132                return null;
133        if ("active".equals(codeString))
134          return EligibilityResponseStatus.ACTIVE;
135        if ("cancelled".equals(codeString))
136          return EligibilityResponseStatus.CANCELLED;
137        if ("draft".equals(codeString))
138          return EligibilityResponseStatus.DRAFT;
139        if ("entered-in-error".equals(codeString))
140          return EligibilityResponseStatus.ENTEREDINERROR;
141        throw new IllegalArgumentException("Unknown EligibilityResponseStatus code '"+codeString+"'");
142        }
143        public Enumeration<EligibilityResponseStatus> fromType(Base code) throws FHIRException {
144          if (code == null)
145            return null;
146          if (code.isEmpty())
147            return new Enumeration<EligibilityResponseStatus>(this);
148          String codeString = ((PrimitiveType) code).asStringValue();
149          if (codeString == null || "".equals(codeString))
150            return null;
151        if ("active".equals(codeString))
152          return new Enumeration<EligibilityResponseStatus>(this, EligibilityResponseStatus.ACTIVE);
153        if ("cancelled".equals(codeString))
154          return new Enumeration<EligibilityResponseStatus>(this, EligibilityResponseStatus.CANCELLED);
155        if ("draft".equals(codeString))
156          return new Enumeration<EligibilityResponseStatus>(this, EligibilityResponseStatus.DRAFT);
157        if ("entered-in-error".equals(codeString))
158          return new Enumeration<EligibilityResponseStatus>(this, EligibilityResponseStatus.ENTEREDINERROR);
159        throw new FHIRException("Unknown EligibilityResponseStatus code '"+codeString+"'");
160        }
161    public String toCode(EligibilityResponseStatus code) {
162      if (code == EligibilityResponseStatus.ACTIVE)
163        return "active";
164      if (code == EligibilityResponseStatus.CANCELLED)
165        return "cancelled";
166      if (code == EligibilityResponseStatus.DRAFT)
167        return "draft";
168      if (code == EligibilityResponseStatus.ENTEREDINERROR)
169        return "entered-in-error";
170      return "?";
171      }
172    public String toSystem(EligibilityResponseStatus code) {
173      return code.getSystem();
174      }
175    }
176
177    @Block()
178    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
179        /**
180         * A suite of updated or additional Coverages from the Insurer.
181         */
182        @Child(name = "coverage", type = {Coverage.class}, order=1, min=0, max=1, modifier=false, summary=false)
183        @Description(shortDefinition="Updated Coverage details", formalDefinition="A suite of updated or additional Coverages from the Insurer." )
184        protected Reference coverage;
185
186        /**
187         * The actual object that is the target of the reference (A suite of updated or additional Coverages from the Insurer.)
188         */
189        protected Coverage coverageTarget;
190
191        /**
192         * The contract resource which may provide more detailed information.
193         */
194        @Child(name = "contract", type = {Contract.class}, order=2, min=0, max=1, modifier=false, summary=false)
195        @Description(shortDefinition="Contract details", formalDefinition="The contract resource which may provide more detailed information." )
196        protected Reference contract;
197
198        /**
199         * The actual object that is the target of the reference (The contract resource which may provide more detailed information.)
200         */
201        protected Contract contractTarget;
202
203        /**
204         * Benefits and optionally current balances by Category.
205         */
206        @Child(name = "benefitBalance", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
207        @Description(shortDefinition="Benefits by Category", formalDefinition="Benefits and optionally current balances by Category." )
208        protected List<BenefitsComponent> benefitBalance;
209
210        private static final long serialVersionUID = 821384102L;
211
212    /**
213     * Constructor
214     */
215      public InsuranceComponent() {
216        super();
217      }
218
219        /**
220         * @return {@link #coverage} (A suite of updated or additional Coverages from the Insurer.)
221         */
222        public Reference getCoverage() { 
223          if (this.coverage == null)
224            if (Configuration.errorOnAutoCreate())
225              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
226            else if (Configuration.doAutoCreate())
227              this.coverage = new Reference(); // cc
228          return this.coverage;
229        }
230
231        public boolean hasCoverage() { 
232          return this.coverage != null && !this.coverage.isEmpty();
233        }
234
235        /**
236         * @param value {@link #coverage} (A suite of updated or additional Coverages from the Insurer.)
237         */
238        public InsuranceComponent setCoverage(Reference value)  { 
239          this.coverage = value;
240          return this;
241        }
242
243        /**
244         * @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. (A suite of updated or additional Coverages from the Insurer.)
245         */
246        public Coverage getCoverageTarget() { 
247          if (this.coverageTarget == null)
248            if (Configuration.errorOnAutoCreate())
249              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
250            else if (Configuration.doAutoCreate())
251              this.coverageTarget = new Coverage(); // aa
252          return this.coverageTarget;
253        }
254
255        /**
256         * @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. (A suite of updated or additional Coverages from the Insurer.)
257         */
258        public InsuranceComponent setCoverageTarget(Coverage value) { 
259          this.coverageTarget = value;
260          return this;
261        }
262
263        /**
264         * @return {@link #contract} (The contract resource which may provide more detailed information.)
265         */
266        public Reference getContract() { 
267          if (this.contract == null)
268            if (Configuration.errorOnAutoCreate())
269              throw new Error("Attempt to auto-create InsuranceComponent.contract");
270            else if (Configuration.doAutoCreate())
271              this.contract = new Reference(); // cc
272          return this.contract;
273        }
274
275        public boolean hasContract() { 
276          return this.contract != null && !this.contract.isEmpty();
277        }
278
279        /**
280         * @param value {@link #contract} (The contract resource which may provide more detailed information.)
281         */
282        public InsuranceComponent setContract(Reference value)  { 
283          this.contract = value;
284          return this;
285        }
286
287        /**
288         * @return {@link #contract} 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 contract resource which may provide more detailed information.)
289         */
290        public Contract getContractTarget() { 
291          if (this.contractTarget == null)
292            if (Configuration.errorOnAutoCreate())
293              throw new Error("Attempt to auto-create InsuranceComponent.contract");
294            else if (Configuration.doAutoCreate())
295              this.contractTarget = new Contract(); // aa
296          return this.contractTarget;
297        }
298
299        /**
300         * @param value {@link #contract} 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 contract resource which may provide more detailed information.)
301         */
302        public InsuranceComponent setContractTarget(Contract value) { 
303          this.contractTarget = value;
304          return this;
305        }
306
307        /**
308         * @return {@link #benefitBalance} (Benefits and optionally current balances by Category.)
309         */
310        public List<BenefitsComponent> getBenefitBalance() { 
311          if (this.benefitBalance == null)
312            this.benefitBalance = new ArrayList<BenefitsComponent>();
313          return this.benefitBalance;
314        }
315
316        /**
317         * @return Returns a reference to <code>this</code> for easy method chaining
318         */
319        public InsuranceComponent setBenefitBalance(List<BenefitsComponent> theBenefitBalance) { 
320          this.benefitBalance = theBenefitBalance;
321          return this;
322        }
323
324        public boolean hasBenefitBalance() { 
325          if (this.benefitBalance == null)
326            return false;
327          for (BenefitsComponent item : this.benefitBalance)
328            if (!item.isEmpty())
329              return true;
330          return false;
331        }
332
333        public BenefitsComponent addBenefitBalance() { //3
334          BenefitsComponent t = new BenefitsComponent();
335          if (this.benefitBalance == null)
336            this.benefitBalance = new ArrayList<BenefitsComponent>();
337          this.benefitBalance.add(t);
338          return t;
339        }
340
341        public InsuranceComponent addBenefitBalance(BenefitsComponent t) { //3
342          if (t == null)
343            return this;
344          if (this.benefitBalance == null)
345            this.benefitBalance = new ArrayList<BenefitsComponent>();
346          this.benefitBalance.add(t);
347          return this;
348        }
349
350        /**
351         * @return The first repetition of repeating field {@link #benefitBalance}, creating it if it does not already exist
352         */
353        public BenefitsComponent getBenefitBalanceFirstRep() { 
354          if (getBenefitBalance().isEmpty()) {
355            addBenefitBalance();
356          }
357          return getBenefitBalance().get(0);
358        }
359
360        protected void listChildren(List<Property> children) {
361          super.listChildren(children);
362          children.add(new Property("coverage", "Reference(Coverage)", "A suite of updated or additional Coverages from the Insurer.", 0, 1, coverage));
363          children.add(new Property("contract", "Reference(Contract)", "The contract resource which may provide more detailed information.", 0, 1, contract));
364          children.add(new Property("benefitBalance", "", "Benefits and optionally current balances by Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
365        }
366
367        @Override
368        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
369          switch (_hash) {
370          case -351767064: /*coverage*/  return new Property("coverage", "Reference(Coverage)", "A suite of updated or additional Coverages from the Insurer.", 0, 1, coverage);
371          case -566947566: /*contract*/  return new Property("contract", "Reference(Contract)", "The contract resource which may provide more detailed information.", 0, 1, contract);
372          case 596003397: /*benefitBalance*/  return new Property("benefitBalance", "", "Benefits and optionally current balances by Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance);
373          default: return super.getNamedProperty(_hash, _name, _checkValid);
374          }
375
376        }
377
378      @Override
379      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
380        switch (hash) {
381        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
382        case -566947566: /*contract*/ return this.contract == null ? new Base[0] : new Base[] {this.contract}; // Reference
383        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitsComponent
384        default: return super.getProperty(hash, name, checkValid);
385        }
386
387      }
388
389      @Override
390      public Base setProperty(int hash, String name, Base value) throws FHIRException {
391        switch (hash) {
392        case -351767064: // coverage
393          this.coverage = castToReference(value); // Reference
394          return value;
395        case -566947566: // contract
396          this.contract = castToReference(value); // Reference
397          return value;
398        case 596003397: // benefitBalance
399          this.getBenefitBalance().add((BenefitsComponent) value); // BenefitsComponent
400          return value;
401        default: return super.setProperty(hash, name, value);
402        }
403
404      }
405
406      @Override
407      public Base setProperty(String name, Base value) throws FHIRException {
408        if (name.equals("coverage")) {
409          this.coverage = castToReference(value); // Reference
410        } else if (name.equals("contract")) {
411          this.contract = castToReference(value); // Reference
412        } else if (name.equals("benefitBalance")) {
413          this.getBenefitBalance().add((BenefitsComponent) value);
414        } else
415          return super.setProperty(name, value);
416        return value;
417      }
418
419      @Override
420      public Base makeProperty(int hash, String name) throws FHIRException {
421        switch (hash) {
422        case -351767064:  return getCoverage(); 
423        case -566947566:  return getContract(); 
424        case 596003397:  return addBenefitBalance(); 
425        default: return super.makeProperty(hash, name);
426        }
427
428      }
429
430      @Override
431      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
432        switch (hash) {
433        case -351767064: /*coverage*/ return new String[] {"Reference"};
434        case -566947566: /*contract*/ return new String[] {"Reference"};
435        case 596003397: /*benefitBalance*/ return new String[] {};
436        default: return super.getTypesForProperty(hash, name);
437        }
438
439      }
440
441      @Override
442      public Base addChild(String name) throws FHIRException {
443        if (name.equals("coverage")) {
444          this.coverage = new Reference();
445          return this.coverage;
446        }
447        else if (name.equals("contract")) {
448          this.contract = new Reference();
449          return this.contract;
450        }
451        else if (name.equals("benefitBalance")) {
452          return addBenefitBalance();
453        }
454        else
455          return super.addChild(name);
456      }
457
458      public InsuranceComponent copy() {
459        InsuranceComponent dst = new InsuranceComponent();
460        copyValues(dst);
461        dst.coverage = coverage == null ? null : coverage.copy();
462        dst.contract = contract == null ? null : contract.copy();
463        if (benefitBalance != null) {
464          dst.benefitBalance = new ArrayList<BenefitsComponent>();
465          for (BenefitsComponent i : benefitBalance)
466            dst.benefitBalance.add(i.copy());
467        };
468        return dst;
469      }
470
471      @Override
472      public boolean equalsDeep(Base other_) {
473        if (!super.equalsDeep(other_))
474          return false;
475        if (!(other_ instanceof InsuranceComponent))
476          return false;
477        InsuranceComponent o = (InsuranceComponent) other_;
478        return compareDeep(coverage, o.coverage, true) && compareDeep(contract, o.contract, true) && compareDeep(benefitBalance, o.benefitBalance, true)
479          ;
480      }
481
482      @Override
483      public boolean equalsShallow(Base other_) {
484        if (!super.equalsShallow(other_))
485          return false;
486        if (!(other_ instanceof InsuranceComponent))
487          return false;
488        InsuranceComponent o = (InsuranceComponent) other_;
489        return true;
490      }
491
492      public boolean isEmpty() {
493        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(coverage, contract, benefitBalance
494          );
495      }
496
497  public String fhirType() {
498    return "EligibilityResponse.insurance";
499
500  }
501
502  }
503
504    @Block()
505    public static class BenefitsComponent extends BackboneElement implements IBaseBackboneElement {
506        /**
507         * Dental, Vision, Medical, Pharmacy, Rehab etc.
508         */
509        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
510        @Description(shortDefinition="Type of services covered", formalDefinition="Dental, Vision, Medical, Pharmacy, Rehab etc." )
511        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-category")
512        protected CodeableConcept category;
513
514        /**
515         * Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.
516         */
517        @Child(name = "subCategory", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
518        @Description(shortDefinition="Detailed services covered within the type", formalDefinition="Dental: basic, major, ortho; Vision exam, glasses, contacts; etc." )
519        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
520        protected CodeableConcept subCategory;
521
522        /**
523         * True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.
524         */
525        @Child(name = "excluded", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
526        @Description(shortDefinition="Excluded from the plan", formalDefinition="True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage." )
527        protected BooleanType excluded;
528
529        /**
530         * A short name or tag for the benefit, for example MED01, or DENT2.
531         */
532        @Child(name = "name", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
533        @Description(shortDefinition="Short name for the benefit", formalDefinition="A short name or tag for the benefit, for example MED01, or DENT2." )
534        protected StringType name;
535
536        /**
537         * A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.
538         */
539        @Child(name = "description", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
540        @Description(shortDefinition="Description of the benefit or services covered", formalDefinition="A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'." )
541        protected StringType description;
542
543        /**
544         * Network designation.
545         */
546        @Child(name = "network", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
547        @Description(shortDefinition="In or out of network", formalDefinition="Network designation." )
548        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-network")
549        protected CodeableConcept network;
550
551        /**
552         * Unit designation: individual or family.
553         */
554        @Child(name = "unit", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
555        @Description(shortDefinition="Individual or family", formalDefinition="Unit designation: individual or family." )
556        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-unit")
557        protected CodeableConcept unit;
558
559        /**
560         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.
561         */
562        @Child(name = "term", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
563        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'." )
564        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-term")
565        protected CodeableConcept term;
566
567        /**
568         * Benefits Used to date.
569         */
570        @Child(name = "financial", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
571        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
572        protected List<BenefitComponent> financial;
573
574        private static final long serialVersionUID = 833826021L;
575
576    /**
577     * Constructor
578     */
579      public BenefitsComponent() {
580        super();
581      }
582
583    /**
584     * Constructor
585     */
586      public BenefitsComponent(CodeableConcept category) {
587        super();
588        this.category = category;
589      }
590
591        /**
592         * @return {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
593         */
594        public CodeableConcept getCategory() { 
595          if (this.category == null)
596            if (Configuration.errorOnAutoCreate())
597              throw new Error("Attempt to auto-create BenefitsComponent.category");
598            else if (Configuration.doAutoCreate())
599              this.category = new CodeableConcept(); // cc
600          return this.category;
601        }
602
603        public boolean hasCategory() { 
604          return this.category != null && !this.category.isEmpty();
605        }
606
607        /**
608         * @param value {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
609         */
610        public BenefitsComponent setCategory(CodeableConcept value)  { 
611          this.category = value;
612          return this;
613        }
614
615        /**
616         * @return {@link #subCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
617         */
618        public CodeableConcept getSubCategory() { 
619          if (this.subCategory == null)
620            if (Configuration.errorOnAutoCreate())
621              throw new Error("Attempt to auto-create BenefitsComponent.subCategory");
622            else if (Configuration.doAutoCreate())
623              this.subCategory = new CodeableConcept(); // cc
624          return this.subCategory;
625        }
626
627        public boolean hasSubCategory() { 
628          return this.subCategory != null && !this.subCategory.isEmpty();
629        }
630
631        /**
632         * @param value {@link #subCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
633         */
634        public BenefitsComponent setSubCategory(CodeableConcept value)  { 
635          this.subCategory = value;
636          return this;
637        }
638
639        /**
640         * @return {@link #excluded} (True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.). This is the underlying object with id, value and extensions. The accessor "getExcluded" gives direct access to the value
641         */
642        public BooleanType getExcludedElement() { 
643          if (this.excluded == null)
644            if (Configuration.errorOnAutoCreate())
645              throw new Error("Attempt to auto-create BenefitsComponent.excluded");
646            else if (Configuration.doAutoCreate())
647              this.excluded = new BooleanType(); // bb
648          return this.excluded;
649        }
650
651        public boolean hasExcludedElement() { 
652          return this.excluded != null && !this.excluded.isEmpty();
653        }
654
655        public boolean hasExcluded() { 
656          return this.excluded != null && !this.excluded.isEmpty();
657        }
658
659        /**
660         * @param value {@link #excluded} (True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.). This is the underlying object with id, value and extensions. The accessor "getExcluded" gives direct access to the value
661         */
662        public BenefitsComponent setExcludedElement(BooleanType value) { 
663          this.excluded = value;
664          return this;
665        }
666
667        /**
668         * @return True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.
669         */
670        public boolean getExcluded() { 
671          return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
672        }
673
674        /**
675         * @param value True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.
676         */
677        public BenefitsComponent setExcluded(boolean value) { 
678            if (this.excluded == null)
679              this.excluded = new BooleanType();
680            this.excluded.setValue(value);
681          return this;
682        }
683
684        /**
685         * @return {@link #name} (A short name or tag for the benefit, for example MED01, or DENT2.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
686         */
687        public StringType getNameElement() { 
688          if (this.name == null)
689            if (Configuration.errorOnAutoCreate())
690              throw new Error("Attempt to auto-create BenefitsComponent.name");
691            else if (Configuration.doAutoCreate())
692              this.name = new StringType(); // bb
693          return this.name;
694        }
695
696        public boolean hasNameElement() { 
697          return this.name != null && !this.name.isEmpty();
698        }
699
700        public boolean hasName() { 
701          return this.name != null && !this.name.isEmpty();
702        }
703
704        /**
705         * @param value {@link #name} (A short name or tag for the benefit, for example MED01, or DENT2.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
706         */
707        public BenefitsComponent setNameElement(StringType value) { 
708          this.name = value;
709          return this;
710        }
711
712        /**
713         * @return A short name or tag for the benefit, for example MED01, or DENT2.
714         */
715        public String getName() { 
716          return this.name == null ? null : this.name.getValue();
717        }
718
719        /**
720         * @param value A short name or tag for the benefit, for example MED01, or DENT2.
721         */
722        public BenefitsComponent setName(String value) { 
723          if (Utilities.noString(value))
724            this.name = null;
725          else {
726            if (this.name == null)
727              this.name = new StringType();
728            this.name.setValue(value);
729          }
730          return this;
731        }
732
733        /**
734         * @return {@link #description} (A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
735         */
736        public StringType getDescriptionElement() { 
737          if (this.description == null)
738            if (Configuration.errorOnAutoCreate())
739              throw new Error("Attempt to auto-create BenefitsComponent.description");
740            else if (Configuration.doAutoCreate())
741              this.description = new StringType(); // bb
742          return this.description;
743        }
744
745        public boolean hasDescriptionElement() { 
746          return this.description != null && !this.description.isEmpty();
747        }
748
749        public boolean hasDescription() { 
750          return this.description != null && !this.description.isEmpty();
751        }
752
753        /**
754         * @param value {@link #description} (A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
755         */
756        public BenefitsComponent setDescriptionElement(StringType value) { 
757          this.description = value;
758          return this;
759        }
760
761        /**
762         * @return A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.
763         */
764        public String getDescription() { 
765          return this.description == null ? null : this.description.getValue();
766        }
767
768        /**
769         * @param value A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.
770         */
771        public BenefitsComponent setDescription(String value) { 
772          if (Utilities.noString(value))
773            this.description = null;
774          else {
775            if (this.description == null)
776              this.description = new StringType();
777            this.description.setValue(value);
778          }
779          return this;
780        }
781
782        /**
783         * @return {@link #network} (Network designation.)
784         */
785        public CodeableConcept getNetwork() { 
786          if (this.network == null)
787            if (Configuration.errorOnAutoCreate())
788              throw new Error("Attempt to auto-create BenefitsComponent.network");
789            else if (Configuration.doAutoCreate())
790              this.network = new CodeableConcept(); // cc
791          return this.network;
792        }
793
794        public boolean hasNetwork() { 
795          return this.network != null && !this.network.isEmpty();
796        }
797
798        /**
799         * @param value {@link #network} (Network designation.)
800         */
801        public BenefitsComponent setNetwork(CodeableConcept value)  { 
802          this.network = value;
803          return this;
804        }
805
806        /**
807         * @return {@link #unit} (Unit designation: individual or family.)
808         */
809        public CodeableConcept getUnit() { 
810          if (this.unit == null)
811            if (Configuration.errorOnAutoCreate())
812              throw new Error("Attempt to auto-create BenefitsComponent.unit");
813            else if (Configuration.doAutoCreate())
814              this.unit = new CodeableConcept(); // cc
815          return this.unit;
816        }
817
818        public boolean hasUnit() { 
819          return this.unit != null && !this.unit.isEmpty();
820        }
821
822        /**
823         * @param value {@link #unit} (Unit designation: individual or family.)
824         */
825        public BenefitsComponent setUnit(CodeableConcept value)  { 
826          this.unit = value;
827          return this;
828        }
829
830        /**
831         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
832         */
833        public CodeableConcept getTerm() { 
834          if (this.term == null)
835            if (Configuration.errorOnAutoCreate())
836              throw new Error("Attempt to auto-create BenefitsComponent.term");
837            else if (Configuration.doAutoCreate())
838              this.term = new CodeableConcept(); // cc
839          return this.term;
840        }
841
842        public boolean hasTerm() { 
843          return this.term != null && !this.term.isEmpty();
844        }
845
846        /**
847         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
848         */
849        public BenefitsComponent setTerm(CodeableConcept value)  { 
850          this.term = value;
851          return this;
852        }
853
854        /**
855         * @return {@link #financial} (Benefits Used to date.)
856         */
857        public List<BenefitComponent> getFinancial() { 
858          if (this.financial == null)
859            this.financial = new ArrayList<BenefitComponent>();
860          return this.financial;
861        }
862
863        /**
864         * @return Returns a reference to <code>this</code> for easy method chaining
865         */
866        public BenefitsComponent setFinancial(List<BenefitComponent> theFinancial) { 
867          this.financial = theFinancial;
868          return this;
869        }
870
871        public boolean hasFinancial() { 
872          if (this.financial == null)
873            return false;
874          for (BenefitComponent item : this.financial)
875            if (!item.isEmpty())
876              return true;
877          return false;
878        }
879
880        public BenefitComponent addFinancial() { //3
881          BenefitComponent t = new BenefitComponent();
882          if (this.financial == null)
883            this.financial = new ArrayList<BenefitComponent>();
884          this.financial.add(t);
885          return t;
886        }
887
888        public BenefitsComponent addFinancial(BenefitComponent t) { //3
889          if (t == null)
890            return this;
891          if (this.financial == null)
892            this.financial = new ArrayList<BenefitComponent>();
893          this.financial.add(t);
894          return this;
895        }
896
897        /**
898         * @return The first repetition of repeating field {@link #financial}, creating it if it does not already exist
899         */
900        public BenefitComponent getFinancialFirstRep() { 
901          if (getFinancial().isEmpty()) {
902            addFinancial();
903          }
904          return getFinancial().get(0);
905        }
906
907        protected void listChildren(List<Property> children) {
908          super.listChildren(children);
909          children.add(new Property("category", "CodeableConcept", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, 1, category));
910          children.add(new Property("subCategory", "CodeableConcept", "Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.", 0, 1, subCategory));
911          children.add(new Property("excluded", "boolean", "True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.", 0, 1, excluded));
912          children.add(new Property("name", "string", "A short name or tag for the benefit, for example MED01, or DENT2.", 0, 1, name));
913          children.add(new Property("description", "string", "A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.", 0, 1, description));
914          children.add(new Property("network", "CodeableConcept", "Network designation.", 0, 1, network));
915          children.add(new Property("unit", "CodeableConcept", "Unit designation: individual or family.", 0, 1, unit));
916          children.add(new Property("term", "CodeableConcept", "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.", 0, 1, term));
917          children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
918        }
919
920        @Override
921        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
922          switch (_hash) {
923          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, 1, category);
924          case 1365024606: /*subCategory*/  return new Property("subCategory", "CodeableConcept", "Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.", 0, 1, subCategory);
925          case 1994055114: /*excluded*/  return new Property("excluded", "boolean", "True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.", 0, 1, excluded);
926          case 3373707: /*name*/  return new Property("name", "string", "A short name or tag for the benefit, for example MED01, or DENT2.", 0, 1, name);
927          case -1724546052: /*description*/  return new Property("description", "string", "A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.", 0, 1, description);
928          case 1843485230: /*network*/  return new Property("network", "CodeableConcept", "Network designation.", 0, 1, network);
929          case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "Unit designation: individual or family.", 0, 1, unit);
930          case 3556460: /*term*/  return new Property("term", "CodeableConcept", "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.", 0, 1, term);
931          case 357555337: /*financial*/  return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial);
932          default: return super.getNamedProperty(_hash, _name, _checkValid);
933          }
934
935        }
936
937      @Override
938      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
939        switch (hash) {
940        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
941        case 1365024606: /*subCategory*/ return this.subCategory == null ? new Base[0] : new Base[] {this.subCategory}; // CodeableConcept
942        case 1994055114: /*excluded*/ return this.excluded == null ? new Base[0] : new Base[] {this.excluded}; // BooleanType
943        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
944        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
945        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // CodeableConcept
946        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
947        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // CodeableConcept
948        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
949        default: return super.getProperty(hash, name, checkValid);
950        }
951
952      }
953
954      @Override
955      public Base setProperty(int hash, String name, Base value) throws FHIRException {
956        switch (hash) {
957        case 50511102: // category
958          this.category = castToCodeableConcept(value); // CodeableConcept
959          return value;
960        case 1365024606: // subCategory
961          this.subCategory = castToCodeableConcept(value); // CodeableConcept
962          return value;
963        case 1994055114: // excluded
964          this.excluded = castToBoolean(value); // BooleanType
965          return value;
966        case 3373707: // name
967          this.name = castToString(value); // StringType
968          return value;
969        case -1724546052: // description
970          this.description = castToString(value); // StringType
971          return value;
972        case 1843485230: // network
973          this.network = castToCodeableConcept(value); // CodeableConcept
974          return value;
975        case 3594628: // unit
976          this.unit = castToCodeableConcept(value); // CodeableConcept
977          return value;
978        case 3556460: // term
979          this.term = castToCodeableConcept(value); // CodeableConcept
980          return value;
981        case 357555337: // financial
982          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
983          return value;
984        default: return super.setProperty(hash, name, value);
985        }
986
987      }
988
989      @Override
990      public Base setProperty(String name, Base value) throws FHIRException {
991        if (name.equals("category")) {
992          this.category = castToCodeableConcept(value); // CodeableConcept
993        } else if (name.equals("subCategory")) {
994          this.subCategory = castToCodeableConcept(value); // CodeableConcept
995        } else if (name.equals("excluded")) {
996          this.excluded = castToBoolean(value); // BooleanType
997        } else if (name.equals("name")) {
998          this.name = castToString(value); // StringType
999        } else if (name.equals("description")) {
1000          this.description = castToString(value); // StringType
1001        } else if (name.equals("network")) {
1002          this.network = castToCodeableConcept(value); // CodeableConcept
1003        } else if (name.equals("unit")) {
1004          this.unit = castToCodeableConcept(value); // CodeableConcept
1005        } else if (name.equals("term")) {
1006          this.term = castToCodeableConcept(value); // CodeableConcept
1007        } else if (name.equals("financial")) {
1008          this.getFinancial().add((BenefitComponent) value);
1009        } else
1010          return super.setProperty(name, value);
1011        return value;
1012      }
1013
1014      @Override
1015      public Base makeProperty(int hash, String name) throws FHIRException {
1016        switch (hash) {
1017        case 50511102:  return getCategory(); 
1018        case 1365024606:  return getSubCategory(); 
1019        case 1994055114:  return getExcludedElement();
1020        case 3373707:  return getNameElement();
1021        case -1724546052:  return getDescriptionElement();
1022        case 1843485230:  return getNetwork(); 
1023        case 3594628:  return getUnit(); 
1024        case 3556460:  return getTerm(); 
1025        case 357555337:  return addFinancial(); 
1026        default: return super.makeProperty(hash, name);
1027        }
1028
1029      }
1030
1031      @Override
1032      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1033        switch (hash) {
1034        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1035        case 1365024606: /*subCategory*/ return new String[] {"CodeableConcept"};
1036        case 1994055114: /*excluded*/ return new String[] {"boolean"};
1037        case 3373707: /*name*/ return new String[] {"string"};
1038        case -1724546052: /*description*/ return new String[] {"string"};
1039        case 1843485230: /*network*/ return new String[] {"CodeableConcept"};
1040        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
1041        case 3556460: /*term*/ return new String[] {"CodeableConcept"};
1042        case 357555337: /*financial*/ return new String[] {};
1043        default: return super.getTypesForProperty(hash, name);
1044        }
1045
1046      }
1047
1048      @Override
1049      public Base addChild(String name) throws FHIRException {
1050        if (name.equals("category")) {
1051          this.category = new CodeableConcept();
1052          return this.category;
1053        }
1054        else if (name.equals("subCategory")) {
1055          this.subCategory = new CodeableConcept();
1056          return this.subCategory;
1057        }
1058        else if (name.equals("excluded")) {
1059          throw new FHIRException("Cannot call addChild on a primitive type EligibilityResponse.excluded");
1060        }
1061        else if (name.equals("name")) {
1062          throw new FHIRException("Cannot call addChild on a primitive type EligibilityResponse.name");
1063        }
1064        else if (name.equals("description")) {
1065          throw new FHIRException("Cannot call addChild on a primitive type EligibilityResponse.description");
1066        }
1067        else if (name.equals("network")) {
1068          this.network = new CodeableConcept();
1069          return this.network;
1070        }
1071        else if (name.equals("unit")) {
1072          this.unit = new CodeableConcept();
1073          return this.unit;
1074        }
1075        else if (name.equals("term")) {
1076          this.term = new CodeableConcept();
1077          return this.term;
1078        }
1079        else if (name.equals("financial")) {
1080          return addFinancial();
1081        }
1082        else
1083          return super.addChild(name);
1084      }
1085
1086      public BenefitsComponent copy() {
1087        BenefitsComponent dst = new BenefitsComponent();
1088        copyValues(dst);
1089        dst.category = category == null ? null : category.copy();
1090        dst.subCategory = subCategory == null ? null : subCategory.copy();
1091        dst.excluded = excluded == null ? null : excluded.copy();
1092        dst.name = name == null ? null : name.copy();
1093        dst.description = description == null ? null : description.copy();
1094        dst.network = network == null ? null : network.copy();
1095        dst.unit = unit == null ? null : unit.copy();
1096        dst.term = term == null ? null : term.copy();
1097        if (financial != null) {
1098          dst.financial = new ArrayList<BenefitComponent>();
1099          for (BenefitComponent i : financial)
1100            dst.financial.add(i.copy());
1101        };
1102        return dst;
1103      }
1104
1105      @Override
1106      public boolean equalsDeep(Base other_) {
1107        if (!super.equalsDeep(other_))
1108          return false;
1109        if (!(other_ instanceof BenefitsComponent))
1110          return false;
1111        BenefitsComponent o = (BenefitsComponent) other_;
1112        return compareDeep(category, o.category, true) && compareDeep(subCategory, o.subCategory, true)
1113           && compareDeep(excluded, o.excluded, true) && compareDeep(name, o.name, true) && compareDeep(description, o.description, true)
1114           && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true) && compareDeep(term, o.term, true)
1115           && compareDeep(financial, o.financial, true);
1116      }
1117
1118      @Override
1119      public boolean equalsShallow(Base other_) {
1120        if (!super.equalsShallow(other_))
1121          return false;
1122        if (!(other_ instanceof BenefitsComponent))
1123          return false;
1124        BenefitsComponent o = (BenefitsComponent) other_;
1125        return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
1126          ;
1127      }
1128
1129      public boolean isEmpty() {
1130        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, subCategory, excluded
1131          , name, description, network, unit, term, financial);
1132      }
1133
1134  public String fhirType() {
1135    return "EligibilityResponse.insurance.benefitBalance";
1136
1137  }
1138
1139  }
1140
1141    @Block()
1142    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
1143        /**
1144         * Deductable, visits, benefit amount.
1145         */
1146        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
1147        @Description(shortDefinition="Deductable, visits, benefit amount", formalDefinition="Deductable, visits, benefit amount." )
1148        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-type")
1149        protected CodeableConcept type;
1150
1151        /**
1152         * Benefits allowed.
1153         */
1154        @Child(name = "allowed", type = {UnsignedIntType.class, StringType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
1155        @Description(shortDefinition="Benefits allowed", formalDefinition="Benefits allowed." )
1156        protected Type allowed;
1157
1158        /**
1159         * Benefits used.
1160         */
1161        @Child(name = "used", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
1162        @Description(shortDefinition="Benefits used", formalDefinition="Benefits used." )
1163        protected Type used;
1164
1165        private static final long serialVersionUID = -1506285314L;
1166
1167    /**
1168     * Constructor
1169     */
1170      public BenefitComponent() {
1171        super();
1172      }
1173
1174    /**
1175     * Constructor
1176     */
1177      public BenefitComponent(CodeableConcept type) {
1178        super();
1179        this.type = type;
1180      }
1181
1182        /**
1183         * @return {@link #type} (Deductable, visits, benefit amount.)
1184         */
1185        public CodeableConcept getType() { 
1186          if (this.type == null)
1187            if (Configuration.errorOnAutoCreate())
1188              throw new Error("Attempt to auto-create BenefitComponent.type");
1189            else if (Configuration.doAutoCreate())
1190              this.type = new CodeableConcept(); // cc
1191          return this.type;
1192        }
1193
1194        public boolean hasType() { 
1195          return this.type != null && !this.type.isEmpty();
1196        }
1197
1198        /**
1199         * @param value {@link #type} (Deductable, visits, benefit amount.)
1200         */
1201        public BenefitComponent setType(CodeableConcept value)  { 
1202          this.type = value;
1203          return this;
1204        }
1205
1206        /**
1207         * @return {@link #allowed} (Benefits allowed.)
1208         */
1209        public Type getAllowed() { 
1210          return this.allowed;
1211        }
1212
1213        /**
1214         * @return {@link #allowed} (Benefits allowed.)
1215         */
1216        public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException { 
1217          if (this.allowed == null)
1218            return null;
1219          if (!(this.allowed instanceof UnsignedIntType))
1220            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.allowed.getClass().getName()+" was encountered");
1221          return (UnsignedIntType) this.allowed;
1222        }
1223
1224        public boolean hasAllowedUnsignedIntType() { 
1225          return this != null && this.allowed instanceof UnsignedIntType;
1226        }
1227
1228        /**
1229         * @return {@link #allowed} (Benefits allowed.)
1230         */
1231        public StringType getAllowedStringType() throws FHIRException { 
1232          if (this.allowed == null)
1233            return null;
1234          if (!(this.allowed instanceof StringType))
1235            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.allowed.getClass().getName()+" was encountered");
1236          return (StringType) this.allowed;
1237        }
1238
1239        public boolean hasAllowedStringType() { 
1240          return this != null && this.allowed instanceof StringType;
1241        }
1242
1243        /**
1244         * @return {@link #allowed} (Benefits allowed.)
1245         */
1246        public Money getAllowedMoney() throws FHIRException { 
1247          if (this.allowed == null)
1248            return null;
1249          if (!(this.allowed instanceof Money))
1250            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.allowed.getClass().getName()+" was encountered");
1251          return (Money) this.allowed;
1252        }
1253
1254        public boolean hasAllowedMoney() { 
1255          return this != null && this.allowed instanceof Money;
1256        }
1257
1258        public boolean hasAllowed() { 
1259          return this.allowed != null && !this.allowed.isEmpty();
1260        }
1261
1262        /**
1263         * @param value {@link #allowed} (Benefits allowed.)
1264         */
1265        public BenefitComponent setAllowed(Type value) throws FHIRFormatError { 
1266          if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
1267            throw new FHIRFormatError("Not the right type for EligibilityResponse.insurance.benefitBalance.financial.allowed[x]: "+value.fhirType());
1268          this.allowed = value;
1269          return this;
1270        }
1271
1272        /**
1273         * @return {@link #used} (Benefits used.)
1274         */
1275        public Type getUsed() { 
1276          return this.used;
1277        }
1278
1279        /**
1280         * @return {@link #used} (Benefits used.)
1281         */
1282        public UnsignedIntType getUsedUnsignedIntType() throws FHIRException { 
1283          if (this.used == null)
1284            return null;
1285          if (!(this.used instanceof UnsignedIntType))
1286            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.used.getClass().getName()+" was encountered");
1287          return (UnsignedIntType) this.used;
1288        }
1289
1290        public boolean hasUsedUnsignedIntType() { 
1291          return this != null && this.used instanceof UnsignedIntType;
1292        }
1293
1294        /**
1295         * @return {@link #used} (Benefits used.)
1296         */
1297        public Money getUsedMoney() throws FHIRException { 
1298          if (this.used == null)
1299            return null;
1300          if (!(this.used instanceof Money))
1301            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.used.getClass().getName()+" was encountered");
1302          return (Money) this.used;
1303        }
1304
1305        public boolean hasUsedMoney() { 
1306          return this != null && this.used instanceof Money;
1307        }
1308
1309        public boolean hasUsed() { 
1310          return this.used != null && !this.used.isEmpty();
1311        }
1312
1313        /**
1314         * @param value {@link #used} (Benefits used.)
1315         */
1316        public BenefitComponent setUsed(Type value) throws FHIRFormatError { 
1317          if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
1318            throw new FHIRFormatError("Not the right type for EligibilityResponse.insurance.benefitBalance.financial.used[x]: "+value.fhirType());
1319          this.used = value;
1320          return this;
1321        }
1322
1323        protected void listChildren(List<Property> children) {
1324          super.listChildren(children);
1325          children.add(new Property("type", "CodeableConcept", "Deductable, visits, benefit amount.", 0, 1, type));
1326          children.add(new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed));
1327          children.add(new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used));
1328        }
1329
1330        @Override
1331        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1332          switch (_hash) {
1333          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Deductable, visits, benefit amount.", 0, 1, type);
1334          case -1336663592: /*allowed[x]*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
1335          case -911343192: /*allowed*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
1336          case 1668802034: /*allowedUnsignedInt*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
1337          case -2135265319: /*allowedString*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
1338          case -351668232: /*allowedMoney*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
1339          case -147553373: /*used[x]*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
1340          case 3599293: /*used*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
1341          case 1252740285: /*usedUnsignedInt*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
1342          case -78048509: /*usedMoney*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
1343          default: return super.getNamedProperty(_hash, _name, _checkValid);
1344          }
1345
1346        }
1347
1348      @Override
1349      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1350        switch (hash) {
1351        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1352        case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // Type
1353        case 3599293: /*used*/ return this.used == null ? new Base[0] : new Base[] {this.used}; // Type
1354        default: return super.getProperty(hash, name, checkValid);
1355        }
1356
1357      }
1358
1359      @Override
1360      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1361        switch (hash) {
1362        case 3575610: // type
1363          this.type = castToCodeableConcept(value); // CodeableConcept
1364          return value;
1365        case -911343192: // allowed
1366          this.allowed = castToType(value); // Type
1367          return value;
1368        case 3599293: // used
1369          this.used = castToType(value); // Type
1370          return value;
1371        default: return super.setProperty(hash, name, value);
1372        }
1373
1374      }
1375
1376      @Override
1377      public Base setProperty(String name, Base value) throws FHIRException {
1378        if (name.equals("type")) {
1379          this.type = castToCodeableConcept(value); // CodeableConcept
1380        } else if (name.equals("allowed[x]")) {
1381          this.allowed = castToType(value); // Type
1382        } else if (name.equals("used[x]")) {
1383          this.used = castToType(value); // Type
1384        } else
1385          return super.setProperty(name, value);
1386        return value;
1387      }
1388
1389      @Override
1390      public Base makeProperty(int hash, String name) throws FHIRException {
1391        switch (hash) {
1392        case 3575610:  return getType(); 
1393        case -1336663592:  return getAllowed(); 
1394        case -911343192:  return getAllowed(); 
1395        case -147553373:  return getUsed(); 
1396        case 3599293:  return getUsed(); 
1397        default: return super.makeProperty(hash, name);
1398        }
1399
1400      }
1401
1402      @Override
1403      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1404        switch (hash) {
1405        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1406        case -911343192: /*allowed*/ return new String[] {"unsignedInt", "string", "Money"};
1407        case 3599293: /*used*/ return new String[] {"unsignedInt", "Money"};
1408        default: return super.getTypesForProperty(hash, name);
1409        }
1410
1411      }
1412
1413      @Override
1414      public Base addChild(String name) throws FHIRException {
1415        if (name.equals("type")) {
1416          this.type = new CodeableConcept();
1417          return this.type;
1418        }
1419        else if (name.equals("allowedUnsignedInt")) {
1420          this.allowed = new UnsignedIntType();
1421          return this.allowed;
1422        }
1423        else if (name.equals("allowedString")) {
1424          this.allowed = new StringType();
1425          return this.allowed;
1426        }
1427        else if (name.equals("allowedMoney")) {
1428          this.allowed = new Money();
1429          return this.allowed;
1430        }
1431        else if (name.equals("usedUnsignedInt")) {
1432          this.used = new UnsignedIntType();
1433          return this.used;
1434        }
1435        else if (name.equals("usedMoney")) {
1436          this.used = new Money();
1437          return this.used;
1438        }
1439        else
1440          return super.addChild(name);
1441      }
1442
1443      public BenefitComponent copy() {
1444        BenefitComponent dst = new BenefitComponent();
1445        copyValues(dst);
1446        dst.type = type == null ? null : type.copy();
1447        dst.allowed = allowed == null ? null : allowed.copy();
1448        dst.used = used == null ? null : used.copy();
1449        return dst;
1450      }
1451
1452      @Override
1453      public boolean equalsDeep(Base other_) {
1454        if (!super.equalsDeep(other_))
1455          return false;
1456        if (!(other_ instanceof BenefitComponent))
1457          return false;
1458        BenefitComponent o = (BenefitComponent) other_;
1459        return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true) && compareDeep(used, o.used, true)
1460          ;
1461      }
1462
1463      @Override
1464      public boolean equalsShallow(Base other_) {
1465        if (!super.equalsShallow(other_))
1466          return false;
1467        if (!(other_ instanceof BenefitComponent))
1468          return false;
1469        BenefitComponent o = (BenefitComponent) other_;
1470        return true;
1471      }
1472
1473      public boolean isEmpty() {
1474        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
1475      }
1476
1477  public String fhirType() {
1478    return "EligibilityResponse.insurance.benefitBalance.financial";
1479
1480  }
1481
1482  }
1483
1484    @Block()
1485    public static class ErrorsComponent extends BackboneElement implements IBaseBackboneElement {
1486        /**
1487         * An error code,from a specified code system, which details why the eligibility check could not be performed.
1488         */
1489        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
1490        @Description(shortDefinition="Error code detailing processing issues", formalDefinition="An error code,from a specified code system, which details why the eligibility check could not be performed." )
1491        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-error")
1492        protected CodeableConcept code;
1493
1494        private static final long serialVersionUID = -1048343046L;
1495
1496    /**
1497     * Constructor
1498     */
1499      public ErrorsComponent() {
1500        super();
1501      }
1502
1503    /**
1504     * Constructor
1505     */
1506      public ErrorsComponent(CodeableConcept code) {
1507        super();
1508        this.code = code;
1509      }
1510
1511        /**
1512         * @return {@link #code} (An error code,from a specified code system, which details why the eligibility check could not be performed.)
1513         */
1514        public CodeableConcept getCode() { 
1515          if (this.code == null)
1516            if (Configuration.errorOnAutoCreate())
1517              throw new Error("Attempt to auto-create ErrorsComponent.code");
1518            else if (Configuration.doAutoCreate())
1519              this.code = new CodeableConcept(); // cc
1520          return this.code;
1521        }
1522
1523        public boolean hasCode() { 
1524          return this.code != null && !this.code.isEmpty();
1525        }
1526
1527        /**
1528         * @param value {@link #code} (An error code,from a specified code system, which details why the eligibility check could not be performed.)
1529         */
1530        public ErrorsComponent setCode(CodeableConcept value)  { 
1531          this.code = value;
1532          return this;
1533        }
1534
1535        protected void listChildren(List<Property> children) {
1536          super.listChildren(children);
1537          children.add(new Property("code", "CodeableConcept", "An error code,from a specified code system, which details why the eligibility check could not be performed.", 0, 1, code));
1538        }
1539
1540        @Override
1541        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1542          switch (_hash) {
1543          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "An error code,from a specified code system, which details why the eligibility check could not be performed.", 0, 1, code);
1544          default: return super.getNamedProperty(_hash, _name, _checkValid);
1545          }
1546
1547        }
1548
1549      @Override
1550      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1551        switch (hash) {
1552        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1553        default: return super.getProperty(hash, name, checkValid);
1554        }
1555
1556      }
1557
1558      @Override
1559      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1560        switch (hash) {
1561        case 3059181: // code
1562          this.code = castToCodeableConcept(value); // CodeableConcept
1563          return value;
1564        default: return super.setProperty(hash, name, value);
1565        }
1566
1567      }
1568
1569      @Override
1570      public Base setProperty(String name, Base value) throws FHIRException {
1571        if (name.equals("code")) {
1572          this.code = castToCodeableConcept(value); // CodeableConcept
1573        } else
1574          return super.setProperty(name, value);
1575        return value;
1576      }
1577
1578      @Override
1579      public Base makeProperty(int hash, String name) throws FHIRException {
1580        switch (hash) {
1581        case 3059181:  return getCode(); 
1582        default: return super.makeProperty(hash, name);
1583        }
1584
1585      }
1586
1587      @Override
1588      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1589        switch (hash) {
1590        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1591        default: return super.getTypesForProperty(hash, name);
1592        }
1593
1594      }
1595
1596      @Override
1597      public Base addChild(String name) throws FHIRException {
1598        if (name.equals("code")) {
1599          this.code = new CodeableConcept();
1600          return this.code;
1601        }
1602        else
1603          return super.addChild(name);
1604      }
1605
1606      public ErrorsComponent copy() {
1607        ErrorsComponent dst = new ErrorsComponent();
1608        copyValues(dst);
1609        dst.code = code == null ? null : code.copy();
1610        return dst;
1611      }
1612
1613      @Override
1614      public boolean equalsDeep(Base other_) {
1615        if (!super.equalsDeep(other_))
1616          return false;
1617        if (!(other_ instanceof ErrorsComponent))
1618          return false;
1619        ErrorsComponent o = (ErrorsComponent) other_;
1620        return compareDeep(code, o.code, true);
1621      }
1622
1623      @Override
1624      public boolean equalsShallow(Base other_) {
1625        if (!super.equalsShallow(other_))
1626          return false;
1627        if (!(other_ instanceof ErrorsComponent))
1628          return false;
1629        ErrorsComponent o = (ErrorsComponent) other_;
1630        return true;
1631      }
1632
1633      public boolean isEmpty() {
1634        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code);
1635      }
1636
1637  public String fhirType() {
1638    return "EligibilityResponse.error";
1639
1640  }
1641
1642  }
1643
1644    /**
1645     * The Response business identifier.
1646     */
1647    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1648    @Description(shortDefinition="Business Identifier", formalDefinition="The Response business identifier." )
1649    protected List<Identifier> identifier;
1650
1651    /**
1652     * The status of the resource instance.
1653     */
1654    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
1655    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
1656    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fm-status")
1657    protected Enumeration<EligibilityResponseStatus> status;
1658
1659    /**
1660     * The date when the enclosed suite of services were performed or completed.
1661     */
1662    @Child(name = "created", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1663    @Description(shortDefinition="Creation date", formalDefinition="The date when the enclosed suite of services were performed or completed." )
1664    protected DateTimeType created;
1665
1666    /**
1667     * The practitioner who is responsible for the services rendered to the patient.
1668     */
1669    @Child(name = "requestProvider", type = {Practitioner.class}, order=3, min=0, max=1, modifier=false, summary=false)
1670    @Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
1671    protected Reference requestProvider;
1672
1673    /**
1674     * The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
1675     */
1676    protected Practitioner requestProviderTarget;
1677
1678    /**
1679     * The organization which is responsible for the services rendered to the patient.
1680     */
1681    @Child(name = "requestOrganization", type = {Organization.class}, order=4, min=0, max=1, modifier=false, summary=false)
1682    @Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
1683    protected Reference requestOrganization;
1684
1685    /**
1686     * The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
1687     */
1688    protected Organization requestOrganizationTarget;
1689
1690    /**
1691     * Original request resource reference.
1692     */
1693    @Child(name = "request", type = {EligibilityRequest.class}, order=5, min=0, max=1, modifier=false, summary=false)
1694    @Description(shortDefinition="Eligibility reference", formalDefinition="Original request resource reference." )
1695    protected Reference request;
1696
1697    /**
1698     * The actual object that is the target of the reference (Original request resource reference.)
1699     */
1700    protected EligibilityRequest requestTarget;
1701
1702    /**
1703     * Transaction status: error, complete.
1704     */
1705    @Child(name = "outcome", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
1706    @Description(shortDefinition="complete | error | partial", formalDefinition="Transaction status: error, complete." )
1707    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
1708    protected CodeableConcept outcome;
1709
1710    /**
1711     * A description of the status of the adjudication.
1712     */
1713    @Child(name = "disposition", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
1714    @Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
1715    protected StringType disposition;
1716
1717    /**
1718     * The Insurer who produced this adjudicated response.
1719     */
1720    @Child(name = "insurer", type = {Organization.class}, order=8, min=0, max=1, modifier=false, summary=false)
1721    @Description(shortDefinition="Insurer issuing the coverage", formalDefinition="The Insurer who produced this adjudicated response." )
1722    protected Reference insurer;
1723
1724    /**
1725     * The actual object that is the target of the reference (The Insurer who produced this adjudicated response.)
1726     */
1727    protected Organization insurerTarget;
1728
1729    /**
1730     * Flag indicating if the coverage provided is inforce currently  if no service date(s) specified or for the whole duration of the service dates.
1731     */
1732    @Child(name = "inforce", type = {BooleanType.class}, order=9, min=0, max=1, modifier=false, summary=false)
1733    @Description(shortDefinition="Coverage inforce indicator", formalDefinition="Flag indicating if the coverage provided is inforce currently  if no service date(s) specified or for the whole duration of the service dates." )
1734    protected BooleanType inforce;
1735
1736    /**
1737     * The insurer may provide both the details for the requested coverage as well as details for additional coverages known to the insurer.
1738     */
1739    @Child(name = "insurance", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1740    @Description(shortDefinition="Details by insurance coverage", formalDefinition="The insurer may provide both the details for the requested coverage as well as details for additional coverages known to the insurer." )
1741    protected List<InsuranceComponent> insurance;
1742
1743    /**
1744     * The form to be used for printing the content.
1745     */
1746    @Child(name = "form", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=false)
1747    @Description(shortDefinition="Printed Form Identifier", formalDefinition="The form to be used for printing the content." )
1748    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
1749    protected CodeableConcept form;
1750
1751    /**
1752     * Mutually exclusive with Services Provided (Item).
1753     */
1754    @Child(name = "error", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1755    @Description(shortDefinition="Processing errors", formalDefinition="Mutually exclusive with Services Provided (Item)." )
1756    protected List<ErrorsComponent> error;
1757
1758    private static final long serialVersionUID = 954270539L;
1759
1760  /**
1761   * Constructor
1762   */
1763    public EligibilityResponse() {
1764      super();
1765    }
1766
1767    /**
1768     * @return {@link #identifier} (The Response business identifier.)
1769     */
1770    public List<Identifier> getIdentifier() { 
1771      if (this.identifier == null)
1772        this.identifier = new ArrayList<Identifier>();
1773      return this.identifier;
1774    }
1775
1776    /**
1777     * @return Returns a reference to <code>this</code> for easy method chaining
1778     */
1779    public EligibilityResponse setIdentifier(List<Identifier> theIdentifier) { 
1780      this.identifier = theIdentifier;
1781      return this;
1782    }
1783
1784    public boolean hasIdentifier() { 
1785      if (this.identifier == null)
1786        return false;
1787      for (Identifier item : this.identifier)
1788        if (!item.isEmpty())
1789          return true;
1790      return false;
1791    }
1792
1793    public Identifier addIdentifier() { //3
1794      Identifier t = new Identifier();
1795      if (this.identifier == null)
1796        this.identifier = new ArrayList<Identifier>();
1797      this.identifier.add(t);
1798      return t;
1799    }
1800
1801    public EligibilityResponse addIdentifier(Identifier t) { //3
1802      if (t == null)
1803        return this;
1804      if (this.identifier == null)
1805        this.identifier = new ArrayList<Identifier>();
1806      this.identifier.add(t);
1807      return this;
1808    }
1809
1810    /**
1811     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1812     */
1813    public Identifier getIdentifierFirstRep() { 
1814      if (getIdentifier().isEmpty()) {
1815        addIdentifier();
1816      }
1817      return getIdentifier().get(0);
1818    }
1819
1820    /**
1821     * @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
1822     */
1823    public Enumeration<EligibilityResponseStatus> getStatusElement() { 
1824      if (this.status == null)
1825        if (Configuration.errorOnAutoCreate())
1826          throw new Error("Attempt to auto-create EligibilityResponse.status");
1827        else if (Configuration.doAutoCreate())
1828          this.status = new Enumeration<EligibilityResponseStatus>(new EligibilityResponseStatusEnumFactory()); // bb
1829      return this.status;
1830    }
1831
1832    public boolean hasStatusElement() { 
1833      return this.status != null && !this.status.isEmpty();
1834    }
1835
1836    public boolean hasStatus() { 
1837      return this.status != null && !this.status.isEmpty();
1838    }
1839
1840    /**
1841     * @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
1842     */
1843    public EligibilityResponse setStatusElement(Enumeration<EligibilityResponseStatus> value) { 
1844      this.status = value;
1845      return this;
1846    }
1847
1848    /**
1849     * @return The status of the resource instance.
1850     */
1851    public EligibilityResponseStatus getStatus() { 
1852      return this.status == null ? null : this.status.getValue();
1853    }
1854
1855    /**
1856     * @param value The status of the resource instance.
1857     */
1858    public EligibilityResponse setStatus(EligibilityResponseStatus value) { 
1859      if (value == null)
1860        this.status = null;
1861      else {
1862        if (this.status == null)
1863          this.status = new Enumeration<EligibilityResponseStatus>(new EligibilityResponseStatusEnumFactory());
1864        this.status.setValue(value);
1865      }
1866      return this;
1867    }
1868
1869    /**
1870     * @return {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
1871     */
1872    public DateTimeType getCreatedElement() { 
1873      if (this.created == null)
1874        if (Configuration.errorOnAutoCreate())
1875          throw new Error("Attempt to auto-create EligibilityResponse.created");
1876        else if (Configuration.doAutoCreate())
1877          this.created = new DateTimeType(); // bb
1878      return this.created;
1879    }
1880
1881    public boolean hasCreatedElement() { 
1882      return this.created != null && !this.created.isEmpty();
1883    }
1884
1885    public boolean hasCreated() { 
1886      return this.created != null && !this.created.isEmpty();
1887    }
1888
1889    /**
1890     * @param value {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
1891     */
1892    public EligibilityResponse setCreatedElement(DateTimeType value) { 
1893      this.created = value;
1894      return this;
1895    }
1896
1897    /**
1898     * @return The date when the enclosed suite of services were performed or completed.
1899     */
1900    public Date getCreated() { 
1901      return this.created == null ? null : this.created.getValue();
1902    }
1903
1904    /**
1905     * @param value The date when the enclosed suite of services were performed or completed.
1906     */
1907    public EligibilityResponse setCreated(Date value) { 
1908      if (value == null)
1909        this.created = null;
1910      else {
1911        if (this.created == null)
1912          this.created = new DateTimeType();
1913        this.created.setValue(value);
1914      }
1915      return this;
1916    }
1917
1918    /**
1919     * @return {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
1920     */
1921    public Reference getRequestProvider() { 
1922      if (this.requestProvider == null)
1923        if (Configuration.errorOnAutoCreate())
1924          throw new Error("Attempt to auto-create EligibilityResponse.requestProvider");
1925        else if (Configuration.doAutoCreate())
1926          this.requestProvider = new Reference(); // cc
1927      return this.requestProvider;
1928    }
1929
1930    public boolean hasRequestProvider() { 
1931      return this.requestProvider != null && !this.requestProvider.isEmpty();
1932    }
1933
1934    /**
1935     * @param value {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
1936     */
1937    public EligibilityResponse setRequestProvider(Reference value)  { 
1938      this.requestProvider = value;
1939      return this;
1940    }
1941
1942    /**
1943     * @return {@link #requestProvider} 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.)
1944     */
1945    public Practitioner getRequestProviderTarget() { 
1946      if (this.requestProviderTarget == null)
1947        if (Configuration.errorOnAutoCreate())
1948          throw new Error("Attempt to auto-create EligibilityResponse.requestProvider");
1949        else if (Configuration.doAutoCreate())
1950          this.requestProviderTarget = new Practitioner(); // aa
1951      return this.requestProviderTarget;
1952    }
1953
1954    /**
1955     * @param value {@link #requestProvider} 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.)
1956     */
1957    public EligibilityResponse setRequestProviderTarget(Practitioner value) { 
1958      this.requestProviderTarget = value;
1959      return this;
1960    }
1961
1962    /**
1963     * @return {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
1964     */
1965    public Reference getRequestOrganization() { 
1966      if (this.requestOrganization == null)
1967        if (Configuration.errorOnAutoCreate())
1968          throw new Error("Attempt to auto-create EligibilityResponse.requestOrganization");
1969        else if (Configuration.doAutoCreate())
1970          this.requestOrganization = new Reference(); // cc
1971      return this.requestOrganization;
1972    }
1973
1974    public boolean hasRequestOrganization() { 
1975      return this.requestOrganization != null && !this.requestOrganization.isEmpty();
1976    }
1977
1978    /**
1979     * @param value {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
1980     */
1981    public EligibilityResponse setRequestOrganization(Reference value)  { 
1982      this.requestOrganization = value;
1983      return this;
1984    }
1985
1986    /**
1987     * @return {@link #requestOrganization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
1988     */
1989    public Organization getRequestOrganizationTarget() { 
1990      if (this.requestOrganizationTarget == null)
1991        if (Configuration.errorOnAutoCreate())
1992          throw new Error("Attempt to auto-create EligibilityResponse.requestOrganization");
1993        else if (Configuration.doAutoCreate())
1994          this.requestOrganizationTarget = new Organization(); // aa
1995      return this.requestOrganizationTarget;
1996    }
1997
1998    /**
1999     * @param value {@link #requestOrganization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
2000     */
2001    public EligibilityResponse setRequestOrganizationTarget(Organization value) { 
2002      this.requestOrganizationTarget = value;
2003      return this;
2004    }
2005
2006    /**
2007     * @return {@link #request} (Original request resource reference.)
2008     */
2009    public Reference getRequest() { 
2010      if (this.request == null)
2011        if (Configuration.errorOnAutoCreate())
2012          throw new Error("Attempt to auto-create EligibilityResponse.request");
2013        else if (Configuration.doAutoCreate())
2014          this.request = new Reference(); // cc
2015      return this.request;
2016    }
2017
2018    public boolean hasRequest() { 
2019      return this.request != null && !this.request.isEmpty();
2020    }
2021
2022    /**
2023     * @param value {@link #request} (Original request resource reference.)
2024     */
2025    public EligibilityResponse setRequest(Reference value)  { 
2026      this.request = value;
2027      return this;
2028    }
2029
2030    /**
2031     * @return {@link #request} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Original request resource reference.)
2032     */
2033    public EligibilityRequest getRequestTarget() { 
2034      if (this.requestTarget == null)
2035        if (Configuration.errorOnAutoCreate())
2036          throw new Error("Attempt to auto-create EligibilityResponse.request");
2037        else if (Configuration.doAutoCreate())
2038          this.requestTarget = new EligibilityRequest(); // aa
2039      return this.requestTarget;
2040    }
2041
2042    /**
2043     * @param value {@link #request} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Original request resource reference.)
2044     */
2045    public EligibilityResponse setRequestTarget(EligibilityRequest value) { 
2046      this.requestTarget = value;
2047      return this;
2048    }
2049
2050    /**
2051     * @return {@link #outcome} (Transaction status: error, complete.)
2052     */
2053    public CodeableConcept getOutcome() { 
2054      if (this.outcome == null)
2055        if (Configuration.errorOnAutoCreate())
2056          throw new Error("Attempt to auto-create EligibilityResponse.outcome");
2057        else if (Configuration.doAutoCreate())
2058          this.outcome = new CodeableConcept(); // cc
2059      return this.outcome;
2060    }
2061
2062    public boolean hasOutcome() { 
2063      return this.outcome != null && !this.outcome.isEmpty();
2064    }
2065
2066    /**
2067     * @param value {@link #outcome} (Transaction status: error, complete.)
2068     */
2069    public EligibilityResponse setOutcome(CodeableConcept value)  { 
2070      this.outcome = value;
2071      return this;
2072    }
2073
2074    /**
2075     * @return {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
2076     */
2077    public StringType getDispositionElement() { 
2078      if (this.disposition == null)
2079        if (Configuration.errorOnAutoCreate())
2080          throw new Error("Attempt to auto-create EligibilityResponse.disposition");
2081        else if (Configuration.doAutoCreate())
2082          this.disposition = new StringType(); // bb
2083      return this.disposition;
2084    }
2085
2086    public boolean hasDispositionElement() { 
2087      return this.disposition != null && !this.disposition.isEmpty();
2088    }
2089
2090    public boolean hasDisposition() { 
2091      return this.disposition != null && !this.disposition.isEmpty();
2092    }
2093
2094    /**
2095     * @param value {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
2096     */
2097    public EligibilityResponse setDispositionElement(StringType value) { 
2098      this.disposition = value;
2099      return this;
2100    }
2101
2102    /**
2103     * @return A description of the status of the adjudication.
2104     */
2105    public String getDisposition() { 
2106      return this.disposition == null ? null : this.disposition.getValue();
2107    }
2108
2109    /**
2110     * @param value A description of the status of the adjudication.
2111     */
2112    public EligibilityResponse setDisposition(String value) { 
2113      if (Utilities.noString(value))
2114        this.disposition = null;
2115      else {
2116        if (this.disposition == null)
2117          this.disposition = new StringType();
2118        this.disposition.setValue(value);
2119      }
2120      return this;
2121    }
2122
2123    /**
2124     * @return {@link #insurer} (The Insurer who produced this adjudicated response.)
2125     */
2126    public Reference getInsurer() { 
2127      if (this.insurer == null)
2128        if (Configuration.errorOnAutoCreate())
2129          throw new Error("Attempt to auto-create EligibilityResponse.insurer");
2130        else if (Configuration.doAutoCreate())
2131          this.insurer = new Reference(); // cc
2132      return this.insurer;
2133    }
2134
2135    public boolean hasInsurer() { 
2136      return this.insurer != null && !this.insurer.isEmpty();
2137    }
2138
2139    /**
2140     * @param value {@link #insurer} (The Insurer who produced this adjudicated response.)
2141     */
2142    public EligibilityResponse setInsurer(Reference value)  { 
2143      this.insurer = value;
2144      return this;
2145    }
2146
2147    /**
2148     * @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 produced this adjudicated response.)
2149     */
2150    public Organization getInsurerTarget() { 
2151      if (this.insurerTarget == null)
2152        if (Configuration.errorOnAutoCreate())
2153          throw new Error("Attempt to auto-create EligibilityResponse.insurer");
2154        else if (Configuration.doAutoCreate())
2155          this.insurerTarget = new Organization(); // aa
2156      return this.insurerTarget;
2157    }
2158
2159    /**
2160     * @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 produced this adjudicated response.)
2161     */
2162    public EligibilityResponse setInsurerTarget(Organization value) { 
2163      this.insurerTarget = value;
2164      return this;
2165    }
2166
2167    /**
2168     * @return {@link #inforce} (Flag indicating if the coverage provided is inforce currently  if no service date(s) specified or for the whole duration of the service dates.). This is the underlying object with id, value and extensions. The accessor "getInforce" gives direct access to the value
2169     */
2170    public BooleanType getInforceElement() { 
2171      if (this.inforce == null)
2172        if (Configuration.errorOnAutoCreate())
2173          throw new Error("Attempt to auto-create EligibilityResponse.inforce");
2174        else if (Configuration.doAutoCreate())
2175          this.inforce = new BooleanType(); // bb
2176      return this.inforce;
2177    }
2178
2179    public boolean hasInforceElement() { 
2180      return this.inforce != null && !this.inforce.isEmpty();
2181    }
2182
2183    public boolean hasInforce() { 
2184      return this.inforce != null && !this.inforce.isEmpty();
2185    }
2186
2187    /**
2188     * @param value {@link #inforce} (Flag indicating if the coverage provided is inforce currently  if no service date(s) specified or for the whole duration of the service dates.). This is the underlying object with id, value and extensions. The accessor "getInforce" gives direct access to the value
2189     */
2190    public EligibilityResponse setInforceElement(BooleanType value) { 
2191      this.inforce = value;
2192      return this;
2193    }
2194
2195    /**
2196     * @return Flag indicating if the coverage provided is inforce currently  if no service date(s) specified or for the whole duration of the service dates.
2197     */
2198    public boolean getInforce() { 
2199      return this.inforce == null || this.inforce.isEmpty() ? false : this.inforce.getValue();
2200    }
2201
2202    /**
2203     * @param value Flag indicating if the coverage provided is inforce currently  if no service date(s) specified or for the whole duration of the service dates.
2204     */
2205    public EligibilityResponse setInforce(boolean value) { 
2206        if (this.inforce == null)
2207          this.inforce = new BooleanType();
2208        this.inforce.setValue(value);
2209      return this;
2210    }
2211
2212    /**
2213     * @return {@link #insurance} (The insurer may provide both the details for the requested coverage as well as details for additional coverages known to the insurer.)
2214     */
2215    public List<InsuranceComponent> getInsurance() { 
2216      if (this.insurance == null)
2217        this.insurance = new ArrayList<InsuranceComponent>();
2218      return this.insurance;
2219    }
2220
2221    /**
2222     * @return Returns a reference to <code>this</code> for easy method chaining
2223     */
2224    public EligibilityResponse setInsurance(List<InsuranceComponent> theInsurance) { 
2225      this.insurance = theInsurance;
2226      return this;
2227    }
2228
2229    public boolean hasInsurance() { 
2230      if (this.insurance == null)
2231        return false;
2232      for (InsuranceComponent item : this.insurance)
2233        if (!item.isEmpty())
2234          return true;
2235      return false;
2236    }
2237
2238    public InsuranceComponent addInsurance() { //3
2239      InsuranceComponent t = new InsuranceComponent();
2240      if (this.insurance == null)
2241        this.insurance = new ArrayList<InsuranceComponent>();
2242      this.insurance.add(t);
2243      return t;
2244    }
2245
2246    public EligibilityResponse addInsurance(InsuranceComponent t) { //3
2247      if (t == null)
2248        return this;
2249      if (this.insurance == null)
2250        this.insurance = new ArrayList<InsuranceComponent>();
2251      this.insurance.add(t);
2252      return this;
2253    }
2254
2255    /**
2256     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist
2257     */
2258    public InsuranceComponent getInsuranceFirstRep() { 
2259      if (getInsurance().isEmpty()) {
2260        addInsurance();
2261      }
2262      return getInsurance().get(0);
2263    }
2264
2265    /**
2266     * @return {@link #form} (The form to be used for printing the content.)
2267     */
2268    public CodeableConcept getForm() { 
2269      if (this.form == null)
2270        if (Configuration.errorOnAutoCreate())
2271          throw new Error("Attempt to auto-create EligibilityResponse.form");
2272        else if (Configuration.doAutoCreate())
2273          this.form = new CodeableConcept(); // cc
2274      return this.form;
2275    }
2276
2277    public boolean hasForm() { 
2278      return this.form != null && !this.form.isEmpty();
2279    }
2280
2281    /**
2282     * @param value {@link #form} (The form to be used for printing the content.)
2283     */
2284    public EligibilityResponse setForm(CodeableConcept value)  { 
2285      this.form = value;
2286      return this;
2287    }
2288
2289    /**
2290     * @return {@link #error} (Mutually exclusive with Services Provided (Item).)
2291     */
2292    public List<ErrorsComponent> getError() { 
2293      if (this.error == null)
2294        this.error = new ArrayList<ErrorsComponent>();
2295      return this.error;
2296    }
2297
2298    /**
2299     * @return Returns a reference to <code>this</code> for easy method chaining
2300     */
2301    public EligibilityResponse setError(List<ErrorsComponent> theError) { 
2302      this.error = theError;
2303      return this;
2304    }
2305
2306    public boolean hasError() { 
2307      if (this.error == null)
2308        return false;
2309      for (ErrorsComponent item : this.error)
2310        if (!item.isEmpty())
2311          return true;
2312      return false;
2313    }
2314
2315    public ErrorsComponent addError() { //3
2316      ErrorsComponent t = new ErrorsComponent();
2317      if (this.error == null)
2318        this.error = new ArrayList<ErrorsComponent>();
2319      this.error.add(t);
2320      return t;
2321    }
2322
2323    public EligibilityResponse addError(ErrorsComponent t) { //3
2324      if (t == null)
2325        return this;
2326      if (this.error == null)
2327        this.error = new ArrayList<ErrorsComponent>();
2328      this.error.add(t);
2329      return this;
2330    }
2331
2332    /**
2333     * @return The first repetition of repeating field {@link #error}, creating it if it does not already exist
2334     */
2335    public ErrorsComponent getErrorFirstRep() { 
2336      if (getError().isEmpty()) {
2337        addError();
2338      }
2339      return getError().get(0);
2340    }
2341
2342      protected void listChildren(List<Property> children) {
2343        super.listChildren(children);
2344        children.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
2345        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
2346        children.add(new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, 1, created));
2347        children.add(new Property("requestProvider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, requestProvider));
2348        children.add(new Property("requestOrganization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, 1, requestOrganization));
2349        children.add(new Property("request", "Reference(EligibilityRequest)", "Original request resource reference.", 0, 1, request));
2350        children.add(new Property("outcome", "CodeableConcept", "Transaction status: error, complete.", 0, 1, outcome));
2351        children.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition));
2352        children.add(new Property("insurer", "Reference(Organization)", "The Insurer who produced this adjudicated response.", 0, 1, insurer));
2353        children.add(new Property("inforce", "boolean", "Flag indicating if the coverage provided is inforce currently  if no service date(s) specified or for the whole duration of the service dates.", 0, 1, inforce));
2354        children.add(new Property("insurance", "", "The insurer may provide both the details for the requested coverage as well as details for additional coverages known to the insurer.", 0, java.lang.Integer.MAX_VALUE, insurance));
2355        children.add(new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, 1, form));
2356        children.add(new Property("error", "", "Mutually exclusive with Services Provided (Item).", 0, java.lang.Integer.MAX_VALUE, error));
2357      }
2358
2359      @Override
2360      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2361        switch (_hash) {
2362        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier);
2363        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
2364        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, 1, created);
2365        case 1601527200: /*requestProvider*/  return new Property("requestProvider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, requestProvider);
2366        case 599053666: /*requestOrganization*/  return new Property("requestOrganization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, 1, requestOrganization);
2367        case 1095692943: /*request*/  return new Property("request", "Reference(EligibilityRequest)", "Original request resource reference.", 0, 1, request);
2368        case -1106507950: /*outcome*/  return new Property("outcome", "CodeableConcept", "Transaction status: error, complete.", 0, 1, outcome);
2369        case 583380919: /*disposition*/  return new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition);
2370        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The Insurer who produced this adjudicated response.", 0, 1, insurer);
2371        case 1945431270: /*inforce*/  return new Property("inforce", "boolean", "Flag indicating if the coverage provided is inforce currently  if no service date(s) specified or for the whole duration of the service dates.", 0, 1, inforce);
2372        case 73049818: /*insurance*/  return new Property("insurance", "", "The insurer may provide both the details for the requested coverage as well as details for additional coverages known to the insurer.", 0, java.lang.Integer.MAX_VALUE, insurance);
2373        case 3148996: /*form*/  return new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, 1, form);
2374        case 96784904: /*error*/  return new Property("error", "", "Mutually exclusive with Services Provided (Item).", 0, java.lang.Integer.MAX_VALUE, error);
2375        default: return super.getNamedProperty(_hash, _name, _checkValid);
2376        }
2377
2378      }
2379
2380      @Override
2381      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2382        switch (hash) {
2383        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2384        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<EligibilityResponseStatus>
2385        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
2386        case 1601527200: /*requestProvider*/ return this.requestProvider == null ? new Base[0] : new Base[] {this.requestProvider}; // Reference
2387        case 599053666: /*requestOrganization*/ return this.requestOrganization == null ? new Base[0] : new Base[] {this.requestOrganization}; // Reference
2388        case 1095692943: /*request*/ return this.request == null ? new Base[0] : new Base[] {this.request}; // Reference
2389        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // CodeableConcept
2390        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
2391        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
2392        case 1945431270: /*inforce*/ return this.inforce == null ? new Base[0] : new Base[] {this.inforce}; // BooleanType
2393        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
2394        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // CodeableConcept
2395        case 96784904: /*error*/ return this.error == null ? new Base[0] : this.error.toArray(new Base[this.error.size()]); // ErrorsComponent
2396        default: return super.getProperty(hash, name, checkValid);
2397        }
2398
2399      }
2400
2401      @Override
2402      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2403        switch (hash) {
2404        case -1618432855: // identifier
2405          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2406          return value;
2407        case -892481550: // status
2408          value = new EligibilityResponseStatusEnumFactory().fromType(castToCode(value));
2409          this.status = (Enumeration) value; // Enumeration<EligibilityResponseStatus>
2410          return value;
2411        case 1028554472: // created
2412          this.created = castToDateTime(value); // DateTimeType
2413          return value;
2414        case 1601527200: // requestProvider
2415          this.requestProvider = castToReference(value); // Reference
2416          return value;
2417        case 599053666: // requestOrganization
2418          this.requestOrganization = castToReference(value); // Reference
2419          return value;
2420        case 1095692943: // request
2421          this.request = castToReference(value); // Reference
2422          return value;
2423        case -1106507950: // outcome
2424          this.outcome = castToCodeableConcept(value); // CodeableConcept
2425          return value;
2426        case 583380919: // disposition
2427          this.disposition = castToString(value); // StringType
2428          return value;
2429        case 1957615864: // insurer
2430          this.insurer = castToReference(value); // Reference
2431          return value;
2432        case 1945431270: // inforce
2433          this.inforce = castToBoolean(value); // BooleanType
2434          return value;
2435        case 73049818: // insurance
2436          this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
2437          return value;
2438        case 3148996: // form
2439          this.form = castToCodeableConcept(value); // CodeableConcept
2440          return value;
2441        case 96784904: // error
2442          this.getError().add((ErrorsComponent) value); // ErrorsComponent
2443          return value;
2444        default: return super.setProperty(hash, name, value);
2445        }
2446
2447      }
2448
2449      @Override
2450      public Base setProperty(String name, Base value) throws FHIRException {
2451        if (name.equals("identifier")) {
2452          this.getIdentifier().add(castToIdentifier(value));
2453        } else if (name.equals("status")) {
2454          value = new EligibilityResponseStatusEnumFactory().fromType(castToCode(value));
2455          this.status = (Enumeration) value; // Enumeration<EligibilityResponseStatus>
2456        } else if (name.equals("created")) {
2457          this.created = castToDateTime(value); // DateTimeType
2458        } else if (name.equals("requestProvider")) {
2459          this.requestProvider = castToReference(value); // Reference
2460        } else if (name.equals("requestOrganization")) {
2461          this.requestOrganization = castToReference(value); // Reference
2462        } else if (name.equals("request")) {
2463          this.request = castToReference(value); // Reference
2464        } else if (name.equals("outcome")) {
2465          this.outcome = castToCodeableConcept(value); // CodeableConcept
2466        } else if (name.equals("disposition")) {
2467          this.disposition = castToString(value); // StringType
2468        } else if (name.equals("insurer")) {
2469          this.insurer = castToReference(value); // Reference
2470        } else if (name.equals("inforce")) {
2471          this.inforce = castToBoolean(value); // BooleanType
2472        } else if (name.equals("insurance")) {
2473          this.getInsurance().add((InsuranceComponent) value);
2474        } else if (name.equals("form")) {
2475          this.form = castToCodeableConcept(value); // CodeableConcept
2476        } else if (name.equals("error")) {
2477          this.getError().add((ErrorsComponent) value);
2478        } else
2479          return super.setProperty(name, value);
2480        return value;
2481      }
2482
2483      @Override
2484      public Base makeProperty(int hash, String name) throws FHIRException {
2485        switch (hash) {
2486        case -1618432855:  return addIdentifier(); 
2487        case -892481550:  return getStatusElement();
2488        case 1028554472:  return getCreatedElement();
2489        case 1601527200:  return getRequestProvider(); 
2490        case 599053666:  return getRequestOrganization(); 
2491        case 1095692943:  return getRequest(); 
2492        case -1106507950:  return getOutcome(); 
2493        case 583380919:  return getDispositionElement();
2494        case 1957615864:  return getInsurer(); 
2495        case 1945431270:  return getInforceElement();
2496        case 73049818:  return addInsurance(); 
2497        case 3148996:  return getForm(); 
2498        case 96784904:  return addError(); 
2499        default: return super.makeProperty(hash, name);
2500        }
2501
2502      }
2503
2504      @Override
2505      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2506        switch (hash) {
2507        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2508        case -892481550: /*status*/ return new String[] {"code"};
2509        case 1028554472: /*created*/ return new String[] {"dateTime"};
2510        case 1601527200: /*requestProvider*/ return new String[] {"Reference"};
2511        case 599053666: /*requestOrganization*/ return new String[] {"Reference"};
2512        case 1095692943: /*request*/ return new String[] {"Reference"};
2513        case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
2514        case 583380919: /*disposition*/ return new String[] {"string"};
2515        case 1957615864: /*insurer*/ return new String[] {"Reference"};
2516        case 1945431270: /*inforce*/ return new String[] {"boolean"};
2517        case 73049818: /*insurance*/ return new String[] {};
2518        case 3148996: /*form*/ return new String[] {"CodeableConcept"};
2519        case 96784904: /*error*/ return new String[] {};
2520        default: return super.getTypesForProperty(hash, name);
2521        }
2522
2523      }
2524
2525      @Override
2526      public Base addChild(String name) throws FHIRException {
2527        if (name.equals("identifier")) {
2528          return addIdentifier();
2529        }
2530        else if (name.equals("status")) {
2531          throw new FHIRException("Cannot call addChild on a primitive type EligibilityResponse.status");
2532        }
2533        else if (name.equals("created")) {
2534          throw new FHIRException("Cannot call addChild on a primitive type EligibilityResponse.created");
2535        }
2536        else if (name.equals("requestProvider")) {
2537          this.requestProvider = new Reference();
2538          return this.requestProvider;
2539        }
2540        else if (name.equals("requestOrganization")) {
2541          this.requestOrganization = new Reference();
2542          return this.requestOrganization;
2543        }
2544        else if (name.equals("request")) {
2545          this.request = new Reference();
2546          return this.request;
2547        }
2548        else if (name.equals("outcome")) {
2549          this.outcome = new CodeableConcept();
2550          return this.outcome;
2551        }
2552        else if (name.equals("disposition")) {
2553          throw new FHIRException("Cannot call addChild on a primitive type EligibilityResponse.disposition");
2554        }
2555        else if (name.equals("insurer")) {
2556          this.insurer = new Reference();
2557          return this.insurer;
2558        }
2559        else if (name.equals("inforce")) {
2560          throw new FHIRException("Cannot call addChild on a primitive type EligibilityResponse.inforce");
2561        }
2562        else if (name.equals("insurance")) {
2563          return addInsurance();
2564        }
2565        else if (name.equals("form")) {
2566          this.form = new CodeableConcept();
2567          return this.form;
2568        }
2569        else if (name.equals("error")) {
2570          return addError();
2571        }
2572        else
2573          return super.addChild(name);
2574      }
2575
2576  public String fhirType() {
2577    return "EligibilityResponse";
2578
2579  }
2580
2581      public EligibilityResponse copy() {
2582        EligibilityResponse dst = new EligibilityResponse();
2583        copyValues(dst);
2584        if (identifier != null) {
2585          dst.identifier = new ArrayList<Identifier>();
2586          for (Identifier i : identifier)
2587            dst.identifier.add(i.copy());
2588        };
2589        dst.status = status == null ? null : status.copy();
2590        dst.created = created == null ? null : created.copy();
2591        dst.requestProvider = requestProvider == null ? null : requestProvider.copy();
2592        dst.requestOrganization = requestOrganization == null ? null : requestOrganization.copy();
2593        dst.request = request == null ? null : request.copy();
2594        dst.outcome = outcome == null ? null : outcome.copy();
2595        dst.disposition = disposition == null ? null : disposition.copy();
2596        dst.insurer = insurer == null ? null : insurer.copy();
2597        dst.inforce = inforce == null ? null : inforce.copy();
2598        if (insurance != null) {
2599          dst.insurance = new ArrayList<InsuranceComponent>();
2600          for (InsuranceComponent i : insurance)
2601            dst.insurance.add(i.copy());
2602        };
2603        dst.form = form == null ? null : form.copy();
2604        if (error != null) {
2605          dst.error = new ArrayList<ErrorsComponent>();
2606          for (ErrorsComponent i : error)
2607            dst.error.add(i.copy());
2608        };
2609        return dst;
2610      }
2611
2612      protected EligibilityResponse typedCopy() {
2613        return copy();
2614      }
2615
2616      @Override
2617      public boolean equalsDeep(Base other_) {
2618        if (!super.equalsDeep(other_))
2619          return false;
2620        if (!(other_ instanceof EligibilityResponse))
2621          return false;
2622        EligibilityResponse o = (EligibilityResponse) other_;
2623        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(created, o.created, true)
2624           && compareDeep(requestProvider, o.requestProvider, true) && compareDeep(requestOrganization, o.requestOrganization, true)
2625           && compareDeep(request, o.request, true) && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true)
2626           && compareDeep(insurer, o.insurer, true) && compareDeep(inforce, o.inforce, true) && compareDeep(insurance, o.insurance, true)
2627           && compareDeep(form, o.form, true) && compareDeep(error, o.error, true);
2628      }
2629
2630      @Override
2631      public boolean equalsShallow(Base other_) {
2632        if (!super.equalsShallow(other_))
2633          return false;
2634        if (!(other_ instanceof EligibilityResponse))
2635          return false;
2636        EligibilityResponse o = (EligibilityResponse) other_;
2637        return compareValues(status, o.status, true) && compareValues(created, o.created, true) && compareValues(disposition, o.disposition, true)
2638           && compareValues(inforce, o.inforce, true);
2639      }
2640
2641      public boolean isEmpty() {
2642        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, created
2643          , requestProvider, requestOrganization, request, outcome, disposition, insurer, inforce
2644          , insurance, form, error);
2645      }
2646
2647  @Override
2648  public ResourceType getResourceType() {
2649    return ResourceType.EligibilityResponse;
2650   }
2651
2652 /**
2653   * Search parameter: <b>identifier</b>
2654   * <p>
2655   * Description: <b>The business identifier</b><br>
2656   * Type: <b>token</b><br>
2657   * Path: <b>EligibilityResponse.identifier</b><br>
2658   * </p>
2659   */
2660  @SearchParamDefinition(name="identifier", path="EligibilityResponse.identifier", description="The business identifier", type="token" )
2661  public static final String SP_IDENTIFIER = "identifier";
2662 /**
2663   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2664   * <p>
2665   * Description: <b>The business identifier</b><br>
2666   * Type: <b>token</b><br>
2667   * Path: <b>EligibilityResponse.identifier</b><br>
2668   * </p>
2669   */
2670  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2671
2672 /**
2673   * Search parameter: <b>request</b>
2674   * <p>
2675   * Description: <b>The EligibilityRequest reference</b><br>
2676   * Type: <b>reference</b><br>
2677   * Path: <b>EligibilityResponse.request</b><br>
2678   * </p>
2679   */
2680  @SearchParamDefinition(name="request", path="EligibilityResponse.request", description="The EligibilityRequest reference", type="reference", target={EligibilityRequest.class } )
2681  public static final String SP_REQUEST = "request";
2682 /**
2683   * <b>Fluent Client</b> search parameter constant for <b>request</b>
2684   * <p>
2685   * Description: <b>The EligibilityRequest reference</b><br>
2686   * Type: <b>reference</b><br>
2687   * Path: <b>EligibilityResponse.request</b><br>
2688   * </p>
2689   */
2690  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST);
2691
2692/**
2693   * Constant for fluent queries to be used to add include statements. Specifies
2694   * the path value of "<b>EligibilityResponse:request</b>".
2695   */
2696  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST = new ca.uhn.fhir.model.api.Include("EligibilityResponse:request").toLocked();
2697
2698 /**
2699   * Search parameter: <b>disposition</b>
2700   * <p>
2701   * Description: <b>The contents of the disposition message</b><br>
2702   * Type: <b>string</b><br>
2703   * Path: <b>EligibilityResponse.disposition</b><br>
2704   * </p>
2705   */
2706  @SearchParamDefinition(name="disposition", path="EligibilityResponse.disposition", description="The contents of the disposition message", type="string" )
2707  public static final String SP_DISPOSITION = "disposition";
2708 /**
2709   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
2710   * <p>
2711   * Description: <b>The contents of the disposition message</b><br>
2712   * Type: <b>string</b><br>
2713   * Path: <b>EligibilityResponse.disposition</b><br>
2714   * </p>
2715   */
2716  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
2717
2718 /**
2719   * Search parameter: <b>insurer</b>
2720   * <p>
2721   * Description: <b>The organization which generated this resource</b><br>
2722   * Type: <b>reference</b><br>
2723   * Path: <b>EligibilityResponse.insurer</b><br>
2724   * </p>
2725   */
2726  @SearchParamDefinition(name="insurer", path="EligibilityResponse.insurer", description="The organization which generated this resource", type="reference", target={Organization.class } )
2727  public static final String SP_INSURER = "insurer";
2728 /**
2729   * <b>Fluent Client</b> search parameter constant for <b>insurer</b>
2730   * <p>
2731   * Description: <b>The organization which generated this resource</b><br>
2732   * Type: <b>reference</b><br>
2733   * Path: <b>EligibilityResponse.insurer</b><br>
2734   * </p>
2735   */
2736  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSURER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INSURER);
2737
2738/**
2739   * Constant for fluent queries to be used to add include statements. Specifies
2740   * the path value of "<b>EligibilityResponse:insurer</b>".
2741   */
2742  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSURER = new ca.uhn.fhir.model.api.Include("EligibilityResponse:insurer").toLocked();
2743
2744 /**
2745   * Search parameter: <b>created</b>
2746   * <p>
2747   * Description: <b>The creation date</b><br>
2748   * Type: <b>date</b><br>
2749   * Path: <b>EligibilityResponse.created</b><br>
2750   * </p>
2751   */
2752  @SearchParamDefinition(name="created", path="EligibilityResponse.created", description="The creation date", type="date" )
2753  public static final String SP_CREATED = "created";
2754 /**
2755   * <b>Fluent Client</b> search parameter constant for <b>created</b>
2756   * <p>
2757   * Description: <b>The creation date</b><br>
2758   * Type: <b>date</b><br>
2759   * Path: <b>EligibilityResponse.created</b><br>
2760   * </p>
2761   */
2762  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
2763
2764 /**
2765   * Search parameter: <b>request-organization</b>
2766   * <p>
2767   * Description: <b>The EligibilityRequest organization</b><br>
2768   * Type: <b>reference</b><br>
2769   * Path: <b>EligibilityResponse.requestOrganization</b><br>
2770   * </p>
2771   */
2772  @SearchParamDefinition(name="request-organization", path="EligibilityResponse.requestOrganization", description="The EligibilityRequest organization", type="reference", target={Organization.class } )
2773  public static final String SP_REQUEST_ORGANIZATION = "request-organization";
2774 /**
2775   * <b>Fluent Client</b> search parameter constant for <b>request-organization</b>
2776   * <p>
2777   * Description: <b>The EligibilityRequest organization</b><br>
2778   * Type: <b>reference</b><br>
2779   * Path: <b>EligibilityResponse.requestOrganization</b><br>
2780   * </p>
2781   */
2782  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST_ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST_ORGANIZATION);
2783
2784/**
2785   * Constant for fluent queries to be used to add include statements. Specifies
2786   * the path value of "<b>EligibilityResponse:request-organization</b>".
2787   */
2788  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST_ORGANIZATION = new ca.uhn.fhir.model.api.Include("EligibilityResponse:request-organization").toLocked();
2789
2790 /**
2791   * Search parameter: <b>request-provider</b>
2792   * <p>
2793   * Description: <b>The EligibilityRequest provider</b><br>
2794   * Type: <b>reference</b><br>
2795   * Path: <b>EligibilityResponse.requestProvider</b><br>
2796   * </p>
2797   */
2798  @SearchParamDefinition(name="request-provider", path="EligibilityResponse.requestProvider", description="The EligibilityRequest provider", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class } )
2799  public static final String SP_REQUEST_PROVIDER = "request-provider";
2800 /**
2801   * <b>Fluent Client</b> search parameter constant for <b>request-provider</b>
2802   * <p>
2803   * Description: <b>The EligibilityRequest provider</b><br>
2804   * Type: <b>reference</b><br>
2805   * Path: <b>EligibilityResponse.requestProvider</b><br>
2806   * </p>
2807   */
2808  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST_PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST_PROVIDER);
2809
2810/**
2811   * Constant for fluent queries to be used to add include statements. Specifies
2812   * the path value of "<b>EligibilityResponse:request-provider</b>".
2813   */
2814  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST_PROVIDER = new ca.uhn.fhir.model.api.Include("EligibilityResponse:request-provider").toLocked();
2815
2816 /**
2817   * Search parameter: <b>outcome</b>
2818   * <p>
2819   * Description: <b>The processing outcome</b><br>
2820   * Type: <b>token</b><br>
2821   * Path: <b>EligibilityResponse.outcome</b><br>
2822   * </p>
2823   */
2824  @SearchParamDefinition(name="outcome", path="EligibilityResponse.outcome", description="The processing outcome", type="token" )
2825  public static final String SP_OUTCOME = "outcome";
2826 /**
2827   * <b>Fluent Client</b> search parameter constant for <b>outcome</b>
2828   * <p>
2829   * Description: <b>The processing outcome</b><br>
2830   * Type: <b>token</b><br>
2831   * Path: <b>EligibilityResponse.outcome</b><br>
2832   * </p>
2833   */
2834  public static final ca.uhn.fhir.rest.gclient.TokenClientParam OUTCOME = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_OUTCOME);
2835
2836
2837}
2838