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