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