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