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