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