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