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