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