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, Dec 27, 2018 10:06-0500 for FHIR v4.0.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 SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
301        /**
302         * A number to uniquely identify supporting information entries.
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="A number to uniquely identify supporting information entries." )
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="Data to be provided", formalDefinition="Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data." )
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 items, 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 items, 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 SupportingInformationComponent() {
333        super();
334      }
335
336    /**
337     * Constructor
338     */
339      public SupportingInformationComponent(PositiveIntType sequence, Reference information) {
340        super();
341        this.sequence = sequence;
342        this.information = information;
343      }
344
345        /**
346         * @return {@link #sequence} (A number to uniquely identify supporting information entries.). 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 SupportingInformationComponent.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} (A number to uniquely identify supporting information entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
367         */
368        public SupportingInformationComponent setSequenceElement(PositiveIntType value) { 
369          this.sequence = value;
370          return this;
371        }
372
373        /**
374         * @return A number to uniquely identify supporting information entries.
375         */
376        public int getSequence() { 
377          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
378        }
379
380        /**
381         * @param value A number to uniquely identify supporting information entries.
382         */
383        public SupportingInformationComponent 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 SupportingInformationComponent.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 SupportingInformationComponent 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 SupportingInformationComponent 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 items, 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 SupportingInformationComponent.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 items, 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 SupportingInformationComponent setAppliesToAllElement(BooleanType value) { 
453          this.appliesToAll = value;
454          return this;
455        }
456
457        /**
458         * @return The supporting materials are applicable for all detail items, 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 items, product/servce categories and specific billing codes.
466         */
467        public SupportingInformationComponent 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", "A number to uniquely identify supporting information entries.", 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 items, 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", "A number to uniquely identify supporting information entries.", 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 items, 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 SupportingInformationComponent copy() {
572        SupportingInformationComponent dst = new SupportingInformationComponent();
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 SupportingInformationComponent))
585          return false;
586        SupportingInformationComponent o = (SupportingInformationComponent) 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 SupportingInformationComponent))
596          return false;
597        SupportingInformationComponent o = (SupportingInformationComponent) 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.supportingInfo";
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 to be used for evaluation of this request when set to true.
618         */
619        @Child(name = "focal", type = {BooleanType.class}, order=1, min=0, max=1, modifier=false, summary=false)
620        @Description(shortDefinition="Applicable coverage", formalDefinition="A flag to indicate that this Coverage is to be used for evaluation of this request when set to true." )
621        protected BooleanType focal;
622
623        /**
624         * Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.
625         */
626        @Child(name = "coverage", type = {Coverage.class}, order=2, min=1, max=1, modifier=false, summary=false)
627        @Description(shortDefinition="Insurance information", formalDefinition="Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system." )
628        protected Reference coverage;
629
630        /**
631         * The actual object that is the target of the reference (Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.)
632         */
633        protected Coverage coverageTarget;
634
635        /**
636         * A business agreement number established between the provider and the insurer for special business processing purposes.
637         */
638        @Child(name = "businessArrangement", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
639        @Description(shortDefinition="Additional provider contract number", formalDefinition="A business agreement number established between the provider and the insurer for special business processing purposes." )
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 to be used for evaluation of this request when set to true.). 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 to be used for evaluation of this request when set to true.). 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 to be used for evaluation of this request when set to true.
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 to be used for evaluation of this request when set to true.
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} (Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.)
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} (Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.)
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. (Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.)
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. (Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.)
742         */
743        public InsuranceComponent setCoverageTarget(Coverage value) { 
744          this.coverageTarget = value;
745          return this;
746        }
747
748        /**
749         * @return {@link #businessArrangement} (A business agreement number established between the provider and the insurer for special business processing purposes.). 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} (A business agreement number established between the provider and the insurer for special business processing purposes.). 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 A business agreement number established between the provider and the insurer for special business processing purposes.
778         */
779        public String getBusinessArrangement() { 
780          return this.businessArrangement == null ? null : this.businessArrangement.getValue();
781        }
782
783        /**
784         * @param value A business agreement number established between the provider and the insurer for special business processing purposes.
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 to be used for evaluation of this request when set to true.", 0, 1, focal));
800          children.add(new Property("coverage", "Reference(Coverage)", "Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.", 0, 1, coverage));
801          children.add(new Property("businessArrangement", "string", "A business agreement number established between the provider and the insurer for special business processing purposes.", 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 to be used for evaluation of this request when set to true.", 0, 1, focal);
808          case -351767064: /*coverage*/  return new Property("coverage", "Reference(Coverage)", "Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.", 0, 1, coverage);
809          case 259920682: /*businessArrangement*/  return new Property("businessArrangement", "string", "A business agreement number established between the provider and the insurer for special business processing purposes.", 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 applicable for this service or product line.
941         */
942        @Child(name = "supportingInfoSequence", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
943        @Description(shortDefinition="Applicable exception or supporting information", formalDefinition="Exceptions, special conditions and supporting information applicable for this service or product line." )
944        protected List<PositiveIntType> supportingInfoSequence;
945
946        /**
947         * Code to identify the general type of benefits under which products and services are provided.
948         */
949        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
950        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
951        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
952        protected CodeableConcept category;
953
954        /**
955         * This contains the product, service, drug or other billing code for the item.
956         */
957        @Child(name = "productOrService", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
958        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="This contains the product, service, drug or other billing code for the item." )
959        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
960        protected CodeableConcept productOrService;
961
962        /**
963         * Item typification or modifiers codes to convey additional context for the product or service.
964         */
965        @Child(name = "modifier", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
966        @Description(shortDefinition="Product or service billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
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 product or service to be 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 product or service to be 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 product or service to be 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 amount charged to the patient by the provider for a single unit.
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 item", formalDefinition="The amount charged to the patient by the provider for a single unit." )
994        protected Money unitPrice;
995
996        /**
997         * Facility where the services will be 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 will be provided." )
1001        protected Reference facility;
1002
1003        /**
1004         * The actual object that is the target of the reference (Facility where the services will be provided.)
1005         */
1006        protected Resource facilityTarget;
1007
1008        /**
1009         * 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="Applicable diagnosis", formalDefinition="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 = 389110539L;
1028
1029    /**
1030     * Constructor
1031     */
1032      public DetailsComponent() {
1033        super();
1034      }
1035
1036        /**
1037         * @return {@link #supportingInfoSequence} (Exceptions, special conditions and supporting information applicable for this service or product line.)
1038         */
1039        public List<PositiveIntType> getSupportingInfoSequence() { 
1040          if (this.supportingInfoSequence == null)
1041            this.supportingInfoSequence = new ArrayList<PositiveIntType>();
1042          return this.supportingInfoSequence;
1043        }
1044
1045        /**
1046         * @return Returns a reference to <code>this</code> for easy method chaining
1047         */
1048        public DetailsComponent setSupportingInfoSequence(List<PositiveIntType> theSupportingInfoSequence) { 
1049          this.supportingInfoSequence = theSupportingInfoSequence;
1050          return this;
1051        }
1052
1053        public boolean hasSupportingInfoSequence() { 
1054          if (this.supportingInfoSequence == null)
1055            return false;
1056          for (PositiveIntType item : this.supportingInfoSequence)
1057            if (!item.isEmpty())
1058              return true;
1059          return false;
1060        }
1061
1062        /**
1063         * @return {@link #supportingInfoSequence} (Exceptions, special conditions and supporting information applicable for this service or product line.)
1064         */
1065        public PositiveIntType addSupportingInfoSequenceElement() {//2 
1066          PositiveIntType t = new PositiveIntType();
1067          if (this.supportingInfoSequence == null)
1068            this.supportingInfoSequence = new ArrayList<PositiveIntType>();
1069          this.supportingInfoSequence.add(t);
1070          return t;
1071        }
1072
1073        /**
1074         * @param value {@link #supportingInfoSequence} (Exceptions, special conditions and supporting information applicable for this service or product line.)
1075         */
1076        public DetailsComponent addSupportingInfoSequence(int value) { //1
1077          PositiveIntType t = new PositiveIntType();
1078          t.setValue(value);
1079          if (this.supportingInfoSequence == null)
1080            this.supportingInfoSequence = new ArrayList<PositiveIntType>();
1081          this.supportingInfoSequence.add(t);
1082          return this;
1083        }
1084
1085        /**
1086         * @param value {@link #supportingInfoSequence} (Exceptions, special conditions and supporting information applicable for this service or product line.)
1087         */
1088        public boolean hasSupportingInfoSequence(int value) { 
1089          if (this.supportingInfoSequence == null)
1090            return false;
1091          for (PositiveIntType v : this.supportingInfoSequence)
1092            if (v.getValue().equals(value)) // positiveInt
1093              return true;
1094          return false;
1095        }
1096
1097        /**
1098         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
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} (Code to identify the general type of benefits under which products and services are provided.)
1115         */
1116        public DetailsComponent setCategory(CodeableConcept value) { 
1117          this.category = value;
1118          return this;
1119        }
1120
1121        /**
1122         * @return {@link #productOrService} (This contains the product, service, drug or other billing code for the item.)
1123         */
1124        public CodeableConcept getProductOrService() { 
1125          if (this.productOrService == null)
1126            if (Configuration.errorOnAutoCreate())
1127              throw new Error("Attempt to auto-create DetailsComponent.productOrService");
1128            else if (Configuration.doAutoCreate())
1129              this.productOrService = new CodeableConcept(); // cc
1130          return this.productOrService;
1131        }
1132
1133        public boolean hasProductOrService() { 
1134          return this.productOrService != null && !this.productOrService.isEmpty();
1135        }
1136
1137        /**
1138         * @param value {@link #productOrService} (This contains the product, service, drug or other billing code for the item.)
1139         */
1140        public DetailsComponent setProductOrService(CodeableConcept value) { 
1141          this.productOrService = value;
1142          return this;
1143        }
1144
1145        /**
1146         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
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 product or service to be 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 product or service to be 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 product or service to be 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 product or service to be 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 amount charged to the patient by the provider for a single unit.)
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 amount charged to the patient by the provider for a single unit.)
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 will be 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 will be 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 will be 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 will be provided.)
1318         */
1319        public DetailsComponent setFacilityTarget(Resource value) { 
1320          this.facilityTarget = value;
1321          return this;
1322        }
1323
1324        /**
1325         * @return {@link #diagnosis} (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("supportingInfoSequence", "positiveInt", "Exceptions, special conditions and supporting information applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, supportingInfoSequence));
1443          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
1444          children.add(new Property("productOrService", "CodeableConcept", "This contains the product, service, drug or other billing code for the item.", 0, 1, productOrService));
1445          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier));
1446          children.add(new Property("provider", "Reference(Practitioner|PractitionerRole)", "The practitioner who is responsible for the product or service to be 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 amount charged to the patient by the provider for a single unit.", 0, 1, unitPrice));
1449          children.add(new Property("facility", "Reference(Location|Organization)", "Facility where the services will be provided.", 0, 1, facility));
1450          children.add(new Property("diagnosis", "", "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 -595860510: /*supportingInfoSequence*/  return new Property("supportingInfoSequence", "positiveInt", "Exceptions, special conditions and supporting information applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, supportingInfoSequence);
1458          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category);
1459          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "This contains the product, service, drug or other billing code for the item.", 0, 1, productOrService);
1460          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier);
1461          case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole)", "The practitioner who is responsible for the product or service to be 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 amount charged to the patient by the provider for a single unit.", 0, 1, unitPrice);
1464          case 501116579: /*facility*/  return new Property("facility", "Reference(Location|Organization)", "Facility where the services will be provided.", 0, 1, facility);
1465          case 1196993265: /*diagnosis*/  return new Property("diagnosis", "", "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 -595860510: /*supportingInfoSequence*/ return this.supportingInfoSequence == null ? new Base[0] : this.supportingInfoSequence.toArray(new Base[this.supportingInfoSequence.size()]); // PositiveIntType
1476        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1477        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // 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 -595860510: // supportingInfoSequence
1494          this.getSupportingInfoSequence().add(castToPositiveInt(value)); // PositiveIntType
1495          return value;
1496        case 50511102: // category
1497          this.category = castToCodeableConcept(value); // CodeableConcept
1498          return value;
1499        case 1957227299: // productOrService
1500          this.productOrService = 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("supportingInfoSequence")) {
1531          this.getSupportingInfoSequence().add(castToPositiveInt(value));
1532        } else if (name.equals("category")) {
1533          this.category = castToCodeableConcept(value); // CodeableConcept
1534        } else if (name.equals("productOrService")) {
1535          this.productOrService = 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 -595860510:  return addSupportingInfoSequenceElement();
1559        case 50511102:  return getCategory(); 
1560        case 1957227299:  return getProductOrService(); 
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 -595860510: /*supportingInfoSequence*/ return new String[] {"positiveInt"};
1577        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1578        case 1957227299: /*productOrService*/ 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("supportingInfoSequence")) {
1594          throw new FHIRException("Cannot call addChild on a primitive type CoverageEligibilityRequest.supportingInfoSequence");
1595        }
1596        else if (name.equals("category")) {
1597          this.category = new CodeableConcept();
1598          return this.category;
1599        }
1600        else if (name.equals("productOrService")) {
1601          this.productOrService = new CodeableConcept();
1602          return this.productOrService;
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 (supportingInfoSequence != null) {
1637          dst.supportingInfoSequence = new ArrayList<PositiveIntType>();
1638          for (PositiveIntType i : supportingInfoSequence)
1639            dst.supportingInfoSequence.add(i.copy());
1640        };
1641        dst.category = category == null ? null : category.copy();
1642        dst.productOrService = productOrService == null ? null : productOrService.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(supportingInfoSequence, o.supportingInfoSequence, true) && compareDeep(category, o.category, true)
1673           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
1674           && compareDeep(provider, o.provider, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
1675           && compareDeep(facility, o.facility, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(detail, o.detail, true)
1676          ;
1677      }
1678
1679      @Override
1680      public boolean equalsShallow(Base other_) {
1681        if (!super.equalsShallow(other_))
1682          return false;
1683        if (!(other_ instanceof DetailsComponent))
1684          return false;
1685        DetailsComponent o = (DetailsComponent) other_;
1686        return compareValues(supportingInfoSequence, o.supportingInfoSequence, true);
1687      }
1688
1689      public boolean isEmpty() {
1690        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(supportingInfoSequence, category
1691          , productOrService, modifier, provider, quantity, unitPrice, facility, diagnosis
1692          , detail);
1693      }
1694
1695  public String fhirType() {
1696    return "CoverageEligibilityRequest.item";
1697
1698  }
1699
1700  }
1701
1702    @Block()
1703    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1704        /**
1705         * The nature of illness or problem in a coded form or as a reference to an external defined Condition.
1706         */
1707        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=1, min=0, max=1, modifier=false, summary=false)
1708        @Description(shortDefinition="Nature of illness or problem", formalDefinition="The nature of illness or problem in a coded form or as a reference to an external defined Condition." )
1709        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
1710        protected Type diagnosis;
1711
1712        private static final long serialVersionUID = -454532709L;
1713
1714    /**
1715     * Constructor
1716     */
1717      public DiagnosisComponent() {
1718        super();
1719      }
1720
1721        /**
1722         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1723         */
1724        public Type getDiagnosis() { 
1725          return this.diagnosis;
1726        }
1727
1728        /**
1729         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1730         */
1731        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
1732          if (this.diagnosis == null)
1733            this.diagnosis = new CodeableConcept();
1734          if (!(this.diagnosis instanceof CodeableConcept))
1735            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1736          return (CodeableConcept) this.diagnosis;
1737        }
1738
1739        public boolean hasDiagnosisCodeableConcept() { 
1740          return this != null && this.diagnosis instanceof CodeableConcept;
1741        }
1742
1743        /**
1744         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1745         */
1746        public Reference getDiagnosisReference() throws FHIRException { 
1747          if (this.diagnosis == null)
1748            this.diagnosis = new Reference();
1749          if (!(this.diagnosis instanceof Reference))
1750            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1751          return (Reference) this.diagnosis;
1752        }
1753
1754        public boolean hasDiagnosisReference() { 
1755          return this != null && this.diagnosis instanceof Reference;
1756        }
1757
1758        public boolean hasDiagnosis() { 
1759          return this.diagnosis != null && !this.diagnosis.isEmpty();
1760        }
1761
1762        /**
1763         * @param value {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1764         */
1765        public DiagnosisComponent setDiagnosis(Type value) { 
1766          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1767            throw new Error("Not the right type for CoverageEligibilityRequest.item.diagnosis.diagnosis[x]: "+value.fhirType());
1768          this.diagnosis = value;
1769          return this;
1770        }
1771
1772        protected void listChildren(List<Property> children) {
1773          super.listChildren(children);
1774          children.add(new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis));
1775        }
1776
1777        @Override
1778        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1779          switch (_hash) {
1780          case -1487009809: /*diagnosis[x]*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
1781          case 1196993265: /*diagnosis*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
1782          case 277781616: /*diagnosisCodeableConcept*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
1783          case 2050454362: /*diagnosisReference*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
1784          default: return super.getNamedProperty(_hash, _name, _checkValid);
1785          }
1786
1787        }
1788
1789      @Override
1790      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1791        switch (hash) {
1792        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // Type
1793        default: return super.getProperty(hash, name, checkValid);
1794        }
1795
1796      }
1797
1798      @Override
1799      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1800        switch (hash) {
1801        case 1196993265: // diagnosis
1802          this.diagnosis = castToType(value); // Type
1803          return value;
1804        default: return super.setProperty(hash, name, value);
1805        }
1806
1807      }
1808
1809      @Override
1810      public Base setProperty(String name, Base value) throws FHIRException {
1811        if (name.equals("diagnosis[x]")) {
1812          this.diagnosis = castToType(value); // Type
1813        } else
1814          return super.setProperty(name, value);
1815        return value;
1816      }
1817
1818      @Override
1819      public Base makeProperty(int hash, String name) throws FHIRException {
1820        switch (hash) {
1821        case -1487009809:  return getDiagnosis(); 
1822        case 1196993265:  return getDiagnosis(); 
1823        default: return super.makeProperty(hash, name);
1824        }
1825
1826      }
1827
1828      @Override
1829      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1830        switch (hash) {
1831        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
1832        default: return super.getTypesForProperty(hash, name);
1833        }
1834
1835      }
1836
1837      @Override
1838      public Base addChild(String name) throws FHIRException {
1839        if (name.equals("diagnosisCodeableConcept")) {
1840          this.diagnosis = new CodeableConcept();
1841          return this.diagnosis;
1842        }
1843        else if (name.equals("diagnosisReference")) {
1844          this.diagnosis = new Reference();
1845          return this.diagnosis;
1846        }
1847        else
1848          return super.addChild(name);
1849      }
1850
1851      public DiagnosisComponent copy() {
1852        DiagnosisComponent dst = new DiagnosisComponent();
1853        copyValues(dst);
1854        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
1855        return dst;
1856      }
1857
1858      @Override
1859      public boolean equalsDeep(Base other_) {
1860        if (!super.equalsDeep(other_))
1861          return false;
1862        if (!(other_ instanceof DiagnosisComponent))
1863          return false;
1864        DiagnosisComponent o = (DiagnosisComponent) other_;
1865        return compareDeep(diagnosis, o.diagnosis, true);
1866      }
1867
1868      @Override
1869      public boolean equalsShallow(Base other_) {
1870        if (!super.equalsShallow(other_))
1871          return false;
1872        if (!(other_ instanceof DiagnosisComponent))
1873          return false;
1874        DiagnosisComponent o = (DiagnosisComponent) other_;
1875        return true;
1876      }
1877
1878      public boolean isEmpty() {
1879        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(diagnosis);
1880      }
1881
1882  public String fhirType() {
1883    return "CoverageEligibilityRequest.item.diagnosis";
1884
1885  }
1886
1887  }
1888
1889    /**
1890     * A unique identifier assigned to this coverage eligiblity request.
1891     */
1892    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1893    @Description(shortDefinition="Business Identifier for coverage eligiblity request", formalDefinition="A unique identifier assigned to this coverage eligiblity request." )
1894    protected List<Identifier> identifier;
1895
1896    /**
1897     * The status of the resource instance.
1898     */
1899    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
1900    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
1901    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fm-status")
1902    protected Enumeration<EligibilityRequestStatus> status;
1903
1904    /**
1905     * When the requestor expects the processor to complete processing.
1906     */
1907    @Child(name = "priority", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
1908    @Description(shortDefinition="Desired processing priority", formalDefinition="When the requestor expects the processor to complete processing." )
1909    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/process-priority")
1910    protected CodeableConcept priority;
1911
1912    /**
1913     * Code to specify whether requesting: prior authorization requirements for some service categories or billing codes; benefits for coverages specified or discovered; discovery and return of coverages for the patient; and/or validation that the specified coverage is in-force at the date/period specified or 'now' if not specified.
1914     */
1915    @Child(name = "purpose", type = {CodeType.class}, order=3, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1916    @Description(shortDefinition="auth-requirements | benefits | discovery | validation", formalDefinition="Code to specify whether requesting: prior authorization requirements for some service categories or billing codes; benefits for coverages specified or discovered; discovery and return of coverages for the patient; and/or validation that the specified coverage is in-force at the date/period specified or 'now' if not specified." )
1917    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/eligibilityrequest-purpose")
1918    protected List<Enumeration<EligibilityRequestPurpose>> purpose;
1919
1920    /**
1921     * The party who is the beneficiary of the supplied coverage and for whom eligibility is sought.
1922     */
1923    @Child(name = "patient", type = {Patient.class}, order=4, min=1, max=1, modifier=false, summary=true)
1924    @Description(shortDefinition="Intended recipient of products and services", formalDefinition="The party who is the beneficiary of the supplied coverage and for whom eligibility is sought." )
1925    protected Reference patient;
1926
1927    /**
1928     * The actual object that is the target of the reference (The party who is the beneficiary of the supplied coverage and for whom eligibility is sought.)
1929     */
1930    protected Patient patientTarget;
1931
1932    /**
1933     * The date or dates when the enclosed suite of services were performed or completed.
1934     */
1935    @Child(name = "serviced", type = {DateType.class, Period.class}, order=5, min=0, max=1, modifier=false, summary=false)
1936    @Description(shortDefinition="Estimated date or dates of service", formalDefinition="The date or dates when the enclosed suite of services were performed or completed." )
1937    protected Type serviced;
1938
1939    /**
1940     * The date when this resource was created.
1941     */
1942    @Child(name = "created", type = {DateTimeType.class}, order=6, min=1, max=1, modifier=false, summary=true)
1943    @Description(shortDefinition="Creation date", formalDefinition="The date when this resource was created." )
1944    protected DateTimeType created;
1945
1946    /**
1947     * Person who created the request.
1948     */
1949    @Child(name = "enterer", type = {Practitioner.class, PractitionerRole.class}, order=7, min=0, max=1, modifier=false, summary=false)
1950    @Description(shortDefinition="Author", formalDefinition="Person who created the request." )
1951    protected Reference enterer;
1952
1953    /**
1954     * The actual object that is the target of the reference (Person who created the request.)
1955     */
1956    protected Resource entererTarget;
1957
1958    /**
1959     * The provider which is responsible for the request.
1960     */
1961    @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=8, min=0, max=1, modifier=false, summary=false)
1962    @Description(shortDefinition="Party responsible for the request", formalDefinition="The provider which is responsible for the request." )
1963    protected Reference provider;
1964
1965    /**
1966     * The actual object that is the target of the reference (The provider which is responsible for the request.)
1967     */
1968    protected Resource providerTarget;
1969
1970    /**
1971     * The Insurer who issued the coverage in question and is the recipient of the request.
1972     */
1973    @Child(name = "insurer", type = {Organization.class}, order=9, min=1, max=1, modifier=false, summary=true)
1974    @Description(shortDefinition="Coverage issuer", formalDefinition="The Insurer who issued the coverage in question and is the recipient of the request." )
1975    protected Reference insurer;
1976
1977    /**
1978     * The actual object that is the target of the reference (The Insurer who issued the coverage in question and is the recipient of the request.)
1979     */
1980    protected Organization insurerTarget;
1981
1982    /**
1983     * Facility where the services are intended to be provided.
1984     */
1985    @Child(name = "facility", type = {Location.class}, order=10, min=0, max=1, modifier=false, summary=false)
1986    @Description(shortDefinition="Servicing facility", formalDefinition="Facility where the services are intended to be provided." )
1987    protected Reference facility;
1988
1989    /**
1990     * The actual object that is the target of the reference (Facility where the services are intended to be provided.)
1991     */
1992    protected Location facilityTarget;
1993
1994    /**
1995     * Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.
1996     */
1997    @Child(name = "supportingInfo", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1998    @Description(shortDefinition="Supporting information", formalDefinition="Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues." )
1999    protected List<SupportingInformationComponent> supportingInfo;
2000
2001    /**
2002     * Financial instruments for reimbursement for the health care products and services.
2003     */
2004    @Child(name = "insurance", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2005    @Description(shortDefinition="Patient insurance information", formalDefinition="Financial instruments for reimbursement for the health care products and services." )
2006    protected List<InsuranceComponent> insurance;
2007
2008    /**
2009     * Service categories or billable services for which benefit details and/or an authorization prior to service delivery may be required by the payor.
2010     */
2011    @Child(name = "item", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2012    @Description(shortDefinition="Item to be evaluated for eligibiity", formalDefinition="Service categories or billable services for which benefit details and/or an authorization prior to service delivery may be required by the payor." )
2013    protected List<DetailsComponent> item;
2014
2015    private static final long serialVersionUID = 1371127108L;
2016
2017  /**
2018   * Constructor
2019   */
2020    public CoverageEligibilityRequest() {
2021      super();
2022    }
2023
2024  /**
2025   * Constructor
2026   */
2027    public CoverageEligibilityRequest(Enumeration<EligibilityRequestStatus> status, Reference patient, DateTimeType created, Reference insurer) {
2028      super();
2029      this.status = status;
2030      this.patient = patient;
2031      this.created = created;
2032      this.insurer = insurer;
2033    }
2034
2035    /**
2036     * @return {@link #identifier} (A unique identifier assigned to this coverage eligiblity request.)
2037     */
2038    public List<Identifier> getIdentifier() { 
2039      if (this.identifier == null)
2040        this.identifier = new ArrayList<Identifier>();
2041      return this.identifier;
2042    }
2043
2044    /**
2045     * @return Returns a reference to <code>this</code> for easy method chaining
2046     */
2047    public CoverageEligibilityRequest setIdentifier(List<Identifier> theIdentifier) { 
2048      this.identifier = theIdentifier;
2049      return this;
2050    }
2051
2052    public boolean hasIdentifier() { 
2053      if (this.identifier == null)
2054        return false;
2055      for (Identifier item : this.identifier)
2056        if (!item.isEmpty())
2057          return true;
2058      return false;
2059    }
2060
2061    public Identifier addIdentifier() { //3
2062      Identifier t = new Identifier();
2063      if (this.identifier == null)
2064        this.identifier = new ArrayList<Identifier>();
2065      this.identifier.add(t);
2066      return t;
2067    }
2068
2069    public CoverageEligibilityRequest addIdentifier(Identifier t) { //3
2070      if (t == null)
2071        return this;
2072      if (this.identifier == null)
2073        this.identifier = new ArrayList<Identifier>();
2074      this.identifier.add(t);
2075      return this;
2076    }
2077
2078    /**
2079     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
2080     */
2081    public Identifier getIdentifierFirstRep() { 
2082      if (getIdentifier().isEmpty()) {
2083        addIdentifier();
2084      }
2085      return getIdentifier().get(0);
2086    }
2087
2088    /**
2089     * @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
2090     */
2091    public Enumeration<EligibilityRequestStatus> getStatusElement() { 
2092      if (this.status == null)
2093        if (Configuration.errorOnAutoCreate())
2094          throw new Error("Attempt to auto-create CoverageEligibilityRequest.status");
2095        else if (Configuration.doAutoCreate())
2096          this.status = new Enumeration<EligibilityRequestStatus>(new EligibilityRequestStatusEnumFactory()); // bb
2097      return this.status;
2098    }
2099
2100    public boolean hasStatusElement() { 
2101      return this.status != null && !this.status.isEmpty();
2102    }
2103
2104    public boolean hasStatus() { 
2105      return this.status != null && !this.status.isEmpty();
2106    }
2107
2108    /**
2109     * @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
2110     */
2111    public CoverageEligibilityRequest setStatusElement(Enumeration<EligibilityRequestStatus> value) { 
2112      this.status = value;
2113      return this;
2114    }
2115
2116    /**
2117     * @return The status of the resource instance.
2118     */
2119    public EligibilityRequestStatus getStatus() { 
2120      return this.status == null ? null : this.status.getValue();
2121    }
2122
2123    /**
2124     * @param value The status of the resource instance.
2125     */
2126    public CoverageEligibilityRequest setStatus(EligibilityRequestStatus value) { 
2127        if (this.status == null)
2128          this.status = new Enumeration<EligibilityRequestStatus>(new EligibilityRequestStatusEnumFactory());
2129        this.status.setValue(value);
2130      return this;
2131    }
2132
2133    /**
2134     * @return {@link #priority} (When the requestor expects the processor to complete processing.)
2135     */
2136    public CodeableConcept getPriority() { 
2137      if (this.priority == null)
2138        if (Configuration.errorOnAutoCreate())
2139          throw new Error("Attempt to auto-create CoverageEligibilityRequest.priority");
2140        else if (Configuration.doAutoCreate())
2141          this.priority = new CodeableConcept(); // cc
2142      return this.priority;
2143    }
2144
2145    public boolean hasPriority() { 
2146      return this.priority != null && !this.priority.isEmpty();
2147    }
2148
2149    /**
2150     * @param value {@link #priority} (When the requestor expects the processor to complete processing.)
2151     */
2152    public CoverageEligibilityRequest setPriority(CodeableConcept value) { 
2153      this.priority = value;
2154      return this;
2155    }
2156
2157    /**
2158     * @return {@link #purpose} (Code to specify whether requesting: prior authorization requirements for some service categories or billing codes; benefits for coverages specified or discovered; discovery and return of coverages for the patient; and/or validation that the specified coverage is in-force at the date/period specified or 'now' if not specified.)
2159     */
2160    public List<Enumeration<EligibilityRequestPurpose>> getPurpose() { 
2161      if (this.purpose == null)
2162        this.purpose = new ArrayList<Enumeration<EligibilityRequestPurpose>>();
2163      return this.purpose;
2164    }
2165
2166    /**
2167     * @return Returns a reference to <code>this</code> for easy method chaining
2168     */
2169    public CoverageEligibilityRequest setPurpose(List<Enumeration<EligibilityRequestPurpose>> thePurpose) { 
2170      this.purpose = thePurpose;
2171      return this;
2172    }
2173
2174    public boolean hasPurpose() { 
2175      if (this.purpose == null)
2176        return false;
2177      for (Enumeration<EligibilityRequestPurpose> item : this.purpose)
2178        if (!item.isEmpty())
2179          return true;
2180      return false;
2181    }
2182
2183    /**
2184     * @return {@link #purpose} (Code to specify whether requesting: prior authorization requirements for some service categories or billing codes; benefits for coverages specified or discovered; discovery and return of coverages for the patient; and/or validation that the specified coverage is in-force at the date/period specified or 'now' if not specified.)
2185     */
2186    public Enumeration<EligibilityRequestPurpose> addPurposeElement() {//2 
2187      Enumeration<EligibilityRequestPurpose> t = new Enumeration<EligibilityRequestPurpose>(new EligibilityRequestPurposeEnumFactory());
2188      if (this.purpose == null)
2189        this.purpose = new ArrayList<Enumeration<EligibilityRequestPurpose>>();
2190      this.purpose.add(t);
2191      return t;
2192    }
2193
2194    /**
2195     * @param value {@link #purpose} (Code to specify whether requesting: prior authorization requirements for some service categories or billing codes; benefits for coverages specified or discovered; discovery and return of coverages for the patient; and/or validation that the specified coverage is in-force at the date/period specified or 'now' if not specified.)
2196     */
2197    public CoverageEligibilityRequest addPurpose(EligibilityRequestPurpose value) { //1
2198      Enumeration<EligibilityRequestPurpose> t = new Enumeration<EligibilityRequestPurpose>(new EligibilityRequestPurposeEnumFactory());
2199      t.setValue(value);
2200      if (this.purpose == null)
2201        this.purpose = new ArrayList<Enumeration<EligibilityRequestPurpose>>();
2202      this.purpose.add(t);
2203      return this;
2204    }
2205
2206    /**
2207     * @param value {@link #purpose} (Code to specify whether requesting: prior authorization requirements for some service categories or billing codes; benefits for coverages specified or discovered; discovery and return of coverages for the patient; and/or validation that the specified coverage is in-force at the date/period specified or 'now' if not specified.)
2208     */
2209    public boolean hasPurpose(EligibilityRequestPurpose value) { 
2210      if (this.purpose == null)
2211        return false;
2212      for (Enumeration<EligibilityRequestPurpose> v : this.purpose)
2213        if (v.getValue().equals(value)) // code
2214          return true;
2215      return false;
2216    }
2217
2218    /**
2219     * @return {@link #patient} (The party who is the beneficiary of the supplied coverage and for whom eligibility is sought.)
2220     */
2221    public Reference getPatient() { 
2222      if (this.patient == null)
2223        if (Configuration.errorOnAutoCreate())
2224          throw new Error("Attempt to auto-create CoverageEligibilityRequest.patient");
2225        else if (Configuration.doAutoCreate())
2226          this.patient = new Reference(); // cc
2227      return this.patient;
2228    }
2229
2230    public boolean hasPatient() { 
2231      return this.patient != null && !this.patient.isEmpty();
2232    }
2233
2234    /**
2235     * @param value {@link #patient} (The party who is the beneficiary of the supplied coverage and for whom eligibility is sought.)
2236     */
2237    public CoverageEligibilityRequest setPatient(Reference value) { 
2238      this.patient = value;
2239      return this;
2240    }
2241
2242    /**
2243     * @return {@link #patient} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The party who is the beneficiary of the supplied coverage and for whom eligibility is sought.)
2244     */
2245    public Patient getPatientTarget() { 
2246      if (this.patientTarget == null)
2247        if (Configuration.errorOnAutoCreate())
2248          throw new Error("Attempt to auto-create CoverageEligibilityRequest.patient");
2249        else if (Configuration.doAutoCreate())
2250          this.patientTarget = new Patient(); // aa
2251      return this.patientTarget;
2252    }
2253
2254    /**
2255     * @param value {@link #patient} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The party who is the beneficiary of the supplied coverage and for whom eligibility is sought.)
2256     */
2257    public CoverageEligibilityRequest setPatientTarget(Patient value) { 
2258      this.patientTarget = value;
2259      return this;
2260    }
2261
2262    /**
2263     * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
2264     */
2265    public Type getServiced() { 
2266      return this.serviced;
2267    }
2268
2269    /**
2270     * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
2271     */
2272    public DateType getServicedDateType() throws FHIRException { 
2273      if (this.serviced == null)
2274        this.serviced = new DateType();
2275      if (!(this.serviced instanceof DateType))
2276        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
2277      return (DateType) this.serviced;
2278    }
2279
2280    public boolean hasServicedDateType() { 
2281      return this != null && this.serviced instanceof DateType;
2282    }
2283
2284    /**
2285     * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
2286     */
2287    public Period getServicedPeriod() throws FHIRException { 
2288      if (this.serviced == null)
2289        this.serviced = new Period();
2290      if (!(this.serviced instanceof Period))
2291        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
2292      return (Period) this.serviced;
2293    }
2294
2295    public boolean hasServicedPeriod() { 
2296      return this != null && this.serviced instanceof Period;
2297    }
2298
2299    public boolean hasServiced() { 
2300      return this.serviced != null && !this.serviced.isEmpty();
2301    }
2302
2303    /**
2304     * @param value {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
2305     */
2306    public CoverageEligibilityRequest setServiced(Type value) { 
2307      if (value != null && !(value instanceof DateType || value instanceof Period))
2308        throw new Error("Not the right type for CoverageEligibilityRequest.serviced[x]: "+value.fhirType());
2309      this.serviced = value;
2310      return this;
2311    }
2312
2313    /**
2314     * @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
2315     */
2316    public DateTimeType getCreatedElement() { 
2317      if (this.created == null)
2318        if (Configuration.errorOnAutoCreate())
2319          throw new Error("Attempt to auto-create CoverageEligibilityRequest.created");
2320        else if (Configuration.doAutoCreate())
2321          this.created = new DateTimeType(); // bb
2322      return this.created;
2323    }
2324
2325    public boolean hasCreatedElement() { 
2326      return this.created != null && !this.created.isEmpty();
2327    }
2328
2329    public boolean hasCreated() { 
2330      return this.created != null && !this.created.isEmpty();
2331    }
2332
2333    /**
2334     * @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
2335     */
2336    public CoverageEligibilityRequest setCreatedElement(DateTimeType value) { 
2337      this.created = value;
2338      return this;
2339    }
2340
2341    /**
2342     * @return The date when this resource was created.
2343     */
2344    public Date getCreated() { 
2345      return this.created == null ? null : this.created.getValue();
2346    }
2347
2348    /**
2349     * @param value The date when this resource was created.
2350     */
2351    public CoverageEligibilityRequest setCreated(Date value) { 
2352        if (this.created == null)
2353          this.created = new DateTimeType();
2354        this.created.setValue(value);
2355      return this;
2356    }
2357
2358    /**
2359     * @return {@link #enterer} (Person who created the request.)
2360     */
2361    public Reference getEnterer() { 
2362      if (this.enterer == null)
2363        if (Configuration.errorOnAutoCreate())
2364          throw new Error("Attempt to auto-create CoverageEligibilityRequest.enterer");
2365        else if (Configuration.doAutoCreate())
2366          this.enterer = new Reference(); // cc
2367      return this.enterer;
2368    }
2369
2370    public boolean hasEnterer() { 
2371      return this.enterer != null && !this.enterer.isEmpty();
2372    }
2373
2374    /**
2375     * @param value {@link #enterer} (Person who created the request.)
2376     */
2377    public CoverageEligibilityRequest setEnterer(Reference value) { 
2378      this.enterer = value;
2379      return this;
2380    }
2381
2382    /**
2383     * @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 request.)
2384     */
2385    public Resource getEntererTarget() { 
2386      return this.entererTarget;
2387    }
2388
2389    /**
2390     * @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 request.)
2391     */
2392    public CoverageEligibilityRequest setEntererTarget(Resource value) { 
2393      this.entererTarget = value;
2394      return this;
2395    }
2396
2397    /**
2398     * @return {@link #provider} (The provider which is responsible for the request.)
2399     */
2400    public Reference getProvider() { 
2401      if (this.provider == null)
2402        if (Configuration.errorOnAutoCreate())
2403          throw new Error("Attempt to auto-create CoverageEligibilityRequest.provider");
2404        else if (Configuration.doAutoCreate())
2405          this.provider = new Reference(); // cc
2406      return this.provider;
2407    }
2408
2409    public boolean hasProvider() { 
2410      return this.provider != null && !this.provider.isEmpty();
2411    }
2412
2413    /**
2414     * @param value {@link #provider} (The provider which is responsible for the request.)
2415     */
2416    public CoverageEligibilityRequest setProvider(Reference value) { 
2417      this.provider = value;
2418      return this;
2419    }
2420
2421    /**
2422     * @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 which is responsible for the request.)
2423     */
2424    public Resource getProviderTarget() { 
2425      return this.providerTarget;
2426    }
2427
2428    /**
2429     * @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 which is responsible for the request.)
2430     */
2431    public CoverageEligibilityRequest setProviderTarget(Resource value) { 
2432      this.providerTarget = value;
2433      return this;
2434    }
2435
2436    /**
2437     * @return {@link #insurer} (The Insurer who issued the coverage in question and is the recipient of the request.)
2438     */
2439    public Reference getInsurer() { 
2440      if (this.insurer == null)
2441        if (Configuration.errorOnAutoCreate())
2442          throw new Error("Attempt to auto-create CoverageEligibilityRequest.insurer");
2443        else if (Configuration.doAutoCreate())
2444          this.insurer = new Reference(); // cc
2445      return this.insurer;
2446    }
2447
2448    public boolean hasInsurer() { 
2449      return this.insurer != null && !this.insurer.isEmpty();
2450    }
2451
2452    /**
2453     * @param value {@link #insurer} (The Insurer who issued the coverage in question and is the recipient of the request.)
2454     */
2455    public CoverageEligibilityRequest setInsurer(Reference value) { 
2456      this.insurer = value;
2457      return this;
2458    }
2459
2460    /**
2461     * @return {@link #insurer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Insurer who issued the coverage in question and is the recipient of the request.)
2462     */
2463    public Organization getInsurerTarget() { 
2464      if (this.insurerTarget == null)
2465        if (Configuration.errorOnAutoCreate())
2466          throw new Error("Attempt to auto-create CoverageEligibilityRequest.insurer");
2467        else if (Configuration.doAutoCreate())
2468          this.insurerTarget = new Organization(); // aa
2469      return this.insurerTarget;
2470    }
2471
2472    /**
2473     * @param value {@link #insurer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Insurer who issued the coverage in question and is the recipient of the request.)
2474     */
2475    public CoverageEligibilityRequest setInsurerTarget(Organization value) { 
2476      this.insurerTarget = value;
2477      return this;
2478    }
2479
2480    /**
2481     * @return {@link #facility} (Facility where the services are intended to be provided.)
2482     */
2483    public Reference getFacility() { 
2484      if (this.facility == null)
2485        if (Configuration.errorOnAutoCreate())
2486          throw new Error("Attempt to auto-create CoverageEligibilityRequest.facility");
2487        else if (Configuration.doAutoCreate())
2488          this.facility = new Reference(); // cc
2489      return this.facility;
2490    }
2491
2492    public boolean hasFacility() { 
2493      return this.facility != null && !this.facility.isEmpty();
2494    }
2495
2496    /**
2497     * @param value {@link #facility} (Facility where the services are intended to be provided.)
2498     */
2499    public CoverageEligibilityRequest setFacility(Reference value) { 
2500      this.facility = value;
2501      return this;
2502    }
2503
2504    /**
2505     * @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 are intended to be provided.)
2506     */
2507    public Location getFacilityTarget() { 
2508      if (this.facilityTarget == null)
2509        if (Configuration.errorOnAutoCreate())
2510          throw new Error("Attempt to auto-create CoverageEligibilityRequest.facility");
2511        else if (Configuration.doAutoCreate())
2512          this.facilityTarget = new Location(); // aa
2513      return this.facilityTarget;
2514    }
2515
2516    /**
2517     * @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 are intended to be provided.)
2518     */
2519    public CoverageEligibilityRequest setFacilityTarget(Location value) { 
2520      this.facilityTarget = value;
2521      return this;
2522    }
2523
2524    /**
2525     * @return {@link #supportingInfo} (Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.)
2526     */
2527    public List<SupportingInformationComponent> getSupportingInfo() { 
2528      if (this.supportingInfo == null)
2529        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
2530      return this.supportingInfo;
2531    }
2532
2533    /**
2534     * @return Returns a reference to <code>this</code> for easy method chaining
2535     */
2536    public CoverageEligibilityRequest setSupportingInfo(List<SupportingInformationComponent> theSupportingInfo) { 
2537      this.supportingInfo = theSupportingInfo;
2538      return this;
2539    }
2540
2541    public boolean hasSupportingInfo() { 
2542      if (this.supportingInfo == null)
2543        return false;
2544      for (SupportingInformationComponent item : this.supportingInfo)
2545        if (!item.isEmpty())
2546          return true;
2547      return false;
2548    }
2549
2550    public SupportingInformationComponent addSupportingInfo() { //3
2551      SupportingInformationComponent t = new SupportingInformationComponent();
2552      if (this.supportingInfo == null)
2553        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
2554      this.supportingInfo.add(t);
2555      return t;
2556    }
2557
2558    public CoverageEligibilityRequest addSupportingInfo(SupportingInformationComponent t) { //3
2559      if (t == null)
2560        return this;
2561      if (this.supportingInfo == null)
2562        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
2563      this.supportingInfo.add(t);
2564      return this;
2565    }
2566
2567    /**
2568     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist
2569     */
2570    public SupportingInformationComponent getSupportingInfoFirstRep() { 
2571      if (getSupportingInfo().isEmpty()) {
2572        addSupportingInfo();
2573      }
2574      return getSupportingInfo().get(0);
2575    }
2576
2577    /**
2578     * @return {@link #insurance} (Financial instruments for reimbursement for the health care products and services.)
2579     */
2580    public List<InsuranceComponent> getInsurance() { 
2581      if (this.insurance == null)
2582        this.insurance = new ArrayList<InsuranceComponent>();
2583      return this.insurance;
2584    }
2585
2586    /**
2587     * @return Returns a reference to <code>this</code> for easy method chaining
2588     */
2589    public CoverageEligibilityRequest setInsurance(List<InsuranceComponent> theInsurance) { 
2590      this.insurance = theInsurance;
2591      return this;
2592    }
2593
2594    public boolean hasInsurance() { 
2595      if (this.insurance == null)
2596        return false;
2597      for (InsuranceComponent item : this.insurance)
2598        if (!item.isEmpty())
2599          return true;
2600      return false;
2601    }
2602
2603    public InsuranceComponent addInsurance() { //3
2604      InsuranceComponent t = new InsuranceComponent();
2605      if (this.insurance == null)
2606        this.insurance = new ArrayList<InsuranceComponent>();
2607      this.insurance.add(t);
2608      return t;
2609    }
2610
2611    public CoverageEligibilityRequest addInsurance(InsuranceComponent t) { //3
2612      if (t == null)
2613        return this;
2614      if (this.insurance == null)
2615        this.insurance = new ArrayList<InsuranceComponent>();
2616      this.insurance.add(t);
2617      return this;
2618    }
2619
2620    /**
2621     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist
2622     */
2623    public InsuranceComponent getInsuranceFirstRep() { 
2624      if (getInsurance().isEmpty()) {
2625        addInsurance();
2626      }
2627      return getInsurance().get(0);
2628    }
2629
2630    /**
2631     * @return {@link #item} (Service categories or billable services for which benefit details and/or an authorization prior to service delivery may be required by the payor.)
2632     */
2633    public List<DetailsComponent> getItem() { 
2634      if (this.item == null)
2635        this.item = new ArrayList<DetailsComponent>();
2636      return this.item;
2637    }
2638
2639    /**
2640     * @return Returns a reference to <code>this</code> for easy method chaining
2641     */
2642    public CoverageEligibilityRequest setItem(List<DetailsComponent> theItem) { 
2643      this.item = theItem;
2644      return this;
2645    }
2646
2647    public boolean hasItem() { 
2648      if (this.item == null)
2649        return false;
2650      for (DetailsComponent item : this.item)
2651        if (!item.isEmpty())
2652          return true;
2653      return false;
2654    }
2655
2656    public DetailsComponent addItem() { //3
2657      DetailsComponent t = new DetailsComponent();
2658      if (this.item == null)
2659        this.item = new ArrayList<DetailsComponent>();
2660      this.item.add(t);
2661      return t;
2662    }
2663
2664    public CoverageEligibilityRequest addItem(DetailsComponent t) { //3
2665      if (t == null)
2666        return this;
2667      if (this.item == null)
2668        this.item = new ArrayList<DetailsComponent>();
2669      this.item.add(t);
2670      return this;
2671    }
2672
2673    /**
2674     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
2675     */
2676    public DetailsComponent getItemFirstRep() { 
2677      if (getItem().isEmpty()) {
2678        addItem();
2679      }
2680      return getItem().get(0);
2681    }
2682
2683      protected void listChildren(List<Property> children) {
2684        super.listChildren(children);
2685        children.add(new Property("identifier", "Identifier", "A unique identifier assigned to this coverage eligiblity request.", 0, java.lang.Integer.MAX_VALUE, identifier));
2686        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
2687        children.add(new Property("priority", "CodeableConcept", "When the requestor expects the processor to complete processing.", 0, 1, priority));
2688        children.add(new Property("purpose", "code", "Code to specify whether requesting: prior authorization requirements for some service categories or billing codes; benefits for coverages specified or discovered; discovery and return of coverages for the patient; and/or validation that the specified coverage is in-force at the date/period specified or 'now' if not specified.", 0, java.lang.Integer.MAX_VALUE, purpose));
2689        children.add(new Property("patient", "Reference(Patient)", "The party who is the beneficiary of the supplied coverage and for whom eligibility is sought.", 0, 1, patient));
2690        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));
2691        children.add(new Property("created", "dateTime", "The date when this resource was created.", 0, 1, created));
2692        children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Person who created the request.", 0, 1, enterer));
2693        children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The provider which is responsible for the request.", 0, 1, provider));
2694        children.add(new Property("insurer", "Reference(Organization)", "The Insurer who issued the coverage in question and is the recipient of the request.", 0, 1, insurer));
2695        children.add(new Property("facility", "Reference(Location)", "Facility where the services are intended to be provided.", 0, 1, facility));
2696        children.add(new Property("supportingInfo", "", "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.", 0, java.lang.Integer.MAX_VALUE, supportingInfo));
2697        children.add(new Property("insurance", "", "Financial instruments for reimbursement for the health care products and services.", 0, java.lang.Integer.MAX_VALUE, insurance));
2698        children.add(new Property("item", "", "Service categories or billable services for which benefit details and/or an authorization prior to service delivery may be required by the payor.", 0, java.lang.Integer.MAX_VALUE, item));
2699      }
2700
2701      @Override
2702      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2703        switch (_hash) {
2704        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A unique identifier assigned to this coverage eligiblity request.", 0, java.lang.Integer.MAX_VALUE, identifier);
2705        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
2706        case -1165461084: /*priority*/  return new Property("priority", "CodeableConcept", "When the requestor expects the processor to complete processing.", 0, 1, priority);
2707        case -220463842: /*purpose*/  return new Property("purpose", "code", "Code to specify whether requesting: prior authorization requirements for some service categories or billing codes; benefits for coverages specified or discovered; discovery and return of coverages for the patient; and/or validation that the specified coverage is in-force at the date/period specified or 'now' if not specified.", 0, java.lang.Integer.MAX_VALUE, purpose);
2708        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "The party who is the beneficiary of the supplied coverage and for whom eligibility is sought.", 0, 1, patient);
2709        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);
2710        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);
2711        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);
2712        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);
2713        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date when this resource was created.", 0, 1, created);
2714        case -1591951995: /*enterer*/  return new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Person who created the request.", 0, 1, enterer);
2715        case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The provider which is responsible for the request.", 0, 1, provider);
2716        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The Insurer who issued the coverage in question and is the recipient of the request.", 0, 1, insurer);
2717        case 501116579: /*facility*/  return new Property("facility", "Reference(Location)", "Facility where the services are intended to be provided.", 0, 1, facility);
2718        case 1922406657: /*supportingInfo*/  return new Property("supportingInfo", "", "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.", 0, java.lang.Integer.MAX_VALUE, supportingInfo);
2719        case 73049818: /*insurance*/  return new Property("insurance", "", "Financial instruments for reimbursement for the health care products and services.", 0, java.lang.Integer.MAX_VALUE, insurance);
2720        case 3242771: /*item*/  return new Property("item", "", "Service categories or billable services for which benefit details and/or an authorization prior to service delivery may be required by the payor.", 0, java.lang.Integer.MAX_VALUE, item);
2721        default: return super.getNamedProperty(_hash, _name, _checkValid);
2722        }
2723
2724      }
2725
2726      @Override
2727      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2728        switch (hash) {
2729        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2730        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<EligibilityRequestStatus>
2731        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
2732        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : this.purpose.toArray(new Base[this.purpose.size()]); // Enumeration<EligibilityRequestPurpose>
2733        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
2734        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
2735        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
2736        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
2737        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
2738        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
2739        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
2740        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // SupportingInformationComponent
2741        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
2742        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // DetailsComponent
2743        default: return super.getProperty(hash, name, checkValid);
2744        }
2745
2746      }
2747
2748      @Override
2749      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2750        switch (hash) {
2751        case -1618432855: // identifier
2752          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2753          return value;
2754        case -892481550: // status
2755          value = new EligibilityRequestStatusEnumFactory().fromType(castToCode(value));
2756          this.status = (Enumeration) value; // Enumeration<EligibilityRequestStatus>
2757          return value;
2758        case -1165461084: // priority
2759          this.priority = castToCodeableConcept(value); // CodeableConcept
2760          return value;
2761        case -220463842: // purpose
2762          value = new EligibilityRequestPurposeEnumFactory().fromType(castToCode(value));
2763          this.getPurpose().add((Enumeration) value); // Enumeration<EligibilityRequestPurpose>
2764          return value;
2765        case -791418107: // patient
2766          this.patient = castToReference(value); // Reference
2767          return value;
2768        case 1379209295: // serviced
2769          this.serviced = castToType(value); // Type
2770          return value;
2771        case 1028554472: // created
2772          this.created = castToDateTime(value); // DateTimeType
2773          return value;
2774        case -1591951995: // enterer
2775          this.enterer = castToReference(value); // Reference
2776          return value;
2777        case -987494927: // provider
2778          this.provider = castToReference(value); // Reference
2779          return value;
2780        case 1957615864: // insurer
2781          this.insurer = castToReference(value); // Reference
2782          return value;
2783        case 501116579: // facility
2784          this.facility = castToReference(value); // Reference
2785          return value;
2786        case 1922406657: // supportingInfo
2787          this.getSupportingInfo().add((SupportingInformationComponent) value); // SupportingInformationComponent
2788          return value;
2789        case 73049818: // insurance
2790          this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
2791          return value;
2792        case 3242771: // item
2793          this.getItem().add((DetailsComponent) value); // DetailsComponent
2794          return value;
2795        default: return super.setProperty(hash, name, value);
2796        }
2797
2798      }
2799
2800      @Override
2801      public Base setProperty(String name, Base value) throws FHIRException {
2802        if (name.equals("identifier")) {
2803          this.getIdentifier().add(castToIdentifier(value));
2804        } else if (name.equals("status")) {
2805          value = new EligibilityRequestStatusEnumFactory().fromType(castToCode(value));
2806          this.status = (Enumeration) value; // Enumeration<EligibilityRequestStatus>
2807        } else if (name.equals("priority")) {
2808          this.priority = castToCodeableConcept(value); // CodeableConcept
2809        } else if (name.equals("purpose")) {
2810          value = new EligibilityRequestPurposeEnumFactory().fromType(castToCode(value));
2811          this.getPurpose().add((Enumeration) value);
2812        } else if (name.equals("patient")) {
2813          this.patient = castToReference(value); // Reference
2814        } else if (name.equals("serviced[x]")) {
2815          this.serviced = castToType(value); // Type
2816        } else if (name.equals("created")) {
2817          this.created = castToDateTime(value); // DateTimeType
2818        } else if (name.equals("enterer")) {
2819          this.enterer = castToReference(value); // Reference
2820        } else if (name.equals("provider")) {
2821          this.provider = castToReference(value); // Reference
2822        } else if (name.equals("insurer")) {
2823          this.insurer = castToReference(value); // Reference
2824        } else if (name.equals("facility")) {
2825          this.facility = castToReference(value); // Reference
2826        } else if (name.equals("supportingInfo")) {
2827          this.getSupportingInfo().add((SupportingInformationComponent) value);
2828        } else if (name.equals("insurance")) {
2829          this.getInsurance().add((InsuranceComponent) value);
2830        } else if (name.equals("item")) {
2831          this.getItem().add((DetailsComponent) value);
2832        } else
2833          return super.setProperty(name, value);
2834        return value;
2835      }
2836
2837      @Override
2838      public Base makeProperty(int hash, String name) throws FHIRException {
2839        switch (hash) {
2840        case -1618432855:  return addIdentifier(); 
2841        case -892481550:  return getStatusElement();
2842        case -1165461084:  return getPriority(); 
2843        case -220463842:  return addPurposeElement();
2844        case -791418107:  return getPatient(); 
2845        case -1927922223:  return getServiced(); 
2846        case 1379209295:  return getServiced(); 
2847        case 1028554472:  return getCreatedElement();
2848        case -1591951995:  return getEnterer(); 
2849        case -987494927:  return getProvider(); 
2850        case 1957615864:  return getInsurer(); 
2851        case 501116579:  return getFacility(); 
2852        case 1922406657:  return addSupportingInfo(); 
2853        case 73049818:  return addInsurance(); 
2854        case 3242771:  return addItem(); 
2855        default: return super.makeProperty(hash, name);
2856        }
2857
2858      }
2859
2860      @Override
2861      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2862        switch (hash) {
2863        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2864        case -892481550: /*status*/ return new String[] {"code"};
2865        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
2866        case -220463842: /*purpose*/ return new String[] {"code"};
2867        case -791418107: /*patient*/ return new String[] {"Reference"};
2868        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
2869        case 1028554472: /*created*/ return new String[] {"dateTime"};
2870        case -1591951995: /*enterer*/ return new String[] {"Reference"};
2871        case -987494927: /*provider*/ return new String[] {"Reference"};
2872        case 1957615864: /*insurer*/ return new String[] {"Reference"};
2873        case 501116579: /*facility*/ return new String[] {"Reference"};
2874        case 1922406657: /*supportingInfo*/ return new String[] {};
2875        case 73049818: /*insurance*/ return new String[] {};
2876        case 3242771: /*item*/ return new String[] {};
2877        default: return super.getTypesForProperty(hash, name);
2878        }
2879
2880      }
2881
2882      @Override
2883      public Base addChild(String name) throws FHIRException {
2884        if (name.equals("identifier")) {
2885          return addIdentifier();
2886        }
2887        else if (name.equals("status")) {
2888          throw new FHIRException("Cannot call addChild on a primitive type CoverageEligibilityRequest.status");
2889        }
2890        else if (name.equals("priority")) {
2891          this.priority = new CodeableConcept();
2892          return this.priority;
2893        }
2894        else if (name.equals("purpose")) {
2895          throw new FHIRException("Cannot call addChild on a primitive type CoverageEligibilityRequest.purpose");
2896        }
2897        else if (name.equals("patient")) {
2898          this.patient = new Reference();
2899          return this.patient;
2900        }
2901        else if (name.equals("servicedDate")) {
2902          this.serviced = new DateType();
2903          return this.serviced;
2904        }
2905        else if (name.equals("servicedPeriod")) {
2906          this.serviced = new Period();
2907          return this.serviced;
2908        }
2909        else if (name.equals("created")) {
2910          throw new FHIRException("Cannot call addChild on a primitive type CoverageEligibilityRequest.created");
2911        }
2912        else if (name.equals("enterer")) {
2913          this.enterer = new Reference();
2914          return this.enterer;
2915        }
2916        else if (name.equals("provider")) {
2917          this.provider = new Reference();
2918          return this.provider;
2919        }
2920        else if (name.equals("insurer")) {
2921          this.insurer = new Reference();
2922          return this.insurer;
2923        }
2924        else if (name.equals("facility")) {
2925          this.facility = new Reference();
2926          return this.facility;
2927        }
2928        else if (name.equals("supportingInfo")) {
2929          return addSupportingInfo();
2930        }
2931        else if (name.equals("insurance")) {
2932          return addInsurance();
2933        }
2934        else if (name.equals("item")) {
2935          return addItem();
2936        }
2937        else
2938          return super.addChild(name);
2939      }
2940
2941  public String fhirType() {
2942    return "CoverageEligibilityRequest";
2943
2944  }
2945
2946      public CoverageEligibilityRequest copy() {
2947        CoverageEligibilityRequest dst = new CoverageEligibilityRequest();
2948        copyValues(dst);
2949        if (identifier != null) {
2950          dst.identifier = new ArrayList<Identifier>();
2951          for (Identifier i : identifier)
2952            dst.identifier.add(i.copy());
2953        };
2954        dst.status = status == null ? null : status.copy();
2955        dst.priority = priority == null ? null : priority.copy();
2956        if (purpose != null) {
2957          dst.purpose = new ArrayList<Enumeration<EligibilityRequestPurpose>>();
2958          for (Enumeration<EligibilityRequestPurpose> i : purpose)
2959            dst.purpose.add(i.copy());
2960        };
2961        dst.patient = patient == null ? null : patient.copy();
2962        dst.serviced = serviced == null ? null : serviced.copy();
2963        dst.created = created == null ? null : created.copy();
2964        dst.enterer = enterer == null ? null : enterer.copy();
2965        dst.provider = provider == null ? null : provider.copy();
2966        dst.insurer = insurer == null ? null : insurer.copy();
2967        dst.facility = facility == null ? null : facility.copy();
2968        if (supportingInfo != null) {
2969          dst.supportingInfo = new ArrayList<SupportingInformationComponent>();
2970          for (SupportingInformationComponent i : supportingInfo)
2971            dst.supportingInfo.add(i.copy());
2972        };
2973        if (insurance != null) {
2974          dst.insurance = new ArrayList<InsuranceComponent>();
2975          for (InsuranceComponent i : insurance)
2976            dst.insurance.add(i.copy());
2977        };
2978        if (item != null) {
2979          dst.item = new ArrayList<DetailsComponent>();
2980          for (DetailsComponent i : item)
2981            dst.item.add(i.copy());
2982        };
2983        return dst;
2984      }
2985
2986      protected CoverageEligibilityRequest typedCopy() {
2987        return copy();
2988      }
2989
2990      @Override
2991      public boolean equalsDeep(Base other_) {
2992        if (!super.equalsDeep(other_))
2993          return false;
2994        if (!(other_ instanceof CoverageEligibilityRequest))
2995          return false;
2996        CoverageEligibilityRequest o = (CoverageEligibilityRequest) other_;
2997        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(priority, o.priority, true)
2998           && compareDeep(purpose, o.purpose, true) && compareDeep(patient, o.patient, true) && compareDeep(serviced, o.serviced, true)
2999           && compareDeep(created, o.created, true) && compareDeep(enterer, o.enterer, true) && compareDeep(provider, o.provider, true)
3000           && compareDeep(insurer, o.insurer, true) && compareDeep(facility, o.facility, true) && compareDeep(supportingInfo, o.supportingInfo, true)
3001           && compareDeep(insurance, o.insurance, true) && compareDeep(item, o.item, true);
3002      }
3003
3004      @Override
3005      public boolean equalsShallow(Base other_) {
3006        if (!super.equalsShallow(other_))
3007          return false;
3008        if (!(other_ instanceof CoverageEligibilityRequest))
3009          return false;
3010        CoverageEligibilityRequest o = (CoverageEligibilityRequest) other_;
3011        return compareValues(status, o.status, true) && compareValues(purpose, o.purpose, true) && compareValues(created, o.created, true)
3012          ;
3013      }
3014
3015      public boolean isEmpty() {
3016        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, priority
3017          , purpose, patient, serviced, created, enterer, provider, insurer, facility
3018          , supportingInfo, insurance, item);
3019      }
3020
3021  @Override
3022  public ResourceType getResourceType() {
3023    return ResourceType.CoverageEligibilityRequest;
3024   }
3025
3026 /**
3027   * Search parameter: <b>identifier</b>
3028   * <p>
3029   * Description: <b>The business identifier of the Eligibility</b><br>
3030   * Type: <b>token</b><br>
3031   * Path: <b>CoverageEligibilityRequest.identifier</b><br>
3032   * </p>
3033   */
3034  @SearchParamDefinition(name="identifier", path="CoverageEligibilityRequest.identifier", description="The business identifier of the Eligibility", type="token" )
3035  public static final String SP_IDENTIFIER = "identifier";
3036 /**
3037   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3038   * <p>
3039   * Description: <b>The business identifier of the Eligibility</b><br>
3040   * Type: <b>token</b><br>
3041   * Path: <b>CoverageEligibilityRequest.identifier</b><br>
3042   * </p>
3043   */
3044  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3045
3046 /**
3047   * Search parameter: <b>provider</b>
3048   * <p>
3049   * Description: <b>The reference to the provider</b><br>
3050   * Type: <b>reference</b><br>
3051   * Path: <b>CoverageEligibilityRequest.provider</b><br>
3052   * </p>
3053   */
3054  @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 } )
3055  public static final String SP_PROVIDER = "provider";
3056 /**
3057   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
3058   * <p>
3059   * Description: <b>The reference to the provider</b><br>
3060   * Type: <b>reference</b><br>
3061   * Path: <b>CoverageEligibilityRequest.provider</b><br>
3062   * </p>
3063   */
3064  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
3065
3066/**
3067   * Constant for fluent queries to be used to add include statements. Specifies
3068   * the path value of "<b>CoverageEligibilityRequest:provider</b>".
3069   */
3070  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("CoverageEligibilityRequest:provider").toLocked();
3071
3072 /**
3073   * Search parameter: <b>patient</b>
3074   * <p>
3075   * Description: <b>The reference to the patient</b><br>
3076   * Type: <b>reference</b><br>
3077   * Path: <b>CoverageEligibilityRequest.patient</b><br>
3078   * </p>
3079   */
3080  @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 } )
3081  public static final String SP_PATIENT = "patient";
3082 /**
3083   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3084   * <p>
3085   * Description: <b>The reference to the patient</b><br>
3086   * Type: <b>reference</b><br>
3087   * Path: <b>CoverageEligibilityRequest.patient</b><br>
3088   * </p>
3089   */
3090  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3091
3092/**
3093   * Constant for fluent queries to be used to add include statements. Specifies
3094   * the path value of "<b>CoverageEligibilityRequest:patient</b>".
3095   */
3096  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("CoverageEligibilityRequest:patient").toLocked();
3097
3098 /**
3099   * Search parameter: <b>created</b>
3100   * <p>
3101   * Description: <b>The creation date for the EOB</b><br>
3102   * Type: <b>date</b><br>
3103   * Path: <b>CoverageEligibilityRequest.created</b><br>
3104   * </p>
3105   */
3106  @SearchParamDefinition(name="created", path="CoverageEligibilityRequest.created", description="The creation date for the EOB", type="date" )
3107  public static final String SP_CREATED = "created";
3108 /**
3109   * <b>Fluent Client</b> search parameter constant for <b>created</b>
3110   * <p>
3111   * Description: <b>The creation date for the EOB</b><br>
3112   * Type: <b>date</b><br>
3113   * Path: <b>CoverageEligibilityRequest.created</b><br>
3114   * </p>
3115   */
3116  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
3117
3118 /**
3119   * Search parameter: <b>enterer</b>
3120   * <p>
3121   * Description: <b>The party who is responsible for the request</b><br>
3122   * Type: <b>reference</b><br>
3123   * Path: <b>CoverageEligibilityRequest.enterer</b><br>
3124   * </p>
3125   */
3126  @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 } )
3127  public static final String SP_ENTERER = "enterer";
3128 /**
3129   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
3130   * <p>
3131   * Description: <b>The party who is responsible for the request</b><br>
3132   * Type: <b>reference</b><br>
3133   * Path: <b>CoverageEligibilityRequest.enterer</b><br>
3134   * </p>
3135   */
3136  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
3137
3138/**
3139   * Constant for fluent queries to be used to add include statements. Specifies
3140   * the path value of "<b>CoverageEligibilityRequest:enterer</b>".
3141   */
3142  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("CoverageEligibilityRequest:enterer").toLocked();
3143
3144 /**
3145   * Search parameter: <b>facility</b>
3146   * <p>
3147   * Description: <b>Facility responsible for the goods and services</b><br>
3148   * Type: <b>reference</b><br>
3149   * Path: <b>CoverageEligibilityRequest.facility</b><br>
3150   * </p>
3151   */
3152  @SearchParamDefinition(name="facility", path="CoverageEligibilityRequest.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class } )
3153  public static final String SP_FACILITY = "facility";
3154 /**
3155   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
3156   * <p>
3157   * Description: <b>Facility responsible for the goods and services</b><br>
3158   * Type: <b>reference</b><br>
3159   * Path: <b>CoverageEligibilityRequest.facility</b><br>
3160   * </p>
3161   */
3162  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
3163
3164/**
3165   * Constant for fluent queries to be used to add include statements. Specifies
3166   * the path value of "<b>CoverageEligibilityRequest:facility</b>".
3167   */
3168  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("CoverageEligibilityRequest:facility").toLocked();
3169
3170 /**
3171   * Search parameter: <b>status</b>
3172   * <p>
3173   * Description: <b>The status of the EligibilityRequest</b><br>
3174   * Type: <b>token</b><br>
3175   * Path: <b>CoverageEligibilityRequest.status</b><br>
3176   * </p>
3177   */
3178  @SearchParamDefinition(name="status", path="CoverageEligibilityRequest.status", description="The status of the EligibilityRequest", type="token" )
3179  public static final String SP_STATUS = "status";
3180 /**
3181   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3182   * <p>
3183   * Description: <b>The status of the EligibilityRequest</b><br>
3184   * Type: <b>token</b><br>
3185   * Path: <b>CoverageEligibilityRequest.status</b><br>
3186   * </p>
3187   */
3188  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3189
3190
3191}
3192