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