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