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