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