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