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