001package org.hl7.fhir.dstu3.model;
002
003import java.math.BigDecimal;
004
005/*-
006 * #%L
007 * org.hl7.fhir.dstu3
008 * %%
009 * Copyright (C) 2014 - 2019 Health Level 7
010 * %%
011 * Licensed under the Apache License, Version 2.0 (the "License");
012 * you may not use this file except in compliance with the License.
013 * You may obtain a copy of the License at
014 * 
015 *      http://www.apache.org/licenses/LICENSE-2.0
016 * 
017 * Unless required by applicable law or agreed to in writing, software
018 * distributed under the License is distributed on an "AS IS" BASIS,
019 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
020 * See the License for the specific language governing permissions and
021 * limitations under the License.
022 * #L%
023 */
024
025/*
026  Copyright (c) 2011+, HL7, Inc.
027  All rights reserved.
028  
029  Redistribution and use in source and binary forms, with or without modification, 
030  are permitted provided that the following conditions are met:
031  
032   * Redistributions of source code must retain the above copyright notice, this 
033     list of conditions and the following disclaimer.
034   * Redistributions in binary form must reproduce the above copyright notice, 
035     this list of conditions and the following disclaimer in the documentation 
036     and/or other materials provided with the distribution.
037   * Neither the name of HL7 nor the names of its contributors may be used to 
038     endorse or promote products derived from this software without specific 
039     prior written permission.
040  
041  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
042  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
043  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
044  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
045  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
046  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
047  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
048  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
049  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
050  POSSIBILITY OF SUCH DAMAGE.
051  
052*/
053
054// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
055import java.util.ArrayList;
056import java.util.Date;
057import java.util.List;
058
059import org.hl7.fhir.exceptions.FHIRException;
060import org.hl7.fhir.exceptions.FHIRFormatError;
061import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
062import org.hl7.fhir.utilities.Utilities;
063
064import ca.uhn.fhir.model.api.annotation.Block;
065import ca.uhn.fhir.model.api.annotation.Child;
066import ca.uhn.fhir.model.api.annotation.Description;
067import ca.uhn.fhir.model.api.annotation.ResourceDef;
068import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
069/**
070 * This resource provides: the claim details; adjudication details from the processing of a Claim; and optionally account balance information, for informing the subscriber of the benefits provided.
071 */
072@ResourceDef(name="ExplanationOfBenefit", profile="http://hl7.org/fhir/Profile/ExplanationOfBenefit")
073public class ExplanationOfBenefit extends DomainResource {
074
075    public enum ExplanationOfBenefitStatus {
076        /**
077         * The resource instance is currently in-force.
078         */
079        ACTIVE, 
080        /**
081         * The resource instance is withdrawn, rescinded or reversed.
082         */
083        CANCELLED, 
084        /**
085         * A new resource instance the contents of which is not complete.
086         */
087        DRAFT, 
088        /**
089         * The resource instance was entered in error.
090         */
091        ENTEREDINERROR, 
092        /**
093         * added to help the parsers with the generic types
094         */
095        NULL;
096        public static ExplanationOfBenefitStatus fromCode(String codeString) throws FHIRException {
097            if (codeString == null || "".equals(codeString))
098                return null;
099        if ("active".equals(codeString))
100          return ACTIVE;
101        if ("cancelled".equals(codeString))
102          return CANCELLED;
103        if ("draft".equals(codeString))
104          return DRAFT;
105        if ("entered-in-error".equals(codeString))
106          return ENTEREDINERROR;
107        if (Configuration.isAcceptInvalidEnums())
108          return null;
109        else
110          throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
111        }
112        public String toCode() {
113          switch (this) {
114            case ACTIVE: return "active";
115            case CANCELLED: return "cancelled";
116            case DRAFT: return "draft";
117            case ENTEREDINERROR: return "entered-in-error";
118            default: return "?";
119          }
120        }
121        public String getSystem() {
122          switch (this) {
123            case ACTIVE: return "http://hl7.org/fhir/explanationofbenefit-status";
124            case CANCELLED: return "http://hl7.org/fhir/explanationofbenefit-status";
125            case DRAFT: return "http://hl7.org/fhir/explanationofbenefit-status";
126            case ENTEREDINERROR: return "http://hl7.org/fhir/explanationofbenefit-status";
127            default: return "?";
128          }
129        }
130        public String getDefinition() {
131          switch (this) {
132            case ACTIVE: return "The resource instance is currently in-force.";
133            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
134            case DRAFT: return "A new resource instance the contents of which is not complete.";
135            case ENTEREDINERROR: return "The resource instance was entered in error.";
136            default: return "?";
137          }
138        }
139        public String getDisplay() {
140          switch (this) {
141            case ACTIVE: return "Active";
142            case CANCELLED: return "Cancelled";
143            case DRAFT: return "Draft";
144            case ENTEREDINERROR: return "Entered In Error";
145            default: return "?";
146          }
147        }
148    }
149
150  public static class ExplanationOfBenefitStatusEnumFactory implements EnumFactory<ExplanationOfBenefitStatus> {
151    public ExplanationOfBenefitStatus fromCode(String codeString) throws IllegalArgumentException {
152      if (codeString == null || "".equals(codeString))
153            if (codeString == null || "".equals(codeString))
154                return null;
155        if ("active".equals(codeString))
156          return ExplanationOfBenefitStatus.ACTIVE;
157        if ("cancelled".equals(codeString))
158          return ExplanationOfBenefitStatus.CANCELLED;
159        if ("draft".equals(codeString))
160          return ExplanationOfBenefitStatus.DRAFT;
161        if ("entered-in-error".equals(codeString))
162          return ExplanationOfBenefitStatus.ENTEREDINERROR;
163        throw new IllegalArgumentException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
164        }
165        public Enumeration<ExplanationOfBenefitStatus> fromType(Base code) throws FHIRException {
166          if (code == null)
167            return null;
168          if (code.isEmpty())
169            return new Enumeration<ExplanationOfBenefitStatus>(this);
170          String codeString = ((PrimitiveType) code).asStringValue();
171          if (codeString == null || "".equals(codeString))
172            return null;
173        if ("active".equals(codeString))
174          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ACTIVE);
175        if ("cancelled".equals(codeString))
176          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.CANCELLED);
177        if ("draft".equals(codeString))
178          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.DRAFT);
179        if ("entered-in-error".equals(codeString))
180          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ENTEREDINERROR);
181        throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
182        }
183    public String toCode(ExplanationOfBenefitStatus code) {
184      if (code == ExplanationOfBenefitStatus.ACTIVE)
185        return "active";
186      if (code == ExplanationOfBenefitStatus.CANCELLED)
187        return "cancelled";
188      if (code == ExplanationOfBenefitStatus.DRAFT)
189        return "draft";
190      if (code == ExplanationOfBenefitStatus.ENTEREDINERROR)
191        return "entered-in-error";
192      return "?";
193      }
194    public String toSystem(ExplanationOfBenefitStatus code) {
195      return code.getSystem();
196      }
197    }
198
199    @Block()
200    public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
201        /**
202         * Other claims which are related to this claim such as prior claim versions or for related services.
203         */
204        @Child(name = "claim", type = {Claim.class}, order=1, min=0, max=1, modifier=false, summary=false)
205        @Description(shortDefinition="Reference to the related claim", formalDefinition="Other claims which are related to this claim such as prior claim versions or for related services." )
206        protected Reference claim;
207
208        /**
209         * The actual object that is the target of the reference (Other claims which are related to this claim such as prior claim versions or for related services.)
210         */
211        protected Claim claimTarget;
212
213        /**
214         * For example prior or umbrella.
215         */
216        @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
217        @Description(shortDefinition="How the reference claim is related", formalDefinition="For example prior or umbrella." )
218        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-claim-relationship")
219        protected CodeableConcept relationship;
220
221        /**
222         * An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .
223         */
224        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=false)
225        @Description(shortDefinition="Related file or case reference", formalDefinition="An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # ." )
226        protected Identifier reference;
227
228        private static final long serialVersionUID = -379338905L;
229
230    /**
231     * Constructor
232     */
233      public RelatedClaimComponent() {
234        super();
235      }
236
237        /**
238         * @return {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
239         */
240        public Reference getClaim() { 
241          if (this.claim == null)
242            if (Configuration.errorOnAutoCreate())
243              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
244            else if (Configuration.doAutoCreate())
245              this.claim = new Reference(); // cc
246          return this.claim;
247        }
248
249        public boolean hasClaim() { 
250          return this.claim != null && !this.claim.isEmpty();
251        }
252
253        /**
254         * @param value {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
255         */
256        public RelatedClaimComponent setClaim(Reference value)  { 
257          this.claim = value;
258          return this;
259        }
260
261        /**
262         * @return {@link #claim} 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. (Other claims which are related to this claim such as prior claim versions or for related services.)
263         */
264        public Claim getClaimTarget() { 
265          if (this.claimTarget == null)
266            if (Configuration.errorOnAutoCreate())
267              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
268            else if (Configuration.doAutoCreate())
269              this.claimTarget = new Claim(); // aa
270          return this.claimTarget;
271        }
272
273        /**
274         * @param value {@link #claim} 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. (Other claims which are related to this claim such as prior claim versions or for related services.)
275         */
276        public RelatedClaimComponent setClaimTarget(Claim value) { 
277          this.claimTarget = value;
278          return this;
279        }
280
281        /**
282         * @return {@link #relationship} (For example prior or umbrella.)
283         */
284        public CodeableConcept getRelationship() { 
285          if (this.relationship == null)
286            if (Configuration.errorOnAutoCreate())
287              throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
288            else if (Configuration.doAutoCreate())
289              this.relationship = new CodeableConcept(); // cc
290          return this.relationship;
291        }
292
293        public boolean hasRelationship() { 
294          return this.relationship != null && !this.relationship.isEmpty();
295        }
296
297        /**
298         * @param value {@link #relationship} (For example prior or umbrella.)
299         */
300        public RelatedClaimComponent setRelationship(CodeableConcept value)  { 
301          this.relationship = value;
302          return this;
303        }
304
305        /**
306         * @return {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .)
307         */
308        public Identifier getReference() { 
309          if (this.reference == null)
310            if (Configuration.errorOnAutoCreate())
311              throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
312            else if (Configuration.doAutoCreate())
313              this.reference = new Identifier(); // cc
314          return this.reference;
315        }
316
317        public boolean hasReference() { 
318          return this.reference != null && !this.reference.isEmpty();
319        }
320
321        /**
322         * @param value {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .)
323         */
324        public RelatedClaimComponent setReference(Identifier value)  { 
325          this.reference = value;
326          return this;
327        }
328
329        protected void listChildren(List<Property> children) {
330          super.listChildren(children);
331          children.add(new Property("claim", "Reference(Claim)", "Other claims which are related to this claim such as prior claim versions or for related services.", 0, 1, claim));
332          children.add(new Property("relationship", "CodeableConcept", "For example prior or umbrella.", 0, 1, relationship));
333          children.add(new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .", 0, 1, reference));
334        }
335
336        @Override
337        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
338          switch (_hash) {
339          case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "Other claims which are related to this claim such as prior claim versions or for related services.", 0, 1, claim);
340          case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "For example prior or umbrella.", 0, 1, relationship);
341          case -925155509: /*reference*/  return new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .", 0, 1, reference);
342          default: return super.getNamedProperty(_hash, _name, _checkValid);
343          }
344
345        }
346
347      @Override
348      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
349        switch (hash) {
350        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
351        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
352        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
353        default: return super.getProperty(hash, name, checkValid);
354        }
355
356      }
357
358      @Override
359      public Base setProperty(int hash, String name, Base value) throws FHIRException {
360        switch (hash) {
361        case 94742588: // claim
362          this.claim = castToReference(value); // Reference
363          return value;
364        case -261851592: // relationship
365          this.relationship = castToCodeableConcept(value); // CodeableConcept
366          return value;
367        case -925155509: // reference
368          this.reference = castToIdentifier(value); // Identifier
369          return value;
370        default: return super.setProperty(hash, name, value);
371        }
372
373      }
374
375      @Override
376      public Base setProperty(String name, Base value) throws FHIRException {
377        if (name.equals("claim")) {
378          this.claim = castToReference(value); // Reference
379        } else if (name.equals("relationship")) {
380          this.relationship = castToCodeableConcept(value); // CodeableConcept
381        } else if (name.equals("reference")) {
382          this.reference = castToIdentifier(value); // Identifier
383        } else
384          return super.setProperty(name, value);
385        return value;
386      }
387
388      @Override
389      public Base makeProperty(int hash, String name) throws FHIRException {
390        switch (hash) {
391        case 94742588:  return getClaim(); 
392        case -261851592:  return getRelationship(); 
393        case -925155509:  return getReference(); 
394        default: return super.makeProperty(hash, name);
395        }
396
397      }
398
399      @Override
400      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
401        switch (hash) {
402        case 94742588: /*claim*/ return new String[] {"Reference"};
403        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
404        case -925155509: /*reference*/ return new String[] {"Identifier"};
405        default: return super.getTypesForProperty(hash, name);
406        }
407
408      }
409
410      @Override
411      public Base addChild(String name) throws FHIRException {
412        if (name.equals("claim")) {
413          this.claim = new Reference();
414          return this.claim;
415        }
416        else if (name.equals("relationship")) {
417          this.relationship = new CodeableConcept();
418          return this.relationship;
419        }
420        else if (name.equals("reference")) {
421          this.reference = new Identifier();
422          return this.reference;
423        }
424        else
425          return super.addChild(name);
426      }
427
428      public RelatedClaimComponent copy() {
429        RelatedClaimComponent dst = new RelatedClaimComponent();
430        copyValues(dst);
431        dst.claim = claim == null ? null : claim.copy();
432        dst.relationship = relationship == null ? null : relationship.copy();
433        dst.reference = reference == null ? null : reference.copy();
434        return dst;
435      }
436
437      @Override
438      public boolean equalsDeep(Base other_) {
439        if (!super.equalsDeep(other_))
440          return false;
441        if (!(other_ instanceof RelatedClaimComponent))
442          return false;
443        RelatedClaimComponent o = (RelatedClaimComponent) other_;
444        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
445          ;
446      }
447
448      @Override
449      public boolean equalsShallow(Base other_) {
450        if (!super.equalsShallow(other_))
451          return false;
452        if (!(other_ instanceof RelatedClaimComponent))
453          return false;
454        RelatedClaimComponent o = (RelatedClaimComponent) other_;
455        return true;
456      }
457
458      public boolean isEmpty() {
459        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference
460          );
461      }
462
463  public String fhirType() {
464    return "ExplanationOfBenefit.related";
465
466  }
467
468  }
469
470    @Block()
471    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
472        /**
473         * Type of Party to be reimbursed: Subscriber, provider, other.
474         */
475        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
476        @Description(shortDefinition="Type of party: Subscriber, Provider, other", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
477        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payeetype")
478        protected CodeableConcept type;
479
480        /**
481         * organization | patient | practitioner | relatedperson.
482         */
483        @Child(name = "resourceType", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
484        @Description(shortDefinition="organization | patient | practitioner | relatedperson", formalDefinition="organization | patient | practitioner | relatedperson." )
485        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-type-link")
486        protected CodeableConcept resourceType;
487
488        /**
489         * Party to be reimbursed: Subscriber, provider, other.
490         */
491        @Child(name = "party", type = {Practitioner.class, Organization.class, Patient.class, RelatedPerson.class}, order=3, min=0, max=1, modifier=false, summary=false)
492        @Description(shortDefinition="Party to receive the payable", formalDefinition="Party to be reimbursed: Subscriber, provider, other." )
493        protected Reference party;
494
495        /**
496         * The actual object that is the target of the reference (Party to be reimbursed: Subscriber, provider, other.)
497         */
498        protected Resource partyTarget;
499
500        private static final long serialVersionUID = 1146157718L;
501
502    /**
503     * Constructor
504     */
505      public PayeeComponent() {
506        super();
507      }
508
509        /**
510         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
511         */
512        public CodeableConcept getType() { 
513          if (this.type == null)
514            if (Configuration.errorOnAutoCreate())
515              throw new Error("Attempt to auto-create PayeeComponent.type");
516            else if (Configuration.doAutoCreate())
517              this.type = new CodeableConcept(); // cc
518          return this.type;
519        }
520
521        public boolean hasType() { 
522          return this.type != null && !this.type.isEmpty();
523        }
524
525        /**
526         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
527         */
528        public PayeeComponent setType(CodeableConcept value)  { 
529          this.type = value;
530          return this;
531        }
532
533        /**
534         * @return {@link #resourceType} (organization | patient | practitioner | relatedperson.)
535         */
536        public CodeableConcept getResourceType() { 
537          if (this.resourceType == null)
538            if (Configuration.errorOnAutoCreate())
539              throw new Error("Attempt to auto-create PayeeComponent.resourceType");
540            else if (Configuration.doAutoCreate())
541              this.resourceType = new CodeableConcept(); // cc
542          return this.resourceType;
543        }
544
545        public boolean hasResourceType() { 
546          return this.resourceType != null && !this.resourceType.isEmpty();
547        }
548
549        /**
550         * @param value {@link #resourceType} (organization | patient | practitioner | relatedperson.)
551         */
552        public PayeeComponent setResourceType(CodeableConcept value)  { 
553          this.resourceType = value;
554          return this;
555        }
556
557        /**
558         * @return {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
559         */
560        public Reference getParty() { 
561          if (this.party == null)
562            if (Configuration.errorOnAutoCreate())
563              throw new Error("Attempt to auto-create PayeeComponent.party");
564            else if (Configuration.doAutoCreate())
565              this.party = new Reference(); // cc
566          return this.party;
567        }
568
569        public boolean hasParty() { 
570          return this.party != null && !this.party.isEmpty();
571        }
572
573        /**
574         * @param value {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
575         */
576        public PayeeComponent setParty(Reference value)  { 
577          this.party = value;
578          return this;
579        }
580
581        /**
582         * @return {@link #party} 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. (Party to be reimbursed: Subscriber, provider, other.)
583         */
584        public Resource getPartyTarget() { 
585          return this.partyTarget;
586        }
587
588        /**
589         * @param value {@link #party} 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. (Party to be reimbursed: Subscriber, provider, other.)
590         */
591        public PayeeComponent setPartyTarget(Resource value) { 
592          this.partyTarget = value;
593          return this;
594        }
595
596        protected void listChildren(List<Property> children) {
597          super.listChildren(children);
598          children.add(new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
599          children.add(new Property("resourceType", "CodeableConcept", "organization | patient | practitioner | relatedperson.", 0, 1, resourceType));
600          children.add(new Property("party", "Reference(Practitioner|Organization|Patient|RelatedPerson)", "Party to be reimbursed: Subscriber, provider, other.", 0, 1, party));
601        }
602
603        @Override
604        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
605          switch (_hash) {
606          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
607          case -384364440: /*resourceType*/  return new Property("resourceType", "CodeableConcept", "organization | patient | practitioner | relatedperson.", 0, 1, resourceType);
608          case 106437350: /*party*/  return new Property("party", "Reference(Practitioner|Organization|Patient|RelatedPerson)", "Party to be reimbursed: Subscriber, provider, other.", 0, 1, party);
609          default: return super.getNamedProperty(_hash, _name, _checkValid);
610          }
611
612        }
613
614      @Override
615      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
616        switch (hash) {
617        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
618        case -384364440: /*resourceType*/ return this.resourceType == null ? new Base[0] : new Base[] {this.resourceType}; // CodeableConcept
619        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
620        default: return super.getProperty(hash, name, checkValid);
621        }
622
623      }
624
625      @Override
626      public Base setProperty(int hash, String name, Base value) throws FHIRException {
627        switch (hash) {
628        case 3575610: // type
629          this.type = castToCodeableConcept(value); // CodeableConcept
630          return value;
631        case -384364440: // resourceType
632          this.resourceType = castToCodeableConcept(value); // CodeableConcept
633          return value;
634        case 106437350: // party
635          this.party = castToReference(value); // Reference
636          return value;
637        default: return super.setProperty(hash, name, value);
638        }
639
640      }
641
642      @Override
643      public Base setProperty(String name, Base value) throws FHIRException {
644        if (name.equals("type")) {
645          this.type = castToCodeableConcept(value); // CodeableConcept
646        } else if (name.equals("resourceType")) {
647          this.resourceType = castToCodeableConcept(value); // CodeableConcept
648        } else if (name.equals("party")) {
649          this.party = castToReference(value); // Reference
650        } else
651          return super.setProperty(name, value);
652        return value;
653      }
654
655      @Override
656      public Base makeProperty(int hash, String name) throws FHIRException {
657        switch (hash) {
658        case 3575610:  return getType(); 
659        case -384364440:  return getResourceType(); 
660        case 106437350:  return getParty(); 
661        default: return super.makeProperty(hash, name);
662        }
663
664      }
665
666      @Override
667      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
668        switch (hash) {
669        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
670        case -384364440: /*resourceType*/ return new String[] {"CodeableConcept"};
671        case 106437350: /*party*/ return new String[] {"Reference"};
672        default: return super.getTypesForProperty(hash, name);
673        }
674
675      }
676
677      @Override
678      public Base addChild(String name) throws FHIRException {
679        if (name.equals("type")) {
680          this.type = new CodeableConcept();
681          return this.type;
682        }
683        else if (name.equals("resourceType")) {
684          this.resourceType = new CodeableConcept();
685          return this.resourceType;
686        }
687        else if (name.equals("party")) {
688          this.party = new Reference();
689          return this.party;
690        }
691        else
692          return super.addChild(name);
693      }
694
695      public PayeeComponent copy() {
696        PayeeComponent dst = new PayeeComponent();
697        copyValues(dst);
698        dst.type = type == null ? null : type.copy();
699        dst.resourceType = resourceType == null ? null : resourceType.copy();
700        dst.party = party == null ? null : party.copy();
701        return dst;
702      }
703
704      @Override
705      public boolean equalsDeep(Base other_) {
706        if (!super.equalsDeep(other_))
707          return false;
708        if (!(other_ instanceof PayeeComponent))
709          return false;
710        PayeeComponent o = (PayeeComponent) other_;
711        return compareDeep(type, o.type, true) && compareDeep(resourceType, o.resourceType, true) && compareDeep(party, o.party, true)
712          ;
713      }
714
715      @Override
716      public boolean equalsShallow(Base other_) {
717        if (!super.equalsShallow(other_))
718          return false;
719        if (!(other_ instanceof PayeeComponent))
720          return false;
721        PayeeComponent o = (PayeeComponent) other_;
722        return true;
723      }
724
725      public boolean isEmpty() {
726        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, resourceType, party
727          );
728      }
729
730  public String fhirType() {
731    return "ExplanationOfBenefit.payee";
732
733  }
734
735  }
736
737    @Block()
738    public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
739        /**
740         * Sequence of the information element which serves to provide a link.
741         */
742        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
743        @Description(shortDefinition="Information instance identifier", formalDefinition="Sequence of the information element which serves to provide a link." )
744        protected PositiveIntType sequence;
745
746        /**
747         * The general class of the information supplied: information; exception; accident, employment; onset, etc.
748         */
749        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
750        @Description(shortDefinition="General class of information", formalDefinition="The general class of the information supplied: information; exception; accident, employment; onset, etc." )
751        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-informationcategory")
752        protected CodeableConcept category;
753
754        /**
755         * System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication.
756         */
757        @Child(name = "code", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
758        @Description(shortDefinition="Type of information", formalDefinition="System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication." )
759        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-exception")
760        protected CodeableConcept code;
761
762        /**
763         * The date when or period to which this information refers.
764         */
765        @Child(name = "timing", type = {DateType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
766        @Description(shortDefinition="When it occurred", formalDefinition="The date when or period to which this information refers." )
767        protected Type timing;
768
769        /**
770         * Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.
771         */
772        @Child(name = "value", type = {StringType.class, Quantity.class, Attachment.class, Reference.class}, order=5, min=0, max=1, modifier=false, summary=false)
773        @Description(shortDefinition="Additional Data or supporting information", formalDefinition="Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data." )
774        protected Type value;
775
776        /**
777         * For example, provides the reason for: the additional stay, or missing tooth or any other situation where a reason code is required in addition to the content.
778         */
779        @Child(name = "reason", type = {Coding.class}, order=6, min=0, max=1, modifier=false, summary=false)
780        @Description(shortDefinition="Reason associated with the information", formalDefinition="For example, provides the reason for: the additional stay, or missing tooth or any other situation where a reason code is required in addition to the content." )
781        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/missing-tooth-reason")
782        protected Coding reason;
783
784        private static final long serialVersionUID = -410136661L;
785
786    /**
787     * Constructor
788     */
789      public SupportingInformationComponent() {
790        super();
791      }
792
793    /**
794     * Constructor
795     */
796      public SupportingInformationComponent(PositiveIntType sequence, CodeableConcept category) {
797        super();
798        this.sequence = sequence;
799        this.category = category;
800      }
801
802        /**
803         * @return {@link #sequence} (Sequence of the information element which serves to provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
804         */
805        public PositiveIntType getSequenceElement() { 
806          if (this.sequence == null)
807            if (Configuration.errorOnAutoCreate())
808              throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
809            else if (Configuration.doAutoCreate())
810              this.sequence = new PositiveIntType(); // bb
811          return this.sequence;
812        }
813
814        public boolean hasSequenceElement() { 
815          return this.sequence != null && !this.sequence.isEmpty();
816        }
817
818        public boolean hasSequence() { 
819          return this.sequence != null && !this.sequence.isEmpty();
820        }
821
822        /**
823         * @param value {@link #sequence} (Sequence of the information element which serves to provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
824         */
825        public SupportingInformationComponent setSequenceElement(PositiveIntType value) { 
826          this.sequence = value;
827          return this;
828        }
829
830        /**
831         * @return Sequence of the information element which serves to provide a link.
832         */
833        public int getSequence() { 
834          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
835        }
836
837        /**
838         * @param value Sequence of the information element which serves to provide a link.
839         */
840        public SupportingInformationComponent setSequence(int value) { 
841            if (this.sequence == null)
842              this.sequence = new PositiveIntType();
843            this.sequence.setValue(value);
844          return this;
845        }
846
847        /**
848         * @return {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
849         */
850        public CodeableConcept getCategory() { 
851          if (this.category == null)
852            if (Configuration.errorOnAutoCreate())
853              throw new Error("Attempt to auto-create SupportingInformationComponent.category");
854            else if (Configuration.doAutoCreate())
855              this.category = new CodeableConcept(); // cc
856          return this.category;
857        }
858
859        public boolean hasCategory() { 
860          return this.category != null && !this.category.isEmpty();
861        }
862
863        /**
864         * @param value {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
865         */
866        public SupportingInformationComponent setCategory(CodeableConcept value)  { 
867          this.category = value;
868          return this;
869        }
870
871        /**
872         * @return {@link #code} (System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication.)
873         */
874        public CodeableConcept getCode() { 
875          if (this.code == null)
876            if (Configuration.errorOnAutoCreate())
877              throw new Error("Attempt to auto-create SupportingInformationComponent.code");
878            else if (Configuration.doAutoCreate())
879              this.code = new CodeableConcept(); // cc
880          return this.code;
881        }
882
883        public boolean hasCode() { 
884          return this.code != null && !this.code.isEmpty();
885        }
886
887        /**
888         * @param value {@link #code} (System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication.)
889         */
890        public SupportingInformationComponent setCode(CodeableConcept value)  { 
891          this.code = value;
892          return this;
893        }
894
895        /**
896         * @return {@link #timing} (The date when or period to which this information refers.)
897         */
898        public Type getTiming() { 
899          return this.timing;
900        }
901
902        /**
903         * @return {@link #timing} (The date when or period to which this information refers.)
904         */
905        public DateType getTimingDateType() throws FHIRException { 
906          if (this.timing == null)
907            return null;
908          if (!(this.timing instanceof DateType))
909            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.timing.getClass().getName()+" was encountered");
910          return (DateType) this.timing;
911        }
912
913        public boolean hasTimingDateType() { 
914          return this != null && this.timing instanceof DateType;
915        }
916
917        /**
918         * @return {@link #timing} (The date when or period to which this information refers.)
919         */
920        public Period getTimingPeriod() throws FHIRException { 
921          if (this.timing == null)
922            return null;
923          if (!(this.timing instanceof Period))
924            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
925          return (Period) this.timing;
926        }
927
928        public boolean hasTimingPeriod() { 
929          return this != null && this.timing instanceof Period;
930        }
931
932        public boolean hasTiming() { 
933          return this.timing != null && !this.timing.isEmpty();
934        }
935
936        /**
937         * @param value {@link #timing} (The date when or period to which this information refers.)
938         */
939        public SupportingInformationComponent setTiming(Type value) throws FHIRFormatError { 
940          if (value != null && !(value instanceof DateType || value instanceof Period))
941            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.information.timing[x]: "+value.fhirType());
942          this.timing = value;
943          return this;
944        }
945
946        /**
947         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
948         */
949        public Type getValue() { 
950          return this.value;
951        }
952
953        /**
954         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
955         */
956        public StringType getValueStringType() throws FHIRException { 
957          if (this.value == null)
958            return null;
959          if (!(this.value instanceof StringType))
960            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
961          return (StringType) this.value;
962        }
963
964        public boolean hasValueStringType() { 
965          return this != null && this.value instanceof StringType;
966        }
967
968        /**
969         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
970         */
971        public Quantity getValueQuantity() throws FHIRException { 
972          if (this.value == null)
973            return null;
974          if (!(this.value instanceof Quantity))
975            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
976          return (Quantity) this.value;
977        }
978
979        public boolean hasValueQuantity() { 
980          return this != null && this.value instanceof Quantity;
981        }
982
983        /**
984         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
985         */
986        public Attachment getValueAttachment() throws FHIRException { 
987          if (this.value == null)
988            return null;
989          if (!(this.value instanceof Attachment))
990            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
991          return (Attachment) this.value;
992        }
993
994        public boolean hasValueAttachment() { 
995          return this != null && this.value instanceof Attachment;
996        }
997
998        /**
999         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
1000         */
1001        public Reference getValueReference() throws FHIRException { 
1002          if (this.value == null)
1003            return null;
1004          if (!(this.value instanceof Reference))
1005            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
1006          return (Reference) this.value;
1007        }
1008
1009        public boolean hasValueReference() { 
1010          return this != null && this.value instanceof Reference;
1011        }
1012
1013        public boolean hasValue() { 
1014          return this.value != null && !this.value.isEmpty();
1015        }
1016
1017        /**
1018         * @param value {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
1019         */
1020        public SupportingInformationComponent setValue(Type value) throws FHIRFormatError { 
1021          if (value != null && !(value instanceof StringType || value instanceof Quantity || value instanceof Attachment || value instanceof Reference))
1022            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.information.value[x]: "+value.fhirType());
1023          this.value = value;
1024          return this;
1025        }
1026
1027        /**
1028         * @return {@link #reason} (For example, provides the reason for: the additional stay, or missing tooth or any other situation where a reason code is required in addition to the content.)
1029         */
1030        public Coding getReason() { 
1031          if (this.reason == null)
1032            if (Configuration.errorOnAutoCreate())
1033              throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1034            else if (Configuration.doAutoCreate())
1035              this.reason = new Coding(); // cc
1036          return this.reason;
1037        }
1038
1039        public boolean hasReason() { 
1040          return this.reason != null && !this.reason.isEmpty();
1041        }
1042
1043        /**
1044         * @param value {@link #reason} (For example, provides the reason for: the additional stay, or missing tooth or any other situation where a reason code is required in addition to the content.)
1045         */
1046        public SupportingInformationComponent setReason(Coding value)  { 
1047          this.reason = value;
1048          return this;
1049        }
1050
1051        protected void listChildren(List<Property> children) {
1052          super.listChildren(children);
1053          children.add(new Property("sequence", "positiveInt", "Sequence of the information element which serves to provide a link.", 0, 1, sequence));
1054          children.add(new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category));
1055          children.add(new Property("code", "CodeableConcept", "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication.", 0, 1, code));
1056          children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing));
1057          children.add(new Property("value[x]", "string|Quantity|Attachment|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, value));
1058          children.add(new Property("reason", "Coding", "For example, provides the reason for: the additional stay, or missing tooth or any other situation where a reason code is required in addition to the content.", 0, 1, reason));
1059        }
1060
1061        @Override
1062        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1063          switch (_hash) {
1064          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of the information element which serves to provide a link.", 0, 1, sequence);
1065          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category);
1066          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication.", 0, 1, code);
1067          case 164632566: /*timing[x]*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1068          case -873664438: /*timing*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1069          case 807935768: /*timingDate*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1070          case -615615829: /*timingPeriod*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1071          case -1410166417: /*value[x]*/  return new Property("value[x]", "string|Quantity|Attachment|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, value);
1072          case 111972721: /*value*/  return new Property("value[x]", "string|Quantity|Attachment|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, value);
1073          case -1424603934: /*valueString*/  return new Property("value[x]", "string|Quantity|Attachment|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, value);
1074          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "string|Quantity|Attachment|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, value);
1075          case -475566732: /*valueAttachment*/  return new Property("value[x]", "string|Quantity|Attachment|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, value);
1076          case 1755241690: /*valueReference*/  return new Property("value[x]", "string|Quantity|Attachment|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, value);
1077          case -934964668: /*reason*/  return new Property("reason", "Coding", "For example, provides the reason for: the additional stay, or missing tooth or any other situation where a reason code is required in addition to the content.", 0, 1, reason);
1078          default: return super.getNamedProperty(_hash, _name, _checkValid);
1079          }
1080
1081        }
1082
1083      @Override
1084      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1085        switch (hash) {
1086        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1087        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1088        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1089        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type
1090        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
1091        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
1092        default: return super.getProperty(hash, name, checkValid);
1093        }
1094
1095      }
1096
1097      @Override
1098      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1099        switch (hash) {
1100        case 1349547969: // sequence
1101          this.sequence = castToPositiveInt(value); // PositiveIntType
1102          return value;
1103        case 50511102: // category
1104          this.category = castToCodeableConcept(value); // CodeableConcept
1105          return value;
1106        case 3059181: // code
1107          this.code = castToCodeableConcept(value); // CodeableConcept
1108          return value;
1109        case -873664438: // timing
1110          this.timing = castToType(value); // Type
1111          return value;
1112        case 111972721: // value
1113          this.value = castToType(value); // Type
1114          return value;
1115        case -934964668: // reason
1116          this.reason = castToCoding(value); // Coding
1117          return value;
1118        default: return super.setProperty(hash, name, value);
1119        }
1120
1121      }
1122
1123      @Override
1124      public Base setProperty(String name, Base value) throws FHIRException {
1125        if (name.equals("sequence")) {
1126          this.sequence = castToPositiveInt(value); // PositiveIntType
1127        } else if (name.equals("category")) {
1128          this.category = castToCodeableConcept(value); // CodeableConcept
1129        } else if (name.equals("code")) {
1130          this.code = castToCodeableConcept(value); // CodeableConcept
1131        } else if (name.equals("timing[x]")) {
1132          this.timing = castToType(value); // Type
1133        } else if (name.equals("value[x]")) {
1134          this.value = castToType(value); // Type
1135        } else if (name.equals("reason")) {
1136          this.reason = castToCoding(value); // Coding
1137        } else
1138          return super.setProperty(name, value);
1139        return value;
1140      }
1141
1142      @Override
1143      public Base makeProperty(int hash, String name) throws FHIRException {
1144        switch (hash) {
1145        case 1349547969:  return getSequenceElement();
1146        case 50511102:  return getCategory(); 
1147        case 3059181:  return getCode(); 
1148        case 164632566:  return getTiming(); 
1149        case -873664438:  return getTiming(); 
1150        case -1410166417:  return getValue(); 
1151        case 111972721:  return getValue(); 
1152        case -934964668:  return getReason(); 
1153        default: return super.makeProperty(hash, name);
1154        }
1155
1156      }
1157
1158      @Override
1159      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1160        switch (hash) {
1161        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1162        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1163        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1164        case -873664438: /*timing*/ return new String[] {"date", "Period"};
1165        case 111972721: /*value*/ return new String[] {"string", "Quantity", "Attachment", "Reference"};
1166        case -934964668: /*reason*/ return new String[] {"Coding"};
1167        default: return super.getTypesForProperty(hash, name);
1168        }
1169
1170      }
1171
1172      @Override
1173      public Base addChild(String name) throws FHIRException {
1174        if (name.equals("sequence")) {
1175          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1176        }
1177        else if (name.equals("category")) {
1178          this.category = new CodeableConcept();
1179          return this.category;
1180        }
1181        else if (name.equals("code")) {
1182          this.code = new CodeableConcept();
1183          return this.code;
1184        }
1185        else if (name.equals("timingDate")) {
1186          this.timing = new DateType();
1187          return this.timing;
1188        }
1189        else if (name.equals("timingPeriod")) {
1190          this.timing = new Period();
1191          return this.timing;
1192        }
1193        else if (name.equals("valueString")) {
1194          this.value = new StringType();
1195          return this.value;
1196        }
1197        else if (name.equals("valueQuantity")) {
1198          this.value = new Quantity();
1199          return this.value;
1200        }
1201        else if (name.equals("valueAttachment")) {
1202          this.value = new Attachment();
1203          return this.value;
1204        }
1205        else if (name.equals("valueReference")) {
1206          this.value = new Reference();
1207          return this.value;
1208        }
1209        else if (name.equals("reason")) {
1210          this.reason = new Coding();
1211          return this.reason;
1212        }
1213        else
1214          return super.addChild(name);
1215      }
1216
1217      public SupportingInformationComponent copy() {
1218        SupportingInformationComponent dst = new SupportingInformationComponent();
1219        copyValues(dst);
1220        dst.sequence = sequence == null ? null : sequence.copy();
1221        dst.category = category == null ? null : category.copy();
1222        dst.code = code == null ? null : code.copy();
1223        dst.timing = timing == null ? null : timing.copy();
1224        dst.value = value == null ? null : value.copy();
1225        dst.reason = reason == null ? null : reason.copy();
1226        return dst;
1227      }
1228
1229      @Override
1230      public boolean equalsDeep(Base other_) {
1231        if (!super.equalsDeep(other_))
1232          return false;
1233        if (!(other_ instanceof SupportingInformationComponent))
1234          return false;
1235        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1236        return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true) && compareDeep(code, o.code, true)
1237           && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true) && compareDeep(reason, o.reason, true)
1238          ;
1239      }
1240
1241      @Override
1242      public boolean equalsShallow(Base other_) {
1243        if (!super.equalsShallow(other_))
1244          return false;
1245        if (!(other_ instanceof SupportingInformationComponent))
1246          return false;
1247        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1248        return compareValues(sequence, o.sequence, true);
1249      }
1250
1251      public boolean isEmpty() {
1252        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code
1253          , timing, value, reason);
1254      }
1255
1256  public String fhirType() {
1257    return "ExplanationOfBenefit.information";
1258
1259  }
1260
1261  }
1262
1263    @Block()
1264    public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
1265        /**
1266         * Sequence of careteam which serves to order and provide a link.
1267         */
1268        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1269        @Description(shortDefinition="Number to covey order of careteam", formalDefinition="Sequence of careteam which serves to order and provide a link." )
1270        protected PositiveIntType sequence;
1271
1272        /**
1273         * The members of the team who provided the overall service.
1274         */
1275        @Child(name = "provider", type = {Practitioner.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=false)
1276        @Description(shortDefinition="Member of the Care Team", formalDefinition="The members of the team who provided the overall service." )
1277        protected Reference provider;
1278
1279        /**
1280         * The actual object that is the target of the reference (The members of the team who provided the overall service.)
1281         */
1282        protected Resource providerTarget;
1283
1284        /**
1285         * The practitioner who is billing and responsible for the claimed services rendered to the patient.
1286         */
1287        @Child(name = "responsible", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
1288        @Description(shortDefinition="Billing practitioner", formalDefinition="The practitioner who is billing and responsible for the claimed services rendered to the patient." )
1289        protected BooleanType responsible;
1290
1291        /**
1292         * The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.
1293         */
1294        @Child(name = "role", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1295        @Description(shortDefinition="Role on the team", formalDefinition="The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team." )
1296        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-careteamrole")
1297        protected CodeableConcept role;
1298
1299        /**
1300         * The qualification which is applicable for this service.
1301         */
1302        @Child(name = "qualification", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1303        @Description(shortDefinition="Type, classification or Specialization", formalDefinition="The qualification which is applicable for this service." )
1304        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provider-qualification")
1305        protected CodeableConcept qualification;
1306
1307        private static final long serialVersionUID = 1758966968L;
1308
1309    /**
1310     * Constructor
1311     */
1312      public CareTeamComponent() {
1313        super();
1314      }
1315
1316    /**
1317     * Constructor
1318     */
1319      public CareTeamComponent(PositiveIntType sequence, Reference provider) {
1320        super();
1321        this.sequence = sequence;
1322        this.provider = provider;
1323      }
1324
1325        /**
1326         * @return {@link #sequence} (Sequence of careteam which serves to order and provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1327         */
1328        public PositiveIntType getSequenceElement() { 
1329          if (this.sequence == null)
1330            if (Configuration.errorOnAutoCreate())
1331              throw new Error("Attempt to auto-create CareTeamComponent.sequence");
1332            else if (Configuration.doAutoCreate())
1333              this.sequence = new PositiveIntType(); // bb
1334          return this.sequence;
1335        }
1336
1337        public boolean hasSequenceElement() { 
1338          return this.sequence != null && !this.sequence.isEmpty();
1339        }
1340
1341        public boolean hasSequence() { 
1342          return this.sequence != null && !this.sequence.isEmpty();
1343        }
1344
1345        /**
1346         * @param value {@link #sequence} (Sequence of careteam which serves to order and provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1347         */
1348        public CareTeamComponent setSequenceElement(PositiveIntType value) { 
1349          this.sequence = value;
1350          return this;
1351        }
1352
1353        /**
1354         * @return Sequence of careteam which serves to order and provide a link.
1355         */
1356        public int getSequence() { 
1357          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1358        }
1359
1360        /**
1361         * @param value Sequence of careteam which serves to order and provide a link.
1362         */
1363        public CareTeamComponent setSequence(int value) { 
1364            if (this.sequence == null)
1365              this.sequence = new PositiveIntType();
1366            this.sequence.setValue(value);
1367          return this;
1368        }
1369
1370        /**
1371         * @return {@link #provider} (The members of the team who provided the overall service.)
1372         */
1373        public Reference getProvider() { 
1374          if (this.provider == null)
1375            if (Configuration.errorOnAutoCreate())
1376              throw new Error("Attempt to auto-create CareTeamComponent.provider");
1377            else if (Configuration.doAutoCreate())
1378              this.provider = new Reference(); // cc
1379          return this.provider;
1380        }
1381
1382        public boolean hasProvider() { 
1383          return this.provider != null && !this.provider.isEmpty();
1384        }
1385
1386        /**
1387         * @param value {@link #provider} (The members of the team who provided the overall service.)
1388         */
1389        public CareTeamComponent setProvider(Reference value)  { 
1390          this.provider = value;
1391          return this;
1392        }
1393
1394        /**
1395         * @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 members of the team who provided the overall service.)
1396         */
1397        public Resource getProviderTarget() { 
1398          return this.providerTarget;
1399        }
1400
1401        /**
1402         * @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 members of the team who provided the overall service.)
1403         */
1404        public CareTeamComponent setProviderTarget(Resource value) { 
1405          this.providerTarget = value;
1406          return this;
1407        }
1408
1409        /**
1410         * @return {@link #responsible} (The practitioner who is billing and responsible for the claimed services rendered to the patient.). This is the underlying object with id, value and extensions. The accessor "getResponsible" gives direct access to the value
1411         */
1412        public BooleanType getResponsibleElement() { 
1413          if (this.responsible == null)
1414            if (Configuration.errorOnAutoCreate())
1415              throw new Error("Attempt to auto-create CareTeamComponent.responsible");
1416            else if (Configuration.doAutoCreate())
1417              this.responsible = new BooleanType(); // bb
1418          return this.responsible;
1419        }
1420
1421        public boolean hasResponsibleElement() { 
1422          return this.responsible != null && !this.responsible.isEmpty();
1423        }
1424
1425        public boolean hasResponsible() { 
1426          return this.responsible != null && !this.responsible.isEmpty();
1427        }
1428
1429        /**
1430         * @param value {@link #responsible} (The practitioner who is billing and responsible for the claimed services rendered to the patient.). This is the underlying object with id, value and extensions. The accessor "getResponsible" gives direct access to the value
1431         */
1432        public CareTeamComponent setResponsibleElement(BooleanType value) { 
1433          this.responsible = value;
1434          return this;
1435        }
1436
1437        /**
1438         * @return The practitioner who is billing and responsible for the claimed services rendered to the patient.
1439         */
1440        public boolean getResponsible() { 
1441          return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
1442        }
1443
1444        /**
1445         * @param value The practitioner who is billing and responsible for the claimed services rendered to the patient.
1446         */
1447        public CareTeamComponent setResponsible(boolean value) { 
1448            if (this.responsible == null)
1449              this.responsible = new BooleanType();
1450            this.responsible.setValue(value);
1451          return this;
1452        }
1453
1454        /**
1455         * @return {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.)
1456         */
1457        public CodeableConcept getRole() { 
1458          if (this.role == null)
1459            if (Configuration.errorOnAutoCreate())
1460              throw new Error("Attempt to auto-create CareTeamComponent.role");
1461            else if (Configuration.doAutoCreate())
1462              this.role = new CodeableConcept(); // cc
1463          return this.role;
1464        }
1465
1466        public boolean hasRole() { 
1467          return this.role != null && !this.role.isEmpty();
1468        }
1469
1470        /**
1471         * @param value {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.)
1472         */
1473        public CareTeamComponent setRole(CodeableConcept value)  { 
1474          this.role = value;
1475          return this;
1476        }
1477
1478        /**
1479         * @return {@link #qualification} (The qualification which is applicable for this service.)
1480         */
1481        public CodeableConcept getQualification() { 
1482          if (this.qualification == null)
1483            if (Configuration.errorOnAutoCreate())
1484              throw new Error("Attempt to auto-create CareTeamComponent.qualification");
1485            else if (Configuration.doAutoCreate())
1486              this.qualification = new CodeableConcept(); // cc
1487          return this.qualification;
1488        }
1489
1490        public boolean hasQualification() { 
1491          return this.qualification != null && !this.qualification.isEmpty();
1492        }
1493
1494        /**
1495         * @param value {@link #qualification} (The qualification which is applicable for this service.)
1496         */
1497        public CareTeamComponent setQualification(CodeableConcept value)  { 
1498          this.qualification = value;
1499          return this;
1500        }
1501
1502        protected void listChildren(List<Property> children) {
1503          super.listChildren(children);
1504          children.add(new Property("sequence", "positiveInt", "Sequence of careteam which serves to order and provide a link.", 0, 1, sequence));
1505          children.add(new Property("provider", "Reference(Practitioner|Organization)", "The members of the team who provided the overall service.", 0, 1, provider));
1506          children.add(new Property("responsible", "boolean", "The practitioner who is billing and responsible for the claimed services rendered to the patient.", 0, 1, responsible));
1507          children.add(new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.", 0, 1, role));
1508          children.add(new Property("qualification", "CodeableConcept", "The qualification which is applicable for this service.", 0, 1, qualification));
1509        }
1510
1511        @Override
1512        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1513          switch (_hash) {
1514          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of careteam which serves to order and provide a link.", 0, 1, sequence);
1515          case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|Organization)", "The members of the team who provided the overall service.", 0, 1, provider);
1516          case 1847674614: /*responsible*/  return new Property("responsible", "boolean", "The practitioner who is billing and responsible for the claimed services rendered to the patient.", 0, 1, responsible);
1517          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.", 0, 1, role);
1518          case -631333393: /*qualification*/  return new Property("qualification", "CodeableConcept", "The qualification which is applicable for this service.", 0, 1, qualification);
1519          default: return super.getNamedProperty(_hash, _name, _checkValid);
1520          }
1521
1522        }
1523
1524      @Override
1525      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1526        switch (hash) {
1527        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1528        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
1529        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // BooleanType
1530        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
1531        case -631333393: /*qualification*/ return this.qualification == null ? new Base[0] : new Base[] {this.qualification}; // CodeableConcept
1532        default: return super.getProperty(hash, name, checkValid);
1533        }
1534
1535      }
1536
1537      @Override
1538      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1539        switch (hash) {
1540        case 1349547969: // sequence
1541          this.sequence = castToPositiveInt(value); // PositiveIntType
1542          return value;
1543        case -987494927: // provider
1544          this.provider = castToReference(value); // Reference
1545          return value;
1546        case 1847674614: // responsible
1547          this.responsible = castToBoolean(value); // BooleanType
1548          return value;
1549        case 3506294: // role
1550          this.role = castToCodeableConcept(value); // CodeableConcept
1551          return value;
1552        case -631333393: // qualification
1553          this.qualification = castToCodeableConcept(value); // CodeableConcept
1554          return value;
1555        default: return super.setProperty(hash, name, value);
1556        }
1557
1558      }
1559
1560      @Override
1561      public Base setProperty(String name, Base value) throws FHIRException {
1562        if (name.equals("sequence")) {
1563          this.sequence = castToPositiveInt(value); // PositiveIntType
1564        } else if (name.equals("provider")) {
1565          this.provider = castToReference(value); // Reference
1566        } else if (name.equals("responsible")) {
1567          this.responsible = castToBoolean(value); // BooleanType
1568        } else if (name.equals("role")) {
1569          this.role = castToCodeableConcept(value); // CodeableConcept
1570        } else if (name.equals("qualification")) {
1571          this.qualification = castToCodeableConcept(value); // CodeableConcept
1572        } else
1573          return super.setProperty(name, value);
1574        return value;
1575      }
1576
1577      @Override
1578      public Base makeProperty(int hash, String name) throws FHIRException {
1579        switch (hash) {
1580        case 1349547969:  return getSequenceElement();
1581        case -987494927:  return getProvider(); 
1582        case 1847674614:  return getResponsibleElement();
1583        case 3506294:  return getRole(); 
1584        case -631333393:  return getQualification(); 
1585        default: return super.makeProperty(hash, name);
1586        }
1587
1588      }
1589
1590      @Override
1591      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1592        switch (hash) {
1593        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1594        case -987494927: /*provider*/ return new String[] {"Reference"};
1595        case 1847674614: /*responsible*/ return new String[] {"boolean"};
1596        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
1597        case -631333393: /*qualification*/ return new String[] {"CodeableConcept"};
1598        default: return super.getTypesForProperty(hash, name);
1599        }
1600
1601      }
1602
1603      @Override
1604      public Base addChild(String name) throws FHIRException {
1605        if (name.equals("sequence")) {
1606          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1607        }
1608        else if (name.equals("provider")) {
1609          this.provider = new Reference();
1610          return this.provider;
1611        }
1612        else if (name.equals("responsible")) {
1613          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.responsible");
1614        }
1615        else if (name.equals("role")) {
1616          this.role = new CodeableConcept();
1617          return this.role;
1618        }
1619        else if (name.equals("qualification")) {
1620          this.qualification = new CodeableConcept();
1621          return this.qualification;
1622        }
1623        else
1624          return super.addChild(name);
1625      }
1626
1627      public CareTeamComponent copy() {
1628        CareTeamComponent dst = new CareTeamComponent();
1629        copyValues(dst);
1630        dst.sequence = sequence == null ? null : sequence.copy();
1631        dst.provider = provider == null ? null : provider.copy();
1632        dst.responsible = responsible == null ? null : responsible.copy();
1633        dst.role = role == null ? null : role.copy();
1634        dst.qualification = qualification == null ? null : qualification.copy();
1635        return dst;
1636      }
1637
1638      @Override
1639      public boolean equalsDeep(Base other_) {
1640        if (!super.equalsDeep(other_))
1641          return false;
1642        if (!(other_ instanceof CareTeamComponent))
1643          return false;
1644        CareTeamComponent o = (CareTeamComponent) other_;
1645        return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true) && compareDeep(responsible, o.responsible, true)
1646           && compareDeep(role, o.role, true) && compareDeep(qualification, o.qualification, true);
1647      }
1648
1649      @Override
1650      public boolean equalsShallow(Base other_) {
1651        if (!super.equalsShallow(other_))
1652          return false;
1653        if (!(other_ instanceof CareTeamComponent))
1654          return false;
1655        CareTeamComponent o = (CareTeamComponent) other_;
1656        return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true)
1657          ;
1658      }
1659
1660      public boolean isEmpty() {
1661        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible
1662          , role, qualification);
1663      }
1664
1665  public String fhirType() {
1666    return "ExplanationOfBenefit.careTeam";
1667
1668  }
1669
1670  }
1671
1672    @Block()
1673    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1674        /**
1675         * Sequence of diagnosis which serves to provide a link.
1676         */
1677        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1678        @Description(shortDefinition="Number to covey order of diagnosis", formalDefinition="Sequence of diagnosis which serves to provide a link." )
1679        protected PositiveIntType sequence;
1680
1681        /**
1682         * The diagnosis.
1683         */
1684        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=2, min=1, max=1, modifier=false, summary=false)
1685        @Description(shortDefinition="Patient's diagnosis", formalDefinition="The diagnosis." )
1686        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
1687        protected Type diagnosis;
1688
1689        /**
1690         * The type of the Diagnosis, for example: admitting, primary, secondary, discharge.
1691         */
1692        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1693        @Description(shortDefinition="Timing or nature of the diagnosis", formalDefinition="The type of the Diagnosis, for example: admitting, primary, secondary, discharge." )
1694        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosistype")
1695        protected List<CodeableConcept> type;
1696
1697        /**
1698         * The package billing code, for example DRG, based on the assigned grouping code system.
1699         */
1700        @Child(name = "packageCode", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1701        @Description(shortDefinition="Package billing code", formalDefinition="The package billing code, for example DRG, based on the assigned grouping code system." )
1702        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
1703        protected CodeableConcept packageCode;
1704
1705        private static final long serialVersionUID = -350960873L;
1706
1707    /**
1708     * Constructor
1709     */
1710      public DiagnosisComponent() {
1711        super();
1712      }
1713
1714    /**
1715     * Constructor
1716     */
1717      public DiagnosisComponent(PositiveIntType sequence, Type diagnosis) {
1718        super();
1719        this.sequence = sequence;
1720        this.diagnosis = diagnosis;
1721      }
1722
1723        /**
1724         * @return {@link #sequence} (Sequence of diagnosis which serves to provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1725         */
1726        public PositiveIntType getSequenceElement() { 
1727          if (this.sequence == null)
1728            if (Configuration.errorOnAutoCreate())
1729              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
1730            else if (Configuration.doAutoCreate())
1731              this.sequence = new PositiveIntType(); // bb
1732          return this.sequence;
1733        }
1734
1735        public boolean hasSequenceElement() { 
1736          return this.sequence != null && !this.sequence.isEmpty();
1737        }
1738
1739        public boolean hasSequence() { 
1740          return this.sequence != null && !this.sequence.isEmpty();
1741        }
1742
1743        /**
1744         * @param value {@link #sequence} (Sequence of diagnosis which serves to provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1745         */
1746        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
1747          this.sequence = value;
1748          return this;
1749        }
1750
1751        /**
1752         * @return Sequence of diagnosis which serves to provide a link.
1753         */
1754        public int getSequence() { 
1755          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1756        }
1757
1758        /**
1759         * @param value Sequence of diagnosis which serves to provide a link.
1760         */
1761        public DiagnosisComponent setSequence(int value) { 
1762            if (this.sequence == null)
1763              this.sequence = new PositiveIntType();
1764            this.sequence.setValue(value);
1765          return this;
1766        }
1767
1768        /**
1769         * @return {@link #diagnosis} (The diagnosis.)
1770         */
1771        public Type getDiagnosis() { 
1772          return this.diagnosis;
1773        }
1774
1775        /**
1776         * @return {@link #diagnosis} (The diagnosis.)
1777         */
1778        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
1779          if (this.diagnosis == null)
1780            return null;
1781          if (!(this.diagnosis instanceof CodeableConcept))
1782            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1783          return (CodeableConcept) this.diagnosis;
1784        }
1785
1786        public boolean hasDiagnosisCodeableConcept() { 
1787          return this != null && this.diagnosis instanceof CodeableConcept;
1788        }
1789
1790        /**
1791         * @return {@link #diagnosis} (The diagnosis.)
1792         */
1793        public Reference getDiagnosisReference() throws FHIRException { 
1794          if (this.diagnosis == null)
1795            return null;
1796          if (!(this.diagnosis instanceof Reference))
1797            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1798          return (Reference) this.diagnosis;
1799        }
1800
1801        public boolean hasDiagnosisReference() { 
1802          return this != null && this.diagnosis instanceof Reference;
1803        }
1804
1805        public boolean hasDiagnosis() { 
1806          return this.diagnosis != null && !this.diagnosis.isEmpty();
1807        }
1808
1809        /**
1810         * @param value {@link #diagnosis} (The diagnosis.)
1811         */
1812        public DiagnosisComponent setDiagnosis(Type value) throws FHIRFormatError { 
1813          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1814            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: "+value.fhirType());
1815          this.diagnosis = value;
1816          return this;
1817        }
1818
1819        /**
1820         * @return {@link #type} (The type of the Diagnosis, for example: admitting, primary, secondary, discharge.)
1821         */
1822        public List<CodeableConcept> getType() { 
1823          if (this.type == null)
1824            this.type = new ArrayList<CodeableConcept>();
1825          return this.type;
1826        }
1827
1828        /**
1829         * @return Returns a reference to <code>this</code> for easy method chaining
1830         */
1831        public DiagnosisComponent setType(List<CodeableConcept> theType) { 
1832          this.type = theType;
1833          return this;
1834        }
1835
1836        public boolean hasType() { 
1837          if (this.type == null)
1838            return false;
1839          for (CodeableConcept item : this.type)
1840            if (!item.isEmpty())
1841              return true;
1842          return false;
1843        }
1844
1845        public CodeableConcept addType() { //3
1846          CodeableConcept t = new CodeableConcept();
1847          if (this.type == null)
1848            this.type = new ArrayList<CodeableConcept>();
1849          this.type.add(t);
1850          return t;
1851        }
1852
1853        public DiagnosisComponent addType(CodeableConcept t) { //3
1854          if (t == null)
1855            return this;
1856          if (this.type == null)
1857            this.type = new ArrayList<CodeableConcept>();
1858          this.type.add(t);
1859          return this;
1860        }
1861
1862        /**
1863         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
1864         */
1865        public CodeableConcept getTypeFirstRep() { 
1866          if (getType().isEmpty()) {
1867            addType();
1868          }
1869          return getType().get(0);
1870        }
1871
1872        /**
1873         * @return {@link #packageCode} (The package billing code, for example DRG, based on the assigned grouping code system.)
1874         */
1875        public CodeableConcept getPackageCode() { 
1876          if (this.packageCode == null)
1877            if (Configuration.errorOnAutoCreate())
1878              throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
1879            else if (Configuration.doAutoCreate())
1880              this.packageCode = new CodeableConcept(); // cc
1881          return this.packageCode;
1882        }
1883
1884        public boolean hasPackageCode() { 
1885          return this.packageCode != null && !this.packageCode.isEmpty();
1886        }
1887
1888        /**
1889         * @param value {@link #packageCode} (The package billing code, for example DRG, based on the assigned grouping code system.)
1890         */
1891        public DiagnosisComponent setPackageCode(CodeableConcept value)  { 
1892          this.packageCode = value;
1893          return this;
1894        }
1895
1896        protected void listChildren(List<Property> children) {
1897          super.listChildren(children);
1898          children.add(new Property("sequence", "positiveInt", "Sequence of diagnosis which serves to provide a link.", 0, 1, sequence));
1899          children.add(new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis));
1900          children.add(new Property("type", "CodeableConcept", "The type of the Diagnosis, for example: admitting, primary, secondary, discharge.", 0, java.lang.Integer.MAX_VALUE, type));
1901          children.add(new Property("packageCode", "CodeableConcept", "The package billing code, for example DRG, based on the assigned grouping code system.", 0, 1, packageCode));
1902        }
1903
1904        @Override
1905        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1906          switch (_hash) {
1907          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of diagnosis which serves to provide a link.", 0, 1, sequence);
1908          case -1487009809: /*diagnosis[x]*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
1909          case 1196993265: /*diagnosis*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
1910          case 277781616: /*diagnosisCodeableConcept*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
1911          case 2050454362: /*diagnosisReference*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
1912          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of the Diagnosis, for example: admitting, primary, secondary, discharge.", 0, java.lang.Integer.MAX_VALUE, type);
1913          case 908444499: /*packageCode*/  return new Property("packageCode", "CodeableConcept", "The package billing code, for example DRG, based on the assigned grouping code system.", 0, 1, packageCode);
1914          default: return super.getNamedProperty(_hash, _name, _checkValid);
1915          }
1916
1917        }
1918
1919      @Override
1920      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1921        switch (hash) {
1922        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1923        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // Type
1924        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
1925        case 908444499: /*packageCode*/ return this.packageCode == null ? new Base[0] : new Base[] {this.packageCode}; // CodeableConcept
1926        default: return super.getProperty(hash, name, checkValid);
1927        }
1928
1929      }
1930
1931      @Override
1932      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1933        switch (hash) {
1934        case 1349547969: // sequence
1935          this.sequence = castToPositiveInt(value); // PositiveIntType
1936          return value;
1937        case 1196993265: // diagnosis
1938          this.diagnosis = castToType(value); // Type
1939          return value;
1940        case 3575610: // type
1941          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
1942          return value;
1943        case 908444499: // packageCode
1944          this.packageCode = castToCodeableConcept(value); // CodeableConcept
1945          return value;
1946        default: return super.setProperty(hash, name, value);
1947        }
1948
1949      }
1950
1951      @Override
1952      public Base setProperty(String name, Base value) throws FHIRException {
1953        if (name.equals("sequence")) {
1954          this.sequence = castToPositiveInt(value); // PositiveIntType
1955        } else if (name.equals("diagnosis[x]")) {
1956          this.diagnosis = castToType(value); // Type
1957        } else if (name.equals("type")) {
1958          this.getType().add(castToCodeableConcept(value));
1959        } else if (name.equals("packageCode")) {
1960          this.packageCode = castToCodeableConcept(value); // CodeableConcept
1961        } else
1962          return super.setProperty(name, value);
1963        return value;
1964      }
1965
1966      @Override
1967      public Base makeProperty(int hash, String name) throws FHIRException {
1968        switch (hash) {
1969        case 1349547969:  return getSequenceElement();
1970        case -1487009809:  return getDiagnosis(); 
1971        case 1196993265:  return getDiagnosis(); 
1972        case 3575610:  return addType(); 
1973        case 908444499:  return getPackageCode(); 
1974        default: return super.makeProperty(hash, name);
1975        }
1976
1977      }
1978
1979      @Override
1980      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1981        switch (hash) {
1982        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1983        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
1984        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1985        case 908444499: /*packageCode*/ return new String[] {"CodeableConcept"};
1986        default: return super.getTypesForProperty(hash, name);
1987        }
1988
1989      }
1990
1991      @Override
1992      public Base addChild(String name) throws FHIRException {
1993        if (name.equals("sequence")) {
1994          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1995        }
1996        else if (name.equals("diagnosisCodeableConcept")) {
1997          this.diagnosis = new CodeableConcept();
1998          return this.diagnosis;
1999        }
2000        else if (name.equals("diagnosisReference")) {
2001          this.diagnosis = new Reference();
2002          return this.diagnosis;
2003        }
2004        else if (name.equals("type")) {
2005          return addType();
2006        }
2007        else if (name.equals("packageCode")) {
2008          this.packageCode = new CodeableConcept();
2009          return this.packageCode;
2010        }
2011        else
2012          return super.addChild(name);
2013      }
2014
2015      public DiagnosisComponent copy() {
2016        DiagnosisComponent dst = new DiagnosisComponent();
2017        copyValues(dst);
2018        dst.sequence = sequence == null ? null : sequence.copy();
2019        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
2020        if (type != null) {
2021          dst.type = new ArrayList<CodeableConcept>();
2022          for (CodeableConcept i : type)
2023            dst.type.add(i.copy());
2024        };
2025        dst.packageCode = packageCode == null ? null : packageCode.copy();
2026        return dst;
2027      }
2028
2029      @Override
2030      public boolean equalsDeep(Base other_) {
2031        if (!super.equalsDeep(other_))
2032          return false;
2033        if (!(other_ instanceof DiagnosisComponent))
2034          return false;
2035        DiagnosisComponent o = (DiagnosisComponent) other_;
2036        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(type, o.type, true)
2037           && compareDeep(packageCode, o.packageCode, true);
2038      }
2039
2040      @Override
2041      public boolean equalsShallow(Base other_) {
2042        if (!super.equalsShallow(other_))
2043          return false;
2044        if (!(other_ instanceof DiagnosisComponent))
2045          return false;
2046        DiagnosisComponent o = (DiagnosisComponent) other_;
2047        return compareValues(sequence, o.sequence, true);
2048      }
2049
2050      public boolean isEmpty() {
2051        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type
2052          , packageCode);
2053      }
2054
2055  public String fhirType() {
2056    return "ExplanationOfBenefit.diagnosis";
2057
2058  }
2059
2060  }
2061
2062    @Block()
2063    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2064        /**
2065         * Sequence of procedures which serves to order and provide a link.
2066         */
2067        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2068        @Description(shortDefinition="Procedure sequence for reference", formalDefinition="Sequence of procedures which serves to order and provide a link." )
2069        protected PositiveIntType sequence;
2070
2071        /**
2072         * Date and optionally time the procedure was performed .
2073         */
2074        @Child(name = "date", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2075        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed ." )
2076        protected DateTimeType date;
2077
2078        /**
2079         * The procedure code.
2080         */
2081        @Child(name = "procedure", type = {CodeableConcept.class, Procedure.class}, order=3, min=1, max=1, modifier=false, summary=false)
2082        @Description(shortDefinition="Patient's list of procedures performed", formalDefinition="The procedure code." )
2083        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10-procedures")
2084        protected Type procedure;
2085
2086        private static final long serialVersionUID = 864307347L;
2087
2088    /**
2089     * Constructor
2090     */
2091      public ProcedureComponent() {
2092        super();
2093      }
2094
2095    /**
2096     * Constructor
2097     */
2098      public ProcedureComponent(PositiveIntType sequence, Type procedure) {
2099        super();
2100        this.sequence = sequence;
2101        this.procedure = procedure;
2102      }
2103
2104        /**
2105         * @return {@link #sequence} (Sequence of procedures which serves to order and provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
2106         */
2107        public PositiveIntType getSequenceElement() { 
2108          if (this.sequence == null)
2109            if (Configuration.errorOnAutoCreate())
2110              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2111            else if (Configuration.doAutoCreate())
2112              this.sequence = new PositiveIntType(); // bb
2113          return this.sequence;
2114        }
2115
2116        public boolean hasSequenceElement() { 
2117          return this.sequence != null && !this.sequence.isEmpty();
2118        }
2119
2120        public boolean hasSequence() { 
2121          return this.sequence != null && !this.sequence.isEmpty();
2122        }
2123
2124        /**
2125         * @param value {@link #sequence} (Sequence of procedures which serves to order and provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
2126         */
2127        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
2128          this.sequence = value;
2129          return this;
2130        }
2131
2132        /**
2133         * @return Sequence of procedures which serves to order and provide a link.
2134         */
2135        public int getSequence() { 
2136          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2137        }
2138
2139        /**
2140         * @param value Sequence of procedures which serves to order and provide a link.
2141         */
2142        public ProcedureComponent setSequence(int value) { 
2143            if (this.sequence == null)
2144              this.sequence = new PositiveIntType();
2145            this.sequence.setValue(value);
2146          return this;
2147        }
2148
2149        /**
2150         * @return {@link #date} (Date and optionally time the procedure was performed .). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2151         */
2152        public DateTimeType getDateElement() { 
2153          if (this.date == null)
2154            if (Configuration.errorOnAutoCreate())
2155              throw new Error("Attempt to auto-create ProcedureComponent.date");
2156            else if (Configuration.doAutoCreate())
2157              this.date = new DateTimeType(); // bb
2158          return this.date;
2159        }
2160
2161        public boolean hasDateElement() { 
2162          return this.date != null && !this.date.isEmpty();
2163        }
2164
2165        public boolean hasDate() { 
2166          return this.date != null && !this.date.isEmpty();
2167        }
2168
2169        /**
2170         * @param value {@link #date} (Date and optionally time the procedure was performed .). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2171         */
2172        public ProcedureComponent setDateElement(DateTimeType value) { 
2173          this.date = value;
2174          return this;
2175        }
2176
2177        /**
2178         * @return Date and optionally time the procedure was performed .
2179         */
2180        public Date getDate() { 
2181          return this.date == null ? null : this.date.getValue();
2182        }
2183
2184        /**
2185         * @param value Date and optionally time the procedure was performed .
2186         */
2187        public ProcedureComponent setDate(Date value) { 
2188          if (value == null)
2189            this.date = null;
2190          else {
2191            if (this.date == null)
2192              this.date = new DateTimeType();
2193            this.date.setValue(value);
2194          }
2195          return this;
2196        }
2197
2198        /**
2199         * @return {@link #procedure} (The procedure code.)
2200         */
2201        public Type getProcedure() { 
2202          return this.procedure;
2203        }
2204
2205        /**
2206         * @return {@link #procedure} (The procedure code.)
2207         */
2208        public CodeableConcept getProcedureCodeableConcept() throws FHIRException { 
2209          if (this.procedure == null)
2210            return null;
2211          if (!(this.procedure instanceof CodeableConcept))
2212            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.procedure.getClass().getName()+" was encountered");
2213          return (CodeableConcept) this.procedure;
2214        }
2215
2216        public boolean hasProcedureCodeableConcept() { 
2217          return this != null && this.procedure instanceof CodeableConcept;
2218        }
2219
2220        /**
2221         * @return {@link #procedure} (The procedure code.)
2222         */
2223        public Reference getProcedureReference() throws FHIRException { 
2224          if (this.procedure == null)
2225            return null;
2226          if (!(this.procedure instanceof Reference))
2227            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
2228          return (Reference) this.procedure;
2229        }
2230
2231        public boolean hasProcedureReference() { 
2232          return this != null && this.procedure instanceof Reference;
2233        }
2234
2235        public boolean hasProcedure() { 
2236          return this.procedure != null && !this.procedure.isEmpty();
2237        }
2238
2239        /**
2240         * @param value {@link #procedure} (The procedure code.)
2241         */
2242        public ProcedureComponent setProcedure(Type value) throws FHIRFormatError { 
2243          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2244            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: "+value.fhirType());
2245          this.procedure = value;
2246          return this;
2247        }
2248
2249        protected void listChildren(List<Property> children) {
2250          super.listChildren(children);
2251          children.add(new Property("sequence", "positiveInt", "Sequence of procedures which serves to order and provide a link.", 0, 1, sequence));
2252          children.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed .", 0, 1, date));
2253          children.add(new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure));
2254        }
2255
2256        @Override
2257        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2258          switch (_hash) {
2259          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of procedures which serves to order and provide a link.", 0, 1, sequence);
2260          case 3076014: /*date*/  return new Property("date", "dateTime", "Date and optionally time the procedure was performed .", 0, 1, date);
2261          case 1640074445: /*procedure[x]*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2262          case -1095204141: /*procedure*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2263          case -1284783026: /*procedureCodeableConcept*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2264          case 881809848: /*procedureReference*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2265          default: return super.getNamedProperty(_hash, _name, _checkValid);
2266          }
2267
2268        }
2269
2270      @Override
2271      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2272        switch (hash) {
2273        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2274        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2275        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // Type
2276        default: return super.getProperty(hash, name, checkValid);
2277        }
2278
2279      }
2280
2281      @Override
2282      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2283        switch (hash) {
2284        case 1349547969: // sequence
2285          this.sequence = castToPositiveInt(value); // PositiveIntType
2286          return value;
2287        case 3076014: // date
2288          this.date = castToDateTime(value); // DateTimeType
2289          return value;
2290        case -1095204141: // procedure
2291          this.procedure = castToType(value); // Type
2292          return value;
2293        default: return super.setProperty(hash, name, value);
2294        }
2295
2296      }
2297
2298      @Override
2299      public Base setProperty(String name, Base value) throws FHIRException {
2300        if (name.equals("sequence")) {
2301          this.sequence = castToPositiveInt(value); // PositiveIntType
2302        } else if (name.equals("date")) {
2303          this.date = castToDateTime(value); // DateTimeType
2304        } else if (name.equals("procedure[x]")) {
2305          this.procedure = castToType(value); // Type
2306        } else
2307          return super.setProperty(name, value);
2308        return value;
2309      }
2310
2311      @Override
2312      public Base makeProperty(int hash, String name) throws FHIRException {
2313        switch (hash) {
2314        case 1349547969:  return getSequenceElement();
2315        case 3076014:  return getDateElement();
2316        case 1640074445:  return getProcedure(); 
2317        case -1095204141:  return getProcedure(); 
2318        default: return super.makeProperty(hash, name);
2319        }
2320
2321      }
2322
2323      @Override
2324      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2325        switch (hash) {
2326        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2327        case 3076014: /*date*/ return new String[] {"dateTime"};
2328        case -1095204141: /*procedure*/ return new String[] {"CodeableConcept", "Reference"};
2329        default: return super.getTypesForProperty(hash, name);
2330        }
2331
2332      }
2333
2334      @Override
2335      public Base addChild(String name) throws FHIRException {
2336        if (name.equals("sequence")) {
2337          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2338        }
2339        else if (name.equals("date")) {
2340          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
2341        }
2342        else if (name.equals("procedureCodeableConcept")) {
2343          this.procedure = new CodeableConcept();
2344          return this.procedure;
2345        }
2346        else if (name.equals("procedureReference")) {
2347          this.procedure = new Reference();
2348          return this.procedure;
2349        }
2350        else
2351          return super.addChild(name);
2352      }
2353
2354      public ProcedureComponent copy() {
2355        ProcedureComponent dst = new ProcedureComponent();
2356        copyValues(dst);
2357        dst.sequence = sequence == null ? null : sequence.copy();
2358        dst.date = date == null ? null : date.copy();
2359        dst.procedure = procedure == null ? null : procedure.copy();
2360        return dst;
2361      }
2362
2363      @Override
2364      public boolean equalsDeep(Base other_) {
2365        if (!super.equalsDeep(other_))
2366          return false;
2367        if (!(other_ instanceof ProcedureComponent))
2368          return false;
2369        ProcedureComponent o = (ProcedureComponent) other_;
2370        return compareDeep(sequence, o.sequence, true) && compareDeep(date, o.date, true) && compareDeep(procedure, o.procedure, true)
2371          ;
2372      }
2373
2374      @Override
2375      public boolean equalsShallow(Base other_) {
2376        if (!super.equalsShallow(other_))
2377          return false;
2378        if (!(other_ instanceof ProcedureComponent))
2379          return false;
2380        ProcedureComponent o = (ProcedureComponent) other_;
2381        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
2382      }
2383
2384      public boolean isEmpty() {
2385        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, date, procedure
2386          );
2387      }
2388
2389  public String fhirType() {
2390    return "ExplanationOfBenefit.procedure";
2391
2392  }
2393
2394  }
2395
2396    @Block()
2397    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
2398        /**
2399         * Reference to the program or plan identification, underwriter or payor.
2400         */
2401        @Child(name = "coverage", type = {Coverage.class}, order=1, min=0, max=1, modifier=false, summary=false)
2402        @Description(shortDefinition="Insurance information", formalDefinition="Reference to the program or plan identification, underwriter or payor." )
2403        protected Reference coverage;
2404
2405        /**
2406         * The actual object that is the target of the reference (Reference to the program or plan identification, underwriter or payor.)
2407         */
2408        protected Coverage coverageTarget;
2409
2410        /**
2411         * A list of references from the Insurer to which these services pertain.
2412         */
2413        @Child(name = "preAuthRef", type = {StringType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2414        @Description(shortDefinition="Pre-Authorization/Determination Reference", formalDefinition="A list of references from the Insurer to which these services pertain." )
2415        protected List<StringType> preAuthRef;
2416
2417        private static final long serialVersionUID = -870298727L;
2418
2419    /**
2420     * Constructor
2421     */
2422      public InsuranceComponent() {
2423        super();
2424      }
2425
2426        /**
2427         * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
2428         */
2429        public Reference getCoverage() { 
2430          if (this.coverage == null)
2431            if (Configuration.errorOnAutoCreate())
2432              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2433            else if (Configuration.doAutoCreate())
2434              this.coverage = new Reference(); // cc
2435          return this.coverage;
2436        }
2437
2438        public boolean hasCoverage() { 
2439          return this.coverage != null && !this.coverage.isEmpty();
2440        }
2441
2442        /**
2443         * @param value {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
2444         */
2445        public InsuranceComponent setCoverage(Reference value)  { 
2446          this.coverage = value;
2447          return this;
2448        }
2449
2450        /**
2451         * @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 program or plan identification, underwriter or payor.)
2452         */
2453        public Coverage getCoverageTarget() { 
2454          if (this.coverageTarget == null)
2455            if (Configuration.errorOnAutoCreate())
2456              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2457            else if (Configuration.doAutoCreate())
2458              this.coverageTarget = new Coverage(); // aa
2459          return this.coverageTarget;
2460        }
2461
2462        /**
2463         * @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 program or plan identification, underwriter or payor.)
2464         */
2465        public InsuranceComponent setCoverageTarget(Coverage value) { 
2466          this.coverageTarget = value;
2467          return this;
2468        }
2469
2470        /**
2471         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2472         */
2473        public List<StringType> getPreAuthRef() { 
2474          if (this.preAuthRef == null)
2475            this.preAuthRef = new ArrayList<StringType>();
2476          return this.preAuthRef;
2477        }
2478
2479        /**
2480         * @return Returns a reference to <code>this</code> for easy method chaining
2481         */
2482        public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) { 
2483          this.preAuthRef = thePreAuthRef;
2484          return this;
2485        }
2486
2487        public boolean hasPreAuthRef() { 
2488          if (this.preAuthRef == null)
2489            return false;
2490          for (StringType item : this.preAuthRef)
2491            if (!item.isEmpty())
2492              return true;
2493          return false;
2494        }
2495
2496        /**
2497         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2498         */
2499        public StringType addPreAuthRefElement() {//2 
2500          StringType t = new StringType();
2501          if (this.preAuthRef == null)
2502            this.preAuthRef = new ArrayList<StringType>();
2503          this.preAuthRef.add(t);
2504          return t;
2505        }
2506
2507        /**
2508         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2509         */
2510        public InsuranceComponent addPreAuthRef(String value) { //1
2511          StringType t = new StringType();
2512          t.setValue(value);
2513          if (this.preAuthRef == null)
2514            this.preAuthRef = new ArrayList<StringType>();
2515          this.preAuthRef.add(t);
2516          return this;
2517        }
2518
2519        /**
2520         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2521         */
2522        public boolean hasPreAuthRef(String value) { 
2523          if (this.preAuthRef == null)
2524            return false;
2525          for (StringType v : this.preAuthRef)
2526            if (v.getValue().equals(value)) // string
2527              return true;
2528          return false;
2529        }
2530
2531        protected void listChildren(List<Property> children) {
2532          super.listChildren(children);
2533          children.add(new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, 1, coverage));
2534          children.add(new Property("preAuthRef", "string", "A list of references from the Insurer to which these services pertain.", 0, java.lang.Integer.MAX_VALUE, preAuthRef));
2535        }
2536
2537        @Override
2538        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2539          switch (_hash) {
2540          case -351767064: /*coverage*/  return new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, 1, coverage);
2541          case 522246568: /*preAuthRef*/  return new Property("preAuthRef", "string", "A list of references from the Insurer to which these services pertain.", 0, java.lang.Integer.MAX_VALUE, preAuthRef);
2542          default: return super.getNamedProperty(_hash, _name, _checkValid);
2543          }
2544
2545        }
2546
2547      @Override
2548      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2549        switch (hash) {
2550        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
2551        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
2552        default: return super.getProperty(hash, name, checkValid);
2553        }
2554
2555      }
2556
2557      @Override
2558      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2559        switch (hash) {
2560        case -351767064: // coverage
2561          this.coverage = castToReference(value); // Reference
2562          return value;
2563        case 522246568: // preAuthRef
2564          this.getPreAuthRef().add(castToString(value)); // StringType
2565          return value;
2566        default: return super.setProperty(hash, name, value);
2567        }
2568
2569      }
2570
2571      @Override
2572      public Base setProperty(String name, Base value) throws FHIRException {
2573        if (name.equals("coverage")) {
2574          this.coverage = castToReference(value); // Reference
2575        } else if (name.equals("preAuthRef")) {
2576          this.getPreAuthRef().add(castToString(value));
2577        } else
2578          return super.setProperty(name, value);
2579        return value;
2580      }
2581
2582      @Override
2583      public Base makeProperty(int hash, String name) throws FHIRException {
2584        switch (hash) {
2585        case -351767064:  return getCoverage(); 
2586        case 522246568:  return addPreAuthRefElement();
2587        default: return super.makeProperty(hash, name);
2588        }
2589
2590      }
2591
2592      @Override
2593      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2594        switch (hash) {
2595        case -351767064: /*coverage*/ return new String[] {"Reference"};
2596        case 522246568: /*preAuthRef*/ return new String[] {"string"};
2597        default: return super.getTypesForProperty(hash, name);
2598        }
2599
2600      }
2601
2602      @Override
2603      public Base addChild(String name) throws FHIRException {
2604        if (name.equals("coverage")) {
2605          this.coverage = new Reference();
2606          return this.coverage;
2607        }
2608        else if (name.equals("preAuthRef")) {
2609          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
2610        }
2611        else
2612          return super.addChild(name);
2613      }
2614
2615      public InsuranceComponent copy() {
2616        InsuranceComponent dst = new InsuranceComponent();
2617        copyValues(dst);
2618        dst.coverage = coverage == null ? null : coverage.copy();
2619        if (preAuthRef != null) {
2620          dst.preAuthRef = new ArrayList<StringType>();
2621          for (StringType i : preAuthRef)
2622            dst.preAuthRef.add(i.copy());
2623        };
2624        return dst;
2625      }
2626
2627      @Override
2628      public boolean equalsDeep(Base other_) {
2629        if (!super.equalsDeep(other_))
2630          return false;
2631        if (!(other_ instanceof InsuranceComponent))
2632          return false;
2633        InsuranceComponent o = (InsuranceComponent) other_;
2634        return compareDeep(coverage, o.coverage, true) && compareDeep(preAuthRef, o.preAuthRef, true);
2635      }
2636
2637      @Override
2638      public boolean equalsShallow(Base other_) {
2639        if (!super.equalsShallow(other_))
2640          return false;
2641        if (!(other_ instanceof InsuranceComponent))
2642          return false;
2643        InsuranceComponent o = (InsuranceComponent) other_;
2644        return compareValues(preAuthRef, o.preAuthRef, true);
2645      }
2646
2647      public boolean isEmpty() {
2648        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(coverage, preAuthRef);
2649      }
2650
2651  public String fhirType() {
2652    return "ExplanationOfBenefit.insurance";
2653
2654  }
2655
2656  }
2657
2658    @Block()
2659    public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
2660        /**
2661         * Date of an accident which these services are addressing.
2662         */
2663        @Child(name = "date", type = {DateType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2664        @Description(shortDefinition="When the accident occurred", formalDefinition="Date of an accident which these services are addressing." )
2665        protected DateType date;
2666
2667        /**
2668         * Type of accident: work, auto, etc.
2669         */
2670        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
2671        @Description(shortDefinition="The nature of the accident", formalDefinition="Type of accident: work, auto, etc." )
2672        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActIncidentCode")
2673        protected CodeableConcept type;
2674
2675        /**
2676         * Where the accident occurred.
2677         */
2678        @Child(name = "location", type = {Address.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=false)
2679        @Description(shortDefinition="Accident Place", formalDefinition="Where the accident occurred." )
2680        protected Type location;
2681
2682        private static final long serialVersionUID = 622904984L;
2683
2684    /**
2685     * Constructor
2686     */
2687      public AccidentComponent() {
2688        super();
2689      }
2690
2691        /**
2692         * @return {@link #date} (Date of an accident which these services are addressing.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2693         */
2694        public DateType getDateElement() { 
2695          if (this.date == null)
2696            if (Configuration.errorOnAutoCreate())
2697              throw new Error("Attempt to auto-create AccidentComponent.date");
2698            else if (Configuration.doAutoCreate())
2699              this.date = new DateType(); // bb
2700          return this.date;
2701        }
2702
2703        public boolean hasDateElement() { 
2704          return this.date != null && !this.date.isEmpty();
2705        }
2706
2707        public boolean hasDate() { 
2708          return this.date != null && !this.date.isEmpty();
2709        }
2710
2711        /**
2712         * @param value {@link #date} (Date of an accident which these services are addressing.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2713         */
2714        public AccidentComponent setDateElement(DateType value) { 
2715          this.date = value;
2716          return this;
2717        }
2718
2719        /**
2720         * @return Date of an accident which these services are addressing.
2721         */
2722        public Date getDate() { 
2723          return this.date == null ? null : this.date.getValue();
2724        }
2725
2726        /**
2727         * @param value Date of an accident which these services are addressing.
2728         */
2729        public AccidentComponent setDate(Date value) { 
2730          if (value == null)
2731            this.date = null;
2732          else {
2733            if (this.date == null)
2734              this.date = new DateType();
2735            this.date.setValue(value);
2736          }
2737          return this;
2738        }
2739
2740        /**
2741         * @return {@link #type} (Type of accident: work, auto, etc.)
2742         */
2743        public CodeableConcept getType() { 
2744          if (this.type == null)
2745            if (Configuration.errorOnAutoCreate())
2746              throw new Error("Attempt to auto-create AccidentComponent.type");
2747            else if (Configuration.doAutoCreate())
2748              this.type = new CodeableConcept(); // cc
2749          return this.type;
2750        }
2751
2752        public boolean hasType() { 
2753          return this.type != null && !this.type.isEmpty();
2754        }
2755
2756        /**
2757         * @param value {@link #type} (Type of accident: work, auto, etc.)
2758         */
2759        public AccidentComponent setType(CodeableConcept value)  { 
2760          this.type = value;
2761          return this;
2762        }
2763
2764        /**
2765         * @return {@link #location} (Where the accident occurred.)
2766         */
2767        public Type getLocation() { 
2768          return this.location;
2769        }
2770
2771        /**
2772         * @return {@link #location} (Where the accident occurred.)
2773         */
2774        public Address getLocationAddress() throws FHIRException { 
2775          if (this.location == null)
2776            return null;
2777          if (!(this.location instanceof Address))
2778            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
2779          return (Address) this.location;
2780        }
2781
2782        public boolean hasLocationAddress() { 
2783          return this != null && this.location instanceof Address;
2784        }
2785
2786        /**
2787         * @return {@link #location} (Where the accident occurred.)
2788         */
2789        public Reference getLocationReference() throws FHIRException { 
2790          if (this.location == null)
2791            return null;
2792          if (!(this.location instanceof Reference))
2793            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
2794          return (Reference) this.location;
2795        }
2796
2797        public boolean hasLocationReference() { 
2798          return this != null && this.location instanceof Reference;
2799        }
2800
2801        public boolean hasLocation() { 
2802          return this.location != null && !this.location.isEmpty();
2803        }
2804
2805        /**
2806         * @param value {@link #location} (Where the accident occurred.)
2807         */
2808        public AccidentComponent setLocation(Type value) throws FHIRFormatError { 
2809          if (value != null && !(value instanceof Address || value instanceof Reference))
2810            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.accident.location[x]: "+value.fhirType());
2811          this.location = value;
2812          return this;
2813        }
2814
2815        protected void listChildren(List<Property> children) {
2816          super.listChildren(children);
2817          children.add(new Property("date", "date", "Date of an accident which these services are addressing.", 0, 1, date));
2818          children.add(new Property("type", "CodeableConcept", "Type of accident: work, auto, etc.", 0, 1, type));
2819          children.add(new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location));
2820        }
2821
2822        @Override
2823        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2824          switch (_hash) {
2825          case 3076014: /*date*/  return new Property("date", "date", "Date of an accident which these services are addressing.", 0, 1, date);
2826          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of accident: work, auto, etc.", 0, 1, type);
2827          case 552316075: /*location[x]*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
2828          case 1901043637: /*location*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
2829          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
2830          case 755866390: /*locationReference*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
2831          default: return super.getNamedProperty(_hash, _name, _checkValid);
2832          }
2833
2834        }
2835
2836      @Override
2837      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2838        switch (hash) {
2839        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
2840        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2841        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
2842        default: return super.getProperty(hash, name, checkValid);
2843        }
2844
2845      }
2846
2847      @Override
2848      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2849        switch (hash) {
2850        case 3076014: // date
2851          this.date = castToDate(value); // DateType
2852          return value;
2853        case 3575610: // type
2854          this.type = castToCodeableConcept(value); // CodeableConcept
2855          return value;
2856        case 1901043637: // location
2857          this.location = castToType(value); // Type
2858          return value;
2859        default: return super.setProperty(hash, name, value);
2860        }
2861
2862      }
2863
2864      @Override
2865      public Base setProperty(String name, Base value) throws FHIRException {
2866        if (name.equals("date")) {
2867          this.date = castToDate(value); // DateType
2868        } else if (name.equals("type")) {
2869          this.type = castToCodeableConcept(value); // CodeableConcept
2870        } else if (name.equals("location[x]")) {
2871          this.location = castToType(value); // Type
2872        } else
2873          return super.setProperty(name, value);
2874        return value;
2875      }
2876
2877      @Override
2878      public Base makeProperty(int hash, String name) throws FHIRException {
2879        switch (hash) {
2880        case 3076014:  return getDateElement();
2881        case 3575610:  return getType(); 
2882        case 552316075:  return getLocation(); 
2883        case 1901043637:  return getLocation(); 
2884        default: return super.makeProperty(hash, name);
2885        }
2886
2887      }
2888
2889      @Override
2890      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2891        switch (hash) {
2892        case 3076014: /*date*/ return new String[] {"date"};
2893        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2894        case 1901043637: /*location*/ return new String[] {"Address", "Reference"};
2895        default: return super.getTypesForProperty(hash, name);
2896        }
2897
2898      }
2899
2900      @Override
2901      public Base addChild(String name) throws FHIRException {
2902        if (name.equals("date")) {
2903          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
2904        }
2905        else if (name.equals("type")) {
2906          this.type = new CodeableConcept();
2907          return this.type;
2908        }
2909        else if (name.equals("locationAddress")) {
2910          this.location = new Address();
2911          return this.location;
2912        }
2913        else if (name.equals("locationReference")) {
2914          this.location = new Reference();
2915          return this.location;
2916        }
2917        else
2918          return super.addChild(name);
2919      }
2920
2921      public AccidentComponent copy() {
2922        AccidentComponent dst = new AccidentComponent();
2923        copyValues(dst);
2924        dst.date = date == null ? null : date.copy();
2925        dst.type = type == null ? null : type.copy();
2926        dst.location = location == null ? null : location.copy();
2927        return dst;
2928      }
2929
2930      @Override
2931      public boolean equalsDeep(Base other_) {
2932        if (!super.equalsDeep(other_))
2933          return false;
2934        if (!(other_ instanceof AccidentComponent))
2935          return false;
2936        AccidentComponent o = (AccidentComponent) other_;
2937        return compareDeep(date, o.date, true) && compareDeep(type, o.type, true) && compareDeep(location, o.location, true)
2938          ;
2939      }
2940
2941      @Override
2942      public boolean equalsShallow(Base other_) {
2943        if (!super.equalsShallow(other_))
2944          return false;
2945        if (!(other_ instanceof AccidentComponent))
2946          return false;
2947        AccidentComponent o = (AccidentComponent) other_;
2948        return compareValues(date, o.date, true);
2949      }
2950
2951      public boolean isEmpty() {
2952        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
2953      }
2954
2955  public String fhirType() {
2956    return "ExplanationOfBenefit.accident";
2957
2958  }
2959
2960  }
2961
2962    @Block()
2963    public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
2964        /**
2965         * A service line number.
2966         */
2967        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2968        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
2969        protected PositiveIntType sequence;
2970
2971        /**
2972         * Careteam applicable for this service or product line.
2973         */
2974        @Child(name = "careTeamLinkId", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2975        @Description(shortDefinition="Applicable careteam members", formalDefinition="Careteam applicable for this service or product line." )
2976        protected List<PositiveIntType> careTeamLinkId;
2977
2978        /**
2979         * Diagnosis applicable for this service or product line.
2980         */
2981        @Child(name = "diagnosisLinkId", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2982        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnosis applicable for this service or product line." )
2983        protected List<PositiveIntType> diagnosisLinkId;
2984
2985        /**
2986         * Procedures applicable for this service or product line.
2987         */
2988        @Child(name = "procedureLinkId", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2989        @Description(shortDefinition="Applicable procedures", formalDefinition="Procedures applicable for this service or product line." )
2990        protected List<PositiveIntType> procedureLinkId;
2991
2992        /**
2993         * Exceptions, special conditions and supporting information pplicable for this service or product line.
2994         */
2995        @Child(name = "informationLinkId", type = {PositiveIntType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2996        @Description(shortDefinition="Applicable exception and supporting information", formalDefinition="Exceptions, special conditions and supporting information pplicable for this service or product line." )
2997        protected List<PositiveIntType> informationLinkId;
2998
2999        /**
3000         * The type of reveneu or cost center providing the product and/or service.
3001         */
3002        @Child(name = "revenue", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
3003        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
3004        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
3005        protected CodeableConcept revenue;
3006
3007        /**
3008         * Health Care Service Type Codes  to identify the classification of service or benefits.
3009         */
3010        @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
3011        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
3012        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
3013        protected CodeableConcept category;
3014
3015        /**
3016         * If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.
3017         */
3018        @Child(name = "service", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
3019        @Description(shortDefinition="Billing Code", formalDefinition="If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'." )
3020        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
3021        protected CodeableConcept service;
3022
3023        /**
3024         * Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.
3025         */
3026        @Child(name = "modifier", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3027        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours." )
3028        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
3029        protected List<CodeableConcept> modifier;
3030
3031        /**
3032         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
3033         */
3034        @Child(name = "programCode", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3035        @Description(shortDefinition="Program specific reason for item inclusion", formalDefinition="For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program." )
3036        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
3037        protected List<CodeableConcept> programCode;
3038
3039        /**
3040         * The date or dates when the enclosed suite of services were performed or completed.
3041         */
3042        @Child(name = "serviced", type = {DateType.class, Period.class}, order=11, min=0, max=1, modifier=false, summary=false)
3043        @Description(shortDefinition="Date or dates of Service", formalDefinition="The date or dates when the enclosed suite of services were performed or completed." )
3044        protected Type serviced;
3045
3046        /**
3047         * Where the service was provided.
3048         */
3049        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
3050        @Description(shortDefinition="Place of service", formalDefinition="Where the service was provided." )
3051        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
3052        protected Type location;
3053
3054        /**
3055         * The number of repetitions of a service or product.
3056         */
3057        @Child(name = "quantity", type = {SimpleQuantity.class}, order=13, min=0, max=1, modifier=false, summary=false)
3058        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
3059        protected SimpleQuantity quantity;
3060
3061        /**
3062         * If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.
3063         */
3064        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
3065        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group." )
3066        protected Money unitPrice;
3067
3068        /**
3069         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3070         */
3071        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=false)
3072        @Description(shortDefinition="Price scaling factor", formalDefinition="A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount." )
3073        protected DecimalType factor;
3074
3075        /**
3076         * The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
3077         */
3078        @Child(name = "net", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
3079        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
3080        protected Money net;
3081
3082        /**
3083         * List of Unique Device Identifiers associated with this line item.
3084         */
3085        @Child(name = "udi", type = {Device.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3086        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
3087        protected List<Reference> udi;
3088        /**
3089         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
3090         */
3091        protected List<Device> udiTarget;
3092
3093
3094        /**
3095         * Physical service site on the patient (limb, tooth, etc).
3096         */
3097        @Child(name = "bodySite", type = {CodeableConcept.class}, order=18, min=0, max=1, modifier=false, summary=false)
3098        @Description(shortDefinition="Service Location", formalDefinition="Physical service site on the patient (limb, tooth, etc)." )
3099        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
3100        protected CodeableConcept bodySite;
3101
3102        /**
3103         * A region or surface of the site, eg. limb region or tooth surface(s).
3104         */
3105        @Child(name = "subSite", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3106        @Description(shortDefinition="Service Sub-location", formalDefinition="A region or surface of the site, eg. limb region or tooth surface(s)." )
3107        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
3108        protected List<CodeableConcept> subSite;
3109
3110        /**
3111         * A billed item may include goods or services provided in multiple encounters.
3112         */
3113        @Child(name = "encounter", type = {Encounter.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3114        @Description(shortDefinition="Encounters related to this billed item", formalDefinition="A billed item may include goods or services provided in multiple encounters." )
3115        protected List<Reference> encounter;
3116        /**
3117         * The actual objects that are the target of the reference (A billed item may include goods or services provided in multiple encounters.)
3118         */
3119        protected List<Encounter> encounterTarget;
3120
3121
3122        /**
3123         * A list of note references to the notes provided below.
3124         */
3125        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3126        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
3127        protected List<PositiveIntType> noteNumber;
3128
3129        /**
3130         * The adjudications results.
3131         */
3132        @Child(name = "adjudication", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3133        @Description(shortDefinition="Adjudication details", formalDefinition="The adjudications results." )
3134        protected List<AdjudicationComponent> adjudication;
3135
3136        /**
3137         * Second tier of goods and services.
3138         */
3139        @Child(name = "detail", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3140        @Description(shortDefinition="Additional items", formalDefinition="Second tier of goods and services." )
3141        protected List<DetailComponent> detail;
3142
3143        private static final long serialVersionUID = -1567825229L;
3144
3145    /**
3146     * Constructor
3147     */
3148      public ItemComponent() {
3149        super();
3150      }
3151
3152    /**
3153     * Constructor
3154     */
3155      public ItemComponent(PositiveIntType sequence) {
3156        super();
3157        this.sequence = sequence;
3158      }
3159
3160        /**
3161         * @return {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
3162         */
3163        public PositiveIntType getSequenceElement() { 
3164          if (this.sequence == null)
3165            if (Configuration.errorOnAutoCreate())
3166              throw new Error("Attempt to auto-create ItemComponent.sequence");
3167            else if (Configuration.doAutoCreate())
3168              this.sequence = new PositiveIntType(); // bb
3169          return this.sequence;
3170        }
3171
3172        public boolean hasSequenceElement() { 
3173          return this.sequence != null && !this.sequence.isEmpty();
3174        }
3175
3176        public boolean hasSequence() { 
3177          return this.sequence != null && !this.sequence.isEmpty();
3178        }
3179
3180        /**
3181         * @param value {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
3182         */
3183        public ItemComponent setSequenceElement(PositiveIntType value) { 
3184          this.sequence = value;
3185          return this;
3186        }
3187
3188        /**
3189         * @return A service line number.
3190         */
3191        public int getSequence() { 
3192          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3193        }
3194
3195        /**
3196         * @param value A service line number.
3197         */
3198        public ItemComponent setSequence(int value) { 
3199            if (this.sequence == null)
3200              this.sequence = new PositiveIntType();
3201            this.sequence.setValue(value);
3202          return this;
3203        }
3204
3205        /**
3206         * @return {@link #careTeamLinkId} (Careteam applicable for this service or product line.)
3207         */
3208        public List<PositiveIntType> getCareTeamLinkId() { 
3209          if (this.careTeamLinkId == null)
3210            this.careTeamLinkId = new ArrayList<PositiveIntType>();
3211          return this.careTeamLinkId;
3212        }
3213
3214        /**
3215         * @return Returns a reference to <code>this</code> for easy method chaining
3216         */
3217        public ItemComponent setCareTeamLinkId(List<PositiveIntType> theCareTeamLinkId) { 
3218          this.careTeamLinkId = theCareTeamLinkId;
3219          return this;
3220        }
3221
3222        public boolean hasCareTeamLinkId() { 
3223          if (this.careTeamLinkId == null)
3224            return false;
3225          for (PositiveIntType item : this.careTeamLinkId)
3226            if (!item.isEmpty())
3227              return true;
3228          return false;
3229        }
3230
3231        /**
3232         * @return {@link #careTeamLinkId} (Careteam applicable for this service or product line.)
3233         */
3234        public PositiveIntType addCareTeamLinkIdElement() {//2 
3235          PositiveIntType t = new PositiveIntType();
3236          if (this.careTeamLinkId == null)
3237            this.careTeamLinkId = new ArrayList<PositiveIntType>();
3238          this.careTeamLinkId.add(t);
3239          return t;
3240        }
3241
3242        /**
3243         * @param value {@link #careTeamLinkId} (Careteam applicable for this service or product line.)
3244         */
3245        public ItemComponent addCareTeamLinkId(int value) { //1
3246          PositiveIntType t = new PositiveIntType();
3247          t.setValue(value);
3248          if (this.careTeamLinkId == null)
3249            this.careTeamLinkId = new ArrayList<PositiveIntType>();
3250          this.careTeamLinkId.add(t);
3251          return this;
3252        }
3253
3254        /**
3255         * @param value {@link #careTeamLinkId} (Careteam applicable for this service or product line.)
3256         */
3257        public boolean hasCareTeamLinkId(int value) { 
3258          if (this.careTeamLinkId == null)
3259            return false;
3260          for (PositiveIntType v : this.careTeamLinkId)
3261            if (v.getValue().equals(value)) // positiveInt
3262              return true;
3263          return false;
3264        }
3265
3266        /**
3267         * @return {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
3268         */
3269        public List<PositiveIntType> getDiagnosisLinkId() { 
3270          if (this.diagnosisLinkId == null)
3271            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
3272          return this.diagnosisLinkId;
3273        }
3274
3275        /**
3276         * @return Returns a reference to <code>this</code> for easy method chaining
3277         */
3278        public ItemComponent setDiagnosisLinkId(List<PositiveIntType> theDiagnosisLinkId) { 
3279          this.diagnosisLinkId = theDiagnosisLinkId;
3280          return this;
3281        }
3282
3283        public boolean hasDiagnosisLinkId() { 
3284          if (this.diagnosisLinkId == null)
3285            return false;
3286          for (PositiveIntType item : this.diagnosisLinkId)
3287            if (!item.isEmpty())
3288              return true;
3289          return false;
3290        }
3291
3292        /**
3293         * @return {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
3294         */
3295        public PositiveIntType addDiagnosisLinkIdElement() {//2 
3296          PositiveIntType t = new PositiveIntType();
3297          if (this.diagnosisLinkId == null)
3298            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
3299          this.diagnosisLinkId.add(t);
3300          return t;
3301        }
3302
3303        /**
3304         * @param value {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
3305         */
3306        public ItemComponent addDiagnosisLinkId(int value) { //1
3307          PositiveIntType t = new PositiveIntType();
3308          t.setValue(value);
3309          if (this.diagnosisLinkId == null)
3310            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
3311          this.diagnosisLinkId.add(t);
3312          return this;
3313        }
3314
3315        /**
3316         * @param value {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
3317         */
3318        public boolean hasDiagnosisLinkId(int value) { 
3319          if (this.diagnosisLinkId == null)
3320            return false;
3321          for (PositiveIntType v : this.diagnosisLinkId)
3322            if (v.getValue().equals(value)) // positiveInt
3323              return true;
3324          return false;
3325        }
3326
3327        /**
3328         * @return {@link #procedureLinkId} (Procedures applicable for this service or product line.)
3329         */
3330        public List<PositiveIntType> getProcedureLinkId() { 
3331          if (this.procedureLinkId == null)
3332            this.procedureLinkId = new ArrayList<PositiveIntType>();
3333          return this.procedureLinkId;
3334        }
3335
3336        /**
3337         * @return Returns a reference to <code>this</code> for easy method chaining
3338         */
3339        public ItemComponent setProcedureLinkId(List<PositiveIntType> theProcedureLinkId) { 
3340          this.procedureLinkId = theProcedureLinkId;
3341          return this;
3342        }
3343
3344        public boolean hasProcedureLinkId() { 
3345          if (this.procedureLinkId == null)
3346            return false;
3347          for (PositiveIntType item : this.procedureLinkId)
3348            if (!item.isEmpty())
3349              return true;
3350          return false;
3351        }
3352
3353        /**
3354         * @return {@link #procedureLinkId} (Procedures applicable for this service or product line.)
3355         */
3356        public PositiveIntType addProcedureLinkIdElement() {//2 
3357          PositiveIntType t = new PositiveIntType();
3358          if (this.procedureLinkId == null)
3359            this.procedureLinkId = new ArrayList<PositiveIntType>();
3360          this.procedureLinkId.add(t);
3361          return t;
3362        }
3363
3364        /**
3365         * @param value {@link #procedureLinkId} (Procedures applicable for this service or product line.)
3366         */
3367        public ItemComponent addProcedureLinkId(int value) { //1
3368          PositiveIntType t = new PositiveIntType();
3369          t.setValue(value);
3370          if (this.procedureLinkId == null)
3371            this.procedureLinkId = new ArrayList<PositiveIntType>();
3372          this.procedureLinkId.add(t);
3373          return this;
3374        }
3375
3376        /**
3377         * @param value {@link #procedureLinkId} (Procedures applicable for this service or product line.)
3378         */
3379        public boolean hasProcedureLinkId(int value) { 
3380          if (this.procedureLinkId == null)
3381            return false;
3382          for (PositiveIntType v : this.procedureLinkId)
3383            if (v.getValue().equals(value)) // positiveInt
3384              return true;
3385          return false;
3386        }
3387
3388        /**
3389         * @return {@link #informationLinkId} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3390         */
3391        public List<PositiveIntType> getInformationLinkId() { 
3392          if (this.informationLinkId == null)
3393            this.informationLinkId = new ArrayList<PositiveIntType>();
3394          return this.informationLinkId;
3395        }
3396
3397        /**
3398         * @return Returns a reference to <code>this</code> for easy method chaining
3399         */
3400        public ItemComponent setInformationLinkId(List<PositiveIntType> theInformationLinkId) { 
3401          this.informationLinkId = theInformationLinkId;
3402          return this;
3403        }
3404
3405        public boolean hasInformationLinkId() { 
3406          if (this.informationLinkId == null)
3407            return false;
3408          for (PositiveIntType item : this.informationLinkId)
3409            if (!item.isEmpty())
3410              return true;
3411          return false;
3412        }
3413
3414        /**
3415         * @return {@link #informationLinkId} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3416         */
3417        public PositiveIntType addInformationLinkIdElement() {//2 
3418          PositiveIntType t = new PositiveIntType();
3419          if (this.informationLinkId == null)
3420            this.informationLinkId = new ArrayList<PositiveIntType>();
3421          this.informationLinkId.add(t);
3422          return t;
3423        }
3424
3425        /**
3426         * @param value {@link #informationLinkId} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3427         */
3428        public ItemComponent addInformationLinkId(int value) { //1
3429          PositiveIntType t = new PositiveIntType();
3430          t.setValue(value);
3431          if (this.informationLinkId == null)
3432            this.informationLinkId = new ArrayList<PositiveIntType>();
3433          this.informationLinkId.add(t);
3434          return this;
3435        }
3436
3437        /**
3438         * @param value {@link #informationLinkId} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3439         */
3440        public boolean hasInformationLinkId(int value) { 
3441          if (this.informationLinkId == null)
3442            return false;
3443          for (PositiveIntType v : this.informationLinkId)
3444            if (v.getValue().equals(value)) // positiveInt
3445              return true;
3446          return false;
3447        }
3448
3449        /**
3450         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
3451         */
3452        public CodeableConcept getRevenue() { 
3453          if (this.revenue == null)
3454            if (Configuration.errorOnAutoCreate())
3455              throw new Error("Attempt to auto-create ItemComponent.revenue");
3456            else if (Configuration.doAutoCreate())
3457              this.revenue = new CodeableConcept(); // cc
3458          return this.revenue;
3459        }
3460
3461        public boolean hasRevenue() { 
3462          return this.revenue != null && !this.revenue.isEmpty();
3463        }
3464
3465        /**
3466         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
3467         */
3468        public ItemComponent setRevenue(CodeableConcept value)  { 
3469          this.revenue = value;
3470          return this;
3471        }
3472
3473        /**
3474         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
3475         */
3476        public CodeableConcept getCategory() { 
3477          if (this.category == null)
3478            if (Configuration.errorOnAutoCreate())
3479              throw new Error("Attempt to auto-create ItemComponent.category");
3480            else if (Configuration.doAutoCreate())
3481              this.category = new CodeableConcept(); // cc
3482          return this.category;
3483        }
3484
3485        public boolean hasCategory() { 
3486          return this.category != null && !this.category.isEmpty();
3487        }
3488
3489        /**
3490         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
3491         */
3492        public ItemComponent setCategory(CodeableConcept value)  { 
3493          this.category = value;
3494          return this;
3495        }
3496
3497        /**
3498         * @return {@link #service} (If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.)
3499         */
3500        public CodeableConcept getService() { 
3501          if (this.service == null)
3502            if (Configuration.errorOnAutoCreate())
3503              throw new Error("Attempt to auto-create ItemComponent.service");
3504            else if (Configuration.doAutoCreate())
3505              this.service = new CodeableConcept(); // cc
3506          return this.service;
3507        }
3508
3509        public boolean hasService() { 
3510          return this.service != null && !this.service.isEmpty();
3511        }
3512
3513        /**
3514         * @param value {@link #service} (If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.)
3515         */
3516        public ItemComponent setService(CodeableConcept value)  { 
3517          this.service = value;
3518          return this;
3519        }
3520
3521        /**
3522         * @return {@link #modifier} (Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.)
3523         */
3524        public List<CodeableConcept> getModifier() { 
3525          if (this.modifier == null)
3526            this.modifier = new ArrayList<CodeableConcept>();
3527          return this.modifier;
3528        }
3529
3530        /**
3531         * @return Returns a reference to <code>this</code> for easy method chaining
3532         */
3533        public ItemComponent setModifier(List<CodeableConcept> theModifier) { 
3534          this.modifier = theModifier;
3535          return this;
3536        }
3537
3538        public boolean hasModifier() { 
3539          if (this.modifier == null)
3540            return false;
3541          for (CodeableConcept item : this.modifier)
3542            if (!item.isEmpty())
3543              return true;
3544          return false;
3545        }
3546
3547        public CodeableConcept addModifier() { //3
3548          CodeableConcept t = new CodeableConcept();
3549          if (this.modifier == null)
3550            this.modifier = new ArrayList<CodeableConcept>();
3551          this.modifier.add(t);
3552          return t;
3553        }
3554
3555        public ItemComponent addModifier(CodeableConcept t) { //3
3556          if (t == null)
3557            return this;
3558          if (this.modifier == null)
3559            this.modifier = new ArrayList<CodeableConcept>();
3560          this.modifier.add(t);
3561          return this;
3562        }
3563
3564        /**
3565         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
3566         */
3567        public CodeableConcept getModifierFirstRep() { 
3568          if (getModifier().isEmpty()) {
3569            addModifier();
3570          }
3571          return getModifier().get(0);
3572        }
3573
3574        /**
3575         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
3576         */
3577        public List<CodeableConcept> getProgramCode() { 
3578          if (this.programCode == null)
3579            this.programCode = new ArrayList<CodeableConcept>();
3580          return this.programCode;
3581        }
3582
3583        /**
3584         * @return Returns a reference to <code>this</code> for easy method chaining
3585         */
3586        public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
3587          this.programCode = theProgramCode;
3588          return this;
3589        }
3590
3591        public boolean hasProgramCode() { 
3592          if (this.programCode == null)
3593            return false;
3594          for (CodeableConcept item : this.programCode)
3595            if (!item.isEmpty())
3596              return true;
3597          return false;
3598        }
3599
3600        public CodeableConcept addProgramCode() { //3
3601          CodeableConcept t = new CodeableConcept();
3602          if (this.programCode == null)
3603            this.programCode = new ArrayList<CodeableConcept>();
3604          this.programCode.add(t);
3605          return t;
3606        }
3607
3608        public ItemComponent addProgramCode(CodeableConcept t) { //3
3609          if (t == null)
3610            return this;
3611          if (this.programCode == null)
3612            this.programCode = new ArrayList<CodeableConcept>();
3613          this.programCode.add(t);
3614          return this;
3615        }
3616
3617        /**
3618         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
3619         */
3620        public CodeableConcept getProgramCodeFirstRep() { 
3621          if (getProgramCode().isEmpty()) {
3622            addProgramCode();
3623          }
3624          return getProgramCode().get(0);
3625        }
3626
3627        /**
3628         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3629         */
3630        public Type getServiced() { 
3631          return this.serviced;
3632        }
3633
3634        /**
3635         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3636         */
3637        public DateType getServicedDateType() throws FHIRException { 
3638          if (this.serviced == null)
3639            return null;
3640          if (!(this.serviced instanceof DateType))
3641            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
3642          return (DateType) this.serviced;
3643        }
3644
3645        public boolean hasServicedDateType() { 
3646          return this != null && this.serviced instanceof DateType;
3647        }
3648
3649        /**
3650         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3651         */
3652        public Period getServicedPeriod() throws FHIRException { 
3653          if (this.serviced == null)
3654            return null;
3655          if (!(this.serviced instanceof Period))
3656            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
3657          return (Period) this.serviced;
3658        }
3659
3660        public boolean hasServicedPeriod() { 
3661          return this != null && this.serviced instanceof Period;
3662        }
3663
3664        public boolean hasServiced() { 
3665          return this.serviced != null && !this.serviced.isEmpty();
3666        }
3667
3668        /**
3669         * @param value {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3670         */
3671        public ItemComponent setServiced(Type value) throws FHIRFormatError { 
3672          if (value != null && !(value instanceof DateType || value instanceof Period))
3673            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.item.serviced[x]: "+value.fhirType());
3674          this.serviced = value;
3675          return this;
3676        }
3677
3678        /**
3679         * @return {@link #location} (Where the service was provided.)
3680         */
3681        public Type getLocation() { 
3682          return this.location;
3683        }
3684
3685        /**
3686         * @return {@link #location} (Where the service was provided.)
3687         */
3688        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
3689          if (this.location == null)
3690            return null;
3691          if (!(this.location instanceof CodeableConcept))
3692            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
3693          return (CodeableConcept) this.location;
3694        }
3695
3696        public boolean hasLocationCodeableConcept() { 
3697          return this != null && this.location instanceof CodeableConcept;
3698        }
3699
3700        /**
3701         * @return {@link #location} (Where the service was provided.)
3702         */
3703        public Address getLocationAddress() throws FHIRException { 
3704          if (this.location == null)
3705            return null;
3706          if (!(this.location instanceof Address))
3707            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3708          return (Address) this.location;
3709        }
3710
3711        public boolean hasLocationAddress() { 
3712          return this != null && this.location instanceof Address;
3713        }
3714
3715        /**
3716         * @return {@link #location} (Where the service was provided.)
3717         */
3718        public Reference getLocationReference() throws FHIRException { 
3719          if (this.location == null)
3720            return null;
3721          if (!(this.location instanceof Reference))
3722            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3723          return (Reference) this.location;
3724        }
3725
3726        public boolean hasLocationReference() { 
3727          return this != null && this.location instanceof Reference;
3728        }
3729
3730        public boolean hasLocation() { 
3731          return this.location != null && !this.location.isEmpty();
3732        }
3733
3734        /**
3735         * @param value {@link #location} (Where the service was provided.)
3736         */
3737        public ItemComponent setLocation(Type value) throws FHIRFormatError { 
3738          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
3739            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.item.location[x]: "+value.fhirType());
3740          this.location = value;
3741          return this;
3742        }
3743
3744        /**
3745         * @return {@link #quantity} (The number of repetitions of a service or product.)
3746         */
3747        public SimpleQuantity getQuantity() { 
3748          if (this.quantity == null)
3749            if (Configuration.errorOnAutoCreate())
3750              throw new Error("Attempt to auto-create ItemComponent.quantity");
3751            else if (Configuration.doAutoCreate())
3752              this.quantity = new SimpleQuantity(); // cc
3753          return this.quantity;
3754        }
3755
3756        public boolean hasQuantity() { 
3757          return this.quantity != null && !this.quantity.isEmpty();
3758        }
3759
3760        /**
3761         * @param value {@link #quantity} (The number of repetitions of a service or product.)
3762         */
3763        public ItemComponent setQuantity(SimpleQuantity value)  { 
3764          this.quantity = value;
3765          return this;
3766        }
3767
3768        /**
3769         * @return {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
3770         */
3771        public Money getUnitPrice() { 
3772          if (this.unitPrice == null)
3773            if (Configuration.errorOnAutoCreate())
3774              throw new Error("Attempt to auto-create ItemComponent.unitPrice");
3775            else if (Configuration.doAutoCreate())
3776              this.unitPrice = new Money(); // cc
3777          return this.unitPrice;
3778        }
3779
3780        public boolean hasUnitPrice() { 
3781          return this.unitPrice != null && !this.unitPrice.isEmpty();
3782        }
3783
3784        /**
3785         * @param value {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
3786         */
3787        public ItemComponent setUnitPrice(Money value)  { 
3788          this.unitPrice = value;
3789          return this;
3790        }
3791
3792        /**
3793         * @return {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
3794         */
3795        public DecimalType getFactorElement() { 
3796          if (this.factor == null)
3797            if (Configuration.errorOnAutoCreate())
3798              throw new Error("Attempt to auto-create ItemComponent.factor");
3799            else if (Configuration.doAutoCreate())
3800              this.factor = new DecimalType(); // bb
3801          return this.factor;
3802        }
3803
3804        public boolean hasFactorElement() { 
3805          return this.factor != null && !this.factor.isEmpty();
3806        }
3807
3808        public boolean hasFactor() { 
3809          return this.factor != null && !this.factor.isEmpty();
3810        }
3811
3812        /**
3813         * @param value {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
3814         */
3815        public ItemComponent setFactorElement(DecimalType value) { 
3816          this.factor = value;
3817          return this;
3818        }
3819
3820        /**
3821         * @return A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3822         */
3823        public BigDecimal getFactor() { 
3824          return this.factor == null ? null : this.factor.getValue();
3825        }
3826
3827        /**
3828         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3829         */
3830        public ItemComponent setFactor(BigDecimal value) { 
3831          if (value == null)
3832            this.factor = null;
3833          else {
3834            if (this.factor == null)
3835              this.factor = new DecimalType();
3836            this.factor.setValue(value);
3837          }
3838          return this;
3839        }
3840
3841        /**
3842         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3843         */
3844        public ItemComponent setFactor(long value) { 
3845              this.factor = new DecimalType();
3846            this.factor.setValue(value);
3847          return this;
3848        }
3849
3850        /**
3851         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3852         */
3853        public ItemComponent setFactor(double value) { 
3854              this.factor = new DecimalType();
3855            this.factor.setValue(value);
3856          return this;
3857        }
3858
3859        /**
3860         * @return {@link #net} (The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
3861         */
3862        public Money getNet() { 
3863          if (this.net == null)
3864            if (Configuration.errorOnAutoCreate())
3865              throw new Error("Attempt to auto-create ItemComponent.net");
3866            else if (Configuration.doAutoCreate())
3867              this.net = new Money(); // cc
3868          return this.net;
3869        }
3870
3871        public boolean hasNet() { 
3872          return this.net != null && !this.net.isEmpty();
3873        }
3874
3875        /**
3876         * @param value {@link #net} (The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
3877         */
3878        public ItemComponent setNet(Money value)  { 
3879          this.net = value;
3880          return this;
3881        }
3882
3883        /**
3884         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
3885         */
3886        public List<Reference> getUdi() { 
3887          if (this.udi == null)
3888            this.udi = new ArrayList<Reference>();
3889          return this.udi;
3890        }
3891
3892        /**
3893         * @return Returns a reference to <code>this</code> for easy method chaining
3894         */
3895        public ItemComponent setUdi(List<Reference> theUdi) { 
3896          this.udi = theUdi;
3897          return this;
3898        }
3899
3900        public boolean hasUdi() { 
3901          if (this.udi == null)
3902            return false;
3903          for (Reference item : this.udi)
3904            if (!item.isEmpty())
3905              return true;
3906          return false;
3907        }
3908
3909        public Reference addUdi() { //3
3910          Reference t = new Reference();
3911          if (this.udi == null)
3912            this.udi = new ArrayList<Reference>();
3913          this.udi.add(t);
3914          return t;
3915        }
3916
3917        public ItemComponent addUdi(Reference t) { //3
3918          if (t == null)
3919            return this;
3920          if (this.udi == null)
3921            this.udi = new ArrayList<Reference>();
3922          this.udi.add(t);
3923          return this;
3924        }
3925
3926        /**
3927         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
3928         */
3929        public Reference getUdiFirstRep() { 
3930          if (getUdi().isEmpty()) {
3931            addUdi();
3932          }
3933          return getUdi().get(0);
3934        }
3935
3936        /**
3937         * @deprecated Use Reference#setResource(IBaseResource) instead
3938         */
3939        @Deprecated
3940        public List<Device> getUdiTarget() { 
3941          if (this.udiTarget == null)
3942            this.udiTarget = new ArrayList<Device>();
3943          return this.udiTarget;
3944        }
3945
3946        /**
3947         * @deprecated Use Reference#setResource(IBaseResource) instead
3948         */
3949        @Deprecated
3950        public Device addUdiTarget() { 
3951          Device r = new Device();
3952          if (this.udiTarget == null)
3953            this.udiTarget = new ArrayList<Device>();
3954          this.udiTarget.add(r);
3955          return r;
3956        }
3957
3958        /**
3959         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc).)
3960         */
3961        public CodeableConcept getBodySite() { 
3962          if (this.bodySite == null)
3963            if (Configuration.errorOnAutoCreate())
3964              throw new Error("Attempt to auto-create ItemComponent.bodySite");
3965            else if (Configuration.doAutoCreate())
3966              this.bodySite = new CodeableConcept(); // cc
3967          return this.bodySite;
3968        }
3969
3970        public boolean hasBodySite() { 
3971          return this.bodySite != null && !this.bodySite.isEmpty();
3972        }
3973
3974        /**
3975         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc).)
3976         */
3977        public ItemComponent setBodySite(CodeableConcept value)  { 
3978          this.bodySite = value;
3979          return this;
3980        }
3981
3982        /**
3983         * @return {@link #subSite} (A region or surface of the site, eg. limb region or tooth surface(s).)
3984         */
3985        public List<CodeableConcept> getSubSite() { 
3986          if (this.subSite == null)
3987            this.subSite = new ArrayList<CodeableConcept>();
3988          return this.subSite;
3989        }
3990
3991        /**
3992         * @return Returns a reference to <code>this</code> for easy method chaining
3993         */
3994        public ItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
3995          this.subSite = theSubSite;
3996          return this;
3997        }
3998
3999        public boolean hasSubSite() { 
4000          if (this.subSite == null)
4001            return false;
4002          for (CodeableConcept item : this.subSite)
4003            if (!item.isEmpty())
4004              return true;
4005          return false;
4006        }
4007
4008        public CodeableConcept addSubSite() { //3
4009          CodeableConcept t = new CodeableConcept();
4010          if (this.subSite == null)
4011            this.subSite = new ArrayList<CodeableConcept>();
4012          this.subSite.add(t);
4013          return t;
4014        }
4015
4016        public ItemComponent addSubSite(CodeableConcept t) { //3
4017          if (t == null)
4018            return this;
4019          if (this.subSite == null)
4020            this.subSite = new ArrayList<CodeableConcept>();
4021          this.subSite.add(t);
4022          return this;
4023        }
4024
4025        /**
4026         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist
4027         */
4028        public CodeableConcept getSubSiteFirstRep() { 
4029          if (getSubSite().isEmpty()) {
4030            addSubSite();
4031          }
4032          return getSubSite().get(0);
4033        }
4034
4035        /**
4036         * @return {@link #encounter} (A billed item may include goods or services provided in multiple encounters.)
4037         */
4038        public List<Reference> getEncounter() { 
4039          if (this.encounter == null)
4040            this.encounter = new ArrayList<Reference>();
4041          return this.encounter;
4042        }
4043
4044        /**
4045         * @return Returns a reference to <code>this</code> for easy method chaining
4046         */
4047        public ItemComponent setEncounter(List<Reference> theEncounter) { 
4048          this.encounter = theEncounter;
4049          return this;
4050        }
4051
4052        public boolean hasEncounter() { 
4053          if (this.encounter == null)
4054            return false;
4055          for (Reference item : this.encounter)
4056            if (!item.isEmpty())
4057              return true;
4058          return false;
4059        }
4060
4061        public Reference addEncounter() { //3
4062          Reference t = new Reference();
4063          if (this.encounter == null)
4064            this.encounter = new ArrayList<Reference>();
4065          this.encounter.add(t);
4066          return t;
4067        }
4068
4069        public ItemComponent addEncounter(Reference t) { //3
4070          if (t == null)
4071            return this;
4072          if (this.encounter == null)
4073            this.encounter = new ArrayList<Reference>();
4074          this.encounter.add(t);
4075          return this;
4076        }
4077
4078        /**
4079         * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist
4080         */
4081        public Reference getEncounterFirstRep() { 
4082          if (getEncounter().isEmpty()) {
4083            addEncounter();
4084          }
4085          return getEncounter().get(0);
4086        }
4087
4088        /**
4089         * @deprecated Use Reference#setResource(IBaseResource) instead
4090         */
4091        @Deprecated
4092        public List<Encounter> getEncounterTarget() { 
4093          if (this.encounterTarget == null)
4094            this.encounterTarget = new ArrayList<Encounter>();
4095          return this.encounterTarget;
4096        }
4097
4098        /**
4099         * @deprecated Use Reference#setResource(IBaseResource) instead
4100         */
4101        @Deprecated
4102        public Encounter addEncounterTarget() { 
4103          Encounter r = new Encounter();
4104          if (this.encounterTarget == null)
4105            this.encounterTarget = new ArrayList<Encounter>();
4106          this.encounterTarget.add(r);
4107          return r;
4108        }
4109
4110        /**
4111         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
4112         */
4113        public List<PositiveIntType> getNoteNumber() { 
4114          if (this.noteNumber == null)
4115            this.noteNumber = new ArrayList<PositiveIntType>();
4116          return this.noteNumber;
4117        }
4118
4119        /**
4120         * @return Returns a reference to <code>this</code> for easy method chaining
4121         */
4122        public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
4123          this.noteNumber = theNoteNumber;
4124          return this;
4125        }
4126
4127        public boolean hasNoteNumber() { 
4128          if (this.noteNumber == null)
4129            return false;
4130          for (PositiveIntType item : this.noteNumber)
4131            if (!item.isEmpty())
4132              return true;
4133          return false;
4134        }
4135
4136        /**
4137         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
4138         */
4139        public PositiveIntType addNoteNumberElement() {//2 
4140          PositiveIntType t = new PositiveIntType();
4141          if (this.noteNumber == null)
4142            this.noteNumber = new ArrayList<PositiveIntType>();
4143          this.noteNumber.add(t);
4144          return t;
4145        }
4146
4147        /**
4148         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
4149         */
4150        public ItemComponent addNoteNumber(int value) { //1
4151          PositiveIntType t = new PositiveIntType();
4152          t.setValue(value);
4153          if (this.noteNumber == null)
4154            this.noteNumber = new ArrayList<PositiveIntType>();
4155          this.noteNumber.add(t);
4156          return this;
4157        }
4158
4159        /**
4160         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
4161         */
4162        public boolean hasNoteNumber(int value) { 
4163          if (this.noteNumber == null)
4164            return false;
4165          for (PositiveIntType v : this.noteNumber)
4166            if (v.getValue().equals(value)) // positiveInt
4167              return true;
4168          return false;
4169        }
4170
4171        /**
4172         * @return {@link #adjudication} (The adjudications results.)
4173         */
4174        public List<AdjudicationComponent> getAdjudication() { 
4175          if (this.adjudication == null)
4176            this.adjudication = new ArrayList<AdjudicationComponent>();
4177          return this.adjudication;
4178        }
4179
4180        /**
4181         * @return Returns a reference to <code>this</code> for easy method chaining
4182         */
4183        public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
4184          this.adjudication = theAdjudication;
4185          return this;
4186        }
4187
4188        public boolean hasAdjudication() { 
4189          if (this.adjudication == null)
4190            return false;
4191          for (AdjudicationComponent item : this.adjudication)
4192            if (!item.isEmpty())
4193              return true;
4194          return false;
4195        }
4196
4197        public AdjudicationComponent addAdjudication() { //3
4198          AdjudicationComponent t = new AdjudicationComponent();
4199          if (this.adjudication == null)
4200            this.adjudication = new ArrayList<AdjudicationComponent>();
4201          this.adjudication.add(t);
4202          return t;
4203        }
4204
4205        public ItemComponent addAdjudication(AdjudicationComponent t) { //3
4206          if (t == null)
4207            return this;
4208          if (this.adjudication == null)
4209            this.adjudication = new ArrayList<AdjudicationComponent>();
4210          this.adjudication.add(t);
4211          return this;
4212        }
4213
4214        /**
4215         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
4216         */
4217        public AdjudicationComponent getAdjudicationFirstRep() { 
4218          if (getAdjudication().isEmpty()) {
4219            addAdjudication();
4220          }
4221          return getAdjudication().get(0);
4222        }
4223
4224        /**
4225         * @return {@link #detail} (Second tier of goods and services.)
4226         */
4227        public List<DetailComponent> getDetail() { 
4228          if (this.detail == null)
4229            this.detail = new ArrayList<DetailComponent>();
4230          return this.detail;
4231        }
4232
4233        /**
4234         * @return Returns a reference to <code>this</code> for easy method chaining
4235         */
4236        public ItemComponent setDetail(List<DetailComponent> theDetail) { 
4237          this.detail = theDetail;
4238          return this;
4239        }
4240
4241        public boolean hasDetail() { 
4242          if (this.detail == null)
4243            return false;
4244          for (DetailComponent item : this.detail)
4245            if (!item.isEmpty())
4246              return true;
4247          return false;
4248        }
4249
4250        public DetailComponent addDetail() { //3
4251          DetailComponent t = new DetailComponent();
4252          if (this.detail == null)
4253            this.detail = new ArrayList<DetailComponent>();
4254          this.detail.add(t);
4255          return t;
4256        }
4257
4258        public ItemComponent addDetail(DetailComponent t) { //3
4259          if (t == null)
4260            return this;
4261          if (this.detail == null)
4262            this.detail = new ArrayList<DetailComponent>();
4263          this.detail.add(t);
4264          return this;
4265        }
4266
4267        /**
4268         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
4269         */
4270        public DetailComponent getDetailFirstRep() { 
4271          if (getDetail().isEmpty()) {
4272            addDetail();
4273          }
4274          return getDetail().get(0);
4275        }
4276
4277        protected void listChildren(List<Property> children) {
4278          super.listChildren(children);
4279          children.add(new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence));
4280          children.add(new Property("careTeamLinkId", "positiveInt", "Careteam applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, careTeamLinkId));
4281          children.add(new Property("diagnosisLinkId", "positiveInt", "Diagnosis applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, diagnosisLinkId));
4282          children.add(new Property("procedureLinkId", "positiveInt", "Procedures applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, procedureLinkId));
4283          children.add(new Property("informationLinkId", "positiveInt", "Exceptions, special conditions and supporting information pplicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, informationLinkId));
4284          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
4285          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
4286          children.add(new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, service));
4287          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
4288          children.add(new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode));
4289          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));
4290          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location));
4291          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
4292          children.add(new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice));
4293          children.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor));
4294          children.add(new Property("net", "Money", "The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net));
4295          children.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
4296          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc).", 0, 1, bodySite));
4297          children.add(new Property("subSite", "CodeableConcept", "A region or surface of the site, eg. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite));
4298          children.add(new Property("encounter", "Reference(Encounter)", "A billed item may include goods or services provided in multiple encounters.", 0, java.lang.Integer.MAX_VALUE, encounter));
4299          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
4300          children.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
4301          children.add(new Property("detail", "", "Second tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
4302        }
4303
4304        @Override
4305        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4306          switch (_hash) {
4307          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence);
4308          case -186757789: /*careTeamLinkId*/  return new Property("careTeamLinkId", "positiveInt", "Careteam applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, careTeamLinkId);
4309          case -1659207418: /*diagnosisLinkId*/  return new Property("diagnosisLinkId", "positiveInt", "Diagnosis applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, diagnosisLinkId);
4310          case -532846744: /*procedureLinkId*/  return new Property("procedureLinkId", "positiveInt", "Procedures applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, procedureLinkId);
4311          case 1965585153: /*informationLinkId*/  return new Property("informationLinkId", "positiveInt", "Exceptions, special conditions and supporting information pplicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, informationLinkId);
4312          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
4313          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
4314          case 1984153269: /*service*/  return new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, service);
4315          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier);
4316          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode);
4317          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);
4318          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);
4319          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);
4320          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);
4321          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4322          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4323          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4324          case -1280020865: /*locationAddress*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4325          case 755866390: /*locationReference*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4326          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
4327          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice);
4328          case -1282148017: /*factor*/  return new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor);
4329          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net);
4330          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
4331          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc).", 0, 1, bodySite);
4332          case -1868566105: /*subSite*/  return new Property("subSite", "CodeableConcept", "A region or surface of the site, eg. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite);
4333          case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "A billed item may include goods or services provided in multiple encounters.", 0, java.lang.Integer.MAX_VALUE, encounter);
4334          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
4335          case -231349275: /*adjudication*/  return new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
4336          case -1335224239: /*detail*/  return new Property("detail", "", "Second tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail);
4337          default: return super.getNamedProperty(_hash, _name, _checkValid);
4338          }
4339
4340        }
4341
4342      @Override
4343      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4344        switch (hash) {
4345        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
4346        case -186757789: /*careTeamLinkId*/ return this.careTeamLinkId == null ? new Base[0] : this.careTeamLinkId.toArray(new Base[this.careTeamLinkId.size()]); // PositiveIntType
4347        case -1659207418: /*diagnosisLinkId*/ return this.diagnosisLinkId == null ? new Base[0] : this.diagnosisLinkId.toArray(new Base[this.diagnosisLinkId.size()]); // PositiveIntType
4348        case -532846744: /*procedureLinkId*/ return this.procedureLinkId == null ? new Base[0] : this.procedureLinkId.toArray(new Base[this.procedureLinkId.size()]); // PositiveIntType
4349        case 1965585153: /*informationLinkId*/ return this.informationLinkId == null ? new Base[0] : this.informationLinkId.toArray(new Base[this.informationLinkId.size()]); // PositiveIntType
4350        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
4351        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4352        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
4353        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
4354        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
4355        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
4356        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
4357        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
4358        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
4359        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
4360        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
4361        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
4362        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
4363        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
4364        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
4365        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
4366        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
4367        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
4368        default: return super.getProperty(hash, name, checkValid);
4369        }
4370
4371      }
4372
4373      @Override
4374      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4375        switch (hash) {
4376        case 1349547969: // sequence
4377          this.sequence = castToPositiveInt(value); // PositiveIntType
4378          return value;
4379        case -186757789: // careTeamLinkId
4380          this.getCareTeamLinkId().add(castToPositiveInt(value)); // PositiveIntType
4381          return value;
4382        case -1659207418: // diagnosisLinkId
4383          this.getDiagnosisLinkId().add(castToPositiveInt(value)); // PositiveIntType
4384          return value;
4385        case -532846744: // procedureLinkId
4386          this.getProcedureLinkId().add(castToPositiveInt(value)); // PositiveIntType
4387          return value;
4388        case 1965585153: // informationLinkId
4389          this.getInformationLinkId().add(castToPositiveInt(value)); // PositiveIntType
4390          return value;
4391        case 1099842588: // revenue
4392          this.revenue = castToCodeableConcept(value); // CodeableConcept
4393          return value;
4394        case 50511102: // category
4395          this.category = castToCodeableConcept(value); // CodeableConcept
4396          return value;
4397        case 1984153269: // service
4398          this.service = castToCodeableConcept(value); // CodeableConcept
4399          return value;
4400        case -615513385: // modifier
4401          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
4402          return value;
4403        case 1010065041: // programCode
4404          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
4405          return value;
4406        case 1379209295: // serviced
4407          this.serviced = castToType(value); // Type
4408          return value;
4409        case 1901043637: // location
4410          this.location = castToType(value); // Type
4411          return value;
4412        case -1285004149: // quantity
4413          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
4414          return value;
4415        case -486196699: // unitPrice
4416          this.unitPrice = castToMoney(value); // Money
4417          return value;
4418        case -1282148017: // factor
4419          this.factor = castToDecimal(value); // DecimalType
4420          return value;
4421        case 108957: // net
4422          this.net = castToMoney(value); // Money
4423          return value;
4424        case 115642: // udi
4425          this.getUdi().add(castToReference(value)); // Reference
4426          return value;
4427        case 1702620169: // bodySite
4428          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4429          return value;
4430        case -1868566105: // subSite
4431          this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
4432          return value;
4433        case 1524132147: // encounter
4434          this.getEncounter().add(castToReference(value)); // Reference
4435          return value;
4436        case -1110033957: // noteNumber
4437          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
4438          return value;
4439        case -231349275: // adjudication
4440          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
4441          return value;
4442        case -1335224239: // detail
4443          this.getDetail().add((DetailComponent) value); // DetailComponent
4444          return value;
4445        default: return super.setProperty(hash, name, value);
4446        }
4447
4448      }
4449
4450      @Override
4451      public Base setProperty(String name, Base value) throws FHIRException {
4452        if (name.equals("sequence")) {
4453          this.sequence = castToPositiveInt(value); // PositiveIntType
4454        } else if (name.equals("careTeamLinkId")) {
4455          this.getCareTeamLinkId().add(castToPositiveInt(value));
4456        } else if (name.equals("diagnosisLinkId")) {
4457          this.getDiagnosisLinkId().add(castToPositiveInt(value));
4458        } else if (name.equals("procedureLinkId")) {
4459          this.getProcedureLinkId().add(castToPositiveInt(value));
4460        } else if (name.equals("informationLinkId")) {
4461          this.getInformationLinkId().add(castToPositiveInt(value));
4462        } else if (name.equals("revenue")) {
4463          this.revenue = castToCodeableConcept(value); // CodeableConcept
4464        } else if (name.equals("category")) {
4465          this.category = castToCodeableConcept(value); // CodeableConcept
4466        } else if (name.equals("service")) {
4467          this.service = castToCodeableConcept(value); // CodeableConcept
4468        } else if (name.equals("modifier")) {
4469          this.getModifier().add(castToCodeableConcept(value));
4470        } else if (name.equals("programCode")) {
4471          this.getProgramCode().add(castToCodeableConcept(value));
4472        } else if (name.equals("serviced[x]")) {
4473          this.serviced = castToType(value); // Type
4474        } else if (name.equals("location[x]")) {
4475          this.location = castToType(value); // Type
4476        } else if (name.equals("quantity")) {
4477          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
4478        } else if (name.equals("unitPrice")) {
4479          this.unitPrice = castToMoney(value); // Money
4480        } else if (name.equals("factor")) {
4481          this.factor = castToDecimal(value); // DecimalType
4482        } else if (name.equals("net")) {
4483          this.net = castToMoney(value); // Money
4484        } else if (name.equals("udi")) {
4485          this.getUdi().add(castToReference(value));
4486        } else if (name.equals("bodySite")) {
4487          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4488        } else if (name.equals("subSite")) {
4489          this.getSubSite().add(castToCodeableConcept(value));
4490        } else if (name.equals("encounter")) {
4491          this.getEncounter().add(castToReference(value));
4492        } else if (name.equals("noteNumber")) {
4493          this.getNoteNumber().add(castToPositiveInt(value));
4494        } else if (name.equals("adjudication")) {
4495          this.getAdjudication().add((AdjudicationComponent) value);
4496        } else if (name.equals("detail")) {
4497          this.getDetail().add((DetailComponent) value);
4498        } else
4499          return super.setProperty(name, value);
4500        return value;
4501      }
4502
4503      @Override
4504      public Base makeProperty(int hash, String name) throws FHIRException {
4505        switch (hash) {
4506        case 1349547969:  return getSequenceElement();
4507        case -186757789:  return addCareTeamLinkIdElement();
4508        case -1659207418:  return addDiagnosisLinkIdElement();
4509        case -532846744:  return addProcedureLinkIdElement();
4510        case 1965585153:  return addInformationLinkIdElement();
4511        case 1099842588:  return getRevenue(); 
4512        case 50511102:  return getCategory(); 
4513        case 1984153269:  return getService(); 
4514        case -615513385:  return addModifier(); 
4515        case 1010065041:  return addProgramCode(); 
4516        case -1927922223:  return getServiced(); 
4517        case 1379209295:  return getServiced(); 
4518        case 552316075:  return getLocation(); 
4519        case 1901043637:  return getLocation(); 
4520        case -1285004149:  return getQuantity(); 
4521        case -486196699:  return getUnitPrice(); 
4522        case -1282148017:  return getFactorElement();
4523        case 108957:  return getNet(); 
4524        case 115642:  return addUdi(); 
4525        case 1702620169:  return getBodySite(); 
4526        case -1868566105:  return addSubSite(); 
4527        case 1524132147:  return addEncounter(); 
4528        case -1110033957:  return addNoteNumberElement();
4529        case -231349275:  return addAdjudication(); 
4530        case -1335224239:  return addDetail(); 
4531        default: return super.makeProperty(hash, name);
4532        }
4533
4534      }
4535
4536      @Override
4537      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4538        switch (hash) {
4539        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
4540        case -186757789: /*careTeamLinkId*/ return new String[] {"positiveInt"};
4541        case -1659207418: /*diagnosisLinkId*/ return new String[] {"positiveInt"};
4542        case -532846744: /*procedureLinkId*/ return new String[] {"positiveInt"};
4543        case 1965585153: /*informationLinkId*/ return new String[] {"positiveInt"};
4544        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
4545        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4546        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
4547        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
4548        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
4549        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
4550        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
4551        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
4552        case -486196699: /*unitPrice*/ return new String[] {"Money"};
4553        case -1282148017: /*factor*/ return new String[] {"decimal"};
4554        case 108957: /*net*/ return new String[] {"Money"};
4555        case 115642: /*udi*/ return new String[] {"Reference"};
4556        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
4557        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
4558        case 1524132147: /*encounter*/ return new String[] {"Reference"};
4559        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
4560        case -231349275: /*adjudication*/ return new String[] {};
4561        case -1335224239: /*detail*/ return new String[] {};
4562        default: return super.getTypesForProperty(hash, name);
4563        }
4564
4565      }
4566
4567      @Override
4568      public Base addChild(String name) throws FHIRException {
4569        if (name.equals("sequence")) {
4570          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
4571        }
4572        else if (name.equals("careTeamLinkId")) {
4573          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeamLinkId");
4574        }
4575        else if (name.equals("diagnosisLinkId")) {
4576          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.diagnosisLinkId");
4577        }
4578        else if (name.equals("procedureLinkId")) {
4579          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedureLinkId");
4580        }
4581        else if (name.equals("informationLinkId")) {
4582          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.informationLinkId");
4583        }
4584        else if (name.equals("revenue")) {
4585          this.revenue = new CodeableConcept();
4586          return this.revenue;
4587        }
4588        else if (name.equals("category")) {
4589          this.category = new CodeableConcept();
4590          return this.category;
4591        }
4592        else if (name.equals("service")) {
4593          this.service = new CodeableConcept();
4594          return this.service;
4595        }
4596        else if (name.equals("modifier")) {
4597          return addModifier();
4598        }
4599        else if (name.equals("programCode")) {
4600          return addProgramCode();
4601        }
4602        else if (name.equals("servicedDate")) {
4603          this.serviced = new DateType();
4604          return this.serviced;
4605        }
4606        else if (name.equals("servicedPeriod")) {
4607          this.serviced = new Period();
4608          return this.serviced;
4609        }
4610        else if (name.equals("locationCodeableConcept")) {
4611          this.location = new CodeableConcept();
4612          return this.location;
4613        }
4614        else if (name.equals("locationAddress")) {
4615          this.location = new Address();
4616          return this.location;
4617        }
4618        else if (name.equals("locationReference")) {
4619          this.location = new Reference();
4620          return this.location;
4621        }
4622        else if (name.equals("quantity")) {
4623          this.quantity = new SimpleQuantity();
4624          return this.quantity;
4625        }
4626        else if (name.equals("unitPrice")) {
4627          this.unitPrice = new Money();
4628          return this.unitPrice;
4629        }
4630        else if (name.equals("factor")) {
4631          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
4632        }
4633        else if (name.equals("net")) {
4634          this.net = new Money();
4635          return this.net;
4636        }
4637        else if (name.equals("udi")) {
4638          return addUdi();
4639        }
4640        else if (name.equals("bodySite")) {
4641          this.bodySite = new CodeableConcept();
4642          return this.bodySite;
4643        }
4644        else if (name.equals("subSite")) {
4645          return addSubSite();
4646        }
4647        else if (name.equals("encounter")) {
4648          return addEncounter();
4649        }
4650        else if (name.equals("noteNumber")) {
4651          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
4652        }
4653        else if (name.equals("adjudication")) {
4654          return addAdjudication();
4655        }
4656        else if (name.equals("detail")) {
4657          return addDetail();
4658        }
4659        else
4660          return super.addChild(name);
4661      }
4662
4663      public ItemComponent copy() {
4664        ItemComponent dst = new ItemComponent();
4665        copyValues(dst);
4666        dst.sequence = sequence == null ? null : sequence.copy();
4667        if (careTeamLinkId != null) {
4668          dst.careTeamLinkId = new ArrayList<PositiveIntType>();
4669          for (PositiveIntType i : careTeamLinkId)
4670            dst.careTeamLinkId.add(i.copy());
4671        };
4672        if (diagnosisLinkId != null) {
4673          dst.diagnosisLinkId = new ArrayList<PositiveIntType>();
4674          for (PositiveIntType i : diagnosisLinkId)
4675            dst.diagnosisLinkId.add(i.copy());
4676        };
4677        if (procedureLinkId != null) {
4678          dst.procedureLinkId = new ArrayList<PositiveIntType>();
4679          for (PositiveIntType i : procedureLinkId)
4680            dst.procedureLinkId.add(i.copy());
4681        };
4682        if (informationLinkId != null) {
4683          dst.informationLinkId = new ArrayList<PositiveIntType>();
4684          for (PositiveIntType i : informationLinkId)
4685            dst.informationLinkId.add(i.copy());
4686        };
4687        dst.revenue = revenue == null ? null : revenue.copy();
4688        dst.category = category == null ? null : category.copy();
4689        dst.service = service == null ? null : service.copy();
4690        if (modifier != null) {
4691          dst.modifier = new ArrayList<CodeableConcept>();
4692          for (CodeableConcept i : modifier)
4693            dst.modifier.add(i.copy());
4694        };
4695        if (programCode != null) {
4696          dst.programCode = new ArrayList<CodeableConcept>();
4697          for (CodeableConcept i : programCode)
4698            dst.programCode.add(i.copy());
4699        };
4700        dst.serviced = serviced == null ? null : serviced.copy();
4701        dst.location = location == null ? null : location.copy();
4702        dst.quantity = quantity == null ? null : quantity.copy();
4703        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
4704        dst.factor = factor == null ? null : factor.copy();
4705        dst.net = net == null ? null : net.copy();
4706        if (udi != null) {
4707          dst.udi = new ArrayList<Reference>();
4708          for (Reference i : udi)
4709            dst.udi.add(i.copy());
4710        };
4711        dst.bodySite = bodySite == null ? null : bodySite.copy();
4712        if (subSite != null) {
4713          dst.subSite = new ArrayList<CodeableConcept>();
4714          for (CodeableConcept i : subSite)
4715            dst.subSite.add(i.copy());
4716        };
4717        if (encounter != null) {
4718          dst.encounter = new ArrayList<Reference>();
4719          for (Reference i : encounter)
4720            dst.encounter.add(i.copy());
4721        };
4722        if (noteNumber != null) {
4723          dst.noteNumber = new ArrayList<PositiveIntType>();
4724          for (PositiveIntType i : noteNumber)
4725            dst.noteNumber.add(i.copy());
4726        };
4727        if (adjudication != null) {
4728          dst.adjudication = new ArrayList<AdjudicationComponent>();
4729          for (AdjudicationComponent i : adjudication)
4730            dst.adjudication.add(i.copy());
4731        };
4732        if (detail != null) {
4733          dst.detail = new ArrayList<DetailComponent>();
4734          for (DetailComponent i : detail)
4735            dst.detail.add(i.copy());
4736        };
4737        return dst;
4738      }
4739
4740      @Override
4741      public boolean equalsDeep(Base other_) {
4742        if (!super.equalsDeep(other_))
4743          return false;
4744        if (!(other_ instanceof ItemComponent))
4745          return false;
4746        ItemComponent o = (ItemComponent) other_;
4747        return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamLinkId, o.careTeamLinkId, true)
4748           && compareDeep(diagnosisLinkId, o.diagnosisLinkId, true) && compareDeep(procedureLinkId, o.procedureLinkId, true)
4749           && compareDeep(informationLinkId, o.informationLinkId, true) && compareDeep(revenue, o.revenue, true)
4750           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
4751           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
4752           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
4753           && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true) && compareDeep(bodySite, o.bodySite, true)
4754           && compareDeep(subSite, o.subSite, true) && compareDeep(encounter, o.encounter, true) && compareDeep(noteNumber, o.noteNumber, true)
4755           && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
4756      }
4757
4758      @Override
4759      public boolean equalsShallow(Base other_) {
4760        if (!super.equalsShallow(other_))
4761          return false;
4762        if (!(other_ instanceof ItemComponent))
4763          return false;
4764        ItemComponent o = (ItemComponent) other_;
4765        return compareValues(sequence, o.sequence, true) && compareValues(careTeamLinkId, o.careTeamLinkId, true)
4766           && compareValues(diagnosisLinkId, o.diagnosisLinkId, true) && compareValues(procedureLinkId, o.procedureLinkId, true)
4767           && compareValues(informationLinkId, o.informationLinkId, true) && compareValues(factor, o.factor, true)
4768           && compareValues(noteNumber, o.noteNumber, true);
4769      }
4770
4771      public boolean isEmpty() {
4772        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamLinkId, diagnosisLinkId
4773          , procedureLinkId, informationLinkId, revenue, category, service, modifier, programCode
4774          , serviced, location, quantity, unitPrice, factor, net, udi, bodySite, subSite
4775          , encounter, noteNumber, adjudication, detail);
4776      }
4777
4778  public String fhirType() {
4779    return "ExplanationOfBenefit.item";
4780
4781  }
4782
4783  }
4784
4785    @Block()
4786    public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
4787        /**
4788         * Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.
4789         */
4790        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
4791        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc." )
4792        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
4793        protected CodeableConcept category;
4794
4795        /**
4796         * Adjudication reason such as limit reached.
4797         */
4798        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
4799        @Description(shortDefinition="Explanation of Adjudication outcome", formalDefinition="Adjudication reason such as limit reached." )
4800        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-reason")
4801        protected CodeableConcept reason;
4802
4803        /**
4804         * Monitory amount associated with the code.
4805         */
4806        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
4807        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
4808        protected Money amount;
4809
4810        /**
4811         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4812         */
4813        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
4814        @Description(shortDefinition="Non-monitory value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
4815        protected DecimalType value;
4816
4817        private static final long serialVersionUID = 1559898786L;
4818
4819    /**
4820     * Constructor
4821     */
4822      public AdjudicationComponent() {
4823        super();
4824      }
4825
4826    /**
4827     * Constructor
4828     */
4829      public AdjudicationComponent(CodeableConcept category) {
4830        super();
4831        this.category = category;
4832      }
4833
4834        /**
4835         * @return {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
4836         */
4837        public CodeableConcept getCategory() { 
4838          if (this.category == null)
4839            if (Configuration.errorOnAutoCreate())
4840              throw new Error("Attempt to auto-create AdjudicationComponent.category");
4841            else if (Configuration.doAutoCreate())
4842              this.category = new CodeableConcept(); // cc
4843          return this.category;
4844        }
4845
4846        public boolean hasCategory() { 
4847          return this.category != null && !this.category.isEmpty();
4848        }
4849
4850        /**
4851         * @param value {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
4852         */
4853        public AdjudicationComponent setCategory(CodeableConcept value)  { 
4854          this.category = value;
4855          return this;
4856        }
4857
4858        /**
4859         * @return {@link #reason} (Adjudication reason such as limit reached.)
4860         */
4861        public CodeableConcept getReason() { 
4862          if (this.reason == null)
4863            if (Configuration.errorOnAutoCreate())
4864              throw new Error("Attempt to auto-create AdjudicationComponent.reason");
4865            else if (Configuration.doAutoCreate())
4866              this.reason = new CodeableConcept(); // cc
4867          return this.reason;
4868        }
4869
4870        public boolean hasReason() { 
4871          return this.reason != null && !this.reason.isEmpty();
4872        }
4873
4874        /**
4875         * @param value {@link #reason} (Adjudication reason such as limit reached.)
4876         */
4877        public AdjudicationComponent setReason(CodeableConcept value)  { 
4878          this.reason = value;
4879          return this;
4880        }
4881
4882        /**
4883         * @return {@link #amount} (Monitory amount associated with the code.)
4884         */
4885        public Money getAmount() { 
4886          if (this.amount == null)
4887            if (Configuration.errorOnAutoCreate())
4888              throw new Error("Attempt to auto-create AdjudicationComponent.amount");
4889            else if (Configuration.doAutoCreate())
4890              this.amount = new Money(); // cc
4891          return this.amount;
4892        }
4893
4894        public boolean hasAmount() { 
4895          return this.amount != null && !this.amount.isEmpty();
4896        }
4897
4898        /**
4899         * @param value {@link #amount} (Monitory amount associated with the code.)
4900         */
4901        public AdjudicationComponent setAmount(Money value)  { 
4902          this.amount = value;
4903          return this;
4904        }
4905
4906        /**
4907         * @return {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
4908         */
4909        public DecimalType getValueElement() { 
4910          if (this.value == null)
4911            if (Configuration.errorOnAutoCreate())
4912              throw new Error("Attempt to auto-create AdjudicationComponent.value");
4913            else if (Configuration.doAutoCreate())
4914              this.value = new DecimalType(); // bb
4915          return this.value;
4916        }
4917
4918        public boolean hasValueElement() { 
4919          return this.value != null && !this.value.isEmpty();
4920        }
4921
4922        public boolean hasValue() { 
4923          return this.value != null && !this.value.isEmpty();
4924        }
4925
4926        /**
4927         * @param value {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
4928         */
4929        public AdjudicationComponent setValueElement(DecimalType value) { 
4930          this.value = value;
4931          return this;
4932        }
4933
4934        /**
4935         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4936         */
4937        public BigDecimal getValue() { 
4938          return this.value == null ? null : this.value.getValue();
4939        }
4940
4941        /**
4942         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4943         */
4944        public AdjudicationComponent setValue(BigDecimal value) { 
4945          if (value == null)
4946            this.value = null;
4947          else {
4948            if (this.value == null)
4949              this.value = new DecimalType();
4950            this.value.setValue(value);
4951          }
4952          return this;
4953        }
4954
4955        /**
4956         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4957         */
4958        public AdjudicationComponent setValue(long value) { 
4959              this.value = new DecimalType();
4960            this.value.setValue(value);
4961          return this;
4962        }
4963
4964        /**
4965         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4966         */
4967        public AdjudicationComponent setValue(double value) { 
4968              this.value = new DecimalType();
4969            this.value.setValue(value);
4970          return this;
4971        }
4972
4973        protected void listChildren(List<Property> children) {
4974          super.listChildren(children);
4975          children.add(new Property("category", "CodeableConcept", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, 1, category));
4976          children.add(new Property("reason", "CodeableConcept", "Adjudication reason such as limit reached.", 0, 1, reason));
4977          children.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, 1, amount));
4978          children.add(new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, 1, value));
4979        }
4980
4981        @Override
4982        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4983          switch (_hash) {
4984          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, 1, category);
4985          case -934964668: /*reason*/  return new Property("reason", "CodeableConcept", "Adjudication reason such as limit reached.", 0, 1, reason);
4986          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monitory amount associated with the code.", 0, 1, amount);
4987          case 111972721: /*value*/  return new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, 1, value);
4988          default: return super.getNamedProperty(_hash, _name, _checkValid);
4989          }
4990
4991        }
4992
4993      @Override
4994      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4995        switch (hash) {
4996        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4997        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
4998        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
4999        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
5000        default: return super.getProperty(hash, name, checkValid);
5001        }
5002
5003      }
5004
5005      @Override
5006      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5007        switch (hash) {
5008        case 50511102: // category
5009          this.category = castToCodeableConcept(value); // CodeableConcept
5010          return value;
5011        case -934964668: // reason
5012          this.reason = castToCodeableConcept(value); // CodeableConcept
5013          return value;
5014        case -1413853096: // amount
5015          this.amount = castToMoney(value); // Money
5016          return value;
5017        case 111972721: // value
5018          this.value = castToDecimal(value); // DecimalType
5019          return value;
5020        default: return super.setProperty(hash, name, value);
5021        }
5022
5023      }
5024
5025      @Override
5026      public Base setProperty(String name, Base value) throws FHIRException {
5027        if (name.equals("category")) {
5028          this.category = castToCodeableConcept(value); // CodeableConcept
5029        } else if (name.equals("reason")) {
5030          this.reason = castToCodeableConcept(value); // CodeableConcept
5031        } else if (name.equals("amount")) {
5032          this.amount = castToMoney(value); // Money
5033        } else if (name.equals("value")) {
5034          this.value = castToDecimal(value); // DecimalType
5035        } else
5036          return super.setProperty(name, value);
5037        return value;
5038      }
5039
5040      @Override
5041      public Base makeProperty(int hash, String name) throws FHIRException {
5042        switch (hash) {
5043        case 50511102:  return getCategory(); 
5044        case -934964668:  return getReason(); 
5045        case -1413853096:  return getAmount(); 
5046        case 111972721:  return getValueElement();
5047        default: return super.makeProperty(hash, name);
5048        }
5049
5050      }
5051
5052      @Override
5053      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5054        switch (hash) {
5055        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5056        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
5057        case -1413853096: /*amount*/ return new String[] {"Money"};
5058        case 111972721: /*value*/ return new String[] {"decimal"};
5059        default: return super.getTypesForProperty(hash, name);
5060        }
5061
5062      }
5063
5064      @Override
5065      public Base addChild(String name) throws FHIRException {
5066        if (name.equals("category")) {
5067          this.category = new CodeableConcept();
5068          return this.category;
5069        }
5070        else if (name.equals("reason")) {
5071          this.reason = new CodeableConcept();
5072          return this.reason;
5073        }
5074        else if (name.equals("amount")) {
5075          this.amount = new Money();
5076          return this.amount;
5077        }
5078        else if (name.equals("value")) {
5079          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
5080        }
5081        else
5082          return super.addChild(name);
5083      }
5084
5085      public AdjudicationComponent copy() {
5086        AdjudicationComponent dst = new AdjudicationComponent();
5087        copyValues(dst);
5088        dst.category = category == null ? null : category.copy();
5089        dst.reason = reason == null ? null : reason.copy();
5090        dst.amount = amount == null ? null : amount.copy();
5091        dst.value = value == null ? null : value.copy();
5092        return dst;
5093      }
5094
5095      @Override
5096      public boolean equalsDeep(Base other_) {
5097        if (!super.equalsDeep(other_))
5098          return false;
5099        if (!(other_ instanceof AdjudicationComponent))
5100          return false;
5101        AdjudicationComponent o = (AdjudicationComponent) other_;
5102        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
5103           && compareDeep(value, o.value, true);
5104      }
5105
5106      @Override
5107      public boolean equalsShallow(Base other_) {
5108        if (!super.equalsShallow(other_))
5109          return false;
5110        if (!(other_ instanceof AdjudicationComponent))
5111          return false;
5112        AdjudicationComponent o = (AdjudicationComponent) other_;
5113        return compareValues(value, o.value, true);
5114      }
5115
5116      public boolean isEmpty() {
5117        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount
5118          , value);
5119      }
5120
5121  public String fhirType() {
5122    return "ExplanationOfBenefit.item.adjudication";
5123
5124  }
5125
5126  }
5127
5128    @Block()
5129    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
5130        /**
5131         * A service line number.
5132         */
5133        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
5134        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
5135        protected PositiveIntType sequence;
5136
5137        /**
5138         * The type of product or service.
5139         */
5140        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
5141        @Description(shortDefinition="Group or type of product or service", formalDefinition="The type of product or service." )
5142        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActInvoiceGroupCode")
5143        protected CodeableConcept type;
5144
5145        /**
5146         * The type of reveneu or cost center providing the product and/or service.
5147         */
5148        @Child(name = "revenue", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
5149        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
5150        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
5151        protected CodeableConcept revenue;
5152
5153        /**
5154         * Health Care Service Type Codes  to identify the classification of service or benefits.
5155         */
5156        @Child(name = "category", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
5157        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
5158        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
5159        protected CodeableConcept category;
5160
5161        /**
5162         * If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.
5163         */
5164        @Child(name = "service", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
5165        @Description(shortDefinition="Billing Code", formalDefinition="If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'." )
5166        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
5167        protected CodeableConcept service;
5168
5169        /**
5170         * Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.
5171         */
5172        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5173        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours." )
5174        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
5175        protected List<CodeableConcept> modifier;
5176
5177        /**
5178         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
5179         */
5180        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5181        @Description(shortDefinition="Program specific reason for item inclusion", formalDefinition="For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program." )
5182        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
5183        protected List<CodeableConcept> programCode;
5184
5185        /**
5186         * The number of repetitions of a service or product.
5187         */
5188        @Child(name = "quantity", type = {SimpleQuantity.class}, order=8, min=0, max=1, modifier=false, summary=false)
5189        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
5190        protected SimpleQuantity quantity;
5191
5192        /**
5193         * If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.
5194         */
5195        @Child(name = "unitPrice", type = {Money.class}, order=9, min=0, max=1, modifier=false, summary=false)
5196        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group." )
5197        protected Money unitPrice;
5198
5199        /**
5200         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
5201         */
5202        @Child(name = "factor", type = {DecimalType.class}, order=10, min=0, max=1, modifier=false, summary=false)
5203        @Description(shortDefinition="Price scaling factor", formalDefinition="A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount." )
5204        protected DecimalType factor;
5205
5206        /**
5207         * The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
5208         */
5209        @Child(name = "net", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=false)
5210        @Description(shortDefinition="Total additional item cost", formalDefinition="The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
5211        protected Money net;
5212
5213        /**
5214         * List of Unique Device Identifiers associated with this line item.
5215         */
5216        @Child(name = "udi", type = {Device.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5217        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
5218        protected List<Reference> udi;
5219        /**
5220         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
5221         */
5222        protected List<Device> udiTarget;
5223
5224
5225        /**
5226         * A list of note references to the notes provided below.
5227         */
5228        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5229        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
5230        protected List<PositiveIntType> noteNumber;
5231
5232        /**
5233         * The adjudications results.
5234         */
5235        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5236        @Description(shortDefinition="Detail level adjudication details", formalDefinition="The adjudications results." )
5237        protected List<AdjudicationComponent> adjudication;
5238
5239        /**
5240         * Third tier of goods and services.
5241         */
5242        @Child(name = "subDetail", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5243        @Description(shortDefinition="Additional items", formalDefinition="Third tier of goods and services." )
5244        protected List<SubDetailComponent> subDetail;
5245
5246        private static final long serialVersionUID = -276371489L;
5247
5248    /**
5249     * Constructor
5250     */
5251      public DetailComponent() {
5252        super();
5253      }
5254
5255    /**
5256     * Constructor
5257     */
5258      public DetailComponent(PositiveIntType sequence, CodeableConcept type) {
5259        super();
5260        this.sequence = sequence;
5261        this.type = type;
5262      }
5263
5264        /**
5265         * @return {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
5266         */
5267        public PositiveIntType getSequenceElement() { 
5268          if (this.sequence == null)
5269            if (Configuration.errorOnAutoCreate())
5270              throw new Error("Attempt to auto-create DetailComponent.sequence");
5271            else if (Configuration.doAutoCreate())
5272              this.sequence = new PositiveIntType(); // bb
5273          return this.sequence;
5274        }
5275
5276        public boolean hasSequenceElement() { 
5277          return this.sequence != null && !this.sequence.isEmpty();
5278        }
5279
5280        public boolean hasSequence() { 
5281          return this.sequence != null && !this.sequence.isEmpty();
5282        }
5283
5284        /**
5285         * @param value {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
5286         */
5287        public DetailComponent setSequenceElement(PositiveIntType value) { 
5288          this.sequence = value;
5289          return this;
5290        }
5291
5292        /**
5293         * @return A service line number.
5294         */
5295        public int getSequence() { 
5296          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
5297        }
5298
5299        /**
5300         * @param value A service line number.
5301         */
5302        public DetailComponent setSequence(int value) { 
5303            if (this.sequence == null)
5304              this.sequence = new PositiveIntType();
5305            this.sequence.setValue(value);
5306          return this;
5307        }
5308
5309        /**
5310         * @return {@link #type} (The type of product or service.)
5311         */
5312        public CodeableConcept getType() { 
5313          if (this.type == null)
5314            if (Configuration.errorOnAutoCreate())
5315              throw new Error("Attempt to auto-create DetailComponent.type");
5316            else if (Configuration.doAutoCreate())
5317              this.type = new CodeableConcept(); // cc
5318          return this.type;
5319        }
5320
5321        public boolean hasType() { 
5322          return this.type != null && !this.type.isEmpty();
5323        }
5324
5325        /**
5326         * @param value {@link #type} (The type of product or service.)
5327         */
5328        public DetailComponent setType(CodeableConcept value)  { 
5329          this.type = value;
5330          return this;
5331        }
5332
5333        /**
5334         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
5335         */
5336        public CodeableConcept getRevenue() { 
5337          if (this.revenue == null)
5338            if (Configuration.errorOnAutoCreate())
5339              throw new Error("Attempt to auto-create DetailComponent.revenue");
5340            else if (Configuration.doAutoCreate())
5341              this.revenue = new CodeableConcept(); // cc
5342          return this.revenue;
5343        }
5344
5345        public boolean hasRevenue() { 
5346          return this.revenue != null && !this.revenue.isEmpty();
5347        }
5348
5349        /**
5350         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
5351         */
5352        public DetailComponent setRevenue(CodeableConcept value)  { 
5353          this.revenue = value;
5354          return this;
5355        }
5356
5357        /**
5358         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
5359         */
5360        public CodeableConcept getCategory() { 
5361          if (this.category == null)
5362            if (Configuration.errorOnAutoCreate())
5363              throw new Error("Attempt to auto-create DetailComponent.category");
5364            else if (Configuration.doAutoCreate())
5365              this.category = new CodeableConcept(); // cc
5366          return this.category;
5367        }
5368
5369        public boolean hasCategory() { 
5370          return this.category != null && !this.category.isEmpty();
5371        }
5372
5373        /**
5374         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
5375         */
5376        public DetailComponent setCategory(CodeableConcept value)  { 
5377          this.category = value;
5378          return this;
5379        }
5380
5381        /**
5382         * @return {@link #service} (If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.)
5383         */
5384        public CodeableConcept getService() { 
5385          if (this.service == null)
5386            if (Configuration.errorOnAutoCreate())
5387              throw new Error("Attempt to auto-create DetailComponent.service");
5388            else if (Configuration.doAutoCreate())
5389              this.service = new CodeableConcept(); // cc
5390          return this.service;
5391        }
5392
5393        public boolean hasService() { 
5394          return this.service != null && !this.service.isEmpty();
5395        }
5396
5397        /**
5398         * @param value {@link #service} (If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.)
5399         */
5400        public DetailComponent setService(CodeableConcept value)  { 
5401          this.service = value;
5402          return this;
5403        }
5404
5405        /**
5406         * @return {@link #modifier} (Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.)
5407         */
5408        public List<CodeableConcept> getModifier() { 
5409          if (this.modifier == null)
5410            this.modifier = new ArrayList<CodeableConcept>();
5411          return this.modifier;
5412        }
5413
5414        /**
5415         * @return Returns a reference to <code>this</code> for easy method chaining
5416         */
5417        public DetailComponent setModifier(List<CodeableConcept> theModifier) { 
5418          this.modifier = theModifier;
5419          return this;
5420        }
5421
5422        public boolean hasModifier() { 
5423          if (this.modifier == null)
5424            return false;
5425          for (CodeableConcept item : this.modifier)
5426            if (!item.isEmpty())
5427              return true;
5428          return false;
5429        }
5430
5431        public CodeableConcept addModifier() { //3
5432          CodeableConcept t = new CodeableConcept();
5433          if (this.modifier == null)
5434            this.modifier = new ArrayList<CodeableConcept>();
5435          this.modifier.add(t);
5436          return t;
5437        }
5438
5439        public DetailComponent addModifier(CodeableConcept t) { //3
5440          if (t == null)
5441            return this;
5442          if (this.modifier == null)
5443            this.modifier = new ArrayList<CodeableConcept>();
5444          this.modifier.add(t);
5445          return this;
5446        }
5447
5448        /**
5449         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
5450         */
5451        public CodeableConcept getModifierFirstRep() { 
5452          if (getModifier().isEmpty()) {
5453            addModifier();
5454          }
5455          return getModifier().get(0);
5456        }
5457
5458        /**
5459         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
5460         */
5461        public List<CodeableConcept> getProgramCode() { 
5462          if (this.programCode == null)
5463            this.programCode = new ArrayList<CodeableConcept>();
5464          return this.programCode;
5465        }
5466
5467        /**
5468         * @return Returns a reference to <code>this</code> for easy method chaining
5469         */
5470        public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
5471          this.programCode = theProgramCode;
5472          return this;
5473        }
5474
5475        public boolean hasProgramCode() { 
5476          if (this.programCode == null)
5477            return false;
5478          for (CodeableConcept item : this.programCode)
5479            if (!item.isEmpty())
5480              return true;
5481          return false;
5482        }
5483
5484        public CodeableConcept addProgramCode() { //3
5485          CodeableConcept t = new CodeableConcept();
5486          if (this.programCode == null)
5487            this.programCode = new ArrayList<CodeableConcept>();
5488          this.programCode.add(t);
5489          return t;
5490        }
5491
5492        public DetailComponent addProgramCode(CodeableConcept t) { //3
5493          if (t == null)
5494            return this;
5495          if (this.programCode == null)
5496            this.programCode = new ArrayList<CodeableConcept>();
5497          this.programCode.add(t);
5498          return this;
5499        }
5500
5501        /**
5502         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
5503         */
5504        public CodeableConcept getProgramCodeFirstRep() { 
5505          if (getProgramCode().isEmpty()) {
5506            addProgramCode();
5507          }
5508          return getProgramCode().get(0);
5509        }
5510
5511        /**
5512         * @return {@link #quantity} (The number of repetitions of a service or product.)
5513         */
5514        public SimpleQuantity getQuantity() { 
5515          if (this.quantity == null)
5516            if (Configuration.errorOnAutoCreate())
5517              throw new Error("Attempt to auto-create DetailComponent.quantity");
5518            else if (Configuration.doAutoCreate())
5519              this.quantity = new SimpleQuantity(); // cc
5520          return this.quantity;
5521        }
5522
5523        public boolean hasQuantity() { 
5524          return this.quantity != null && !this.quantity.isEmpty();
5525        }
5526
5527        /**
5528         * @param value {@link #quantity} (The number of repetitions of a service or product.)
5529         */
5530        public DetailComponent setQuantity(SimpleQuantity value)  { 
5531          this.quantity = value;
5532          return this;
5533        }
5534
5535        /**
5536         * @return {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
5537         */
5538        public Money getUnitPrice() { 
5539          if (this.unitPrice == null)
5540            if (Configuration.errorOnAutoCreate())
5541              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
5542            else if (Configuration.doAutoCreate())
5543              this.unitPrice = new Money(); // cc
5544          return this.unitPrice;
5545        }
5546
5547        public boolean hasUnitPrice() { 
5548          return this.unitPrice != null && !this.unitPrice.isEmpty();
5549        }
5550
5551        /**
5552         * @param value {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
5553         */
5554        public DetailComponent setUnitPrice(Money value)  { 
5555          this.unitPrice = value;
5556          return this;
5557        }
5558
5559        /**
5560         * @return {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
5561         */
5562        public DecimalType getFactorElement() { 
5563          if (this.factor == null)
5564            if (Configuration.errorOnAutoCreate())
5565              throw new Error("Attempt to auto-create DetailComponent.factor");
5566            else if (Configuration.doAutoCreate())
5567              this.factor = new DecimalType(); // bb
5568          return this.factor;
5569        }
5570
5571        public boolean hasFactorElement() { 
5572          return this.factor != null && !this.factor.isEmpty();
5573        }
5574
5575        public boolean hasFactor() { 
5576          return this.factor != null && !this.factor.isEmpty();
5577        }
5578
5579        /**
5580         * @param value {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
5581         */
5582        public DetailComponent setFactorElement(DecimalType value) { 
5583          this.factor = value;
5584          return this;
5585        }
5586
5587        /**
5588         * @return A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
5589         */
5590        public BigDecimal getFactor() { 
5591          return this.factor == null ? null : this.factor.getValue();
5592        }
5593
5594        /**
5595         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
5596         */
5597        public DetailComponent setFactor(BigDecimal value) { 
5598          if (value == null)
5599            this.factor = null;
5600          else {
5601            if (this.factor == null)
5602              this.factor = new DecimalType();
5603            this.factor.setValue(value);
5604          }
5605          return this;
5606        }
5607
5608        /**
5609         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
5610         */
5611        public DetailComponent setFactor(long value) { 
5612              this.factor = new DecimalType();
5613            this.factor.setValue(value);
5614          return this;
5615        }
5616
5617        /**
5618         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
5619         */
5620        public DetailComponent setFactor(double value) { 
5621              this.factor = new DecimalType();
5622            this.factor.setValue(value);
5623          return this;
5624        }
5625
5626        /**
5627         * @return {@link #net} (The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
5628         */
5629        public Money getNet() { 
5630          if (this.net == null)
5631            if (Configuration.errorOnAutoCreate())
5632              throw new Error("Attempt to auto-create DetailComponent.net");
5633            else if (Configuration.doAutoCreate())
5634              this.net = new Money(); // cc
5635          return this.net;
5636        }
5637
5638        public boolean hasNet() { 
5639          return this.net != null && !this.net.isEmpty();
5640        }
5641
5642        /**
5643         * @param value {@link #net} (The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
5644         */
5645        public DetailComponent setNet(Money value)  { 
5646          this.net = value;
5647          return this;
5648        }
5649
5650        /**
5651         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
5652         */
5653        public List<Reference> getUdi() { 
5654          if (this.udi == null)
5655            this.udi = new ArrayList<Reference>();
5656          return this.udi;
5657        }
5658
5659        /**
5660         * @return Returns a reference to <code>this</code> for easy method chaining
5661         */
5662        public DetailComponent setUdi(List<Reference> theUdi) { 
5663          this.udi = theUdi;
5664          return this;
5665        }
5666
5667        public boolean hasUdi() { 
5668          if (this.udi == null)
5669            return false;
5670          for (Reference item : this.udi)
5671            if (!item.isEmpty())
5672              return true;
5673          return false;
5674        }
5675
5676        public Reference addUdi() { //3
5677          Reference t = new Reference();
5678          if (this.udi == null)
5679            this.udi = new ArrayList<Reference>();
5680          this.udi.add(t);
5681          return t;
5682        }
5683
5684        public DetailComponent addUdi(Reference t) { //3
5685          if (t == null)
5686            return this;
5687          if (this.udi == null)
5688            this.udi = new ArrayList<Reference>();
5689          this.udi.add(t);
5690          return this;
5691        }
5692
5693        /**
5694         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
5695         */
5696        public Reference getUdiFirstRep() { 
5697          if (getUdi().isEmpty()) {
5698            addUdi();
5699          }
5700          return getUdi().get(0);
5701        }
5702
5703        /**
5704         * @deprecated Use Reference#setResource(IBaseResource) instead
5705         */
5706        @Deprecated
5707        public List<Device> getUdiTarget() { 
5708          if (this.udiTarget == null)
5709            this.udiTarget = new ArrayList<Device>();
5710          return this.udiTarget;
5711        }
5712
5713        /**
5714         * @deprecated Use Reference#setResource(IBaseResource) instead
5715         */
5716        @Deprecated
5717        public Device addUdiTarget() { 
5718          Device r = new Device();
5719          if (this.udiTarget == null)
5720            this.udiTarget = new ArrayList<Device>();
5721          this.udiTarget.add(r);
5722          return r;
5723        }
5724
5725        /**
5726         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
5727         */
5728        public List<PositiveIntType> getNoteNumber() { 
5729          if (this.noteNumber == null)
5730            this.noteNumber = new ArrayList<PositiveIntType>();
5731          return this.noteNumber;
5732        }
5733
5734        /**
5735         * @return Returns a reference to <code>this</code> for easy method chaining
5736         */
5737        public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
5738          this.noteNumber = theNoteNumber;
5739          return this;
5740        }
5741
5742        public boolean hasNoteNumber() { 
5743          if (this.noteNumber == null)
5744            return false;
5745          for (PositiveIntType item : this.noteNumber)
5746            if (!item.isEmpty())
5747              return true;
5748          return false;
5749        }
5750
5751        /**
5752         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
5753         */
5754        public PositiveIntType addNoteNumberElement() {//2 
5755          PositiveIntType t = new PositiveIntType();
5756          if (this.noteNumber == null)
5757            this.noteNumber = new ArrayList<PositiveIntType>();
5758          this.noteNumber.add(t);
5759          return t;
5760        }
5761
5762        /**
5763         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
5764         */
5765        public DetailComponent addNoteNumber(int value) { //1
5766          PositiveIntType t = new PositiveIntType();
5767          t.setValue(value);
5768          if (this.noteNumber == null)
5769            this.noteNumber = new ArrayList<PositiveIntType>();
5770          this.noteNumber.add(t);
5771          return this;
5772        }
5773
5774        /**
5775         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
5776         */
5777        public boolean hasNoteNumber(int value) { 
5778          if (this.noteNumber == null)
5779            return false;
5780          for (PositiveIntType v : this.noteNumber)
5781            if (v.getValue().equals(value)) // positiveInt
5782              return true;
5783          return false;
5784        }
5785
5786        /**
5787         * @return {@link #adjudication} (The adjudications results.)
5788         */
5789        public List<AdjudicationComponent> getAdjudication() { 
5790          if (this.adjudication == null)
5791            this.adjudication = new ArrayList<AdjudicationComponent>();
5792          return this.adjudication;
5793        }
5794
5795        /**
5796         * @return Returns a reference to <code>this</code> for easy method chaining
5797         */
5798        public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
5799          this.adjudication = theAdjudication;
5800          return this;
5801        }
5802
5803        public boolean hasAdjudication() { 
5804          if (this.adjudication == null)
5805            return false;
5806          for (AdjudicationComponent item : this.adjudication)
5807            if (!item.isEmpty())
5808              return true;
5809          return false;
5810        }
5811
5812        public AdjudicationComponent addAdjudication() { //3
5813          AdjudicationComponent t = new AdjudicationComponent();
5814          if (this.adjudication == null)
5815            this.adjudication = new ArrayList<AdjudicationComponent>();
5816          this.adjudication.add(t);
5817          return t;
5818        }
5819
5820        public DetailComponent addAdjudication(AdjudicationComponent t) { //3
5821          if (t == null)
5822            return this;
5823          if (this.adjudication == null)
5824            this.adjudication = new ArrayList<AdjudicationComponent>();
5825          this.adjudication.add(t);
5826          return this;
5827        }
5828
5829        /**
5830         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
5831         */
5832        public AdjudicationComponent getAdjudicationFirstRep() { 
5833          if (getAdjudication().isEmpty()) {
5834            addAdjudication();
5835          }
5836          return getAdjudication().get(0);
5837        }
5838
5839        /**
5840         * @return {@link #subDetail} (Third tier of goods and services.)
5841         */
5842        public List<SubDetailComponent> getSubDetail() { 
5843          if (this.subDetail == null)
5844            this.subDetail = new ArrayList<SubDetailComponent>();
5845          return this.subDetail;
5846        }
5847
5848        /**
5849         * @return Returns a reference to <code>this</code> for easy method chaining
5850         */
5851        public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) { 
5852          this.subDetail = theSubDetail;
5853          return this;
5854        }
5855
5856        public boolean hasSubDetail() { 
5857          if (this.subDetail == null)
5858            return false;
5859          for (SubDetailComponent item : this.subDetail)
5860            if (!item.isEmpty())
5861              return true;
5862          return false;
5863        }
5864
5865        public SubDetailComponent addSubDetail() { //3
5866          SubDetailComponent t = new SubDetailComponent();
5867          if (this.subDetail == null)
5868            this.subDetail = new ArrayList<SubDetailComponent>();
5869          this.subDetail.add(t);
5870          return t;
5871        }
5872
5873        public DetailComponent addSubDetail(SubDetailComponent t) { //3
5874          if (t == null)
5875            return this;
5876          if (this.subDetail == null)
5877            this.subDetail = new ArrayList<SubDetailComponent>();
5878          this.subDetail.add(t);
5879          return this;
5880        }
5881
5882        /**
5883         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
5884         */
5885        public SubDetailComponent getSubDetailFirstRep() { 
5886          if (getSubDetail().isEmpty()) {
5887            addSubDetail();
5888          }
5889          return getSubDetail().get(0);
5890        }
5891
5892        protected void listChildren(List<Property> children) {
5893          super.listChildren(children);
5894          children.add(new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence));
5895          children.add(new Property("type", "CodeableConcept", "The type of product or service.", 0, 1, type));
5896          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
5897          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
5898          children.add(new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, service));
5899          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
5900          children.add(new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode));
5901          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
5902          children.add(new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice));
5903          children.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor));
5904          children.add(new Property("net", "Money", "The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net));
5905          children.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
5906          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
5907          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
5908          children.add(new Property("subDetail", "", "Third tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
5909        }
5910
5911        @Override
5912        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5913          switch (_hash) {
5914          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence);
5915          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of product or service.", 0, 1, type);
5916          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
5917          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
5918          case 1984153269: /*service*/  return new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, service);
5919          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier);
5920          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode);
5921          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
5922          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice);
5923          case -1282148017: /*factor*/  return new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor);
5924          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net);
5925          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
5926          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
5927          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
5928          case -828829007: /*subDetail*/  return new Property("subDetail", "", "Third tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
5929          default: return super.getNamedProperty(_hash, _name, _checkValid);
5930          }
5931
5932        }
5933
5934      @Override
5935      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5936        switch (hash) {
5937        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
5938        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
5939        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
5940        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
5941        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
5942        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
5943        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
5944        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
5945        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
5946        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
5947        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
5948        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
5949        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
5950        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
5951        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
5952        default: return super.getProperty(hash, name, checkValid);
5953        }
5954
5955      }
5956
5957      @Override
5958      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5959        switch (hash) {
5960        case 1349547969: // sequence
5961          this.sequence = castToPositiveInt(value); // PositiveIntType
5962          return value;
5963        case 3575610: // type
5964          this.type = castToCodeableConcept(value); // CodeableConcept
5965          return value;
5966        case 1099842588: // revenue
5967          this.revenue = castToCodeableConcept(value); // CodeableConcept
5968          return value;
5969        case 50511102: // category
5970          this.category = castToCodeableConcept(value); // CodeableConcept
5971          return value;
5972        case 1984153269: // service
5973          this.service = castToCodeableConcept(value); // CodeableConcept
5974          return value;
5975        case -615513385: // modifier
5976          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
5977          return value;
5978        case 1010065041: // programCode
5979          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
5980          return value;
5981        case -1285004149: // quantity
5982          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
5983          return value;
5984        case -486196699: // unitPrice
5985          this.unitPrice = castToMoney(value); // Money
5986          return value;
5987        case -1282148017: // factor
5988          this.factor = castToDecimal(value); // DecimalType
5989          return value;
5990        case 108957: // net
5991          this.net = castToMoney(value); // Money
5992          return value;
5993        case 115642: // udi
5994          this.getUdi().add(castToReference(value)); // Reference
5995          return value;
5996        case -1110033957: // noteNumber
5997          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
5998          return value;
5999        case -231349275: // adjudication
6000          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
6001          return value;
6002        case -828829007: // subDetail
6003          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
6004          return value;
6005        default: return super.setProperty(hash, name, value);
6006        }
6007
6008      }
6009
6010      @Override
6011      public Base setProperty(String name, Base value) throws FHIRException {
6012        if (name.equals("sequence")) {
6013          this.sequence = castToPositiveInt(value); // PositiveIntType
6014        } else if (name.equals("type")) {
6015          this.type = castToCodeableConcept(value); // CodeableConcept
6016        } else if (name.equals("revenue")) {
6017          this.revenue = castToCodeableConcept(value); // CodeableConcept
6018        } else if (name.equals("category")) {
6019          this.category = castToCodeableConcept(value); // CodeableConcept
6020        } else if (name.equals("service")) {
6021          this.service = castToCodeableConcept(value); // CodeableConcept
6022        } else if (name.equals("modifier")) {
6023          this.getModifier().add(castToCodeableConcept(value));
6024        } else if (name.equals("programCode")) {
6025          this.getProgramCode().add(castToCodeableConcept(value));
6026        } else if (name.equals("quantity")) {
6027          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
6028        } else if (name.equals("unitPrice")) {
6029          this.unitPrice = castToMoney(value); // Money
6030        } else if (name.equals("factor")) {
6031          this.factor = castToDecimal(value); // DecimalType
6032        } else if (name.equals("net")) {
6033          this.net = castToMoney(value); // Money
6034        } else if (name.equals("udi")) {
6035          this.getUdi().add(castToReference(value));
6036        } else if (name.equals("noteNumber")) {
6037          this.getNoteNumber().add(castToPositiveInt(value));
6038        } else if (name.equals("adjudication")) {
6039          this.getAdjudication().add((AdjudicationComponent) value);
6040        } else if (name.equals("subDetail")) {
6041          this.getSubDetail().add((SubDetailComponent) value);
6042        } else
6043          return super.setProperty(name, value);
6044        return value;
6045      }
6046
6047      @Override
6048      public Base makeProperty(int hash, String name) throws FHIRException {
6049        switch (hash) {
6050        case 1349547969:  return getSequenceElement();
6051        case 3575610:  return getType(); 
6052        case 1099842588:  return getRevenue(); 
6053        case 50511102:  return getCategory(); 
6054        case 1984153269:  return getService(); 
6055        case -615513385:  return addModifier(); 
6056        case 1010065041:  return addProgramCode(); 
6057        case -1285004149:  return getQuantity(); 
6058        case -486196699:  return getUnitPrice(); 
6059        case -1282148017:  return getFactorElement();
6060        case 108957:  return getNet(); 
6061        case 115642:  return addUdi(); 
6062        case -1110033957:  return addNoteNumberElement();
6063        case -231349275:  return addAdjudication(); 
6064        case -828829007:  return addSubDetail(); 
6065        default: return super.makeProperty(hash, name);
6066        }
6067
6068      }
6069
6070      @Override
6071      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6072        switch (hash) {
6073        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
6074        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
6075        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
6076        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
6077        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
6078        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
6079        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
6080        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
6081        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6082        case -1282148017: /*factor*/ return new String[] {"decimal"};
6083        case 108957: /*net*/ return new String[] {"Money"};
6084        case 115642: /*udi*/ return new String[] {"Reference"};
6085        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
6086        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
6087        case -828829007: /*subDetail*/ return new String[] {};
6088        default: return super.getTypesForProperty(hash, name);
6089        }
6090
6091      }
6092
6093      @Override
6094      public Base addChild(String name) throws FHIRException {
6095        if (name.equals("sequence")) {
6096          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
6097        }
6098        else if (name.equals("type")) {
6099          this.type = new CodeableConcept();
6100          return this.type;
6101        }
6102        else if (name.equals("revenue")) {
6103          this.revenue = new CodeableConcept();
6104          return this.revenue;
6105        }
6106        else if (name.equals("category")) {
6107          this.category = new CodeableConcept();
6108          return this.category;
6109        }
6110        else if (name.equals("service")) {
6111          this.service = new CodeableConcept();
6112          return this.service;
6113        }
6114        else if (name.equals("modifier")) {
6115          return addModifier();
6116        }
6117        else if (name.equals("programCode")) {
6118          return addProgramCode();
6119        }
6120        else if (name.equals("quantity")) {
6121          this.quantity = new SimpleQuantity();
6122          return this.quantity;
6123        }
6124        else if (name.equals("unitPrice")) {
6125          this.unitPrice = new Money();
6126          return this.unitPrice;
6127        }
6128        else if (name.equals("factor")) {
6129          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
6130        }
6131        else if (name.equals("net")) {
6132          this.net = new Money();
6133          return this.net;
6134        }
6135        else if (name.equals("udi")) {
6136          return addUdi();
6137        }
6138        else if (name.equals("noteNumber")) {
6139          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
6140        }
6141        else if (name.equals("adjudication")) {
6142          return addAdjudication();
6143        }
6144        else if (name.equals("subDetail")) {
6145          return addSubDetail();
6146        }
6147        else
6148          return super.addChild(name);
6149      }
6150
6151      public DetailComponent copy() {
6152        DetailComponent dst = new DetailComponent();
6153        copyValues(dst);
6154        dst.sequence = sequence == null ? null : sequence.copy();
6155        dst.type = type == null ? null : type.copy();
6156        dst.revenue = revenue == null ? null : revenue.copy();
6157        dst.category = category == null ? null : category.copy();
6158        dst.service = service == null ? null : service.copy();
6159        if (modifier != null) {
6160          dst.modifier = new ArrayList<CodeableConcept>();
6161          for (CodeableConcept i : modifier)
6162            dst.modifier.add(i.copy());
6163        };
6164        if (programCode != null) {
6165          dst.programCode = new ArrayList<CodeableConcept>();
6166          for (CodeableConcept i : programCode)
6167            dst.programCode.add(i.copy());
6168        };
6169        dst.quantity = quantity == null ? null : quantity.copy();
6170        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6171        dst.factor = factor == null ? null : factor.copy();
6172        dst.net = net == null ? null : net.copy();
6173        if (udi != null) {
6174          dst.udi = new ArrayList<Reference>();
6175          for (Reference i : udi)
6176            dst.udi.add(i.copy());
6177        };
6178        if (noteNumber != null) {
6179          dst.noteNumber = new ArrayList<PositiveIntType>();
6180          for (PositiveIntType i : noteNumber)
6181            dst.noteNumber.add(i.copy());
6182        };
6183        if (adjudication != null) {
6184          dst.adjudication = new ArrayList<AdjudicationComponent>();
6185          for (AdjudicationComponent i : adjudication)
6186            dst.adjudication.add(i.copy());
6187        };
6188        if (subDetail != null) {
6189          dst.subDetail = new ArrayList<SubDetailComponent>();
6190          for (SubDetailComponent i : subDetail)
6191            dst.subDetail.add(i.copy());
6192        };
6193        return dst;
6194      }
6195
6196      @Override
6197      public boolean equalsDeep(Base other_) {
6198        if (!super.equalsDeep(other_))
6199          return false;
6200        if (!(other_ instanceof DetailComponent))
6201          return false;
6202        DetailComponent o = (DetailComponent) other_;
6203        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(revenue, o.revenue, true)
6204           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
6205           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
6206           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6207           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
6208           && compareDeep(subDetail, o.subDetail, true);
6209      }
6210
6211      @Override
6212      public boolean equalsShallow(Base other_) {
6213        if (!super.equalsShallow(other_))
6214          return false;
6215        if (!(other_ instanceof DetailComponent))
6216          return false;
6217        DetailComponent o = (DetailComponent) other_;
6218        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
6219          ;
6220      }
6221
6222      public boolean isEmpty() {
6223        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, revenue
6224          , category, service, modifier, programCode, quantity, unitPrice, factor, net
6225          , udi, noteNumber, adjudication, subDetail);
6226      }
6227
6228  public String fhirType() {
6229    return "ExplanationOfBenefit.item.detail";
6230
6231  }
6232
6233  }
6234
6235    @Block()
6236    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
6237        /**
6238         * A service line number.
6239         */
6240        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
6241        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
6242        protected PositiveIntType sequence;
6243
6244        /**
6245         * The type of product or service.
6246         */
6247        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
6248        @Description(shortDefinition="Type of product or service", formalDefinition="The type of product or service." )
6249        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActInvoiceGroupCode")
6250        protected CodeableConcept type;
6251
6252        /**
6253         * The type of reveneu or cost center providing the product and/or service.
6254         */
6255        @Child(name = "revenue", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
6256        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
6257        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
6258        protected CodeableConcept revenue;
6259
6260        /**
6261         * Health Care Service Type Codes  to identify the classification of service or benefits.
6262         */
6263        @Child(name = "category", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
6264        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
6265        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
6266        protected CodeableConcept category;
6267
6268        /**
6269         * A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).
6270         */
6271        @Child(name = "service", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
6272        @Description(shortDefinition="Billing Code", formalDefinition="A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI)." )
6273        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6274        protected CodeableConcept service;
6275
6276        /**
6277         * Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.
6278         */
6279        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6280        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours." )
6281        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
6282        protected List<CodeableConcept> modifier;
6283
6284        /**
6285         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
6286         */
6287        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6288        @Description(shortDefinition="Program specific reason for item inclusion", formalDefinition="For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program." )
6289        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
6290        protected List<CodeableConcept> programCode;
6291
6292        /**
6293         * The number of repetitions of a service or product.
6294         */
6295        @Child(name = "quantity", type = {SimpleQuantity.class}, order=8, min=0, max=1, modifier=false, summary=false)
6296        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
6297        protected SimpleQuantity quantity;
6298
6299        /**
6300         * The fee for an addittional service or product or charge.
6301         */
6302        @Child(name = "unitPrice", type = {Money.class}, order=9, min=0, max=1, modifier=false, summary=false)
6303        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="The fee for an addittional service or product or charge." )
6304        protected Money unitPrice;
6305
6306        /**
6307         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
6308         */
6309        @Child(name = "factor", type = {DecimalType.class}, order=10, min=0, max=1, modifier=false, summary=false)
6310        @Description(shortDefinition="Price scaling factor", formalDefinition="A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount." )
6311        protected DecimalType factor;
6312
6313        /**
6314         * The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
6315         */
6316        @Child(name = "net", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=false)
6317        @Description(shortDefinition="Net additional item cost", formalDefinition="The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
6318        protected Money net;
6319
6320        /**
6321         * List of Unique Device Identifiers associated with this line item.
6322         */
6323        @Child(name = "udi", type = {Device.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6324        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
6325        protected List<Reference> udi;
6326        /**
6327         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
6328         */
6329        protected List<Device> udiTarget;
6330
6331
6332        /**
6333         * A list of note references to the notes provided below.
6334         */
6335        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6336        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
6337        protected List<PositiveIntType> noteNumber;
6338
6339        /**
6340         * The adjudications results.
6341         */
6342        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6343        @Description(shortDefinition="Language if different from the resource", formalDefinition="The adjudications results." )
6344        protected List<AdjudicationComponent> adjudication;
6345
6346        private static final long serialVersionUID = 1621872130L;
6347
6348    /**
6349     * Constructor
6350     */
6351      public SubDetailComponent() {
6352        super();
6353      }
6354
6355    /**
6356     * Constructor
6357     */
6358      public SubDetailComponent(PositiveIntType sequence, CodeableConcept type) {
6359        super();
6360        this.sequence = sequence;
6361        this.type = type;
6362      }
6363
6364        /**
6365         * @return {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
6366         */
6367        public PositiveIntType getSequenceElement() { 
6368          if (this.sequence == null)
6369            if (Configuration.errorOnAutoCreate())
6370              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
6371            else if (Configuration.doAutoCreate())
6372              this.sequence = new PositiveIntType(); // bb
6373          return this.sequence;
6374        }
6375
6376        public boolean hasSequenceElement() { 
6377          return this.sequence != null && !this.sequence.isEmpty();
6378        }
6379
6380        public boolean hasSequence() { 
6381          return this.sequence != null && !this.sequence.isEmpty();
6382        }
6383
6384        /**
6385         * @param value {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
6386         */
6387        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
6388          this.sequence = value;
6389          return this;
6390        }
6391
6392        /**
6393         * @return A service line number.
6394         */
6395        public int getSequence() { 
6396          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6397        }
6398
6399        /**
6400         * @param value A service line number.
6401         */
6402        public SubDetailComponent setSequence(int value) { 
6403            if (this.sequence == null)
6404              this.sequence = new PositiveIntType();
6405            this.sequence.setValue(value);
6406          return this;
6407        }
6408
6409        /**
6410         * @return {@link #type} (The type of product or service.)
6411         */
6412        public CodeableConcept getType() { 
6413          if (this.type == null)
6414            if (Configuration.errorOnAutoCreate())
6415              throw new Error("Attempt to auto-create SubDetailComponent.type");
6416            else if (Configuration.doAutoCreate())
6417              this.type = new CodeableConcept(); // cc
6418          return this.type;
6419        }
6420
6421        public boolean hasType() { 
6422          return this.type != null && !this.type.isEmpty();
6423        }
6424
6425        /**
6426         * @param value {@link #type} (The type of product or service.)
6427         */
6428        public SubDetailComponent setType(CodeableConcept value)  { 
6429          this.type = value;
6430          return this;
6431        }
6432
6433        /**
6434         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
6435         */
6436        public CodeableConcept getRevenue() { 
6437          if (this.revenue == null)
6438            if (Configuration.errorOnAutoCreate())
6439              throw new Error("Attempt to auto-create SubDetailComponent.revenue");
6440            else if (Configuration.doAutoCreate())
6441              this.revenue = new CodeableConcept(); // cc
6442          return this.revenue;
6443        }
6444
6445        public boolean hasRevenue() { 
6446          return this.revenue != null && !this.revenue.isEmpty();
6447        }
6448
6449        /**
6450         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
6451         */
6452        public SubDetailComponent setRevenue(CodeableConcept value)  { 
6453          this.revenue = value;
6454          return this;
6455        }
6456
6457        /**
6458         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
6459         */
6460        public CodeableConcept getCategory() { 
6461          if (this.category == null)
6462            if (Configuration.errorOnAutoCreate())
6463              throw new Error("Attempt to auto-create SubDetailComponent.category");
6464            else if (Configuration.doAutoCreate())
6465              this.category = new CodeableConcept(); // cc
6466          return this.category;
6467        }
6468
6469        public boolean hasCategory() { 
6470          return this.category != null && !this.category.isEmpty();
6471        }
6472
6473        /**
6474         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
6475         */
6476        public SubDetailComponent setCategory(CodeableConcept value)  { 
6477          this.category = value;
6478          return this;
6479        }
6480
6481        /**
6482         * @return {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
6483         */
6484        public CodeableConcept getService() { 
6485          if (this.service == null)
6486            if (Configuration.errorOnAutoCreate())
6487              throw new Error("Attempt to auto-create SubDetailComponent.service");
6488            else if (Configuration.doAutoCreate())
6489              this.service = new CodeableConcept(); // cc
6490          return this.service;
6491        }
6492
6493        public boolean hasService() { 
6494          return this.service != null && !this.service.isEmpty();
6495        }
6496
6497        /**
6498         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
6499         */
6500        public SubDetailComponent setService(CodeableConcept value)  { 
6501          this.service = value;
6502          return this;
6503        }
6504
6505        /**
6506         * @return {@link #modifier} (Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.)
6507         */
6508        public List<CodeableConcept> getModifier() { 
6509          if (this.modifier == null)
6510            this.modifier = new ArrayList<CodeableConcept>();
6511          return this.modifier;
6512        }
6513
6514        /**
6515         * @return Returns a reference to <code>this</code> for easy method chaining
6516         */
6517        public SubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
6518          this.modifier = theModifier;
6519          return this;
6520        }
6521
6522        public boolean hasModifier() { 
6523          if (this.modifier == null)
6524            return false;
6525          for (CodeableConcept item : this.modifier)
6526            if (!item.isEmpty())
6527              return true;
6528          return false;
6529        }
6530
6531        public CodeableConcept addModifier() { //3
6532          CodeableConcept t = new CodeableConcept();
6533          if (this.modifier == null)
6534            this.modifier = new ArrayList<CodeableConcept>();
6535          this.modifier.add(t);
6536          return t;
6537        }
6538
6539        public SubDetailComponent addModifier(CodeableConcept t) { //3
6540          if (t == null)
6541            return this;
6542          if (this.modifier == null)
6543            this.modifier = new ArrayList<CodeableConcept>();
6544          this.modifier.add(t);
6545          return this;
6546        }
6547
6548        /**
6549         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
6550         */
6551        public CodeableConcept getModifierFirstRep() { 
6552          if (getModifier().isEmpty()) {
6553            addModifier();
6554          }
6555          return getModifier().get(0);
6556        }
6557
6558        /**
6559         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
6560         */
6561        public List<CodeableConcept> getProgramCode() { 
6562          if (this.programCode == null)
6563            this.programCode = new ArrayList<CodeableConcept>();
6564          return this.programCode;
6565        }
6566
6567        /**
6568         * @return Returns a reference to <code>this</code> for easy method chaining
6569         */
6570        public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
6571          this.programCode = theProgramCode;
6572          return this;
6573        }
6574
6575        public boolean hasProgramCode() { 
6576          if (this.programCode == null)
6577            return false;
6578          for (CodeableConcept item : this.programCode)
6579            if (!item.isEmpty())
6580              return true;
6581          return false;
6582        }
6583
6584        public CodeableConcept addProgramCode() { //3
6585          CodeableConcept t = new CodeableConcept();
6586          if (this.programCode == null)
6587            this.programCode = new ArrayList<CodeableConcept>();
6588          this.programCode.add(t);
6589          return t;
6590        }
6591
6592        public SubDetailComponent addProgramCode(CodeableConcept t) { //3
6593          if (t == null)
6594            return this;
6595          if (this.programCode == null)
6596            this.programCode = new ArrayList<CodeableConcept>();
6597          this.programCode.add(t);
6598          return this;
6599        }
6600
6601        /**
6602         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
6603         */
6604        public CodeableConcept getProgramCodeFirstRep() { 
6605          if (getProgramCode().isEmpty()) {
6606            addProgramCode();
6607          }
6608          return getProgramCode().get(0);
6609        }
6610
6611        /**
6612         * @return {@link #quantity} (The number of repetitions of a service or product.)
6613         */
6614        public SimpleQuantity getQuantity() { 
6615          if (this.quantity == null)
6616            if (Configuration.errorOnAutoCreate())
6617              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
6618            else if (Configuration.doAutoCreate())
6619              this.quantity = new SimpleQuantity(); // cc
6620          return this.quantity;
6621        }
6622
6623        public boolean hasQuantity() { 
6624          return this.quantity != null && !this.quantity.isEmpty();
6625        }
6626
6627        /**
6628         * @param value {@link #quantity} (The number of repetitions of a service or product.)
6629         */
6630        public SubDetailComponent setQuantity(SimpleQuantity value)  { 
6631          this.quantity = value;
6632          return this;
6633        }
6634
6635        /**
6636         * @return {@link #unitPrice} (The fee for an addittional service or product or charge.)
6637         */
6638        public Money getUnitPrice() { 
6639          if (this.unitPrice == null)
6640            if (Configuration.errorOnAutoCreate())
6641              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
6642            else if (Configuration.doAutoCreate())
6643              this.unitPrice = new Money(); // cc
6644          return this.unitPrice;
6645        }
6646
6647        public boolean hasUnitPrice() { 
6648          return this.unitPrice != null && !this.unitPrice.isEmpty();
6649        }
6650
6651        /**
6652         * @param value {@link #unitPrice} (The fee for an addittional service or product or charge.)
6653         */
6654        public SubDetailComponent setUnitPrice(Money value)  { 
6655          this.unitPrice = value;
6656          return this;
6657        }
6658
6659        /**
6660         * @return {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
6661         */
6662        public DecimalType getFactorElement() { 
6663          if (this.factor == null)
6664            if (Configuration.errorOnAutoCreate())
6665              throw new Error("Attempt to auto-create SubDetailComponent.factor");
6666            else if (Configuration.doAutoCreate())
6667              this.factor = new DecimalType(); // bb
6668          return this.factor;
6669        }
6670
6671        public boolean hasFactorElement() { 
6672          return this.factor != null && !this.factor.isEmpty();
6673        }
6674
6675        public boolean hasFactor() { 
6676          return this.factor != null && !this.factor.isEmpty();
6677        }
6678
6679        /**
6680         * @param value {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
6681         */
6682        public SubDetailComponent setFactorElement(DecimalType value) { 
6683          this.factor = value;
6684          return this;
6685        }
6686
6687        /**
6688         * @return A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
6689         */
6690        public BigDecimal getFactor() { 
6691          return this.factor == null ? null : this.factor.getValue();
6692        }
6693
6694        /**
6695         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
6696         */
6697        public SubDetailComponent setFactor(BigDecimal value) { 
6698          if (value == null)
6699            this.factor = null;
6700          else {
6701            if (this.factor == null)
6702              this.factor = new DecimalType();
6703            this.factor.setValue(value);
6704          }
6705          return this;
6706        }
6707
6708        /**
6709         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
6710         */
6711        public SubDetailComponent setFactor(long value) { 
6712              this.factor = new DecimalType();
6713            this.factor.setValue(value);
6714          return this;
6715        }
6716
6717        /**
6718         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
6719         */
6720        public SubDetailComponent setFactor(double value) { 
6721              this.factor = new DecimalType();
6722            this.factor.setValue(value);
6723          return this;
6724        }
6725
6726        /**
6727         * @return {@link #net} (The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
6728         */
6729        public Money getNet() { 
6730          if (this.net == null)
6731            if (Configuration.errorOnAutoCreate())
6732              throw new Error("Attempt to auto-create SubDetailComponent.net");
6733            else if (Configuration.doAutoCreate())
6734              this.net = new Money(); // cc
6735          return this.net;
6736        }
6737
6738        public boolean hasNet() { 
6739          return this.net != null && !this.net.isEmpty();
6740        }
6741
6742        /**
6743         * @param value {@link #net} (The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
6744         */
6745        public SubDetailComponent setNet(Money value)  { 
6746          this.net = value;
6747          return this;
6748        }
6749
6750        /**
6751         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
6752         */
6753        public List<Reference> getUdi() { 
6754          if (this.udi == null)
6755            this.udi = new ArrayList<Reference>();
6756          return this.udi;
6757        }
6758
6759        /**
6760         * @return Returns a reference to <code>this</code> for easy method chaining
6761         */
6762        public SubDetailComponent setUdi(List<Reference> theUdi) { 
6763          this.udi = theUdi;
6764          return this;
6765        }
6766
6767        public boolean hasUdi() { 
6768          if (this.udi == null)
6769            return false;
6770          for (Reference item : this.udi)
6771            if (!item.isEmpty())
6772              return true;
6773          return false;
6774        }
6775
6776        public Reference addUdi() { //3
6777          Reference t = new Reference();
6778          if (this.udi == null)
6779            this.udi = new ArrayList<Reference>();
6780          this.udi.add(t);
6781          return t;
6782        }
6783
6784        public SubDetailComponent addUdi(Reference t) { //3
6785          if (t == null)
6786            return this;
6787          if (this.udi == null)
6788            this.udi = new ArrayList<Reference>();
6789          this.udi.add(t);
6790          return this;
6791        }
6792
6793        /**
6794         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
6795         */
6796        public Reference getUdiFirstRep() { 
6797          if (getUdi().isEmpty()) {
6798            addUdi();
6799          }
6800          return getUdi().get(0);
6801        }
6802
6803        /**
6804         * @deprecated Use Reference#setResource(IBaseResource) instead
6805         */
6806        @Deprecated
6807        public List<Device> getUdiTarget() { 
6808          if (this.udiTarget == null)
6809            this.udiTarget = new ArrayList<Device>();
6810          return this.udiTarget;
6811        }
6812
6813        /**
6814         * @deprecated Use Reference#setResource(IBaseResource) instead
6815         */
6816        @Deprecated
6817        public Device addUdiTarget() { 
6818          Device r = new Device();
6819          if (this.udiTarget == null)
6820            this.udiTarget = new ArrayList<Device>();
6821          this.udiTarget.add(r);
6822          return r;
6823        }
6824
6825        /**
6826         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
6827         */
6828        public List<PositiveIntType> getNoteNumber() { 
6829          if (this.noteNumber == null)
6830            this.noteNumber = new ArrayList<PositiveIntType>();
6831          return this.noteNumber;
6832        }
6833
6834        /**
6835         * @return Returns a reference to <code>this</code> for easy method chaining
6836         */
6837        public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
6838          this.noteNumber = theNoteNumber;
6839          return this;
6840        }
6841
6842        public boolean hasNoteNumber() { 
6843          if (this.noteNumber == null)
6844            return false;
6845          for (PositiveIntType item : this.noteNumber)
6846            if (!item.isEmpty())
6847              return true;
6848          return false;
6849        }
6850
6851        /**
6852         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
6853         */
6854        public PositiveIntType addNoteNumberElement() {//2 
6855          PositiveIntType t = new PositiveIntType();
6856          if (this.noteNumber == null)
6857            this.noteNumber = new ArrayList<PositiveIntType>();
6858          this.noteNumber.add(t);
6859          return t;
6860        }
6861
6862        /**
6863         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
6864         */
6865        public SubDetailComponent addNoteNumber(int value) { //1
6866          PositiveIntType t = new PositiveIntType();
6867          t.setValue(value);
6868          if (this.noteNumber == null)
6869            this.noteNumber = new ArrayList<PositiveIntType>();
6870          this.noteNumber.add(t);
6871          return this;
6872        }
6873
6874        /**
6875         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
6876         */
6877        public boolean hasNoteNumber(int value) { 
6878          if (this.noteNumber == null)
6879            return false;
6880          for (PositiveIntType v : this.noteNumber)
6881            if (v.getValue().equals(value)) // positiveInt
6882              return true;
6883          return false;
6884        }
6885
6886        /**
6887         * @return {@link #adjudication} (The adjudications results.)
6888         */
6889        public List<AdjudicationComponent> getAdjudication() { 
6890          if (this.adjudication == null)
6891            this.adjudication = new ArrayList<AdjudicationComponent>();
6892          return this.adjudication;
6893        }
6894
6895        /**
6896         * @return Returns a reference to <code>this</code> for easy method chaining
6897         */
6898        public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
6899          this.adjudication = theAdjudication;
6900          return this;
6901        }
6902
6903        public boolean hasAdjudication() { 
6904          if (this.adjudication == null)
6905            return false;
6906          for (AdjudicationComponent item : this.adjudication)
6907            if (!item.isEmpty())
6908              return true;
6909          return false;
6910        }
6911
6912        public AdjudicationComponent addAdjudication() { //3
6913          AdjudicationComponent t = new AdjudicationComponent();
6914          if (this.adjudication == null)
6915            this.adjudication = new ArrayList<AdjudicationComponent>();
6916          this.adjudication.add(t);
6917          return t;
6918        }
6919
6920        public SubDetailComponent addAdjudication(AdjudicationComponent t) { //3
6921          if (t == null)
6922            return this;
6923          if (this.adjudication == null)
6924            this.adjudication = new ArrayList<AdjudicationComponent>();
6925          this.adjudication.add(t);
6926          return this;
6927        }
6928
6929        /**
6930         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
6931         */
6932        public AdjudicationComponent getAdjudicationFirstRep() { 
6933          if (getAdjudication().isEmpty()) {
6934            addAdjudication();
6935          }
6936          return getAdjudication().get(0);
6937        }
6938
6939        protected void listChildren(List<Property> children) {
6940          super.listChildren(children);
6941          children.add(new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence));
6942          children.add(new Property("type", "CodeableConcept", "The type of product or service.", 0, 1, type));
6943          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
6944          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
6945          children.add(new Property("service", "CodeableConcept", "A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).", 0, 1, service));
6946          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
6947          children.add(new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode));
6948          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
6949          children.add(new Property("unitPrice", "Money", "The fee for an addittional service or product or charge.", 0, 1, unitPrice));
6950          children.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor));
6951          children.add(new Property("net", "Money", "The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net));
6952          children.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
6953          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
6954          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6955        }
6956
6957        @Override
6958        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6959          switch (_hash) {
6960          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence);
6961          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of product or service.", 0, 1, type);
6962          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
6963          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
6964          case 1984153269: /*service*/  return new Property("service", "CodeableConcept", "A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).", 0, 1, service);
6965          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier);
6966          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode);
6967          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
6968          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "The fee for an addittional service or product or charge.", 0, 1, unitPrice);
6969          case -1282148017: /*factor*/  return new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor);
6970          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net);
6971          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
6972          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
6973          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6974          default: return super.getNamedProperty(_hash, _name, _checkValid);
6975          }
6976
6977        }
6978
6979      @Override
6980      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6981        switch (hash) {
6982        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6983        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
6984        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6985        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6986        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
6987        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6988        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6989        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
6990        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6991        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6992        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6993        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6994        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
6995        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
6996        default: return super.getProperty(hash, name, checkValid);
6997        }
6998
6999      }
7000
7001      @Override
7002      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7003        switch (hash) {
7004        case 1349547969: // sequence
7005          this.sequence = castToPositiveInt(value); // PositiveIntType
7006          return value;
7007        case 3575610: // type
7008          this.type = castToCodeableConcept(value); // CodeableConcept
7009          return value;
7010        case 1099842588: // revenue
7011          this.revenue = castToCodeableConcept(value); // CodeableConcept
7012          return value;
7013        case 50511102: // category
7014          this.category = castToCodeableConcept(value); // CodeableConcept
7015          return value;
7016        case 1984153269: // service
7017          this.service = castToCodeableConcept(value); // CodeableConcept
7018          return value;
7019        case -615513385: // modifier
7020          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7021          return value;
7022        case 1010065041: // programCode
7023          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
7024          return value;
7025        case -1285004149: // quantity
7026          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
7027          return value;
7028        case -486196699: // unitPrice
7029          this.unitPrice = castToMoney(value); // Money
7030          return value;
7031        case -1282148017: // factor
7032          this.factor = castToDecimal(value); // DecimalType
7033          return value;
7034        case 108957: // net
7035          this.net = castToMoney(value); // Money
7036          return value;
7037        case 115642: // udi
7038          this.getUdi().add(castToReference(value)); // Reference
7039          return value;
7040        case -1110033957: // noteNumber
7041          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
7042          return value;
7043        case -231349275: // adjudication
7044          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7045          return value;
7046        default: return super.setProperty(hash, name, value);
7047        }
7048
7049      }
7050
7051      @Override
7052      public Base setProperty(String name, Base value) throws FHIRException {
7053        if (name.equals("sequence")) {
7054          this.sequence = castToPositiveInt(value); // PositiveIntType
7055        } else if (name.equals("type")) {
7056          this.type = castToCodeableConcept(value); // CodeableConcept
7057        } else if (name.equals("revenue")) {
7058          this.revenue = castToCodeableConcept(value); // CodeableConcept
7059        } else if (name.equals("category")) {
7060          this.category = castToCodeableConcept(value); // CodeableConcept
7061        } else if (name.equals("service")) {
7062          this.service = castToCodeableConcept(value); // CodeableConcept
7063        } else if (name.equals("modifier")) {
7064          this.getModifier().add(castToCodeableConcept(value));
7065        } else if (name.equals("programCode")) {
7066          this.getProgramCode().add(castToCodeableConcept(value));
7067        } else if (name.equals("quantity")) {
7068          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
7069        } else if (name.equals("unitPrice")) {
7070          this.unitPrice = castToMoney(value); // Money
7071        } else if (name.equals("factor")) {
7072          this.factor = castToDecimal(value); // DecimalType
7073        } else if (name.equals("net")) {
7074          this.net = castToMoney(value); // Money
7075        } else if (name.equals("udi")) {
7076          this.getUdi().add(castToReference(value));
7077        } else if (name.equals("noteNumber")) {
7078          this.getNoteNumber().add(castToPositiveInt(value));
7079        } else if (name.equals("adjudication")) {
7080          this.getAdjudication().add((AdjudicationComponent) value);
7081        } else
7082          return super.setProperty(name, value);
7083        return value;
7084      }
7085
7086      @Override
7087      public Base makeProperty(int hash, String name) throws FHIRException {
7088        switch (hash) {
7089        case 1349547969:  return getSequenceElement();
7090        case 3575610:  return getType(); 
7091        case 1099842588:  return getRevenue(); 
7092        case 50511102:  return getCategory(); 
7093        case 1984153269:  return getService(); 
7094        case -615513385:  return addModifier(); 
7095        case 1010065041:  return addProgramCode(); 
7096        case -1285004149:  return getQuantity(); 
7097        case -486196699:  return getUnitPrice(); 
7098        case -1282148017:  return getFactorElement();
7099        case 108957:  return getNet(); 
7100        case 115642:  return addUdi(); 
7101        case -1110033957:  return addNoteNumberElement();
7102        case -231349275:  return addAdjudication(); 
7103        default: return super.makeProperty(hash, name);
7104        }
7105
7106      }
7107
7108      @Override
7109      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7110        switch (hash) {
7111        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
7112        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
7113        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7114        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7115        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
7116        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7117        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
7118        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
7119        case -486196699: /*unitPrice*/ return new String[] {"Money"};
7120        case -1282148017: /*factor*/ return new String[] {"decimal"};
7121        case 108957: /*net*/ return new String[] {"Money"};
7122        case 115642: /*udi*/ return new String[] {"Reference"};
7123        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7124        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7125        default: return super.getTypesForProperty(hash, name);
7126        }
7127
7128      }
7129
7130      @Override
7131      public Base addChild(String name) throws FHIRException {
7132        if (name.equals("sequence")) {
7133          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
7134        }
7135        else if (name.equals("type")) {
7136          this.type = new CodeableConcept();
7137          return this.type;
7138        }
7139        else if (name.equals("revenue")) {
7140          this.revenue = new CodeableConcept();
7141          return this.revenue;
7142        }
7143        else if (name.equals("category")) {
7144          this.category = new CodeableConcept();
7145          return this.category;
7146        }
7147        else if (name.equals("service")) {
7148          this.service = new CodeableConcept();
7149          return this.service;
7150        }
7151        else if (name.equals("modifier")) {
7152          return addModifier();
7153        }
7154        else if (name.equals("programCode")) {
7155          return addProgramCode();
7156        }
7157        else if (name.equals("quantity")) {
7158          this.quantity = new SimpleQuantity();
7159          return this.quantity;
7160        }
7161        else if (name.equals("unitPrice")) {
7162          this.unitPrice = new Money();
7163          return this.unitPrice;
7164        }
7165        else if (name.equals("factor")) {
7166          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
7167        }
7168        else if (name.equals("net")) {
7169          this.net = new Money();
7170          return this.net;
7171        }
7172        else if (name.equals("udi")) {
7173          return addUdi();
7174        }
7175        else if (name.equals("noteNumber")) {
7176          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
7177        }
7178        else if (name.equals("adjudication")) {
7179          return addAdjudication();
7180        }
7181        else
7182          return super.addChild(name);
7183      }
7184
7185      public SubDetailComponent copy() {
7186        SubDetailComponent dst = new SubDetailComponent();
7187        copyValues(dst);
7188        dst.sequence = sequence == null ? null : sequence.copy();
7189        dst.type = type == null ? null : type.copy();
7190        dst.revenue = revenue == null ? null : revenue.copy();
7191        dst.category = category == null ? null : category.copy();
7192        dst.service = service == null ? null : service.copy();
7193        if (modifier != null) {
7194          dst.modifier = new ArrayList<CodeableConcept>();
7195          for (CodeableConcept i : modifier)
7196            dst.modifier.add(i.copy());
7197        };
7198        if (programCode != null) {
7199          dst.programCode = new ArrayList<CodeableConcept>();
7200          for (CodeableConcept i : programCode)
7201            dst.programCode.add(i.copy());
7202        };
7203        dst.quantity = quantity == null ? null : quantity.copy();
7204        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7205        dst.factor = factor == null ? null : factor.copy();
7206        dst.net = net == null ? null : net.copy();
7207        if (udi != null) {
7208          dst.udi = new ArrayList<Reference>();
7209          for (Reference i : udi)
7210            dst.udi.add(i.copy());
7211        };
7212        if (noteNumber != null) {
7213          dst.noteNumber = new ArrayList<PositiveIntType>();
7214          for (PositiveIntType i : noteNumber)
7215            dst.noteNumber.add(i.copy());
7216        };
7217        if (adjudication != null) {
7218          dst.adjudication = new ArrayList<AdjudicationComponent>();
7219          for (AdjudicationComponent i : adjudication)
7220            dst.adjudication.add(i.copy());
7221        };
7222        return dst;
7223      }
7224
7225      @Override
7226      public boolean equalsDeep(Base other_) {
7227        if (!super.equalsDeep(other_))
7228          return false;
7229        if (!(other_ instanceof SubDetailComponent))
7230          return false;
7231        SubDetailComponent o = (SubDetailComponent) other_;
7232        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(revenue, o.revenue, true)
7233           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
7234           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
7235           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
7236           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
7237          ;
7238      }
7239
7240      @Override
7241      public boolean equalsShallow(Base other_) {
7242        if (!super.equalsShallow(other_))
7243          return false;
7244        if (!(other_ instanceof SubDetailComponent))
7245          return false;
7246        SubDetailComponent o = (SubDetailComponent) other_;
7247        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
7248          ;
7249      }
7250
7251      public boolean isEmpty() {
7252        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, revenue
7253          , category, service, modifier, programCode, quantity, unitPrice, factor, net
7254          , udi, noteNumber, adjudication);
7255      }
7256
7257  public String fhirType() {
7258    return "ExplanationOfBenefit.item.detail.subDetail";
7259
7260  }
7261
7262  }
7263
7264    @Block()
7265    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
7266        /**
7267         * List of input service items which this service line is intended to replace.
7268         */
7269        @Child(name = "sequenceLinkId", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7270        @Description(shortDefinition="Service instances", formalDefinition="List of input service items which this service line is intended to replace." )
7271        protected List<PositiveIntType> sequenceLinkId;
7272
7273        /**
7274         * The type of reveneu or cost center providing the product and/or service.
7275         */
7276        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
7277        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
7278        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
7279        protected CodeableConcept revenue;
7280
7281        /**
7282         * Health Care Service Type Codes  to identify the classification of service or benefits.
7283         */
7284        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
7285        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
7286        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
7287        protected CodeableConcept category;
7288
7289        /**
7290         * If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.
7291         */
7292        @Child(name = "service", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
7293        @Description(shortDefinition="Billing Code", formalDefinition="If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'." )
7294        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7295        protected CodeableConcept service;
7296
7297        /**
7298         * Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.
7299         */
7300        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7301        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours." )
7302        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
7303        protected List<CodeableConcept> modifier;
7304
7305        /**
7306         * The fee charged for the professional service or product.
7307         */
7308        @Child(name = "fee", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
7309        @Description(shortDefinition="Professional fee or Product charge", formalDefinition="The fee charged for the professional service or product." )
7310        protected Money fee;
7311
7312        /**
7313         * A list of note references to the notes provided below.
7314         */
7315        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7316        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
7317        protected List<PositiveIntType> noteNumber;
7318
7319        /**
7320         * The adjudications results.
7321         */
7322        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7323        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudications results." )
7324        protected List<AdjudicationComponent> adjudication;
7325
7326        /**
7327         * The second tier service adjudications for payor added services.
7328         */
7329        @Child(name = "detail", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7330        @Description(shortDefinition="Added items details", formalDefinition="The second tier service adjudications for payor added services." )
7331        protected List<AddedItemsDetailComponent> detail;
7332
7333        private static final long serialVersionUID = 1969703165L;
7334
7335    /**
7336     * Constructor
7337     */
7338      public AddedItemComponent() {
7339        super();
7340      }
7341
7342        /**
7343         * @return {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
7344         */
7345        public List<PositiveIntType> getSequenceLinkId() { 
7346          if (this.sequenceLinkId == null)
7347            this.sequenceLinkId = new ArrayList<PositiveIntType>();
7348          return this.sequenceLinkId;
7349        }
7350
7351        /**
7352         * @return Returns a reference to <code>this</code> for easy method chaining
7353         */
7354        public AddedItemComponent setSequenceLinkId(List<PositiveIntType> theSequenceLinkId) { 
7355          this.sequenceLinkId = theSequenceLinkId;
7356          return this;
7357        }
7358
7359        public boolean hasSequenceLinkId() { 
7360          if (this.sequenceLinkId == null)
7361            return false;
7362          for (PositiveIntType item : this.sequenceLinkId)
7363            if (!item.isEmpty())
7364              return true;
7365          return false;
7366        }
7367
7368        /**
7369         * @return {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
7370         */
7371        public PositiveIntType addSequenceLinkIdElement() {//2 
7372          PositiveIntType t = new PositiveIntType();
7373          if (this.sequenceLinkId == null)
7374            this.sequenceLinkId = new ArrayList<PositiveIntType>();
7375          this.sequenceLinkId.add(t);
7376          return t;
7377        }
7378
7379        /**
7380         * @param value {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
7381         */
7382        public AddedItemComponent addSequenceLinkId(int value) { //1
7383          PositiveIntType t = new PositiveIntType();
7384          t.setValue(value);
7385          if (this.sequenceLinkId == null)
7386            this.sequenceLinkId = new ArrayList<PositiveIntType>();
7387          this.sequenceLinkId.add(t);
7388          return this;
7389        }
7390
7391        /**
7392         * @param value {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
7393         */
7394        public boolean hasSequenceLinkId(int value) { 
7395          if (this.sequenceLinkId == null)
7396            return false;
7397          for (PositiveIntType v : this.sequenceLinkId)
7398            if (v.getValue().equals(value)) // positiveInt
7399              return true;
7400          return false;
7401        }
7402
7403        /**
7404         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
7405         */
7406        public CodeableConcept getRevenue() { 
7407          if (this.revenue == null)
7408            if (Configuration.errorOnAutoCreate())
7409              throw new Error("Attempt to auto-create AddedItemComponent.revenue");
7410            else if (Configuration.doAutoCreate())
7411              this.revenue = new CodeableConcept(); // cc
7412          return this.revenue;
7413        }
7414
7415        public boolean hasRevenue() { 
7416          return this.revenue != null && !this.revenue.isEmpty();
7417        }
7418
7419        /**
7420         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
7421         */
7422        public AddedItemComponent setRevenue(CodeableConcept value)  { 
7423          this.revenue = value;
7424          return this;
7425        }
7426
7427        /**
7428         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
7429         */
7430        public CodeableConcept getCategory() { 
7431          if (this.category == null)
7432            if (Configuration.errorOnAutoCreate())
7433              throw new Error("Attempt to auto-create AddedItemComponent.category");
7434            else if (Configuration.doAutoCreate())
7435              this.category = new CodeableConcept(); // cc
7436          return this.category;
7437        }
7438
7439        public boolean hasCategory() { 
7440          return this.category != null && !this.category.isEmpty();
7441        }
7442
7443        /**
7444         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
7445         */
7446        public AddedItemComponent setCategory(CodeableConcept value)  { 
7447          this.category = value;
7448          return this;
7449        }
7450
7451        /**
7452         * @return {@link #service} (If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.)
7453         */
7454        public CodeableConcept getService() { 
7455          if (this.service == null)
7456            if (Configuration.errorOnAutoCreate())
7457              throw new Error("Attempt to auto-create AddedItemComponent.service");
7458            else if (Configuration.doAutoCreate())
7459              this.service = new CodeableConcept(); // cc
7460          return this.service;
7461        }
7462
7463        public boolean hasService() { 
7464          return this.service != null && !this.service.isEmpty();
7465        }
7466
7467        /**
7468         * @param value {@link #service} (If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.)
7469         */
7470        public AddedItemComponent setService(CodeableConcept value)  { 
7471          this.service = value;
7472          return this;
7473        }
7474
7475        /**
7476         * @return {@link #modifier} (Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.)
7477         */
7478        public List<CodeableConcept> getModifier() { 
7479          if (this.modifier == null)
7480            this.modifier = new ArrayList<CodeableConcept>();
7481          return this.modifier;
7482        }
7483
7484        /**
7485         * @return Returns a reference to <code>this</code> for easy method chaining
7486         */
7487        public AddedItemComponent setModifier(List<CodeableConcept> theModifier) { 
7488          this.modifier = theModifier;
7489          return this;
7490        }
7491
7492        public boolean hasModifier() { 
7493          if (this.modifier == null)
7494            return false;
7495          for (CodeableConcept item : this.modifier)
7496            if (!item.isEmpty())
7497              return true;
7498          return false;
7499        }
7500
7501        public CodeableConcept addModifier() { //3
7502          CodeableConcept t = new CodeableConcept();
7503          if (this.modifier == null)
7504            this.modifier = new ArrayList<CodeableConcept>();
7505          this.modifier.add(t);
7506          return t;
7507        }
7508
7509        public AddedItemComponent addModifier(CodeableConcept t) { //3
7510          if (t == null)
7511            return this;
7512          if (this.modifier == null)
7513            this.modifier = new ArrayList<CodeableConcept>();
7514          this.modifier.add(t);
7515          return this;
7516        }
7517
7518        /**
7519         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
7520         */
7521        public CodeableConcept getModifierFirstRep() { 
7522          if (getModifier().isEmpty()) {
7523            addModifier();
7524          }
7525          return getModifier().get(0);
7526        }
7527
7528        /**
7529         * @return {@link #fee} (The fee charged for the professional service or product.)
7530         */
7531        public Money getFee() { 
7532          if (this.fee == null)
7533            if (Configuration.errorOnAutoCreate())
7534              throw new Error("Attempt to auto-create AddedItemComponent.fee");
7535            else if (Configuration.doAutoCreate())
7536              this.fee = new Money(); // cc
7537          return this.fee;
7538        }
7539
7540        public boolean hasFee() { 
7541          return this.fee != null && !this.fee.isEmpty();
7542        }
7543
7544        /**
7545         * @param value {@link #fee} (The fee charged for the professional service or product.)
7546         */
7547        public AddedItemComponent setFee(Money value)  { 
7548          this.fee = value;
7549          return this;
7550        }
7551
7552        /**
7553         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
7554         */
7555        public List<PositiveIntType> getNoteNumber() { 
7556          if (this.noteNumber == null)
7557            this.noteNumber = new ArrayList<PositiveIntType>();
7558          return this.noteNumber;
7559        }
7560
7561        /**
7562         * @return Returns a reference to <code>this</code> for easy method chaining
7563         */
7564        public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
7565          this.noteNumber = theNoteNumber;
7566          return this;
7567        }
7568
7569        public boolean hasNoteNumber() { 
7570          if (this.noteNumber == null)
7571            return false;
7572          for (PositiveIntType item : this.noteNumber)
7573            if (!item.isEmpty())
7574              return true;
7575          return false;
7576        }
7577
7578        /**
7579         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
7580         */
7581        public PositiveIntType addNoteNumberElement() {//2 
7582          PositiveIntType t = new PositiveIntType();
7583          if (this.noteNumber == null)
7584            this.noteNumber = new ArrayList<PositiveIntType>();
7585          this.noteNumber.add(t);
7586          return t;
7587        }
7588
7589        /**
7590         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
7591         */
7592        public AddedItemComponent addNoteNumber(int value) { //1
7593          PositiveIntType t = new PositiveIntType();
7594          t.setValue(value);
7595          if (this.noteNumber == null)
7596            this.noteNumber = new ArrayList<PositiveIntType>();
7597          this.noteNumber.add(t);
7598          return this;
7599        }
7600
7601        /**
7602         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
7603         */
7604        public boolean hasNoteNumber(int value) { 
7605          if (this.noteNumber == null)
7606            return false;
7607          for (PositiveIntType v : this.noteNumber)
7608            if (v.getValue().equals(value)) // positiveInt
7609              return true;
7610          return false;
7611        }
7612
7613        /**
7614         * @return {@link #adjudication} (The adjudications results.)
7615         */
7616        public List<AdjudicationComponent> getAdjudication() { 
7617          if (this.adjudication == null)
7618            this.adjudication = new ArrayList<AdjudicationComponent>();
7619          return this.adjudication;
7620        }
7621
7622        /**
7623         * @return Returns a reference to <code>this</code> for easy method chaining
7624         */
7625        public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
7626          this.adjudication = theAdjudication;
7627          return this;
7628        }
7629
7630        public boolean hasAdjudication() { 
7631          if (this.adjudication == null)
7632            return false;
7633          for (AdjudicationComponent item : this.adjudication)
7634            if (!item.isEmpty())
7635              return true;
7636          return false;
7637        }
7638
7639        public AdjudicationComponent addAdjudication() { //3
7640          AdjudicationComponent t = new AdjudicationComponent();
7641          if (this.adjudication == null)
7642            this.adjudication = new ArrayList<AdjudicationComponent>();
7643          this.adjudication.add(t);
7644          return t;
7645        }
7646
7647        public AddedItemComponent addAdjudication(AdjudicationComponent t) { //3
7648          if (t == null)
7649            return this;
7650          if (this.adjudication == null)
7651            this.adjudication = new ArrayList<AdjudicationComponent>();
7652          this.adjudication.add(t);
7653          return this;
7654        }
7655
7656        /**
7657         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
7658         */
7659        public AdjudicationComponent getAdjudicationFirstRep() { 
7660          if (getAdjudication().isEmpty()) {
7661            addAdjudication();
7662          }
7663          return getAdjudication().get(0);
7664        }
7665
7666        /**
7667         * @return {@link #detail} (The second tier service adjudications for payor added services.)
7668         */
7669        public List<AddedItemsDetailComponent> getDetail() { 
7670          if (this.detail == null)
7671            this.detail = new ArrayList<AddedItemsDetailComponent>();
7672          return this.detail;
7673        }
7674
7675        /**
7676         * @return Returns a reference to <code>this</code> for easy method chaining
7677         */
7678        public AddedItemComponent setDetail(List<AddedItemsDetailComponent> theDetail) { 
7679          this.detail = theDetail;
7680          return this;
7681        }
7682
7683        public boolean hasDetail() { 
7684          if (this.detail == null)
7685            return false;
7686          for (AddedItemsDetailComponent item : this.detail)
7687            if (!item.isEmpty())
7688              return true;
7689          return false;
7690        }
7691
7692        public AddedItemsDetailComponent addDetail() { //3
7693          AddedItemsDetailComponent t = new AddedItemsDetailComponent();
7694          if (this.detail == null)
7695            this.detail = new ArrayList<AddedItemsDetailComponent>();
7696          this.detail.add(t);
7697          return t;
7698        }
7699
7700        public AddedItemComponent addDetail(AddedItemsDetailComponent t) { //3
7701          if (t == null)
7702            return this;
7703          if (this.detail == null)
7704            this.detail = new ArrayList<AddedItemsDetailComponent>();
7705          this.detail.add(t);
7706          return this;
7707        }
7708
7709        /**
7710         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
7711         */
7712        public AddedItemsDetailComponent getDetailFirstRep() { 
7713          if (getDetail().isEmpty()) {
7714            addDetail();
7715          }
7716          return getDetail().get(0);
7717        }
7718
7719        protected void listChildren(List<Property> children) {
7720          super.listChildren(children);
7721          children.add(new Property("sequenceLinkId", "positiveInt", "List of input service items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, sequenceLinkId));
7722          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
7723          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
7724          children.add(new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, service));
7725          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
7726          children.add(new Property("fee", "Money", "The fee charged for the professional service or product.", 0, 1, fee));
7727          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
7728          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
7729          children.add(new Property("detail", "", "The second tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
7730        }
7731
7732        @Override
7733        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7734          switch (_hash) {
7735          case -1422298666: /*sequenceLinkId*/  return new Property("sequenceLinkId", "positiveInt", "List of input service items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, sequenceLinkId);
7736          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
7737          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
7738          case 1984153269: /*service*/  return new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, service);
7739          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier);
7740          case 101254: /*fee*/  return new Property("fee", "Money", "The fee charged for the professional service or product.", 0, 1, fee);
7741          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
7742          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
7743          case -1335224239: /*detail*/  return new Property("detail", "", "The second tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail);
7744          default: return super.getNamedProperty(_hash, _name, _checkValid);
7745          }
7746
7747        }
7748
7749      @Override
7750      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7751        switch (hash) {
7752        case -1422298666: /*sequenceLinkId*/ return this.sequenceLinkId == null ? new Base[0] : this.sequenceLinkId.toArray(new Base[this.sequenceLinkId.size()]); // PositiveIntType
7753        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
7754        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
7755        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
7756        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7757        case 101254: /*fee*/ return this.fee == null ? new Base[0] : new Base[] {this.fee}; // Money
7758        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7759        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7760        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemsDetailComponent
7761        default: return super.getProperty(hash, name, checkValid);
7762        }
7763
7764      }
7765
7766      @Override
7767      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7768        switch (hash) {
7769        case -1422298666: // sequenceLinkId
7770          this.getSequenceLinkId().add(castToPositiveInt(value)); // PositiveIntType
7771          return value;
7772        case 1099842588: // revenue
7773          this.revenue = castToCodeableConcept(value); // CodeableConcept
7774          return value;
7775        case 50511102: // category
7776          this.category = castToCodeableConcept(value); // CodeableConcept
7777          return value;
7778        case 1984153269: // service
7779          this.service = castToCodeableConcept(value); // CodeableConcept
7780          return value;
7781        case -615513385: // modifier
7782          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7783          return value;
7784        case 101254: // fee
7785          this.fee = castToMoney(value); // Money
7786          return value;
7787        case -1110033957: // noteNumber
7788          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
7789          return value;
7790        case -231349275: // adjudication
7791          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7792          return value;
7793        case -1335224239: // detail
7794          this.getDetail().add((AddedItemsDetailComponent) value); // AddedItemsDetailComponent
7795          return value;
7796        default: return super.setProperty(hash, name, value);
7797        }
7798
7799      }
7800
7801      @Override
7802      public Base setProperty(String name, Base value) throws FHIRException {
7803        if (name.equals("sequenceLinkId")) {
7804          this.getSequenceLinkId().add(castToPositiveInt(value));
7805        } else if (name.equals("revenue")) {
7806          this.revenue = castToCodeableConcept(value); // CodeableConcept
7807        } else if (name.equals("category")) {
7808          this.category = castToCodeableConcept(value); // CodeableConcept
7809        } else if (name.equals("service")) {
7810          this.service = castToCodeableConcept(value); // CodeableConcept
7811        } else if (name.equals("modifier")) {
7812          this.getModifier().add(castToCodeableConcept(value));
7813        } else if (name.equals("fee")) {
7814          this.fee = castToMoney(value); // Money
7815        } else if (name.equals("noteNumber")) {
7816          this.getNoteNumber().add(castToPositiveInt(value));
7817        } else if (name.equals("adjudication")) {
7818          this.getAdjudication().add((AdjudicationComponent) value);
7819        } else if (name.equals("detail")) {
7820          this.getDetail().add((AddedItemsDetailComponent) value);
7821        } else
7822          return super.setProperty(name, value);
7823        return value;
7824      }
7825
7826      @Override
7827      public Base makeProperty(int hash, String name) throws FHIRException {
7828        switch (hash) {
7829        case -1422298666:  return addSequenceLinkIdElement();
7830        case 1099842588:  return getRevenue(); 
7831        case 50511102:  return getCategory(); 
7832        case 1984153269:  return getService(); 
7833        case -615513385:  return addModifier(); 
7834        case 101254:  return getFee(); 
7835        case -1110033957:  return addNoteNumberElement();
7836        case -231349275:  return addAdjudication(); 
7837        case -1335224239:  return addDetail(); 
7838        default: return super.makeProperty(hash, name);
7839        }
7840
7841      }
7842
7843      @Override
7844      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7845        switch (hash) {
7846        case -1422298666: /*sequenceLinkId*/ return new String[] {"positiveInt"};
7847        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7848        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7849        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
7850        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7851        case 101254: /*fee*/ return new String[] {"Money"};
7852        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7853        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7854        case -1335224239: /*detail*/ return new String[] {};
7855        default: return super.getTypesForProperty(hash, name);
7856        }
7857
7858      }
7859
7860      @Override
7861      public Base addChild(String name) throws FHIRException {
7862        if (name.equals("sequenceLinkId")) {
7863          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequenceLinkId");
7864        }
7865        else if (name.equals("revenue")) {
7866          this.revenue = new CodeableConcept();
7867          return this.revenue;
7868        }
7869        else if (name.equals("category")) {
7870          this.category = new CodeableConcept();
7871          return this.category;
7872        }
7873        else if (name.equals("service")) {
7874          this.service = new CodeableConcept();
7875          return this.service;
7876        }
7877        else if (name.equals("modifier")) {
7878          return addModifier();
7879        }
7880        else if (name.equals("fee")) {
7881          this.fee = new Money();
7882          return this.fee;
7883        }
7884        else if (name.equals("noteNumber")) {
7885          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
7886        }
7887        else if (name.equals("adjudication")) {
7888          return addAdjudication();
7889        }
7890        else if (name.equals("detail")) {
7891          return addDetail();
7892        }
7893        else
7894          return super.addChild(name);
7895      }
7896
7897      public AddedItemComponent copy() {
7898        AddedItemComponent dst = new AddedItemComponent();
7899        copyValues(dst);
7900        if (sequenceLinkId != null) {
7901          dst.sequenceLinkId = new ArrayList<PositiveIntType>();
7902          for (PositiveIntType i : sequenceLinkId)
7903            dst.sequenceLinkId.add(i.copy());
7904        };
7905        dst.revenue = revenue == null ? null : revenue.copy();
7906        dst.category = category == null ? null : category.copy();
7907        dst.service = service == null ? null : service.copy();
7908        if (modifier != null) {
7909          dst.modifier = new ArrayList<CodeableConcept>();
7910          for (CodeableConcept i : modifier)
7911            dst.modifier.add(i.copy());
7912        };
7913        dst.fee = fee == null ? null : fee.copy();
7914        if (noteNumber != null) {
7915          dst.noteNumber = new ArrayList<PositiveIntType>();
7916          for (PositiveIntType i : noteNumber)
7917            dst.noteNumber.add(i.copy());
7918        };
7919        if (adjudication != null) {
7920          dst.adjudication = new ArrayList<AdjudicationComponent>();
7921          for (AdjudicationComponent i : adjudication)
7922            dst.adjudication.add(i.copy());
7923        };
7924        if (detail != null) {
7925          dst.detail = new ArrayList<AddedItemsDetailComponent>();
7926          for (AddedItemsDetailComponent i : detail)
7927            dst.detail.add(i.copy());
7928        };
7929        return dst;
7930      }
7931
7932      @Override
7933      public boolean equalsDeep(Base other_) {
7934        if (!super.equalsDeep(other_))
7935          return false;
7936        if (!(other_ instanceof AddedItemComponent))
7937          return false;
7938        AddedItemComponent o = (AddedItemComponent) other_;
7939        return compareDeep(sequenceLinkId, o.sequenceLinkId, true) && compareDeep(revenue, o.revenue, true)
7940           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
7941           && compareDeep(fee, o.fee, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
7942           && compareDeep(detail, o.detail, true);
7943      }
7944
7945      @Override
7946      public boolean equalsShallow(Base other_) {
7947        if (!super.equalsShallow(other_))
7948          return false;
7949        if (!(other_ instanceof AddedItemComponent))
7950          return false;
7951        AddedItemComponent o = (AddedItemComponent) other_;
7952        return compareValues(sequenceLinkId, o.sequenceLinkId, true) && compareValues(noteNumber, o.noteNumber, true)
7953          ;
7954      }
7955
7956      public boolean isEmpty() {
7957        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequenceLinkId, revenue, category
7958          , service, modifier, fee, noteNumber, adjudication, detail);
7959      }
7960
7961  public String fhirType() {
7962    return "ExplanationOfBenefit.addItem";
7963
7964  }
7965
7966  }
7967
7968    @Block()
7969    public static class AddedItemsDetailComponent extends BackboneElement implements IBaseBackboneElement {
7970        /**
7971         * The type of reveneu or cost center providing the product and/or service.
7972         */
7973        @Child(name = "revenue", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
7974        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
7975        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
7976        protected CodeableConcept revenue;
7977
7978        /**
7979         * Health Care Service Type Codes  to identify the classification of service or benefits.
7980         */
7981        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
7982        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
7983        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
7984        protected CodeableConcept category;
7985
7986        /**
7987         * A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).
7988         */
7989        @Child(name = "service", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
7990        @Description(shortDefinition="Billing Code", formalDefinition="A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI)." )
7991        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7992        protected CodeableConcept service;
7993
7994        /**
7995         * Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.
7996         */
7997        @Child(name = "modifier", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7998        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours." )
7999        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
8000        protected List<CodeableConcept> modifier;
8001
8002        /**
8003         * The fee charged for the professional service or product.
8004         */
8005        @Child(name = "fee", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
8006        @Description(shortDefinition="Professional fee or Product charge", formalDefinition="The fee charged for the professional service or product." )
8007        protected Money fee;
8008
8009        /**
8010         * A list of note references to the notes provided below.
8011         */
8012        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8013        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
8014        protected List<PositiveIntType> noteNumber;
8015
8016        /**
8017         * The adjudications results.
8018         */
8019        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8020        @Description(shortDefinition="Added items detail adjudication", formalDefinition="The adjudications results." )
8021        protected List<AdjudicationComponent> adjudication;
8022
8023        private static final long serialVersionUID = -311484980L;
8024
8025    /**
8026     * Constructor
8027     */
8028      public AddedItemsDetailComponent() {
8029        super();
8030      }
8031
8032        /**
8033         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
8034         */
8035        public CodeableConcept getRevenue() { 
8036          if (this.revenue == null)
8037            if (Configuration.errorOnAutoCreate())
8038              throw new Error("Attempt to auto-create AddedItemsDetailComponent.revenue");
8039            else if (Configuration.doAutoCreate())
8040              this.revenue = new CodeableConcept(); // cc
8041          return this.revenue;
8042        }
8043
8044        public boolean hasRevenue() { 
8045          return this.revenue != null && !this.revenue.isEmpty();
8046        }
8047
8048        /**
8049         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
8050         */
8051        public AddedItemsDetailComponent setRevenue(CodeableConcept value)  { 
8052          this.revenue = value;
8053          return this;
8054        }
8055
8056        /**
8057         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
8058         */
8059        public CodeableConcept getCategory() { 
8060          if (this.category == null)
8061            if (Configuration.errorOnAutoCreate())
8062              throw new Error("Attempt to auto-create AddedItemsDetailComponent.category");
8063            else if (Configuration.doAutoCreate())
8064              this.category = new CodeableConcept(); // cc
8065          return this.category;
8066        }
8067
8068        public boolean hasCategory() { 
8069          return this.category != null && !this.category.isEmpty();
8070        }
8071
8072        /**
8073         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
8074         */
8075        public AddedItemsDetailComponent setCategory(CodeableConcept value)  { 
8076          this.category = value;
8077          return this;
8078        }
8079
8080        /**
8081         * @return {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
8082         */
8083        public CodeableConcept getService() { 
8084          if (this.service == null)
8085            if (Configuration.errorOnAutoCreate())
8086              throw new Error("Attempt to auto-create AddedItemsDetailComponent.service");
8087            else if (Configuration.doAutoCreate())
8088              this.service = new CodeableConcept(); // cc
8089          return this.service;
8090        }
8091
8092        public boolean hasService() { 
8093          return this.service != null && !this.service.isEmpty();
8094        }
8095
8096        /**
8097         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
8098         */
8099        public AddedItemsDetailComponent setService(CodeableConcept value)  { 
8100          this.service = value;
8101          return this;
8102        }
8103
8104        /**
8105         * @return {@link #modifier} (Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.)
8106         */
8107        public List<CodeableConcept> getModifier() { 
8108          if (this.modifier == null)
8109            this.modifier = new ArrayList<CodeableConcept>();
8110          return this.modifier;
8111        }
8112
8113        /**
8114         * @return Returns a reference to <code>this</code> for easy method chaining
8115         */
8116        public AddedItemsDetailComponent setModifier(List<CodeableConcept> theModifier) { 
8117          this.modifier = theModifier;
8118          return this;
8119        }
8120
8121        public boolean hasModifier() { 
8122          if (this.modifier == null)
8123            return false;
8124          for (CodeableConcept item : this.modifier)
8125            if (!item.isEmpty())
8126              return true;
8127          return false;
8128        }
8129
8130        public CodeableConcept addModifier() { //3
8131          CodeableConcept t = new CodeableConcept();
8132          if (this.modifier == null)
8133            this.modifier = new ArrayList<CodeableConcept>();
8134          this.modifier.add(t);
8135          return t;
8136        }
8137
8138        public AddedItemsDetailComponent addModifier(CodeableConcept t) { //3
8139          if (t == null)
8140            return this;
8141          if (this.modifier == null)
8142            this.modifier = new ArrayList<CodeableConcept>();
8143          this.modifier.add(t);
8144          return this;
8145        }
8146
8147        /**
8148         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
8149         */
8150        public CodeableConcept getModifierFirstRep() { 
8151          if (getModifier().isEmpty()) {
8152            addModifier();
8153          }
8154          return getModifier().get(0);
8155        }
8156
8157        /**
8158         * @return {@link #fee} (The fee charged for the professional service or product.)
8159         */
8160        public Money getFee() { 
8161          if (this.fee == null)
8162            if (Configuration.errorOnAutoCreate())
8163              throw new Error("Attempt to auto-create AddedItemsDetailComponent.fee");
8164            else if (Configuration.doAutoCreate())
8165              this.fee = new Money(); // cc
8166          return this.fee;
8167        }
8168
8169        public boolean hasFee() { 
8170          return this.fee != null && !this.fee.isEmpty();
8171        }
8172
8173        /**
8174         * @param value {@link #fee} (The fee charged for the professional service or product.)
8175         */
8176        public AddedItemsDetailComponent setFee(Money value)  { 
8177          this.fee = value;
8178          return this;
8179        }
8180
8181        /**
8182         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
8183         */
8184        public List<PositiveIntType> getNoteNumber() { 
8185          if (this.noteNumber == null)
8186            this.noteNumber = new ArrayList<PositiveIntType>();
8187          return this.noteNumber;
8188        }
8189
8190        /**
8191         * @return Returns a reference to <code>this</code> for easy method chaining
8192         */
8193        public AddedItemsDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
8194          this.noteNumber = theNoteNumber;
8195          return this;
8196        }
8197
8198        public boolean hasNoteNumber() { 
8199          if (this.noteNumber == null)
8200            return false;
8201          for (PositiveIntType item : this.noteNumber)
8202            if (!item.isEmpty())
8203              return true;
8204          return false;
8205        }
8206
8207        /**
8208         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
8209         */
8210        public PositiveIntType addNoteNumberElement() {//2 
8211          PositiveIntType t = new PositiveIntType();
8212          if (this.noteNumber == null)
8213            this.noteNumber = new ArrayList<PositiveIntType>();
8214          this.noteNumber.add(t);
8215          return t;
8216        }
8217
8218        /**
8219         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
8220         */
8221        public AddedItemsDetailComponent addNoteNumber(int value) { //1
8222          PositiveIntType t = new PositiveIntType();
8223          t.setValue(value);
8224          if (this.noteNumber == null)
8225            this.noteNumber = new ArrayList<PositiveIntType>();
8226          this.noteNumber.add(t);
8227          return this;
8228        }
8229
8230        /**
8231         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
8232         */
8233        public boolean hasNoteNumber(int value) { 
8234          if (this.noteNumber == null)
8235            return false;
8236          for (PositiveIntType v : this.noteNumber)
8237            if (v.getValue().equals(value)) // positiveInt
8238              return true;
8239          return false;
8240        }
8241
8242        /**
8243         * @return {@link #adjudication} (The adjudications results.)
8244         */
8245        public List<AdjudicationComponent> getAdjudication() { 
8246          if (this.adjudication == null)
8247            this.adjudication = new ArrayList<AdjudicationComponent>();
8248          return this.adjudication;
8249        }
8250
8251        /**
8252         * @return Returns a reference to <code>this</code> for easy method chaining
8253         */
8254        public AddedItemsDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
8255          this.adjudication = theAdjudication;
8256          return this;
8257        }
8258
8259        public boolean hasAdjudication() { 
8260          if (this.adjudication == null)
8261            return false;
8262          for (AdjudicationComponent item : this.adjudication)
8263            if (!item.isEmpty())
8264              return true;
8265          return false;
8266        }
8267
8268        public AdjudicationComponent addAdjudication() { //3
8269          AdjudicationComponent t = new AdjudicationComponent();
8270          if (this.adjudication == null)
8271            this.adjudication = new ArrayList<AdjudicationComponent>();
8272          this.adjudication.add(t);
8273          return t;
8274        }
8275
8276        public AddedItemsDetailComponent addAdjudication(AdjudicationComponent t) { //3
8277          if (t == null)
8278            return this;
8279          if (this.adjudication == null)
8280            this.adjudication = new ArrayList<AdjudicationComponent>();
8281          this.adjudication.add(t);
8282          return this;
8283        }
8284
8285        /**
8286         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
8287         */
8288        public AdjudicationComponent getAdjudicationFirstRep() { 
8289          if (getAdjudication().isEmpty()) {
8290            addAdjudication();
8291          }
8292          return getAdjudication().get(0);
8293        }
8294
8295        protected void listChildren(List<Property> children) {
8296          super.listChildren(children);
8297          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
8298          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
8299          children.add(new Property("service", "CodeableConcept", "A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).", 0, 1, service));
8300          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
8301          children.add(new Property("fee", "Money", "The fee charged for the professional service or product.", 0, 1, fee));
8302          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
8303          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
8304        }
8305
8306        @Override
8307        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8308          switch (_hash) {
8309          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
8310          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
8311          case 1984153269: /*service*/  return new Property("service", "CodeableConcept", "A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).", 0, 1, service);
8312          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier);
8313          case 101254: /*fee*/  return new Property("fee", "Money", "The fee charged for the professional service or product.", 0, 1, fee);
8314          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
8315          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
8316          default: return super.getNamedProperty(_hash, _name, _checkValid);
8317          }
8318
8319        }
8320
8321      @Override
8322      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8323        switch (hash) {
8324        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
8325        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
8326        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
8327        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
8328        case 101254: /*fee*/ return this.fee == null ? new Base[0] : new Base[] {this.fee}; // Money
8329        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
8330        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
8331        default: return super.getProperty(hash, name, checkValid);
8332        }
8333
8334      }
8335
8336      @Override
8337      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8338        switch (hash) {
8339        case 1099842588: // revenue
8340          this.revenue = castToCodeableConcept(value); // CodeableConcept
8341          return value;
8342        case 50511102: // category
8343          this.category = castToCodeableConcept(value); // CodeableConcept
8344          return value;
8345        case 1984153269: // service
8346          this.service = castToCodeableConcept(value); // CodeableConcept
8347          return value;
8348        case -615513385: // modifier
8349          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
8350          return value;
8351        case 101254: // fee
8352          this.fee = castToMoney(value); // Money
8353          return value;
8354        case -1110033957: // noteNumber
8355          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
8356          return value;
8357        case -231349275: // adjudication
8358          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
8359          return value;
8360        default: return super.setProperty(hash, name, value);
8361        }
8362
8363      }
8364
8365      @Override
8366      public Base setProperty(String name, Base value) throws FHIRException {
8367        if (name.equals("revenue")) {
8368          this.revenue = castToCodeableConcept(value); // CodeableConcept
8369        } else if (name.equals("category")) {
8370          this.category = castToCodeableConcept(value); // CodeableConcept
8371        } else if (name.equals("service")) {
8372          this.service = castToCodeableConcept(value); // CodeableConcept
8373        } else if (name.equals("modifier")) {
8374          this.getModifier().add(castToCodeableConcept(value));
8375        } else if (name.equals("fee")) {
8376          this.fee = castToMoney(value); // Money
8377        } else if (name.equals("noteNumber")) {
8378          this.getNoteNumber().add(castToPositiveInt(value));
8379        } else if (name.equals("adjudication")) {
8380          this.getAdjudication().add((AdjudicationComponent) value);
8381        } else
8382          return super.setProperty(name, value);
8383        return value;
8384      }
8385
8386      @Override
8387      public Base makeProperty(int hash, String name) throws FHIRException {
8388        switch (hash) {
8389        case 1099842588:  return getRevenue(); 
8390        case 50511102:  return getCategory(); 
8391        case 1984153269:  return getService(); 
8392        case -615513385:  return addModifier(); 
8393        case 101254:  return getFee(); 
8394        case -1110033957:  return addNoteNumberElement();
8395        case -231349275:  return addAdjudication(); 
8396        default: return super.makeProperty(hash, name);
8397        }
8398
8399      }
8400
8401      @Override
8402      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8403        switch (hash) {
8404        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
8405        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
8406        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
8407        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
8408        case 101254: /*fee*/ return new String[] {"Money"};
8409        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
8410        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
8411        default: return super.getTypesForProperty(hash, name);
8412        }
8413
8414      }
8415
8416      @Override
8417      public Base addChild(String name) throws FHIRException {
8418        if (name.equals("revenue")) {
8419          this.revenue = new CodeableConcept();
8420          return this.revenue;
8421        }
8422        else if (name.equals("category")) {
8423          this.category = new CodeableConcept();
8424          return this.category;
8425        }
8426        else if (name.equals("service")) {
8427          this.service = new CodeableConcept();
8428          return this.service;
8429        }
8430        else if (name.equals("modifier")) {
8431          return addModifier();
8432        }
8433        else if (name.equals("fee")) {
8434          this.fee = new Money();
8435          return this.fee;
8436        }
8437        else if (name.equals("noteNumber")) {
8438          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
8439        }
8440        else if (name.equals("adjudication")) {
8441          return addAdjudication();
8442        }
8443        else
8444          return super.addChild(name);
8445      }
8446
8447      public AddedItemsDetailComponent copy() {
8448        AddedItemsDetailComponent dst = new AddedItemsDetailComponent();
8449        copyValues(dst);
8450        dst.revenue = revenue == null ? null : revenue.copy();
8451        dst.category = category == null ? null : category.copy();
8452        dst.service = service == null ? null : service.copy();
8453        if (modifier != null) {
8454          dst.modifier = new ArrayList<CodeableConcept>();
8455          for (CodeableConcept i : modifier)
8456            dst.modifier.add(i.copy());
8457        };
8458        dst.fee = fee == null ? null : fee.copy();
8459        if (noteNumber != null) {
8460          dst.noteNumber = new ArrayList<PositiveIntType>();
8461          for (PositiveIntType i : noteNumber)
8462            dst.noteNumber.add(i.copy());
8463        };
8464        if (adjudication != null) {
8465          dst.adjudication = new ArrayList<AdjudicationComponent>();
8466          for (AdjudicationComponent i : adjudication)
8467            dst.adjudication.add(i.copy());
8468        };
8469        return dst;
8470      }
8471
8472      @Override
8473      public boolean equalsDeep(Base other_) {
8474        if (!super.equalsDeep(other_))
8475          return false;
8476        if (!(other_ instanceof AddedItemsDetailComponent))
8477          return false;
8478        AddedItemsDetailComponent o = (AddedItemsDetailComponent) other_;
8479        return compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true) && compareDeep(service, o.service, true)
8480           && compareDeep(modifier, o.modifier, true) && compareDeep(fee, o.fee, true) && compareDeep(noteNumber, o.noteNumber, true)
8481           && compareDeep(adjudication, o.adjudication, true);
8482      }
8483
8484      @Override
8485      public boolean equalsShallow(Base other_) {
8486        if (!super.equalsShallow(other_))
8487          return false;
8488        if (!(other_ instanceof AddedItemsDetailComponent))
8489          return false;
8490        AddedItemsDetailComponent o = (AddedItemsDetailComponent) other_;
8491        return compareValues(noteNumber, o.noteNumber, true);
8492      }
8493
8494      public boolean isEmpty() {
8495        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(revenue, category, service
8496          , modifier, fee, noteNumber, adjudication);
8497      }
8498
8499  public String fhirType() {
8500    return "ExplanationOfBenefit.addItem.detail";
8501
8502  }
8503
8504  }
8505
8506    @Block()
8507    public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
8508        /**
8509         * Whether this represents partial or complete payment of the claim.
8510         */
8511        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
8512        @Description(shortDefinition="Partial or Complete", formalDefinition="Whether this represents partial or complete payment of the claim." )
8513        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-paymenttype")
8514        protected CodeableConcept type;
8515
8516        /**
8517         * Adjustment to the payment of this transaction which is not related to adjudication of this transaction.
8518         */
8519        @Child(name = "adjustment", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
8520        @Description(shortDefinition="Payment adjustment for non-Claim issues", formalDefinition="Adjustment to the payment of this transaction which is not related to adjudication of this transaction." )
8521        protected Money adjustment;
8522
8523        /**
8524         * Reason for the payment adjustment.
8525         */
8526        @Child(name = "adjustmentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
8527        @Description(shortDefinition="Explanation for the non-claim adjustment", formalDefinition="Reason for the payment adjustment." )
8528        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
8529        protected CodeableConcept adjustmentReason;
8530
8531        /**
8532         * Estimated payment date.
8533         */
8534        @Child(name = "date", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=false)
8535        @Description(shortDefinition="Expected date of Payment", formalDefinition="Estimated payment date." )
8536        protected DateType date;
8537
8538        /**
8539         * Payable less any payment adjustment.
8540         */
8541        @Child(name = "amount", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
8542        @Description(shortDefinition="Payable amount after adjustment", formalDefinition="Payable less any payment adjustment." )
8543        protected Money amount;
8544
8545        /**
8546         * Payment identifer.
8547         */
8548        @Child(name = "identifier", type = {Identifier.class}, order=6, min=0, max=1, modifier=false, summary=false)
8549        @Description(shortDefinition="Identifier of the payment instrument", formalDefinition="Payment identifer." )
8550        protected Identifier identifier;
8551
8552        private static final long serialVersionUID = 1539906026L;
8553
8554    /**
8555     * Constructor
8556     */
8557      public PaymentComponent() {
8558        super();
8559      }
8560
8561        /**
8562         * @return {@link #type} (Whether this represents partial or complete payment of the claim.)
8563         */
8564        public CodeableConcept getType() { 
8565          if (this.type == null)
8566            if (Configuration.errorOnAutoCreate())
8567              throw new Error("Attempt to auto-create PaymentComponent.type");
8568            else if (Configuration.doAutoCreate())
8569              this.type = new CodeableConcept(); // cc
8570          return this.type;
8571        }
8572
8573        public boolean hasType() { 
8574          return this.type != null && !this.type.isEmpty();
8575        }
8576
8577        /**
8578         * @param value {@link #type} (Whether this represents partial or complete payment of the claim.)
8579         */
8580        public PaymentComponent setType(CodeableConcept value)  { 
8581          this.type = value;
8582          return this;
8583        }
8584
8585        /**
8586         * @return {@link #adjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
8587         */
8588        public Money getAdjustment() { 
8589          if (this.adjustment == null)
8590            if (Configuration.errorOnAutoCreate())
8591              throw new Error("Attempt to auto-create PaymentComponent.adjustment");
8592            else if (Configuration.doAutoCreate())
8593              this.adjustment = new Money(); // cc
8594          return this.adjustment;
8595        }
8596
8597        public boolean hasAdjustment() { 
8598          return this.adjustment != null && !this.adjustment.isEmpty();
8599        }
8600
8601        /**
8602         * @param value {@link #adjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
8603         */
8604        public PaymentComponent setAdjustment(Money value)  { 
8605          this.adjustment = value;
8606          return this;
8607        }
8608
8609        /**
8610         * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
8611         */
8612        public CodeableConcept getAdjustmentReason() { 
8613          if (this.adjustmentReason == null)
8614            if (Configuration.errorOnAutoCreate())
8615              throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
8616            else if (Configuration.doAutoCreate())
8617              this.adjustmentReason = new CodeableConcept(); // cc
8618          return this.adjustmentReason;
8619        }
8620
8621        public boolean hasAdjustmentReason() { 
8622          return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
8623        }
8624
8625        /**
8626         * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
8627         */
8628        public PaymentComponent setAdjustmentReason(CodeableConcept value)  { 
8629          this.adjustmentReason = value;
8630          return this;
8631        }
8632
8633        /**
8634         * @return {@link #date} (Estimated payment date.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
8635         */
8636        public DateType getDateElement() { 
8637          if (this.date == null)
8638            if (Configuration.errorOnAutoCreate())
8639              throw new Error("Attempt to auto-create PaymentComponent.date");
8640            else if (Configuration.doAutoCreate())
8641              this.date = new DateType(); // bb
8642          return this.date;
8643        }
8644
8645        public boolean hasDateElement() { 
8646          return this.date != null && !this.date.isEmpty();
8647        }
8648
8649        public boolean hasDate() { 
8650          return this.date != null && !this.date.isEmpty();
8651        }
8652
8653        /**
8654         * @param value {@link #date} (Estimated payment date.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
8655         */
8656        public PaymentComponent setDateElement(DateType value) { 
8657          this.date = value;
8658          return this;
8659        }
8660
8661        /**
8662         * @return Estimated payment date.
8663         */
8664        public Date getDate() { 
8665          return this.date == null ? null : this.date.getValue();
8666        }
8667
8668        /**
8669         * @param value Estimated payment date.
8670         */
8671        public PaymentComponent setDate(Date value) { 
8672          if (value == null)
8673            this.date = null;
8674          else {
8675            if (this.date == null)
8676              this.date = new DateType();
8677            this.date.setValue(value);
8678          }
8679          return this;
8680        }
8681
8682        /**
8683         * @return {@link #amount} (Payable less any payment adjustment.)
8684         */
8685        public Money getAmount() { 
8686          if (this.amount == null)
8687            if (Configuration.errorOnAutoCreate())
8688              throw new Error("Attempt to auto-create PaymentComponent.amount");
8689            else if (Configuration.doAutoCreate())
8690              this.amount = new Money(); // cc
8691          return this.amount;
8692        }
8693
8694        public boolean hasAmount() { 
8695          return this.amount != null && !this.amount.isEmpty();
8696        }
8697
8698        /**
8699         * @param value {@link #amount} (Payable less any payment adjustment.)
8700         */
8701        public PaymentComponent setAmount(Money value)  { 
8702          this.amount = value;
8703          return this;
8704        }
8705
8706        /**
8707         * @return {@link #identifier} (Payment identifer.)
8708         */
8709        public Identifier getIdentifier() { 
8710          if (this.identifier == null)
8711            if (Configuration.errorOnAutoCreate())
8712              throw new Error("Attempt to auto-create PaymentComponent.identifier");
8713            else if (Configuration.doAutoCreate())
8714              this.identifier = new Identifier(); // cc
8715          return this.identifier;
8716        }
8717
8718        public boolean hasIdentifier() { 
8719          return this.identifier != null && !this.identifier.isEmpty();
8720        }
8721
8722        /**
8723         * @param value {@link #identifier} (Payment identifer.)
8724         */
8725        public PaymentComponent setIdentifier(Identifier value)  { 
8726          this.identifier = value;
8727          return this;
8728        }
8729
8730        protected void listChildren(List<Property> children) {
8731          super.listChildren(children);
8732          children.add(new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the claim.", 0, 1, type));
8733          children.add(new Property("adjustment", "Money", "Adjustment to the payment of this transaction which is not related to adjudication of this transaction.", 0, 1, adjustment));
8734          children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason));
8735          children.add(new Property("date", "date", "Estimated payment date.", 0, 1, date));
8736          children.add(new Property("amount", "Money", "Payable less any payment adjustment.", 0, 1, amount));
8737          children.add(new Property("identifier", "Identifier", "Payment identifer.", 0, 1, identifier));
8738        }
8739
8740        @Override
8741        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8742          switch (_hash) {
8743          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the claim.", 0, 1, type);
8744          case 1977085293: /*adjustment*/  return new Property("adjustment", "Money", "Adjustment to the payment of this transaction which is not related to adjudication of this transaction.", 0, 1, adjustment);
8745          case -1255938543: /*adjustmentReason*/  return new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason);
8746          case 3076014: /*date*/  return new Property("date", "date", "Estimated payment date.", 0, 1, date);
8747          case -1413853096: /*amount*/  return new Property("amount", "Money", "Payable less any payment adjustment.", 0, 1, amount);
8748          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Payment identifer.", 0, 1, identifier);
8749          default: return super.getNamedProperty(_hash, _name, _checkValid);
8750          }
8751
8752        }
8753
8754      @Override
8755      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8756        switch (hash) {
8757        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
8758        case 1977085293: /*adjustment*/ return this.adjustment == null ? new Base[0] : new Base[] {this.adjustment}; // Money
8759        case -1255938543: /*adjustmentReason*/ return this.adjustmentReason == null ? new Base[0] : new Base[] {this.adjustmentReason}; // CodeableConcept
8760        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
8761        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
8762        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
8763        default: return super.getProperty(hash, name, checkValid);
8764        }
8765
8766      }
8767
8768      @Override
8769      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8770        switch (hash) {
8771        case 3575610: // type
8772          this.type = castToCodeableConcept(value); // CodeableConcept
8773          return value;
8774        case 1977085293: // adjustment
8775          this.adjustment = castToMoney(value); // Money
8776          return value;
8777        case -1255938543: // adjustmentReason
8778          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
8779          return value;
8780        case 3076014: // date
8781          this.date = castToDate(value); // DateType
8782          return value;
8783        case -1413853096: // amount
8784          this.amount = castToMoney(value); // Money
8785          return value;
8786        case -1618432855: // identifier
8787          this.identifier = castToIdentifier(value); // Identifier
8788          return value;
8789        default: return super.setProperty(hash, name, value);
8790        }
8791
8792      }
8793
8794      @Override
8795      public Base setProperty(String name, Base value) throws FHIRException {
8796        if (name.equals("type")) {
8797          this.type = castToCodeableConcept(value); // CodeableConcept
8798        } else if (name.equals("adjustment")) {
8799          this.adjustment = castToMoney(value); // Money
8800        } else if (name.equals("adjustmentReason")) {
8801          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
8802        } else if (name.equals("date")) {
8803          this.date = castToDate(value); // DateType
8804        } else if (name.equals("amount")) {
8805          this.amount = castToMoney(value); // Money
8806        } else if (name.equals("identifier")) {
8807          this.identifier = castToIdentifier(value); // Identifier
8808        } else
8809          return super.setProperty(name, value);
8810        return value;
8811      }
8812
8813      @Override
8814      public Base makeProperty(int hash, String name) throws FHIRException {
8815        switch (hash) {
8816        case 3575610:  return getType(); 
8817        case 1977085293:  return getAdjustment(); 
8818        case -1255938543:  return getAdjustmentReason(); 
8819        case 3076014:  return getDateElement();
8820        case -1413853096:  return getAmount(); 
8821        case -1618432855:  return getIdentifier(); 
8822        default: return super.makeProperty(hash, name);
8823        }
8824
8825      }
8826
8827      @Override
8828      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8829        switch (hash) {
8830        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
8831        case 1977085293: /*adjustment*/ return new String[] {"Money"};
8832        case -1255938543: /*adjustmentReason*/ return new String[] {"CodeableConcept"};
8833        case 3076014: /*date*/ return new String[] {"date"};
8834        case -1413853096: /*amount*/ return new String[] {"Money"};
8835        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
8836        default: return super.getTypesForProperty(hash, name);
8837        }
8838
8839      }
8840
8841      @Override
8842      public Base addChild(String name) throws FHIRException {
8843        if (name.equals("type")) {
8844          this.type = new CodeableConcept();
8845          return this.type;
8846        }
8847        else if (name.equals("adjustment")) {
8848          this.adjustment = new Money();
8849          return this.adjustment;
8850        }
8851        else if (name.equals("adjustmentReason")) {
8852          this.adjustmentReason = new CodeableConcept();
8853          return this.adjustmentReason;
8854        }
8855        else if (name.equals("date")) {
8856          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
8857        }
8858        else if (name.equals("amount")) {
8859          this.amount = new Money();
8860          return this.amount;
8861        }
8862        else if (name.equals("identifier")) {
8863          this.identifier = new Identifier();
8864          return this.identifier;
8865        }
8866        else
8867          return super.addChild(name);
8868      }
8869
8870      public PaymentComponent copy() {
8871        PaymentComponent dst = new PaymentComponent();
8872        copyValues(dst);
8873        dst.type = type == null ? null : type.copy();
8874        dst.adjustment = adjustment == null ? null : adjustment.copy();
8875        dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
8876        dst.date = date == null ? null : date.copy();
8877        dst.amount = amount == null ? null : amount.copy();
8878        dst.identifier = identifier == null ? null : identifier.copy();
8879        return dst;
8880      }
8881
8882      @Override
8883      public boolean equalsDeep(Base other_) {
8884        if (!super.equalsDeep(other_))
8885          return false;
8886        if (!(other_ instanceof PaymentComponent))
8887          return false;
8888        PaymentComponent o = (PaymentComponent) other_;
8889        return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true) && compareDeep(adjustmentReason, o.adjustmentReason, true)
8890           && compareDeep(date, o.date, true) && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true)
8891          ;
8892      }
8893
8894      @Override
8895      public boolean equalsShallow(Base other_) {
8896        if (!super.equalsShallow(other_))
8897          return false;
8898        if (!(other_ instanceof PaymentComponent))
8899          return false;
8900        PaymentComponent o = (PaymentComponent) other_;
8901        return compareValues(date, o.date, true);
8902      }
8903
8904      public boolean isEmpty() {
8905        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason
8906          , date, amount, identifier);
8907      }
8908
8909  public String fhirType() {
8910    return "ExplanationOfBenefit.payment";
8911
8912  }
8913
8914  }
8915
8916    @Block()
8917    public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
8918        /**
8919         * An integer associated with each note which may be referred to from each service line item.
8920         */
8921        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
8922        @Description(shortDefinition="Sequence number for this note", formalDefinition="An integer associated with each note which may be referred to from each service line item." )
8923        protected PositiveIntType number;
8924
8925        /**
8926         * The note purpose: Print/Display.
8927         */
8928        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
8929        @Description(shortDefinition="display | print | printoper", formalDefinition="The note purpose: Print/Display." )
8930        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
8931        protected CodeableConcept type;
8932
8933        /**
8934         * The note text.
8935         */
8936        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
8937        @Description(shortDefinition="Note explanitory text", formalDefinition="The note text." )
8938        protected StringType text;
8939
8940        /**
8941         * The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.
8942         */
8943        @Child(name = "language", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
8944        @Description(shortDefinition="Language if different from the resource", formalDefinition="The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English." )
8945        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
8946        protected CodeableConcept language;
8947
8948        private static final long serialVersionUID = -944255449L;
8949
8950    /**
8951     * Constructor
8952     */
8953      public NoteComponent() {
8954        super();
8955      }
8956
8957        /**
8958         * @return {@link #number} (An integer associated with each note which may be referred to from each service line item.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
8959         */
8960        public PositiveIntType getNumberElement() { 
8961          if (this.number == null)
8962            if (Configuration.errorOnAutoCreate())
8963              throw new Error("Attempt to auto-create NoteComponent.number");
8964            else if (Configuration.doAutoCreate())
8965              this.number = new PositiveIntType(); // bb
8966          return this.number;
8967        }
8968
8969        public boolean hasNumberElement() { 
8970          return this.number != null && !this.number.isEmpty();
8971        }
8972
8973        public boolean hasNumber() { 
8974          return this.number != null && !this.number.isEmpty();
8975        }
8976
8977        /**
8978         * @param value {@link #number} (An integer associated with each note which may be referred to from each service line item.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
8979         */
8980        public NoteComponent setNumberElement(PositiveIntType value) { 
8981          this.number = value;
8982          return this;
8983        }
8984
8985        /**
8986         * @return An integer associated with each note which may be referred to from each service line item.
8987         */
8988        public int getNumber() { 
8989          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
8990        }
8991
8992        /**
8993         * @param value An integer associated with each note which may be referred to from each service line item.
8994         */
8995        public NoteComponent setNumber(int value) { 
8996            if (this.number == null)
8997              this.number = new PositiveIntType();
8998            this.number.setValue(value);
8999          return this;
9000        }
9001
9002        /**
9003         * @return {@link #type} (The note purpose: Print/Display.)
9004         */
9005        public CodeableConcept getType() { 
9006          if (this.type == null)
9007            if (Configuration.errorOnAutoCreate())
9008              throw new Error("Attempt to auto-create NoteComponent.type");
9009            else if (Configuration.doAutoCreate())
9010              this.type = new CodeableConcept(); // cc
9011          return this.type;
9012        }
9013
9014        public boolean hasType() { 
9015          return this.type != null && !this.type.isEmpty();
9016        }
9017
9018        /**
9019         * @param value {@link #type} (The note purpose: Print/Display.)
9020         */
9021        public NoteComponent setType(CodeableConcept value)  { 
9022          this.type = value;
9023          return this;
9024        }
9025
9026        /**
9027         * @return {@link #text} (The note text.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
9028         */
9029        public StringType getTextElement() { 
9030          if (this.text == null)
9031            if (Configuration.errorOnAutoCreate())
9032              throw new Error("Attempt to auto-create NoteComponent.text");
9033            else if (Configuration.doAutoCreate())
9034              this.text = new StringType(); // bb
9035          return this.text;
9036        }
9037
9038        public boolean hasTextElement() { 
9039          return this.text != null && !this.text.isEmpty();
9040        }
9041
9042        public boolean hasText() { 
9043          return this.text != null && !this.text.isEmpty();
9044        }
9045
9046        /**
9047         * @param value {@link #text} (The note text.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
9048         */
9049        public NoteComponent setTextElement(StringType value) { 
9050          this.text = value;
9051          return this;
9052        }
9053
9054        /**
9055         * @return The note text.
9056         */
9057        public String getText() { 
9058          return this.text == null ? null : this.text.getValue();
9059        }
9060
9061        /**
9062         * @param value The note text.
9063         */
9064        public NoteComponent setText(String value) { 
9065          if (Utilities.noString(value))
9066            this.text = null;
9067          else {
9068            if (this.text == null)
9069              this.text = new StringType();
9070            this.text.setValue(value);
9071          }
9072          return this;
9073        }
9074
9075        /**
9076         * @return {@link #language} (The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.)
9077         */
9078        public CodeableConcept getLanguage() { 
9079          if (this.language == null)
9080            if (Configuration.errorOnAutoCreate())
9081              throw new Error("Attempt to auto-create NoteComponent.language");
9082            else if (Configuration.doAutoCreate())
9083              this.language = new CodeableConcept(); // cc
9084          return this.language;
9085        }
9086
9087        public boolean hasLanguage() { 
9088          return this.language != null && !this.language.isEmpty();
9089        }
9090
9091        /**
9092         * @param value {@link #language} (The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.)
9093         */
9094        public NoteComponent setLanguage(CodeableConcept value)  { 
9095          this.language = value;
9096          return this;
9097        }
9098
9099        protected void listChildren(List<Property> children) {
9100          super.listChildren(children);
9101          children.add(new Property("number", "positiveInt", "An integer associated with each note which may be referred to from each service line item.", 0, 1, number));
9102          children.add(new Property("type", "CodeableConcept", "The note purpose: Print/Display.", 0, 1, type));
9103          children.add(new Property("text", "string", "The note text.", 0, 1, text));
9104          children.add(new Property("language", "CodeableConcept", "The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English.", 0, 1, language));
9105        }
9106
9107        @Override
9108        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9109          switch (_hash) {
9110          case -1034364087: /*number*/  return new Property("number", "positiveInt", "An integer associated with each note which may be referred to from each service line item.", 0, 1, number);
9111          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The note purpose: Print/Display.", 0, 1, type);
9112          case 3556653: /*text*/  return new Property("text", "string", "The note text.", 0, 1, text);
9113          case -1613589672: /*language*/  return new Property("language", "CodeableConcept", "The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English.", 0, 1, language);
9114          default: return super.getNamedProperty(_hash, _name, _checkValid);
9115          }
9116
9117        }
9118
9119      @Override
9120      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9121        switch (hash) {
9122        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
9123        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
9124        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
9125        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
9126        default: return super.getProperty(hash, name, checkValid);
9127        }
9128
9129      }
9130
9131      @Override
9132      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9133        switch (hash) {
9134        case -1034364087: // number
9135          this.number = castToPositiveInt(value); // PositiveIntType
9136          return value;
9137        case 3575610: // type
9138          this.type = castToCodeableConcept(value); // CodeableConcept
9139          return value;
9140        case 3556653: // text
9141          this.text = castToString(value); // StringType
9142          return value;
9143        case -1613589672: // language
9144          this.language = castToCodeableConcept(value); // CodeableConcept
9145          return value;
9146        default: return super.setProperty(hash, name, value);
9147        }
9148
9149      }
9150
9151      @Override
9152      public Base setProperty(String name, Base value) throws FHIRException {
9153        if (name.equals("number")) {
9154          this.number = castToPositiveInt(value); // PositiveIntType
9155        } else if (name.equals("type")) {
9156          this.type = castToCodeableConcept(value); // CodeableConcept
9157        } else if (name.equals("text")) {
9158          this.text = castToString(value); // StringType
9159        } else if (name.equals("language")) {
9160          this.language = castToCodeableConcept(value); // CodeableConcept
9161        } else
9162          return super.setProperty(name, value);
9163        return value;
9164      }
9165
9166      @Override
9167      public Base makeProperty(int hash, String name) throws FHIRException {
9168        switch (hash) {
9169        case -1034364087:  return getNumberElement();
9170        case 3575610:  return getType(); 
9171        case 3556653:  return getTextElement();
9172        case -1613589672:  return getLanguage(); 
9173        default: return super.makeProperty(hash, name);
9174        }
9175
9176      }
9177
9178      @Override
9179      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9180        switch (hash) {
9181        case -1034364087: /*number*/ return new String[] {"positiveInt"};
9182        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
9183        case 3556653: /*text*/ return new String[] {"string"};
9184        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
9185        default: return super.getTypesForProperty(hash, name);
9186        }
9187
9188      }
9189
9190      @Override
9191      public Base addChild(String name) throws FHIRException {
9192        if (name.equals("number")) {
9193          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.number");
9194        }
9195        else if (name.equals("type")) {
9196          this.type = new CodeableConcept();
9197          return this.type;
9198        }
9199        else if (name.equals("text")) {
9200          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.text");
9201        }
9202        else if (name.equals("language")) {
9203          this.language = new CodeableConcept();
9204          return this.language;
9205        }
9206        else
9207          return super.addChild(name);
9208      }
9209
9210      public NoteComponent copy() {
9211        NoteComponent dst = new NoteComponent();
9212        copyValues(dst);
9213        dst.number = number == null ? null : number.copy();
9214        dst.type = type == null ? null : type.copy();
9215        dst.text = text == null ? null : text.copy();
9216        dst.language = language == null ? null : language.copy();
9217        return dst;
9218      }
9219
9220      @Override
9221      public boolean equalsDeep(Base other_) {
9222        if (!super.equalsDeep(other_))
9223          return false;
9224        if (!(other_ instanceof NoteComponent))
9225          return false;
9226        NoteComponent o = (NoteComponent) other_;
9227        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
9228           && compareDeep(language, o.language, true);
9229      }
9230
9231      @Override
9232      public boolean equalsShallow(Base other_) {
9233        if (!super.equalsShallow(other_))
9234          return false;
9235        if (!(other_ instanceof NoteComponent))
9236          return false;
9237        NoteComponent o = (NoteComponent) other_;
9238        return compareValues(number, o.number, true) && compareValues(text, o.text, true);
9239      }
9240
9241      public boolean isEmpty() {
9242        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language
9243          );
9244      }
9245
9246  public String fhirType() {
9247    return "ExplanationOfBenefit.processNote";
9248
9249  }
9250
9251  }
9252
9253    @Block()
9254    public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
9255        /**
9256         * Dental, Vision, Medical, Pharmacy, Rehab etc.
9257         */
9258        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9259        @Description(shortDefinition="Type of services covered", formalDefinition="Dental, Vision, Medical, Pharmacy, Rehab etc." )
9260        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-category")
9261        protected CodeableConcept category;
9262
9263        /**
9264         * Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.
9265         */
9266        @Child(name = "subCategory", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
9267        @Description(shortDefinition="Detailed services covered within the type", formalDefinition="Dental: basic, major, ortho; Vision exam, glasses, contacts; etc." )
9268        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
9269        protected CodeableConcept subCategory;
9270
9271        /**
9272         * True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.
9273         */
9274        @Child(name = "excluded", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
9275        @Description(shortDefinition="Excluded from the plan", formalDefinition="True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage." )
9276        protected BooleanType excluded;
9277
9278        /**
9279         * A short name or tag for the benefit, for example MED01, or DENT2.
9280         */
9281        @Child(name = "name", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
9282        @Description(shortDefinition="Short name for the benefit", formalDefinition="A short name or tag for the benefit, for example MED01, or DENT2." )
9283        protected StringType name;
9284
9285        /**
9286         * A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.
9287         */
9288        @Child(name = "description", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
9289        @Description(shortDefinition="Description of the benefit or services covered", formalDefinition="A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'." )
9290        protected StringType description;
9291
9292        /**
9293         * Network designation.
9294         */
9295        @Child(name = "network", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
9296        @Description(shortDefinition="In or out of network", formalDefinition="Network designation." )
9297        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-network")
9298        protected CodeableConcept network;
9299
9300        /**
9301         * Unit designation: individual or family.
9302         */
9303        @Child(name = "unit", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
9304        @Description(shortDefinition="Individual or family", formalDefinition="Unit designation: individual or family." )
9305        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-unit")
9306        protected CodeableConcept unit;
9307
9308        /**
9309         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.
9310         */
9311        @Child(name = "term", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
9312        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'." )
9313        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-term")
9314        protected CodeableConcept term;
9315
9316        /**
9317         * Benefits Used to date.
9318         */
9319        @Child(name = "financial", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9320        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
9321        protected List<BenefitComponent> financial;
9322
9323        private static final long serialVersionUID = 833826021L;
9324
9325    /**
9326     * Constructor
9327     */
9328      public BenefitBalanceComponent() {
9329        super();
9330      }
9331
9332    /**
9333     * Constructor
9334     */
9335      public BenefitBalanceComponent(CodeableConcept category) {
9336        super();
9337        this.category = category;
9338      }
9339
9340        /**
9341         * @return {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
9342         */
9343        public CodeableConcept getCategory() { 
9344          if (this.category == null)
9345            if (Configuration.errorOnAutoCreate())
9346              throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
9347            else if (Configuration.doAutoCreate())
9348              this.category = new CodeableConcept(); // cc
9349          return this.category;
9350        }
9351
9352        public boolean hasCategory() { 
9353          return this.category != null && !this.category.isEmpty();
9354        }
9355
9356        /**
9357         * @param value {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
9358         */
9359        public BenefitBalanceComponent setCategory(CodeableConcept value)  { 
9360          this.category = value;
9361          return this;
9362        }
9363
9364        /**
9365         * @return {@link #subCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
9366         */
9367        public CodeableConcept getSubCategory() { 
9368          if (this.subCategory == null)
9369            if (Configuration.errorOnAutoCreate())
9370              throw new Error("Attempt to auto-create BenefitBalanceComponent.subCategory");
9371            else if (Configuration.doAutoCreate())
9372              this.subCategory = new CodeableConcept(); // cc
9373          return this.subCategory;
9374        }
9375
9376        public boolean hasSubCategory() { 
9377          return this.subCategory != null && !this.subCategory.isEmpty();
9378        }
9379
9380        /**
9381         * @param value {@link #subCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
9382         */
9383        public BenefitBalanceComponent setSubCategory(CodeableConcept value)  { 
9384          this.subCategory = value;
9385          return this;
9386        }
9387
9388        /**
9389         * @return {@link #excluded} (True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.). This is the underlying object with id, value and extensions. The accessor "getExcluded" gives direct access to the value
9390         */
9391        public BooleanType getExcludedElement() { 
9392          if (this.excluded == null)
9393            if (Configuration.errorOnAutoCreate())
9394              throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
9395            else if (Configuration.doAutoCreate())
9396              this.excluded = new BooleanType(); // bb
9397          return this.excluded;
9398        }
9399
9400        public boolean hasExcludedElement() { 
9401          return this.excluded != null && !this.excluded.isEmpty();
9402        }
9403
9404        public boolean hasExcluded() { 
9405          return this.excluded != null && !this.excluded.isEmpty();
9406        }
9407
9408        /**
9409         * @param value {@link #excluded} (True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.). This is the underlying object with id, value and extensions. The accessor "getExcluded" gives direct access to the value
9410         */
9411        public BenefitBalanceComponent setExcludedElement(BooleanType value) { 
9412          this.excluded = value;
9413          return this;
9414        }
9415
9416        /**
9417         * @return True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.
9418         */
9419        public boolean getExcluded() { 
9420          return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
9421        }
9422
9423        /**
9424         * @param value True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.
9425         */
9426        public BenefitBalanceComponent setExcluded(boolean value) { 
9427            if (this.excluded == null)
9428              this.excluded = new BooleanType();
9429            this.excluded.setValue(value);
9430          return this;
9431        }
9432
9433        /**
9434         * @return {@link #name} (A short name or tag for the benefit, for example MED01, or DENT2.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
9435         */
9436        public StringType getNameElement() { 
9437          if (this.name == null)
9438            if (Configuration.errorOnAutoCreate())
9439              throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
9440            else if (Configuration.doAutoCreate())
9441              this.name = new StringType(); // bb
9442          return this.name;
9443        }
9444
9445        public boolean hasNameElement() { 
9446          return this.name != null && !this.name.isEmpty();
9447        }
9448
9449        public boolean hasName() { 
9450          return this.name != null && !this.name.isEmpty();
9451        }
9452
9453        /**
9454         * @param value {@link #name} (A short name or tag for the benefit, for example MED01, or DENT2.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
9455         */
9456        public BenefitBalanceComponent setNameElement(StringType value) { 
9457          this.name = value;
9458          return this;
9459        }
9460
9461        /**
9462         * @return A short name or tag for the benefit, for example MED01, or DENT2.
9463         */
9464        public String getName() { 
9465          return this.name == null ? null : this.name.getValue();
9466        }
9467
9468        /**
9469         * @param value A short name or tag for the benefit, for example MED01, or DENT2.
9470         */
9471        public BenefitBalanceComponent setName(String value) { 
9472          if (Utilities.noString(value))
9473            this.name = null;
9474          else {
9475            if (this.name == null)
9476              this.name = new StringType();
9477            this.name.setValue(value);
9478          }
9479          return this;
9480        }
9481
9482        /**
9483         * @return {@link #description} (A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
9484         */
9485        public StringType getDescriptionElement() { 
9486          if (this.description == null)
9487            if (Configuration.errorOnAutoCreate())
9488              throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
9489            else if (Configuration.doAutoCreate())
9490              this.description = new StringType(); // bb
9491          return this.description;
9492        }
9493
9494        public boolean hasDescriptionElement() { 
9495          return this.description != null && !this.description.isEmpty();
9496        }
9497
9498        public boolean hasDescription() { 
9499          return this.description != null && !this.description.isEmpty();
9500        }
9501
9502        /**
9503         * @param value {@link #description} (A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
9504         */
9505        public BenefitBalanceComponent setDescriptionElement(StringType value) { 
9506          this.description = value;
9507          return this;
9508        }
9509
9510        /**
9511         * @return A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.
9512         */
9513        public String getDescription() { 
9514          return this.description == null ? null : this.description.getValue();
9515        }
9516
9517        /**
9518         * @param value A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.
9519         */
9520        public BenefitBalanceComponent setDescription(String value) { 
9521          if (Utilities.noString(value))
9522            this.description = null;
9523          else {
9524            if (this.description == null)
9525              this.description = new StringType();
9526            this.description.setValue(value);
9527          }
9528          return this;
9529        }
9530
9531        /**
9532         * @return {@link #network} (Network designation.)
9533         */
9534        public CodeableConcept getNetwork() { 
9535          if (this.network == null)
9536            if (Configuration.errorOnAutoCreate())
9537              throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
9538            else if (Configuration.doAutoCreate())
9539              this.network = new CodeableConcept(); // cc
9540          return this.network;
9541        }
9542
9543        public boolean hasNetwork() { 
9544          return this.network != null && !this.network.isEmpty();
9545        }
9546
9547        /**
9548         * @param value {@link #network} (Network designation.)
9549         */
9550        public BenefitBalanceComponent setNetwork(CodeableConcept value)  { 
9551          this.network = value;
9552          return this;
9553        }
9554
9555        /**
9556         * @return {@link #unit} (Unit designation: individual or family.)
9557         */
9558        public CodeableConcept getUnit() { 
9559          if (this.unit == null)
9560            if (Configuration.errorOnAutoCreate())
9561              throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
9562            else if (Configuration.doAutoCreate())
9563              this.unit = new CodeableConcept(); // cc
9564          return this.unit;
9565        }
9566
9567        public boolean hasUnit() { 
9568          return this.unit != null && !this.unit.isEmpty();
9569        }
9570
9571        /**
9572         * @param value {@link #unit} (Unit designation: individual or family.)
9573         */
9574        public BenefitBalanceComponent setUnit(CodeableConcept value)  { 
9575          this.unit = value;
9576          return this;
9577        }
9578
9579        /**
9580         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
9581         */
9582        public CodeableConcept getTerm() { 
9583          if (this.term == null)
9584            if (Configuration.errorOnAutoCreate())
9585              throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
9586            else if (Configuration.doAutoCreate())
9587              this.term = new CodeableConcept(); // cc
9588          return this.term;
9589        }
9590
9591        public boolean hasTerm() { 
9592          return this.term != null && !this.term.isEmpty();
9593        }
9594
9595        /**
9596         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
9597         */
9598        public BenefitBalanceComponent setTerm(CodeableConcept value)  { 
9599          this.term = value;
9600          return this;
9601        }
9602
9603        /**
9604         * @return {@link #financial} (Benefits Used to date.)
9605         */
9606        public List<BenefitComponent> getFinancial() { 
9607          if (this.financial == null)
9608            this.financial = new ArrayList<BenefitComponent>();
9609          return this.financial;
9610        }
9611
9612        /**
9613         * @return Returns a reference to <code>this</code> for easy method chaining
9614         */
9615        public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) { 
9616          this.financial = theFinancial;
9617          return this;
9618        }
9619
9620        public boolean hasFinancial() { 
9621          if (this.financial == null)
9622            return false;
9623          for (BenefitComponent item : this.financial)
9624            if (!item.isEmpty())
9625              return true;
9626          return false;
9627        }
9628
9629        public BenefitComponent addFinancial() { //3
9630          BenefitComponent t = new BenefitComponent();
9631          if (this.financial == null)
9632            this.financial = new ArrayList<BenefitComponent>();
9633          this.financial.add(t);
9634          return t;
9635        }
9636
9637        public BenefitBalanceComponent addFinancial(BenefitComponent t) { //3
9638          if (t == null)
9639            return this;
9640          if (this.financial == null)
9641            this.financial = new ArrayList<BenefitComponent>();
9642          this.financial.add(t);
9643          return this;
9644        }
9645
9646        /**
9647         * @return The first repetition of repeating field {@link #financial}, creating it if it does not already exist
9648         */
9649        public BenefitComponent getFinancialFirstRep() { 
9650          if (getFinancial().isEmpty()) {
9651            addFinancial();
9652          }
9653          return getFinancial().get(0);
9654        }
9655
9656        protected void listChildren(List<Property> children) {
9657          super.listChildren(children);
9658          children.add(new Property("category", "CodeableConcept", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, 1, category));
9659          children.add(new Property("subCategory", "CodeableConcept", "Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.", 0, 1, subCategory));
9660          children.add(new Property("excluded", "boolean", "True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.", 0, 1, excluded));
9661          children.add(new Property("name", "string", "A short name or tag for the benefit, for example MED01, or DENT2.", 0, 1, name));
9662          children.add(new Property("description", "string", "A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.", 0, 1, description));
9663          children.add(new Property("network", "CodeableConcept", "Network designation.", 0, 1, network));
9664          children.add(new Property("unit", "CodeableConcept", "Unit designation: individual or family.", 0, 1, unit));
9665          children.add(new Property("term", "CodeableConcept", "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.", 0, 1, term));
9666          children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
9667        }
9668
9669        @Override
9670        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9671          switch (_hash) {
9672          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, 1, category);
9673          case 1365024606: /*subCategory*/  return new Property("subCategory", "CodeableConcept", "Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.", 0, 1, subCategory);
9674          case 1994055114: /*excluded*/  return new Property("excluded", "boolean", "True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.", 0, 1, excluded);
9675          case 3373707: /*name*/  return new Property("name", "string", "A short name or tag for the benefit, for example MED01, or DENT2.", 0, 1, name);
9676          case -1724546052: /*description*/  return new Property("description", "string", "A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.", 0, 1, description);
9677          case 1843485230: /*network*/  return new Property("network", "CodeableConcept", "Network designation.", 0, 1, network);
9678          case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "Unit designation: individual or family.", 0, 1, unit);
9679          case 3556460: /*term*/  return new Property("term", "CodeableConcept", "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.", 0, 1, term);
9680          case 357555337: /*financial*/  return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial);
9681          default: return super.getNamedProperty(_hash, _name, _checkValid);
9682          }
9683
9684        }
9685
9686      @Override
9687      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9688        switch (hash) {
9689        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
9690        case 1365024606: /*subCategory*/ return this.subCategory == null ? new Base[0] : new Base[] {this.subCategory}; // CodeableConcept
9691        case 1994055114: /*excluded*/ return this.excluded == null ? new Base[0] : new Base[] {this.excluded}; // BooleanType
9692        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
9693        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
9694        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // CodeableConcept
9695        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
9696        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // CodeableConcept
9697        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
9698        default: return super.getProperty(hash, name, checkValid);
9699        }
9700
9701      }
9702
9703      @Override
9704      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9705        switch (hash) {
9706        case 50511102: // category
9707          this.category = castToCodeableConcept(value); // CodeableConcept
9708          return value;
9709        case 1365024606: // subCategory
9710          this.subCategory = castToCodeableConcept(value); // CodeableConcept
9711          return value;
9712        case 1994055114: // excluded
9713          this.excluded = castToBoolean(value); // BooleanType
9714          return value;
9715        case 3373707: // name
9716          this.name = castToString(value); // StringType
9717          return value;
9718        case -1724546052: // description
9719          this.description = castToString(value); // StringType
9720          return value;
9721        case 1843485230: // network
9722          this.network = castToCodeableConcept(value); // CodeableConcept
9723          return value;
9724        case 3594628: // unit
9725          this.unit = castToCodeableConcept(value); // CodeableConcept
9726          return value;
9727        case 3556460: // term
9728          this.term = castToCodeableConcept(value); // CodeableConcept
9729          return value;
9730        case 357555337: // financial
9731          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
9732          return value;
9733        default: return super.setProperty(hash, name, value);
9734        }
9735
9736      }
9737
9738      @Override
9739      public Base setProperty(String name, Base value) throws FHIRException {
9740        if (name.equals("category")) {
9741          this.category = castToCodeableConcept(value); // CodeableConcept
9742        } else if (name.equals("subCategory")) {
9743          this.subCategory = castToCodeableConcept(value); // CodeableConcept
9744        } else if (name.equals("excluded")) {
9745          this.excluded = castToBoolean(value); // BooleanType
9746        } else if (name.equals("name")) {
9747          this.name = castToString(value); // StringType
9748        } else if (name.equals("description")) {
9749          this.description = castToString(value); // StringType
9750        } else if (name.equals("network")) {
9751          this.network = castToCodeableConcept(value); // CodeableConcept
9752        } else if (name.equals("unit")) {
9753          this.unit = castToCodeableConcept(value); // CodeableConcept
9754        } else if (name.equals("term")) {
9755          this.term = castToCodeableConcept(value); // CodeableConcept
9756        } else if (name.equals("financial")) {
9757          this.getFinancial().add((BenefitComponent) value);
9758        } else
9759          return super.setProperty(name, value);
9760        return value;
9761      }
9762
9763      @Override
9764      public Base makeProperty(int hash, String name) throws FHIRException {
9765        switch (hash) {
9766        case 50511102:  return getCategory(); 
9767        case 1365024606:  return getSubCategory(); 
9768        case 1994055114:  return getExcludedElement();
9769        case 3373707:  return getNameElement();
9770        case -1724546052:  return getDescriptionElement();
9771        case 1843485230:  return getNetwork(); 
9772        case 3594628:  return getUnit(); 
9773        case 3556460:  return getTerm(); 
9774        case 357555337:  return addFinancial(); 
9775        default: return super.makeProperty(hash, name);
9776        }
9777
9778      }
9779
9780      @Override
9781      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9782        switch (hash) {
9783        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
9784        case 1365024606: /*subCategory*/ return new String[] {"CodeableConcept"};
9785        case 1994055114: /*excluded*/ return new String[] {"boolean"};
9786        case 3373707: /*name*/ return new String[] {"string"};
9787        case -1724546052: /*description*/ return new String[] {"string"};
9788        case 1843485230: /*network*/ return new String[] {"CodeableConcept"};
9789        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
9790        case 3556460: /*term*/ return new String[] {"CodeableConcept"};
9791        case 357555337: /*financial*/ return new String[] {};
9792        default: return super.getTypesForProperty(hash, name);
9793        }
9794
9795      }
9796
9797      @Override
9798      public Base addChild(String name) throws FHIRException {
9799        if (name.equals("category")) {
9800          this.category = new CodeableConcept();
9801          return this.category;
9802        }
9803        else if (name.equals("subCategory")) {
9804          this.subCategory = new CodeableConcept();
9805          return this.subCategory;
9806        }
9807        else if (name.equals("excluded")) {
9808          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.excluded");
9809        }
9810        else if (name.equals("name")) {
9811          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.name");
9812        }
9813        else if (name.equals("description")) {
9814          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.description");
9815        }
9816        else if (name.equals("network")) {
9817          this.network = new CodeableConcept();
9818          return this.network;
9819        }
9820        else if (name.equals("unit")) {
9821          this.unit = new CodeableConcept();
9822          return this.unit;
9823        }
9824        else if (name.equals("term")) {
9825          this.term = new CodeableConcept();
9826          return this.term;
9827        }
9828        else if (name.equals("financial")) {
9829          return addFinancial();
9830        }
9831        else
9832          return super.addChild(name);
9833      }
9834
9835      public BenefitBalanceComponent copy() {
9836        BenefitBalanceComponent dst = new BenefitBalanceComponent();
9837        copyValues(dst);
9838        dst.category = category == null ? null : category.copy();
9839        dst.subCategory = subCategory == null ? null : subCategory.copy();
9840        dst.excluded = excluded == null ? null : excluded.copy();
9841        dst.name = name == null ? null : name.copy();
9842        dst.description = description == null ? null : description.copy();
9843        dst.network = network == null ? null : network.copy();
9844        dst.unit = unit == null ? null : unit.copy();
9845        dst.term = term == null ? null : term.copy();
9846        if (financial != null) {
9847          dst.financial = new ArrayList<BenefitComponent>();
9848          for (BenefitComponent i : financial)
9849            dst.financial.add(i.copy());
9850        };
9851        return dst;
9852      }
9853
9854      @Override
9855      public boolean equalsDeep(Base other_) {
9856        if (!super.equalsDeep(other_))
9857          return false;
9858        if (!(other_ instanceof BenefitBalanceComponent))
9859          return false;
9860        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
9861        return compareDeep(category, o.category, true) && compareDeep(subCategory, o.subCategory, true)
9862           && compareDeep(excluded, o.excluded, true) && compareDeep(name, o.name, true) && compareDeep(description, o.description, true)
9863           && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true) && compareDeep(term, o.term, true)
9864           && compareDeep(financial, o.financial, true);
9865      }
9866
9867      @Override
9868      public boolean equalsShallow(Base other_) {
9869        if (!super.equalsShallow(other_))
9870          return false;
9871        if (!(other_ instanceof BenefitBalanceComponent))
9872          return false;
9873        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
9874        return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
9875          ;
9876      }
9877
9878      public boolean isEmpty() {
9879        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, subCategory, excluded
9880          , name, description, network, unit, term, financial);
9881      }
9882
9883  public String fhirType() {
9884    return "ExplanationOfBenefit.benefitBalance";
9885
9886  }
9887
9888  }
9889
9890    @Block()
9891    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
9892        /**
9893         * Deductable, visits, benefit amount.
9894         */
9895        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9896        @Description(shortDefinition="Deductable, visits, benefit amount", formalDefinition="Deductable, visits, benefit amount." )
9897        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-type")
9898        protected CodeableConcept type;
9899
9900        /**
9901         * Benefits allowed.
9902         */
9903        @Child(name = "allowed", type = {UnsignedIntType.class, StringType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
9904        @Description(shortDefinition="Benefits allowed", formalDefinition="Benefits allowed." )
9905        protected Type allowed;
9906
9907        /**
9908         * Benefits used.
9909         */
9910        @Child(name = "used", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
9911        @Description(shortDefinition="Benefits used", formalDefinition="Benefits used." )
9912        protected Type used;
9913
9914        private static final long serialVersionUID = -1506285314L;
9915
9916    /**
9917     * Constructor
9918     */
9919      public BenefitComponent() {
9920        super();
9921      }
9922
9923    /**
9924     * Constructor
9925     */
9926      public BenefitComponent(CodeableConcept type) {
9927        super();
9928        this.type = type;
9929      }
9930
9931        /**
9932         * @return {@link #type} (Deductable, visits, benefit amount.)
9933         */
9934        public CodeableConcept getType() { 
9935          if (this.type == null)
9936            if (Configuration.errorOnAutoCreate())
9937              throw new Error("Attempt to auto-create BenefitComponent.type");
9938            else if (Configuration.doAutoCreate())
9939              this.type = new CodeableConcept(); // cc
9940          return this.type;
9941        }
9942
9943        public boolean hasType() { 
9944          return this.type != null && !this.type.isEmpty();
9945        }
9946
9947        /**
9948         * @param value {@link #type} (Deductable, visits, benefit amount.)
9949         */
9950        public BenefitComponent setType(CodeableConcept value)  { 
9951          this.type = value;
9952          return this;
9953        }
9954
9955        /**
9956         * @return {@link #allowed} (Benefits allowed.)
9957         */
9958        public Type getAllowed() { 
9959          return this.allowed;
9960        }
9961
9962        /**
9963         * @return {@link #allowed} (Benefits allowed.)
9964         */
9965        public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException { 
9966          if (this.allowed == null)
9967            return null;
9968          if (!(this.allowed instanceof UnsignedIntType))
9969            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.allowed.getClass().getName()+" was encountered");
9970          return (UnsignedIntType) this.allowed;
9971        }
9972
9973        public boolean hasAllowedUnsignedIntType() { 
9974          return this != null && this.allowed instanceof UnsignedIntType;
9975        }
9976
9977        /**
9978         * @return {@link #allowed} (Benefits allowed.)
9979         */
9980        public StringType getAllowedStringType() throws FHIRException { 
9981          if (this.allowed == null)
9982            return null;
9983          if (!(this.allowed instanceof StringType))
9984            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.allowed.getClass().getName()+" was encountered");
9985          return (StringType) this.allowed;
9986        }
9987
9988        public boolean hasAllowedStringType() { 
9989          return this != null && this.allowed instanceof StringType;
9990        }
9991
9992        /**
9993         * @return {@link #allowed} (Benefits allowed.)
9994         */
9995        public Money getAllowedMoney() throws FHIRException { 
9996          if (this.allowed == null)
9997            return null;
9998          if (!(this.allowed instanceof Money))
9999            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.allowed.getClass().getName()+" was encountered");
10000          return (Money) this.allowed;
10001        }
10002
10003        public boolean hasAllowedMoney() { 
10004          return this != null && this.allowed instanceof Money;
10005        }
10006
10007        public boolean hasAllowed() { 
10008          return this.allowed != null && !this.allowed.isEmpty();
10009        }
10010
10011        /**
10012         * @param value {@link #allowed} (Benefits allowed.)
10013         */
10014        public BenefitComponent setAllowed(Type value) throws FHIRFormatError { 
10015          if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
10016            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.benefitBalance.financial.allowed[x]: "+value.fhirType());
10017          this.allowed = value;
10018          return this;
10019        }
10020
10021        /**
10022         * @return {@link #used} (Benefits used.)
10023         */
10024        public Type getUsed() { 
10025          return this.used;
10026        }
10027
10028        /**
10029         * @return {@link #used} (Benefits used.)
10030         */
10031        public UnsignedIntType getUsedUnsignedIntType() throws FHIRException { 
10032          if (this.used == null)
10033            return null;
10034          if (!(this.used instanceof UnsignedIntType))
10035            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.used.getClass().getName()+" was encountered");
10036          return (UnsignedIntType) this.used;
10037        }
10038
10039        public boolean hasUsedUnsignedIntType() { 
10040          return this != null && this.used instanceof UnsignedIntType;
10041        }
10042
10043        /**
10044         * @return {@link #used} (Benefits used.)
10045         */
10046        public Money getUsedMoney() throws FHIRException { 
10047          if (this.used == null)
10048            return null;
10049          if (!(this.used instanceof Money))
10050            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.used.getClass().getName()+" was encountered");
10051          return (Money) this.used;
10052        }
10053
10054        public boolean hasUsedMoney() { 
10055          return this != null && this.used instanceof Money;
10056        }
10057
10058        public boolean hasUsed() { 
10059          return this.used != null && !this.used.isEmpty();
10060        }
10061
10062        /**
10063         * @param value {@link #used} (Benefits used.)
10064         */
10065        public BenefitComponent setUsed(Type value) throws FHIRFormatError { 
10066          if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
10067            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.benefitBalance.financial.used[x]: "+value.fhirType());
10068          this.used = value;
10069          return this;
10070        }
10071
10072        protected void listChildren(List<Property> children) {
10073          super.listChildren(children);
10074          children.add(new Property("type", "CodeableConcept", "Deductable, visits, benefit amount.", 0, 1, type));
10075          children.add(new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed));
10076          children.add(new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used));
10077        }
10078
10079        @Override
10080        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10081          switch (_hash) {
10082          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Deductable, visits, benefit amount.", 0, 1, type);
10083          case -1336663592: /*allowed[x]*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
10084          case -911343192: /*allowed*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
10085          case 1668802034: /*allowedUnsignedInt*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
10086          case -2135265319: /*allowedString*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
10087          case -351668232: /*allowedMoney*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
10088          case -147553373: /*used[x]*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
10089          case 3599293: /*used*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
10090          case 1252740285: /*usedUnsignedInt*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
10091          case -78048509: /*usedMoney*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
10092          default: return super.getNamedProperty(_hash, _name, _checkValid);
10093          }
10094
10095        }
10096
10097      @Override
10098      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10099        switch (hash) {
10100        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
10101        case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // Type
10102        case 3599293: /*used*/ return this.used == null ? new Base[0] : new Base[] {this.used}; // Type
10103        default: return super.getProperty(hash, name, checkValid);
10104        }
10105
10106      }
10107
10108      @Override
10109      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10110        switch (hash) {
10111        case 3575610: // type
10112          this.type = castToCodeableConcept(value); // CodeableConcept
10113          return value;
10114        case -911343192: // allowed
10115          this.allowed = castToType(value); // Type
10116          return value;
10117        case 3599293: // used
10118          this.used = castToType(value); // Type
10119          return value;
10120        default: return super.setProperty(hash, name, value);
10121        }
10122
10123      }
10124
10125      @Override
10126      public Base setProperty(String name, Base value) throws FHIRException {
10127        if (name.equals("type")) {
10128          this.type = castToCodeableConcept(value); // CodeableConcept
10129        } else if (name.equals("allowed[x]")) {
10130          this.allowed = castToType(value); // Type
10131        } else if (name.equals("used[x]")) {
10132          this.used = castToType(value); // Type
10133        } else
10134          return super.setProperty(name, value);
10135        return value;
10136      }
10137
10138      @Override
10139      public Base makeProperty(int hash, String name) throws FHIRException {
10140        switch (hash) {
10141        case 3575610:  return getType(); 
10142        case -1336663592:  return getAllowed(); 
10143        case -911343192:  return getAllowed(); 
10144        case -147553373:  return getUsed(); 
10145        case 3599293:  return getUsed(); 
10146        default: return super.makeProperty(hash, name);
10147        }
10148
10149      }
10150
10151      @Override
10152      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10153        switch (hash) {
10154        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
10155        case -911343192: /*allowed*/ return new String[] {"unsignedInt", "string", "Money"};
10156        case 3599293: /*used*/ return new String[] {"unsignedInt", "Money"};
10157        default: return super.getTypesForProperty(hash, name);
10158        }
10159
10160      }
10161
10162      @Override
10163      public Base addChild(String name) throws FHIRException {
10164        if (name.equals("type")) {
10165          this.type = new CodeableConcept();
10166          return this.type;
10167        }
10168        else if (name.equals("allowedUnsignedInt")) {
10169          this.allowed = new UnsignedIntType();
10170          return this.allowed;
10171        }
10172        else if (name.equals("allowedString")) {
10173          this.allowed = new StringType();
10174          return this.allowed;
10175        }
10176        else if (name.equals("allowedMoney")) {
10177          this.allowed = new Money();
10178          return this.allowed;
10179        }
10180        else if (name.equals("usedUnsignedInt")) {
10181          this.used = new UnsignedIntType();
10182          return this.used;
10183        }
10184        else if (name.equals("usedMoney")) {
10185          this.used = new Money();
10186          return this.used;
10187        }
10188        else
10189          return super.addChild(name);
10190      }
10191
10192      public BenefitComponent copy() {
10193        BenefitComponent dst = new BenefitComponent();
10194        copyValues(dst);
10195        dst.type = type == null ? null : type.copy();
10196        dst.allowed = allowed == null ? null : allowed.copy();
10197        dst.used = used == null ? null : used.copy();
10198        return dst;
10199      }
10200
10201      @Override
10202      public boolean equalsDeep(Base other_) {
10203        if (!super.equalsDeep(other_))
10204          return false;
10205        if (!(other_ instanceof BenefitComponent))
10206          return false;
10207        BenefitComponent o = (BenefitComponent) other_;
10208        return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true) && compareDeep(used, o.used, true)
10209          ;
10210      }
10211
10212      @Override
10213      public boolean equalsShallow(Base other_) {
10214        if (!super.equalsShallow(other_))
10215          return false;
10216        if (!(other_ instanceof BenefitComponent))
10217          return false;
10218        BenefitComponent o = (BenefitComponent) other_;
10219        return true;
10220      }
10221
10222      public boolean isEmpty() {
10223        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
10224      }
10225
10226  public String fhirType() {
10227    return "ExplanationOfBenefit.benefitBalance.financial";
10228
10229  }
10230
10231  }
10232
10233    /**
10234     * The EOB Business Identifier.
10235     */
10236    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10237    @Description(shortDefinition="Business Identifier", formalDefinition="The EOB Business Identifier." )
10238    protected List<Identifier> identifier;
10239
10240    /**
10241     * The status of the resource instance.
10242     */
10243    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
10244    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
10245    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
10246    protected Enumeration<ExplanationOfBenefitStatus> status;
10247
10248    /**
10249     * The category of claim, eg, oral, pharmacy, vision, insitutional, professional.
10250     */
10251    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
10252    @Description(shortDefinition="Type or discipline", formalDefinition="The category of claim, eg, oral, pharmacy, vision, insitutional, professional." )
10253    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-type")
10254    protected CodeableConcept type;
10255
10256    /**
10257     * A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType.
10258     */
10259    @Child(name = "subType", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10260    @Description(shortDefinition="Finer grained claim type information", formalDefinition="A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType." )
10261    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-subtype")
10262    protected List<CodeableConcept> subType;
10263
10264    /**
10265     * Patient Resource.
10266     */
10267    @Child(name = "patient", type = {Patient.class}, order=4, min=0, max=1, modifier=false, summary=false)
10268    @Description(shortDefinition="The subject of the Products and Services", formalDefinition="Patient Resource." )
10269    protected Reference patient;
10270
10271    /**
10272     * The actual object that is the target of the reference (Patient Resource.)
10273     */
10274    protected Patient patientTarget;
10275
10276    /**
10277     * The billable period for which charges are being submitted.
10278     */
10279    @Child(name = "billablePeriod", type = {Period.class}, order=5, min=0, max=1, modifier=false, summary=false)
10280    @Description(shortDefinition="Period for charge submission", formalDefinition="The billable period for which charges are being submitted." )
10281    protected Period billablePeriod;
10282
10283    /**
10284     * The date when the EOB was created.
10285     */
10286    @Child(name = "created", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=false)
10287    @Description(shortDefinition="Creation date", formalDefinition="The date when the EOB was created." )
10288    protected DateTimeType created;
10289
10290    /**
10291     * The person who created the explanation of benefit.
10292     */
10293    @Child(name = "enterer", type = {Practitioner.class}, order=7, min=0, max=1, modifier=false, summary=false)
10294    @Description(shortDefinition="Author", formalDefinition="The person who created the explanation of benefit." )
10295    protected Reference enterer;
10296
10297    /**
10298     * The actual object that is the target of the reference (The person who created the explanation of benefit.)
10299     */
10300    protected Practitioner entererTarget;
10301
10302    /**
10303     * The insurer which is responsible for the explanation of benefit.
10304     */
10305    @Child(name = "insurer", type = {Organization.class}, order=8, min=0, max=1, modifier=false, summary=false)
10306    @Description(shortDefinition="Insurer responsible for the EOB", formalDefinition="The insurer which is responsible for the explanation of benefit." )
10307    protected Reference insurer;
10308
10309    /**
10310     * The actual object that is the target of the reference (The insurer which is responsible for the explanation of benefit.)
10311     */
10312    protected Organization insurerTarget;
10313
10314    /**
10315     * The provider which is responsible for the claim.
10316     */
10317    @Child(name = "provider", type = {Practitioner.class}, order=9, min=0, max=1, modifier=false, summary=false)
10318    @Description(shortDefinition="Responsible provider for the claim", formalDefinition="The provider which is responsible for the claim." )
10319    protected Reference provider;
10320
10321    /**
10322     * The actual object that is the target of the reference (The provider which is responsible for the claim.)
10323     */
10324    protected Practitioner providerTarget;
10325
10326    /**
10327     * The provider which is responsible for the claim.
10328     */
10329    @Child(name = "organization", type = {Organization.class}, order=10, min=0, max=1, modifier=false, summary=false)
10330    @Description(shortDefinition="Responsible organization for the claim", formalDefinition="The provider which is responsible for the claim." )
10331    protected Reference organization;
10332
10333    /**
10334     * The actual object that is the target of the reference (The provider which is responsible for the claim.)
10335     */
10336    protected Organization organizationTarget;
10337
10338    /**
10339     * The referral resource which lists the date, practitioner, reason and other supporting information.
10340     */
10341    @Child(name = "referral", type = {ReferralRequest.class}, order=11, min=0, max=1, modifier=false, summary=false)
10342    @Description(shortDefinition="Treatment Referral", formalDefinition="The referral resource which lists the date, practitioner, reason and other supporting information." )
10343    protected Reference referral;
10344
10345    /**
10346     * The actual object that is the target of the reference (The referral resource which lists the date, practitioner, reason and other supporting information.)
10347     */
10348    protected ReferralRequest referralTarget;
10349
10350    /**
10351     * Facility where the services were provided.
10352     */
10353    @Child(name = "facility", type = {Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
10354    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
10355    protected Reference facility;
10356
10357    /**
10358     * The actual object that is the target of the reference (Facility where the services were provided.)
10359     */
10360    protected Location facilityTarget;
10361
10362    /**
10363     * The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.
10364     */
10365    @Child(name = "claim", type = {Claim.class}, order=13, min=0, max=1, modifier=false, summary=false)
10366    @Description(shortDefinition="Claim reference", formalDefinition="The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number." )
10367    protected Reference claim;
10368
10369    /**
10370     * The actual object that is the target of the reference (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
10371     */
10372    protected Claim claimTarget;
10373
10374    /**
10375     * The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.
10376     */
10377    @Child(name = "claimResponse", type = {ClaimResponse.class}, order=14, min=0, max=1, modifier=false, summary=false)
10378    @Description(shortDefinition="Claim response reference", formalDefinition="The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number." )
10379    protected Reference claimResponse;
10380
10381    /**
10382     * The actual object that is the target of the reference (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
10383     */
10384    protected ClaimResponse claimResponseTarget;
10385
10386    /**
10387     * Processing outcome errror, partial or complete processing.
10388     */
10389    @Child(name = "outcome", type = {CodeableConcept.class}, order=15, min=0, max=1, modifier=false, summary=false)
10390    @Description(shortDefinition="complete | error | partial", formalDefinition="Processing outcome errror, partial or complete processing." )
10391    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
10392    protected CodeableConcept outcome;
10393
10394    /**
10395     * A description of the status of the adjudication.
10396     */
10397    @Child(name = "disposition", type = {StringType.class}, order=16, min=0, max=1, modifier=false, summary=false)
10398    @Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
10399    protected StringType disposition;
10400
10401    /**
10402     * Other claims which are related to this claim such as prior claim versions or for related services.
10403     */
10404    @Child(name = "related", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10405    @Description(shortDefinition="Related Claims which may be revelant to processing this claim", formalDefinition="Other claims which are related to this claim such as prior claim versions or for related services." )
10406    protected List<RelatedClaimComponent> related;
10407
10408    /**
10409     * Prescription to support the dispensing of Pharmacy or Vision products.
10410     */
10411    @Child(name = "prescription", type = {MedicationRequest.class, VisionPrescription.class}, order=18, min=0, max=1, modifier=false, summary=false)
10412    @Description(shortDefinition="Prescription authorizing services or products", formalDefinition="Prescription to support the dispensing of Pharmacy or Vision products." )
10413    protected Reference prescription;
10414
10415    /**
10416     * The actual object that is the target of the reference (Prescription to support the dispensing of Pharmacy or Vision products.)
10417     */
10418    protected Resource prescriptionTarget;
10419
10420    /**
10421     * Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.
10422     */
10423    @Child(name = "originalPrescription", type = {MedicationRequest.class}, order=19, min=0, max=1, modifier=false, summary=false)
10424    @Description(shortDefinition="Original prescription if superceded by fulfiller", formalDefinition="Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'." )
10425    protected Reference originalPrescription;
10426
10427    /**
10428     * The actual object that is the target of the reference (Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.)
10429     */
10430    protected MedicationRequest originalPrescriptionTarget;
10431
10432    /**
10433     * The party to be reimbursed for the services.
10434     */
10435    @Child(name = "payee", type = {}, order=20, min=0, max=1, modifier=false, summary=false)
10436    @Description(shortDefinition="Party to be paid any benefits payable", formalDefinition="The party to be reimbursed for the services." )
10437    protected PayeeComponent payee;
10438
10439    /**
10440     * Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required.
10441     */
10442    @Child(name = "information", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10443    @Description(shortDefinition="Exceptions, special considerations, the condition, situation, prior or concurrent issues", formalDefinition="Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required." )
10444    protected List<SupportingInformationComponent> information;
10445
10446    /**
10447     * The members of the team who provided the overall service as well as their role and whether responsible and qualifications.
10448     */
10449    @Child(name = "careTeam", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10450    @Description(shortDefinition="Care Team members", formalDefinition="The members of the team who provided the overall service as well as their role and whether responsible and qualifications." )
10451    protected List<CareTeamComponent> careTeam;
10452
10453    /**
10454     * Ordered list of patient diagnosis for which care is sought.
10455     */
10456    @Child(name = "diagnosis", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10457    @Description(shortDefinition="List of Diagnosis", formalDefinition="Ordered list of patient diagnosis for which care is sought." )
10458    protected List<DiagnosisComponent> diagnosis;
10459
10460    /**
10461     * Ordered list of patient procedures performed to support the adjudication.
10462     */
10463    @Child(name = "procedure", type = {}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10464    @Description(shortDefinition="Procedures performed", formalDefinition="Ordered list of patient procedures performed to support the adjudication." )
10465    protected List<ProcedureComponent> procedure;
10466
10467    /**
10468     * Precedence (primary, secondary, etc.).
10469     */
10470    @Child(name = "precedence", type = {PositiveIntType.class}, order=25, min=0, max=1, modifier=false, summary=false)
10471    @Description(shortDefinition="Precedence (primary, secondary, etc.)", formalDefinition="Precedence (primary, secondary, etc.)." )
10472    protected PositiveIntType precedence;
10473
10474    /**
10475     * Financial instrument by which payment information for health care.
10476     */
10477    @Child(name = "insurance", type = {}, order=26, min=0, max=1, modifier=false, summary=false)
10478    @Description(shortDefinition="Insurance or medical plan", formalDefinition="Financial instrument by which payment information for health care." )
10479    protected InsuranceComponent insurance;
10480
10481    /**
10482     * An accident which resulted in the need for healthcare services.
10483     */
10484    @Child(name = "accident", type = {}, order=27, min=0, max=1, modifier=false, summary=false)
10485    @Description(shortDefinition="Details of an accident", formalDefinition="An accident which resulted in the need for healthcare services." )
10486    protected AccidentComponent accident;
10487
10488    /**
10489     * The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).
10490     */
10491    @Child(name = "employmentImpacted", type = {Period.class}, order=28, min=0, max=1, modifier=false, summary=false)
10492    @Description(shortDefinition="Period unable to work", formalDefinition="The start and optional end dates of when the patient was precluded from working due to the treatable condition(s)." )
10493    protected Period employmentImpacted;
10494
10495    /**
10496     * The start and optional end dates of when the patient was confined to a treatment center.
10497     */
10498    @Child(name = "hospitalization", type = {Period.class}, order=29, min=0, max=1, modifier=false, summary=false)
10499    @Description(shortDefinition="Period in hospital", formalDefinition="The start and optional end dates of when the patient was confined to a treatment center." )
10500    protected Period hospitalization;
10501
10502    /**
10503     * First tier of goods and services.
10504     */
10505    @Child(name = "item", type = {}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10506    @Description(shortDefinition="Goods and Services", formalDefinition="First tier of goods and services." )
10507    protected List<ItemComponent> item;
10508
10509    /**
10510     * The first tier service adjudications for payor added services.
10511     */
10512    @Child(name = "addItem", type = {}, order=31, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10513    @Description(shortDefinition="Insurer added line items", formalDefinition="The first tier service adjudications for payor added services." )
10514    protected List<AddedItemComponent> addItem;
10515
10516    /**
10517     * The total cost of the services reported.
10518     */
10519    @Child(name = "totalCost", type = {Money.class}, order=32, min=0, max=1, modifier=false, summary=false)
10520    @Description(shortDefinition="Total Cost of service from the Claim", formalDefinition="The total cost of the services reported." )
10521    protected Money totalCost;
10522
10523    /**
10524     * The amount of deductable applied which was not allocated to any particular service line.
10525     */
10526    @Child(name = "unallocDeductable", type = {Money.class}, order=33, min=0, max=1, modifier=false, summary=false)
10527    @Description(shortDefinition="Unallocated deductable", formalDefinition="The amount of deductable applied which was not allocated to any particular service line." )
10528    protected Money unallocDeductable;
10529
10530    /**
10531     * Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable).
10532     */
10533    @Child(name = "totalBenefit", type = {Money.class}, order=34, min=0, max=1, modifier=false, summary=false)
10534    @Description(shortDefinition="Total benefit payable for the Claim", formalDefinition="Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable)." )
10535    protected Money totalBenefit;
10536
10537    /**
10538     * Payment details for the claim if the claim has been paid.
10539     */
10540    @Child(name = "payment", type = {}, order=35, min=0, max=1, modifier=false, summary=false)
10541    @Description(shortDefinition="Payment (if paid)", formalDefinition="Payment details for the claim if the claim has been paid." )
10542    protected PaymentComponent payment;
10543
10544    /**
10545     * The form to be used for printing the content.
10546     */
10547    @Child(name = "form", type = {CodeableConcept.class}, order=36, min=0, max=1, modifier=false, summary=false)
10548    @Description(shortDefinition="Printed Form Identifier", formalDefinition="The form to be used for printing the content." )
10549    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
10550    protected CodeableConcept form;
10551
10552    /**
10553     * Note text.
10554     */
10555    @Child(name = "processNote", type = {}, order=37, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10556    @Description(shortDefinition="Processing notes", formalDefinition="Note text." )
10557    protected List<NoteComponent> processNote;
10558
10559    /**
10560     * Balance by Benefit Category.
10561     */
10562    @Child(name = "benefitBalance", type = {}, order=38, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10563    @Description(shortDefinition="Balance by Benefit Category", formalDefinition="Balance by Benefit Category." )
10564    protected List<BenefitBalanceComponent> benefitBalance;
10565
10566    private static final long serialVersionUID = -1301056913L;
10567
10568  /**
10569   * Constructor
10570   */
10571    public ExplanationOfBenefit() {
10572      super();
10573    }
10574
10575    /**
10576     * @return {@link #identifier} (The EOB Business Identifier.)
10577     */
10578    public List<Identifier> getIdentifier() { 
10579      if (this.identifier == null)
10580        this.identifier = new ArrayList<Identifier>();
10581      return this.identifier;
10582    }
10583
10584    /**
10585     * @return Returns a reference to <code>this</code> for easy method chaining
10586     */
10587    public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) { 
10588      this.identifier = theIdentifier;
10589      return this;
10590    }
10591
10592    public boolean hasIdentifier() { 
10593      if (this.identifier == null)
10594        return false;
10595      for (Identifier item : this.identifier)
10596        if (!item.isEmpty())
10597          return true;
10598      return false;
10599    }
10600
10601    public Identifier addIdentifier() { //3
10602      Identifier t = new Identifier();
10603      if (this.identifier == null)
10604        this.identifier = new ArrayList<Identifier>();
10605      this.identifier.add(t);
10606      return t;
10607    }
10608
10609    public ExplanationOfBenefit addIdentifier(Identifier t) { //3
10610      if (t == null)
10611        return this;
10612      if (this.identifier == null)
10613        this.identifier = new ArrayList<Identifier>();
10614      this.identifier.add(t);
10615      return this;
10616    }
10617
10618    /**
10619     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
10620     */
10621    public Identifier getIdentifierFirstRep() { 
10622      if (getIdentifier().isEmpty()) {
10623        addIdentifier();
10624      }
10625      return getIdentifier().get(0);
10626    }
10627
10628    /**
10629     * @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
10630     */
10631    public Enumeration<ExplanationOfBenefitStatus> getStatusElement() { 
10632      if (this.status == null)
10633        if (Configuration.errorOnAutoCreate())
10634          throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
10635        else if (Configuration.doAutoCreate())
10636          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
10637      return this.status;
10638    }
10639
10640    public boolean hasStatusElement() { 
10641      return this.status != null && !this.status.isEmpty();
10642    }
10643
10644    public boolean hasStatus() { 
10645      return this.status != null && !this.status.isEmpty();
10646    }
10647
10648    /**
10649     * @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
10650     */
10651    public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) { 
10652      this.status = value;
10653      return this;
10654    }
10655
10656    /**
10657     * @return The status of the resource instance.
10658     */
10659    public ExplanationOfBenefitStatus getStatus() { 
10660      return this.status == null ? null : this.status.getValue();
10661    }
10662
10663    /**
10664     * @param value The status of the resource instance.
10665     */
10666    public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) { 
10667      if (value == null)
10668        this.status = null;
10669      else {
10670        if (this.status == null)
10671          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
10672        this.status.setValue(value);
10673      }
10674      return this;
10675    }
10676
10677    /**
10678     * @return {@link #type} (The category of claim, eg, oral, pharmacy, vision, insitutional, professional.)
10679     */
10680    public CodeableConcept getType() { 
10681      if (this.type == null)
10682        if (Configuration.errorOnAutoCreate())
10683          throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
10684        else if (Configuration.doAutoCreate())
10685          this.type = new CodeableConcept(); // cc
10686      return this.type;
10687    }
10688
10689    public boolean hasType() { 
10690      return this.type != null && !this.type.isEmpty();
10691    }
10692
10693    /**
10694     * @param value {@link #type} (The category of claim, eg, oral, pharmacy, vision, insitutional, professional.)
10695     */
10696    public ExplanationOfBenefit setType(CodeableConcept value)  { 
10697      this.type = value;
10698      return this;
10699    }
10700
10701    /**
10702     * @return {@link #subType} (A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType.)
10703     */
10704    public List<CodeableConcept> getSubType() { 
10705      if (this.subType == null)
10706        this.subType = new ArrayList<CodeableConcept>();
10707      return this.subType;
10708    }
10709
10710    /**
10711     * @return Returns a reference to <code>this</code> for easy method chaining
10712     */
10713    public ExplanationOfBenefit setSubType(List<CodeableConcept> theSubType) { 
10714      this.subType = theSubType;
10715      return this;
10716    }
10717
10718    public boolean hasSubType() { 
10719      if (this.subType == null)
10720        return false;
10721      for (CodeableConcept item : this.subType)
10722        if (!item.isEmpty())
10723          return true;
10724      return false;
10725    }
10726
10727    public CodeableConcept addSubType() { //3
10728      CodeableConcept t = new CodeableConcept();
10729      if (this.subType == null)
10730        this.subType = new ArrayList<CodeableConcept>();
10731      this.subType.add(t);
10732      return t;
10733    }
10734
10735    public ExplanationOfBenefit addSubType(CodeableConcept t) { //3
10736      if (t == null)
10737        return this;
10738      if (this.subType == null)
10739        this.subType = new ArrayList<CodeableConcept>();
10740      this.subType.add(t);
10741      return this;
10742    }
10743
10744    /**
10745     * @return The first repetition of repeating field {@link #subType}, creating it if it does not already exist
10746     */
10747    public CodeableConcept getSubTypeFirstRep() { 
10748      if (getSubType().isEmpty()) {
10749        addSubType();
10750      }
10751      return getSubType().get(0);
10752    }
10753
10754    /**
10755     * @return {@link #patient} (Patient Resource.)
10756     */
10757    public Reference getPatient() { 
10758      if (this.patient == null)
10759        if (Configuration.errorOnAutoCreate())
10760          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
10761        else if (Configuration.doAutoCreate())
10762          this.patient = new Reference(); // cc
10763      return this.patient;
10764    }
10765
10766    public boolean hasPatient() { 
10767      return this.patient != null && !this.patient.isEmpty();
10768    }
10769
10770    /**
10771     * @param value {@link #patient} (Patient Resource.)
10772     */
10773    public ExplanationOfBenefit setPatient(Reference value)  { 
10774      this.patient = value;
10775      return this;
10776    }
10777
10778    /**
10779     * @return {@link #patient} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Patient Resource.)
10780     */
10781    public Patient getPatientTarget() { 
10782      if (this.patientTarget == null)
10783        if (Configuration.errorOnAutoCreate())
10784          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
10785        else if (Configuration.doAutoCreate())
10786          this.patientTarget = new Patient(); // aa
10787      return this.patientTarget;
10788    }
10789
10790    /**
10791     * @param value {@link #patient} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Patient Resource.)
10792     */
10793    public ExplanationOfBenefit setPatientTarget(Patient value) { 
10794      this.patientTarget = value;
10795      return this;
10796    }
10797
10798    /**
10799     * @return {@link #billablePeriod} (The billable period for which charges are being submitted.)
10800     */
10801    public Period getBillablePeriod() { 
10802      if (this.billablePeriod == null)
10803        if (Configuration.errorOnAutoCreate())
10804          throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
10805        else if (Configuration.doAutoCreate())
10806          this.billablePeriod = new Period(); // cc
10807      return this.billablePeriod;
10808    }
10809
10810    public boolean hasBillablePeriod() { 
10811      return this.billablePeriod != null && !this.billablePeriod.isEmpty();
10812    }
10813
10814    /**
10815     * @param value {@link #billablePeriod} (The billable period for which charges are being submitted.)
10816     */
10817    public ExplanationOfBenefit setBillablePeriod(Period value)  { 
10818      this.billablePeriod = value;
10819      return this;
10820    }
10821
10822    /**
10823     * @return {@link #created} (The date when the EOB was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
10824     */
10825    public DateTimeType getCreatedElement() { 
10826      if (this.created == null)
10827        if (Configuration.errorOnAutoCreate())
10828          throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
10829        else if (Configuration.doAutoCreate())
10830          this.created = new DateTimeType(); // bb
10831      return this.created;
10832    }
10833
10834    public boolean hasCreatedElement() { 
10835      return this.created != null && !this.created.isEmpty();
10836    }
10837
10838    public boolean hasCreated() { 
10839      return this.created != null && !this.created.isEmpty();
10840    }
10841
10842    /**
10843     * @param value {@link #created} (The date when the EOB was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
10844     */
10845    public ExplanationOfBenefit setCreatedElement(DateTimeType value) { 
10846      this.created = value;
10847      return this;
10848    }
10849
10850    /**
10851     * @return The date when the EOB was created.
10852     */
10853    public Date getCreated() { 
10854      return this.created == null ? null : this.created.getValue();
10855    }
10856
10857    /**
10858     * @param value The date when the EOB was created.
10859     */
10860    public ExplanationOfBenefit setCreated(Date value) { 
10861      if (value == null)
10862        this.created = null;
10863      else {
10864        if (this.created == null)
10865          this.created = new DateTimeType();
10866        this.created.setValue(value);
10867      }
10868      return this;
10869    }
10870
10871    /**
10872     * @return {@link #enterer} (The person who created the explanation of benefit.)
10873     */
10874    public Reference getEnterer() { 
10875      if (this.enterer == null)
10876        if (Configuration.errorOnAutoCreate())
10877          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
10878        else if (Configuration.doAutoCreate())
10879          this.enterer = new Reference(); // cc
10880      return this.enterer;
10881    }
10882
10883    public boolean hasEnterer() { 
10884      return this.enterer != null && !this.enterer.isEmpty();
10885    }
10886
10887    /**
10888     * @param value {@link #enterer} (The person who created the explanation of benefit.)
10889     */
10890    public ExplanationOfBenefit setEnterer(Reference value)  { 
10891      this.enterer = value;
10892      return this;
10893    }
10894
10895    /**
10896     * @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. (The person who created the explanation of benefit.)
10897     */
10898    public Practitioner getEntererTarget() { 
10899      if (this.entererTarget == null)
10900        if (Configuration.errorOnAutoCreate())
10901          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
10902        else if (Configuration.doAutoCreate())
10903          this.entererTarget = new Practitioner(); // aa
10904      return this.entererTarget;
10905    }
10906
10907    /**
10908     * @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. (The person who created the explanation of benefit.)
10909     */
10910    public ExplanationOfBenefit setEntererTarget(Practitioner value) { 
10911      this.entererTarget = value;
10912      return this;
10913    }
10914
10915    /**
10916     * @return {@link #insurer} (The insurer which is responsible for the explanation of benefit.)
10917     */
10918    public Reference getInsurer() { 
10919      if (this.insurer == null)
10920        if (Configuration.errorOnAutoCreate())
10921          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
10922        else if (Configuration.doAutoCreate())
10923          this.insurer = new Reference(); // cc
10924      return this.insurer;
10925    }
10926
10927    public boolean hasInsurer() { 
10928      return this.insurer != null && !this.insurer.isEmpty();
10929    }
10930
10931    /**
10932     * @param value {@link #insurer} (The insurer which is responsible for the explanation of benefit.)
10933     */
10934    public ExplanationOfBenefit setInsurer(Reference value)  { 
10935      this.insurer = value;
10936      return this;
10937    }
10938
10939    /**
10940     * @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 which is responsible for the explanation of benefit.)
10941     */
10942    public Organization getInsurerTarget() { 
10943      if (this.insurerTarget == null)
10944        if (Configuration.errorOnAutoCreate())
10945          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
10946        else if (Configuration.doAutoCreate())
10947          this.insurerTarget = new Organization(); // aa
10948      return this.insurerTarget;
10949    }
10950
10951    /**
10952     * @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 which is responsible for the explanation of benefit.)
10953     */
10954    public ExplanationOfBenefit setInsurerTarget(Organization value) { 
10955      this.insurerTarget = value;
10956      return this;
10957    }
10958
10959    /**
10960     * @return {@link #provider} (The provider which is responsible for the claim.)
10961     */
10962    public Reference getProvider() { 
10963      if (this.provider == null)
10964        if (Configuration.errorOnAutoCreate())
10965          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
10966        else if (Configuration.doAutoCreate())
10967          this.provider = new Reference(); // cc
10968      return this.provider;
10969    }
10970
10971    public boolean hasProvider() { 
10972      return this.provider != null && !this.provider.isEmpty();
10973    }
10974
10975    /**
10976     * @param value {@link #provider} (The provider which is responsible for the claim.)
10977     */
10978    public ExplanationOfBenefit setProvider(Reference value)  { 
10979      this.provider = value;
10980      return this;
10981    }
10982
10983    /**
10984     * @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 claim.)
10985     */
10986    public Practitioner getProviderTarget() { 
10987      if (this.providerTarget == null)
10988        if (Configuration.errorOnAutoCreate())
10989          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
10990        else if (Configuration.doAutoCreate())
10991          this.providerTarget = new Practitioner(); // aa
10992      return this.providerTarget;
10993    }
10994
10995    /**
10996     * @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 claim.)
10997     */
10998    public ExplanationOfBenefit setProviderTarget(Practitioner value) { 
10999      this.providerTarget = value;
11000      return this;
11001    }
11002
11003    /**
11004     * @return {@link #organization} (The provider which is responsible for the claim.)
11005     */
11006    public Reference getOrganization() { 
11007      if (this.organization == null)
11008        if (Configuration.errorOnAutoCreate())
11009          throw new Error("Attempt to auto-create ExplanationOfBenefit.organization");
11010        else if (Configuration.doAutoCreate())
11011          this.organization = new Reference(); // cc
11012      return this.organization;
11013    }
11014
11015    public boolean hasOrganization() { 
11016      return this.organization != null && !this.organization.isEmpty();
11017    }
11018
11019    /**
11020     * @param value {@link #organization} (The provider which is responsible for the claim.)
11021     */
11022    public ExplanationOfBenefit setOrganization(Reference value)  { 
11023      this.organization = value;
11024      return this;
11025    }
11026
11027    /**
11028     * @return {@link #organization} 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 claim.)
11029     */
11030    public Organization getOrganizationTarget() { 
11031      if (this.organizationTarget == null)
11032        if (Configuration.errorOnAutoCreate())
11033          throw new Error("Attempt to auto-create ExplanationOfBenefit.organization");
11034        else if (Configuration.doAutoCreate())
11035          this.organizationTarget = new Organization(); // aa
11036      return this.organizationTarget;
11037    }
11038
11039    /**
11040     * @param value {@link #organization} 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 claim.)
11041     */
11042    public ExplanationOfBenefit setOrganizationTarget(Organization value) { 
11043      this.organizationTarget = value;
11044      return this;
11045    }
11046
11047    /**
11048     * @return {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
11049     */
11050    public Reference getReferral() { 
11051      if (this.referral == null)
11052        if (Configuration.errorOnAutoCreate())
11053          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
11054        else if (Configuration.doAutoCreate())
11055          this.referral = new Reference(); // cc
11056      return this.referral;
11057    }
11058
11059    public boolean hasReferral() { 
11060      return this.referral != null && !this.referral.isEmpty();
11061    }
11062
11063    /**
11064     * @param value {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
11065     */
11066    public ExplanationOfBenefit setReferral(Reference value)  { 
11067      this.referral = value;
11068      return this;
11069    }
11070
11071    /**
11072     * @return {@link #referral} 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 referral resource which lists the date, practitioner, reason and other supporting information.)
11073     */
11074    public ReferralRequest getReferralTarget() { 
11075      if (this.referralTarget == null)
11076        if (Configuration.errorOnAutoCreate())
11077          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
11078        else if (Configuration.doAutoCreate())
11079          this.referralTarget = new ReferralRequest(); // aa
11080      return this.referralTarget;
11081    }
11082
11083    /**
11084     * @param value {@link #referral} 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 referral resource which lists the date, practitioner, reason and other supporting information.)
11085     */
11086    public ExplanationOfBenefit setReferralTarget(ReferralRequest value) { 
11087      this.referralTarget = value;
11088      return this;
11089    }
11090
11091    /**
11092     * @return {@link #facility} (Facility where the services were provided.)
11093     */
11094    public Reference getFacility() { 
11095      if (this.facility == null)
11096        if (Configuration.errorOnAutoCreate())
11097          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
11098        else if (Configuration.doAutoCreate())
11099          this.facility = new Reference(); // cc
11100      return this.facility;
11101    }
11102
11103    public boolean hasFacility() { 
11104      return this.facility != null && !this.facility.isEmpty();
11105    }
11106
11107    /**
11108     * @param value {@link #facility} (Facility where the services were provided.)
11109     */
11110    public ExplanationOfBenefit setFacility(Reference value)  { 
11111      this.facility = value;
11112      return this;
11113    }
11114
11115    /**
11116     * @return {@link #facility} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Facility where the services were provided.)
11117     */
11118    public Location getFacilityTarget() { 
11119      if (this.facilityTarget == null)
11120        if (Configuration.errorOnAutoCreate())
11121          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
11122        else if (Configuration.doAutoCreate())
11123          this.facilityTarget = new Location(); // aa
11124      return this.facilityTarget;
11125    }
11126
11127    /**
11128     * @param value {@link #facility} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Facility where the services were provided.)
11129     */
11130    public ExplanationOfBenefit setFacilityTarget(Location value) { 
11131      this.facilityTarget = value;
11132      return this;
11133    }
11134
11135    /**
11136     * @return {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
11137     */
11138    public Reference getClaim() { 
11139      if (this.claim == null)
11140        if (Configuration.errorOnAutoCreate())
11141          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
11142        else if (Configuration.doAutoCreate())
11143          this.claim = new Reference(); // cc
11144      return this.claim;
11145    }
11146
11147    public boolean hasClaim() { 
11148      return this.claim != null && !this.claim.isEmpty();
11149    }
11150
11151    /**
11152     * @param value {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
11153     */
11154    public ExplanationOfBenefit setClaim(Reference value)  { 
11155      this.claim = value;
11156      return this;
11157    }
11158
11159    /**
11160     * @return {@link #claim} 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 business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
11161     */
11162    public Claim getClaimTarget() { 
11163      if (this.claimTarget == null)
11164        if (Configuration.errorOnAutoCreate())
11165          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
11166        else if (Configuration.doAutoCreate())
11167          this.claimTarget = new Claim(); // aa
11168      return this.claimTarget;
11169    }
11170
11171    /**
11172     * @param value {@link #claim} 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 business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
11173     */
11174    public ExplanationOfBenefit setClaimTarget(Claim value) { 
11175      this.claimTarget = value;
11176      return this;
11177    }
11178
11179    /**
11180     * @return {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
11181     */
11182    public Reference getClaimResponse() { 
11183      if (this.claimResponse == null)
11184        if (Configuration.errorOnAutoCreate())
11185          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
11186        else if (Configuration.doAutoCreate())
11187          this.claimResponse = new Reference(); // cc
11188      return this.claimResponse;
11189    }
11190
11191    public boolean hasClaimResponse() { 
11192      return this.claimResponse != null && !this.claimResponse.isEmpty();
11193    }
11194
11195    /**
11196     * @param value {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
11197     */
11198    public ExplanationOfBenefit setClaimResponse(Reference value)  { 
11199      this.claimResponse = value;
11200      return this;
11201    }
11202
11203    /**
11204     * @return {@link #claimResponse} 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 business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
11205     */
11206    public ClaimResponse getClaimResponseTarget() { 
11207      if (this.claimResponseTarget == null)
11208        if (Configuration.errorOnAutoCreate())
11209          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
11210        else if (Configuration.doAutoCreate())
11211          this.claimResponseTarget = new ClaimResponse(); // aa
11212      return this.claimResponseTarget;
11213    }
11214
11215    /**
11216     * @param value {@link #claimResponse} 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 business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
11217     */
11218    public ExplanationOfBenefit setClaimResponseTarget(ClaimResponse value) { 
11219      this.claimResponseTarget = value;
11220      return this;
11221    }
11222
11223    /**
11224     * @return {@link #outcome} (Processing outcome errror, partial or complete processing.)
11225     */
11226    public CodeableConcept getOutcome() { 
11227      if (this.outcome == null)
11228        if (Configuration.errorOnAutoCreate())
11229          throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
11230        else if (Configuration.doAutoCreate())
11231          this.outcome = new CodeableConcept(); // cc
11232      return this.outcome;
11233    }
11234
11235    public boolean hasOutcome() { 
11236      return this.outcome != null && !this.outcome.isEmpty();
11237    }
11238
11239    /**
11240     * @param value {@link #outcome} (Processing outcome errror, partial or complete processing.)
11241     */
11242    public ExplanationOfBenefit setOutcome(CodeableConcept value)  { 
11243      this.outcome = value;
11244      return this;
11245    }
11246
11247    /**
11248     * @return {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
11249     */
11250    public StringType getDispositionElement() { 
11251      if (this.disposition == null)
11252        if (Configuration.errorOnAutoCreate())
11253          throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
11254        else if (Configuration.doAutoCreate())
11255          this.disposition = new StringType(); // bb
11256      return this.disposition;
11257    }
11258
11259    public boolean hasDispositionElement() { 
11260      return this.disposition != null && !this.disposition.isEmpty();
11261    }
11262
11263    public boolean hasDisposition() { 
11264      return this.disposition != null && !this.disposition.isEmpty();
11265    }
11266
11267    /**
11268     * @param value {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
11269     */
11270    public ExplanationOfBenefit setDispositionElement(StringType value) { 
11271      this.disposition = value;
11272      return this;
11273    }
11274
11275    /**
11276     * @return A description of the status of the adjudication.
11277     */
11278    public String getDisposition() { 
11279      return this.disposition == null ? null : this.disposition.getValue();
11280    }
11281
11282    /**
11283     * @param value A description of the status of the adjudication.
11284     */
11285    public ExplanationOfBenefit setDisposition(String value) { 
11286      if (Utilities.noString(value))
11287        this.disposition = null;
11288      else {
11289        if (this.disposition == null)
11290          this.disposition = new StringType();
11291        this.disposition.setValue(value);
11292      }
11293      return this;
11294    }
11295
11296    /**
11297     * @return {@link #related} (Other claims which are related to this claim such as prior claim versions or for related services.)
11298     */
11299    public List<RelatedClaimComponent> getRelated() { 
11300      if (this.related == null)
11301        this.related = new ArrayList<RelatedClaimComponent>();
11302      return this.related;
11303    }
11304
11305    /**
11306     * @return Returns a reference to <code>this</code> for easy method chaining
11307     */
11308    public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) { 
11309      this.related = theRelated;
11310      return this;
11311    }
11312
11313    public boolean hasRelated() { 
11314      if (this.related == null)
11315        return false;
11316      for (RelatedClaimComponent item : this.related)
11317        if (!item.isEmpty())
11318          return true;
11319      return false;
11320    }
11321
11322    public RelatedClaimComponent addRelated() { //3
11323      RelatedClaimComponent t = new RelatedClaimComponent();
11324      if (this.related == null)
11325        this.related = new ArrayList<RelatedClaimComponent>();
11326      this.related.add(t);
11327      return t;
11328    }
11329
11330    public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { //3
11331      if (t == null)
11332        return this;
11333      if (this.related == null)
11334        this.related = new ArrayList<RelatedClaimComponent>();
11335      this.related.add(t);
11336      return this;
11337    }
11338
11339    /**
11340     * @return The first repetition of repeating field {@link #related}, creating it if it does not already exist
11341     */
11342    public RelatedClaimComponent getRelatedFirstRep() { 
11343      if (getRelated().isEmpty()) {
11344        addRelated();
11345      }
11346      return getRelated().get(0);
11347    }
11348
11349    /**
11350     * @return {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
11351     */
11352    public Reference getPrescription() { 
11353      if (this.prescription == null)
11354        if (Configuration.errorOnAutoCreate())
11355          throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
11356        else if (Configuration.doAutoCreate())
11357          this.prescription = new Reference(); // cc
11358      return this.prescription;
11359    }
11360
11361    public boolean hasPrescription() { 
11362      return this.prescription != null && !this.prescription.isEmpty();
11363    }
11364
11365    /**
11366     * @param value {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
11367     */
11368    public ExplanationOfBenefit setPrescription(Reference value)  { 
11369      this.prescription = value;
11370      return this;
11371    }
11372
11373    /**
11374     * @return {@link #prescription} 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. (Prescription to support the dispensing of Pharmacy or Vision products.)
11375     */
11376    public Resource getPrescriptionTarget() { 
11377      return this.prescriptionTarget;
11378    }
11379
11380    /**
11381     * @param value {@link #prescription} 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. (Prescription to support the dispensing of Pharmacy or Vision products.)
11382     */
11383    public ExplanationOfBenefit setPrescriptionTarget(Resource value) { 
11384      this.prescriptionTarget = value;
11385      return this;
11386    }
11387
11388    /**
11389     * @return {@link #originalPrescription} (Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.)
11390     */
11391    public Reference getOriginalPrescription() { 
11392      if (this.originalPrescription == null)
11393        if (Configuration.errorOnAutoCreate())
11394          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
11395        else if (Configuration.doAutoCreate())
11396          this.originalPrescription = new Reference(); // cc
11397      return this.originalPrescription;
11398    }
11399
11400    public boolean hasOriginalPrescription() { 
11401      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
11402    }
11403
11404    /**
11405     * @param value {@link #originalPrescription} (Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.)
11406     */
11407    public ExplanationOfBenefit setOriginalPrescription(Reference value)  { 
11408      this.originalPrescription = value;
11409      return this;
11410    }
11411
11412    /**
11413     * @return {@link #originalPrescription} 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. (Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.)
11414     */
11415    public MedicationRequest getOriginalPrescriptionTarget() { 
11416      if (this.originalPrescriptionTarget == null)
11417        if (Configuration.errorOnAutoCreate())
11418          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
11419        else if (Configuration.doAutoCreate())
11420          this.originalPrescriptionTarget = new MedicationRequest(); // aa
11421      return this.originalPrescriptionTarget;
11422    }
11423
11424    /**
11425     * @param value {@link #originalPrescription} 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. (Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.)
11426     */
11427    public ExplanationOfBenefit setOriginalPrescriptionTarget(MedicationRequest value) { 
11428      this.originalPrescriptionTarget = value;
11429      return this;
11430    }
11431
11432    /**
11433     * @return {@link #payee} (The party to be reimbursed for the services.)
11434     */
11435    public PayeeComponent getPayee() { 
11436      if (this.payee == null)
11437        if (Configuration.errorOnAutoCreate())
11438          throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
11439        else if (Configuration.doAutoCreate())
11440          this.payee = new PayeeComponent(); // cc
11441      return this.payee;
11442    }
11443
11444    public boolean hasPayee() { 
11445      return this.payee != null && !this.payee.isEmpty();
11446    }
11447
11448    /**
11449     * @param value {@link #payee} (The party to be reimbursed for the services.)
11450     */
11451    public ExplanationOfBenefit setPayee(PayeeComponent value)  { 
11452      this.payee = value;
11453      return this;
11454    }
11455
11456    /**
11457     * @return {@link #information} (Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required.)
11458     */
11459    public List<SupportingInformationComponent> getInformation() { 
11460      if (this.information == null)
11461        this.information = new ArrayList<SupportingInformationComponent>();
11462      return this.information;
11463    }
11464
11465    /**
11466     * @return Returns a reference to <code>this</code> for easy method chaining
11467     */
11468    public ExplanationOfBenefit setInformation(List<SupportingInformationComponent> theInformation) { 
11469      this.information = theInformation;
11470      return this;
11471    }
11472
11473    public boolean hasInformation() { 
11474      if (this.information == null)
11475        return false;
11476      for (SupportingInformationComponent item : this.information)
11477        if (!item.isEmpty())
11478          return true;
11479      return false;
11480    }
11481
11482    public SupportingInformationComponent addInformation() { //3
11483      SupportingInformationComponent t = new SupportingInformationComponent();
11484      if (this.information == null)
11485        this.information = new ArrayList<SupportingInformationComponent>();
11486      this.information.add(t);
11487      return t;
11488    }
11489
11490    public ExplanationOfBenefit addInformation(SupportingInformationComponent t) { //3
11491      if (t == null)
11492        return this;
11493      if (this.information == null)
11494        this.information = new ArrayList<SupportingInformationComponent>();
11495      this.information.add(t);
11496      return this;
11497    }
11498
11499    /**
11500     * @return The first repetition of repeating field {@link #information}, creating it if it does not already exist
11501     */
11502    public SupportingInformationComponent getInformationFirstRep() { 
11503      if (getInformation().isEmpty()) {
11504        addInformation();
11505      }
11506      return getInformation().get(0);
11507    }
11508
11509    /**
11510     * @return {@link #careTeam} (The members of the team who provided the overall service as well as their role and whether responsible and qualifications.)
11511     */
11512    public List<CareTeamComponent> getCareTeam() { 
11513      if (this.careTeam == null)
11514        this.careTeam = new ArrayList<CareTeamComponent>();
11515      return this.careTeam;
11516    }
11517
11518    /**
11519     * @return Returns a reference to <code>this</code> for easy method chaining
11520     */
11521    public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) { 
11522      this.careTeam = theCareTeam;
11523      return this;
11524    }
11525
11526    public boolean hasCareTeam() { 
11527      if (this.careTeam == null)
11528        return false;
11529      for (CareTeamComponent item : this.careTeam)
11530        if (!item.isEmpty())
11531          return true;
11532      return false;
11533    }
11534
11535    public CareTeamComponent addCareTeam() { //3
11536      CareTeamComponent t = new CareTeamComponent();
11537      if (this.careTeam == null)
11538        this.careTeam = new ArrayList<CareTeamComponent>();
11539      this.careTeam.add(t);
11540      return t;
11541    }
11542
11543    public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { //3
11544      if (t == null)
11545        return this;
11546      if (this.careTeam == null)
11547        this.careTeam = new ArrayList<CareTeamComponent>();
11548      this.careTeam.add(t);
11549      return this;
11550    }
11551
11552    /**
11553     * @return The first repetition of repeating field {@link #careTeam}, creating it if it does not already exist
11554     */
11555    public CareTeamComponent getCareTeamFirstRep() { 
11556      if (getCareTeam().isEmpty()) {
11557        addCareTeam();
11558      }
11559      return getCareTeam().get(0);
11560    }
11561
11562    /**
11563     * @return {@link #diagnosis} (Ordered list of patient diagnosis for which care is sought.)
11564     */
11565    public List<DiagnosisComponent> getDiagnosis() { 
11566      if (this.diagnosis == null)
11567        this.diagnosis = new ArrayList<DiagnosisComponent>();
11568      return this.diagnosis;
11569    }
11570
11571    /**
11572     * @return Returns a reference to <code>this</code> for easy method chaining
11573     */
11574    public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
11575      this.diagnosis = theDiagnosis;
11576      return this;
11577    }
11578
11579    public boolean hasDiagnosis() { 
11580      if (this.diagnosis == null)
11581        return false;
11582      for (DiagnosisComponent item : this.diagnosis)
11583        if (!item.isEmpty())
11584          return true;
11585      return false;
11586    }
11587
11588    public DiagnosisComponent addDiagnosis() { //3
11589      DiagnosisComponent t = new DiagnosisComponent();
11590      if (this.diagnosis == null)
11591        this.diagnosis = new ArrayList<DiagnosisComponent>();
11592      this.diagnosis.add(t);
11593      return t;
11594    }
11595
11596    public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { //3
11597      if (t == null)
11598        return this;
11599      if (this.diagnosis == null)
11600        this.diagnosis = new ArrayList<DiagnosisComponent>();
11601      this.diagnosis.add(t);
11602      return this;
11603    }
11604
11605    /**
11606     * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist
11607     */
11608    public DiagnosisComponent getDiagnosisFirstRep() { 
11609      if (getDiagnosis().isEmpty()) {
11610        addDiagnosis();
11611      }
11612      return getDiagnosis().get(0);
11613    }
11614
11615    /**
11616     * @return {@link #procedure} (Ordered list of patient procedures performed to support the adjudication.)
11617     */
11618    public List<ProcedureComponent> getProcedure() { 
11619      if (this.procedure == null)
11620        this.procedure = new ArrayList<ProcedureComponent>();
11621      return this.procedure;
11622    }
11623
11624    /**
11625     * @return Returns a reference to <code>this</code> for easy method chaining
11626     */
11627    public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) { 
11628      this.procedure = theProcedure;
11629      return this;
11630    }
11631
11632    public boolean hasProcedure() { 
11633      if (this.procedure == null)
11634        return false;
11635      for (ProcedureComponent item : this.procedure)
11636        if (!item.isEmpty())
11637          return true;
11638      return false;
11639    }
11640
11641    public ProcedureComponent addProcedure() { //3
11642      ProcedureComponent t = new ProcedureComponent();
11643      if (this.procedure == null)
11644        this.procedure = new ArrayList<ProcedureComponent>();
11645      this.procedure.add(t);
11646      return t;
11647    }
11648
11649    public ExplanationOfBenefit addProcedure(ProcedureComponent t) { //3
11650      if (t == null)
11651        return this;
11652      if (this.procedure == null)
11653        this.procedure = new ArrayList<ProcedureComponent>();
11654      this.procedure.add(t);
11655      return this;
11656    }
11657
11658    /**
11659     * @return The first repetition of repeating field {@link #procedure}, creating it if it does not already exist
11660     */
11661    public ProcedureComponent getProcedureFirstRep() { 
11662      if (getProcedure().isEmpty()) {
11663        addProcedure();
11664      }
11665      return getProcedure().get(0);
11666    }
11667
11668    /**
11669     * @return {@link #precedence} (Precedence (primary, secondary, etc.).). This is the underlying object with id, value and extensions. The accessor "getPrecedence" gives direct access to the value
11670     */
11671    public PositiveIntType getPrecedenceElement() { 
11672      if (this.precedence == null)
11673        if (Configuration.errorOnAutoCreate())
11674          throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
11675        else if (Configuration.doAutoCreate())
11676          this.precedence = new PositiveIntType(); // bb
11677      return this.precedence;
11678    }
11679
11680    public boolean hasPrecedenceElement() { 
11681      return this.precedence != null && !this.precedence.isEmpty();
11682    }
11683
11684    public boolean hasPrecedence() { 
11685      return this.precedence != null && !this.precedence.isEmpty();
11686    }
11687
11688    /**
11689     * @param value {@link #precedence} (Precedence (primary, secondary, etc.).). This is the underlying object with id, value and extensions. The accessor "getPrecedence" gives direct access to the value
11690     */
11691    public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) { 
11692      this.precedence = value;
11693      return this;
11694    }
11695
11696    /**
11697     * @return Precedence (primary, secondary, etc.).
11698     */
11699    public int getPrecedence() { 
11700      return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
11701    }
11702
11703    /**
11704     * @param value Precedence (primary, secondary, etc.).
11705     */
11706    public ExplanationOfBenefit setPrecedence(int value) { 
11707        if (this.precedence == null)
11708          this.precedence = new PositiveIntType();
11709        this.precedence.setValue(value);
11710      return this;
11711    }
11712
11713    /**
11714     * @return {@link #insurance} (Financial instrument by which payment information for health care.)
11715     */
11716    public InsuranceComponent getInsurance() { 
11717      if (this.insurance == null)
11718        if (Configuration.errorOnAutoCreate())
11719          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurance");
11720        else if (Configuration.doAutoCreate())
11721          this.insurance = new InsuranceComponent(); // cc
11722      return this.insurance;
11723    }
11724
11725    public boolean hasInsurance() { 
11726      return this.insurance != null && !this.insurance.isEmpty();
11727    }
11728
11729    /**
11730     * @param value {@link #insurance} (Financial instrument by which payment information for health care.)
11731     */
11732    public ExplanationOfBenefit setInsurance(InsuranceComponent value)  { 
11733      this.insurance = value;
11734      return this;
11735    }
11736
11737    /**
11738     * @return {@link #accident} (An accident which resulted in the need for healthcare services.)
11739     */
11740    public AccidentComponent getAccident() { 
11741      if (this.accident == null)
11742        if (Configuration.errorOnAutoCreate())
11743          throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
11744        else if (Configuration.doAutoCreate())
11745          this.accident = new AccidentComponent(); // cc
11746      return this.accident;
11747    }
11748
11749    public boolean hasAccident() { 
11750      return this.accident != null && !this.accident.isEmpty();
11751    }
11752
11753    /**
11754     * @param value {@link #accident} (An accident which resulted in the need for healthcare services.)
11755     */
11756    public ExplanationOfBenefit setAccident(AccidentComponent value)  { 
11757      this.accident = value;
11758      return this;
11759    }
11760
11761    /**
11762     * @return {@link #employmentImpacted} (The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).)
11763     */
11764    public Period getEmploymentImpacted() { 
11765      if (this.employmentImpacted == null)
11766        if (Configuration.errorOnAutoCreate())
11767          throw new Error("Attempt to auto-create ExplanationOfBenefit.employmentImpacted");
11768        else if (Configuration.doAutoCreate())
11769          this.employmentImpacted = new Period(); // cc
11770      return this.employmentImpacted;
11771    }
11772
11773    public boolean hasEmploymentImpacted() { 
11774      return this.employmentImpacted != null && !this.employmentImpacted.isEmpty();
11775    }
11776
11777    /**
11778     * @param value {@link #employmentImpacted} (The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).)
11779     */
11780    public ExplanationOfBenefit setEmploymentImpacted(Period value)  { 
11781      this.employmentImpacted = value;
11782      return this;
11783    }
11784
11785    /**
11786     * @return {@link #hospitalization} (The start and optional end dates of when the patient was confined to a treatment center.)
11787     */
11788    public Period getHospitalization() { 
11789      if (this.hospitalization == null)
11790        if (Configuration.errorOnAutoCreate())
11791          throw new Error("Attempt to auto-create ExplanationOfBenefit.hospitalization");
11792        else if (Configuration.doAutoCreate())
11793          this.hospitalization = new Period(); // cc
11794      return this.hospitalization;
11795    }
11796
11797    public boolean hasHospitalization() { 
11798      return this.hospitalization != null && !this.hospitalization.isEmpty();
11799    }
11800
11801    /**
11802     * @param value {@link #hospitalization} (The start and optional end dates of when the patient was confined to a treatment center.)
11803     */
11804    public ExplanationOfBenefit setHospitalization(Period value)  { 
11805      this.hospitalization = value;
11806      return this;
11807    }
11808
11809    /**
11810     * @return {@link #item} (First tier of goods and services.)
11811     */
11812    public List<ItemComponent> getItem() { 
11813      if (this.item == null)
11814        this.item = new ArrayList<ItemComponent>();
11815      return this.item;
11816    }
11817
11818    /**
11819     * @return Returns a reference to <code>this</code> for easy method chaining
11820     */
11821    public ExplanationOfBenefit setItem(List<ItemComponent> theItem) { 
11822      this.item = theItem;
11823      return this;
11824    }
11825
11826    public boolean hasItem() { 
11827      if (this.item == null)
11828        return false;
11829      for (ItemComponent item : this.item)
11830        if (!item.isEmpty())
11831          return true;
11832      return false;
11833    }
11834
11835    public ItemComponent addItem() { //3
11836      ItemComponent t = new ItemComponent();
11837      if (this.item == null)
11838        this.item = new ArrayList<ItemComponent>();
11839      this.item.add(t);
11840      return t;
11841    }
11842
11843    public ExplanationOfBenefit addItem(ItemComponent t) { //3
11844      if (t == null)
11845        return this;
11846      if (this.item == null)
11847        this.item = new ArrayList<ItemComponent>();
11848      this.item.add(t);
11849      return this;
11850    }
11851
11852    /**
11853     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
11854     */
11855    public ItemComponent getItemFirstRep() { 
11856      if (getItem().isEmpty()) {
11857        addItem();
11858      }
11859      return getItem().get(0);
11860    }
11861
11862    /**
11863     * @return {@link #addItem} (The first tier service adjudications for payor added services.)
11864     */
11865    public List<AddedItemComponent> getAddItem() { 
11866      if (this.addItem == null)
11867        this.addItem = new ArrayList<AddedItemComponent>();
11868      return this.addItem;
11869    }
11870
11871    /**
11872     * @return Returns a reference to <code>this</code> for easy method chaining
11873     */
11874    public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) { 
11875      this.addItem = theAddItem;
11876      return this;
11877    }
11878
11879    public boolean hasAddItem() { 
11880      if (this.addItem == null)
11881        return false;
11882      for (AddedItemComponent item : this.addItem)
11883        if (!item.isEmpty())
11884          return true;
11885      return false;
11886    }
11887
11888    public AddedItemComponent addAddItem() { //3
11889      AddedItemComponent t = new AddedItemComponent();
11890      if (this.addItem == null)
11891        this.addItem = new ArrayList<AddedItemComponent>();
11892      this.addItem.add(t);
11893      return t;
11894    }
11895
11896    public ExplanationOfBenefit addAddItem(AddedItemComponent t) { //3
11897      if (t == null)
11898        return this;
11899      if (this.addItem == null)
11900        this.addItem = new ArrayList<AddedItemComponent>();
11901      this.addItem.add(t);
11902      return this;
11903    }
11904
11905    /**
11906     * @return The first repetition of repeating field {@link #addItem}, creating it if it does not already exist
11907     */
11908    public AddedItemComponent getAddItemFirstRep() { 
11909      if (getAddItem().isEmpty()) {
11910        addAddItem();
11911      }
11912      return getAddItem().get(0);
11913    }
11914
11915    /**
11916     * @return {@link #totalCost} (The total cost of the services reported.)
11917     */
11918    public Money getTotalCost() { 
11919      if (this.totalCost == null)
11920        if (Configuration.errorOnAutoCreate())
11921          throw new Error("Attempt to auto-create ExplanationOfBenefit.totalCost");
11922        else if (Configuration.doAutoCreate())
11923          this.totalCost = new Money(); // cc
11924      return this.totalCost;
11925    }
11926
11927    public boolean hasTotalCost() { 
11928      return this.totalCost != null && !this.totalCost.isEmpty();
11929    }
11930
11931    /**
11932     * @param value {@link #totalCost} (The total cost of the services reported.)
11933     */
11934    public ExplanationOfBenefit setTotalCost(Money value)  { 
11935      this.totalCost = value;
11936      return this;
11937    }
11938
11939    /**
11940     * @return {@link #unallocDeductable} (The amount of deductable applied which was not allocated to any particular service line.)
11941     */
11942    public Money getUnallocDeductable() { 
11943      if (this.unallocDeductable == null)
11944        if (Configuration.errorOnAutoCreate())
11945          throw new Error("Attempt to auto-create ExplanationOfBenefit.unallocDeductable");
11946        else if (Configuration.doAutoCreate())
11947          this.unallocDeductable = new Money(); // cc
11948      return this.unallocDeductable;
11949    }
11950
11951    public boolean hasUnallocDeductable() { 
11952      return this.unallocDeductable != null && !this.unallocDeductable.isEmpty();
11953    }
11954
11955    /**
11956     * @param value {@link #unallocDeductable} (The amount of deductable applied which was not allocated to any particular service line.)
11957     */
11958    public ExplanationOfBenefit setUnallocDeductable(Money value)  { 
11959      this.unallocDeductable = value;
11960      return this;
11961    }
11962
11963    /**
11964     * @return {@link #totalBenefit} (Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable).)
11965     */
11966    public Money getTotalBenefit() { 
11967      if (this.totalBenefit == null)
11968        if (Configuration.errorOnAutoCreate())
11969          throw new Error("Attempt to auto-create ExplanationOfBenefit.totalBenefit");
11970        else if (Configuration.doAutoCreate())
11971          this.totalBenefit = new Money(); // cc
11972      return this.totalBenefit;
11973    }
11974
11975    public boolean hasTotalBenefit() { 
11976      return this.totalBenefit != null && !this.totalBenefit.isEmpty();
11977    }
11978
11979    /**
11980     * @param value {@link #totalBenefit} (Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable).)
11981     */
11982    public ExplanationOfBenefit setTotalBenefit(Money value)  { 
11983      this.totalBenefit = value;
11984      return this;
11985    }
11986
11987    /**
11988     * @return {@link #payment} (Payment details for the claim if the claim has been paid.)
11989     */
11990    public PaymentComponent getPayment() { 
11991      if (this.payment == null)
11992        if (Configuration.errorOnAutoCreate())
11993          throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
11994        else if (Configuration.doAutoCreate())
11995          this.payment = new PaymentComponent(); // cc
11996      return this.payment;
11997    }
11998
11999    public boolean hasPayment() { 
12000      return this.payment != null && !this.payment.isEmpty();
12001    }
12002
12003    /**
12004     * @param value {@link #payment} (Payment details for the claim if the claim has been paid.)
12005     */
12006    public ExplanationOfBenefit setPayment(PaymentComponent value)  { 
12007      this.payment = value;
12008      return this;
12009    }
12010
12011    /**
12012     * @return {@link #form} (The form to be used for printing the content.)
12013     */
12014    public CodeableConcept getForm() { 
12015      if (this.form == null)
12016        if (Configuration.errorOnAutoCreate())
12017          throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
12018        else if (Configuration.doAutoCreate())
12019          this.form = new CodeableConcept(); // cc
12020      return this.form;
12021    }
12022
12023    public boolean hasForm() { 
12024      return this.form != null && !this.form.isEmpty();
12025    }
12026
12027    /**
12028     * @param value {@link #form} (The form to be used for printing the content.)
12029     */
12030    public ExplanationOfBenefit setForm(CodeableConcept value)  { 
12031      this.form = value;
12032      return this;
12033    }
12034
12035    /**
12036     * @return {@link #processNote} (Note text.)
12037     */
12038    public List<NoteComponent> getProcessNote() { 
12039      if (this.processNote == null)
12040        this.processNote = new ArrayList<NoteComponent>();
12041      return this.processNote;
12042    }
12043
12044    /**
12045     * @return Returns a reference to <code>this</code> for easy method chaining
12046     */
12047    public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) { 
12048      this.processNote = theProcessNote;
12049      return this;
12050    }
12051
12052    public boolean hasProcessNote() { 
12053      if (this.processNote == null)
12054        return false;
12055      for (NoteComponent item : this.processNote)
12056        if (!item.isEmpty())
12057          return true;
12058      return false;
12059    }
12060
12061    public NoteComponent addProcessNote() { //3
12062      NoteComponent t = new NoteComponent();
12063      if (this.processNote == null)
12064        this.processNote = new ArrayList<NoteComponent>();
12065      this.processNote.add(t);
12066      return t;
12067    }
12068
12069    public ExplanationOfBenefit addProcessNote(NoteComponent t) { //3
12070      if (t == null)
12071        return this;
12072      if (this.processNote == null)
12073        this.processNote = new ArrayList<NoteComponent>();
12074      this.processNote.add(t);
12075      return this;
12076    }
12077
12078    /**
12079     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist
12080     */
12081    public NoteComponent getProcessNoteFirstRep() { 
12082      if (getProcessNote().isEmpty()) {
12083        addProcessNote();
12084      }
12085      return getProcessNote().get(0);
12086    }
12087
12088    /**
12089     * @return {@link #benefitBalance} (Balance by Benefit Category.)
12090     */
12091    public List<BenefitBalanceComponent> getBenefitBalance() { 
12092      if (this.benefitBalance == null)
12093        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
12094      return this.benefitBalance;
12095    }
12096
12097    /**
12098     * @return Returns a reference to <code>this</code> for easy method chaining
12099     */
12100    public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) { 
12101      this.benefitBalance = theBenefitBalance;
12102      return this;
12103    }
12104
12105    public boolean hasBenefitBalance() { 
12106      if (this.benefitBalance == null)
12107        return false;
12108      for (BenefitBalanceComponent item : this.benefitBalance)
12109        if (!item.isEmpty())
12110          return true;
12111      return false;
12112    }
12113
12114    public BenefitBalanceComponent addBenefitBalance() { //3
12115      BenefitBalanceComponent t = new BenefitBalanceComponent();
12116      if (this.benefitBalance == null)
12117        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
12118      this.benefitBalance.add(t);
12119      return t;
12120    }
12121
12122    public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { //3
12123      if (t == null)
12124        return this;
12125      if (this.benefitBalance == null)
12126        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
12127      this.benefitBalance.add(t);
12128      return this;
12129    }
12130
12131    /**
12132     * @return The first repetition of repeating field {@link #benefitBalance}, creating it if it does not already exist
12133     */
12134    public BenefitBalanceComponent getBenefitBalanceFirstRep() { 
12135      if (getBenefitBalance().isEmpty()) {
12136        addBenefitBalance();
12137      }
12138      return getBenefitBalance().get(0);
12139    }
12140
12141      protected void listChildren(List<Property> children) {
12142        super.listChildren(children);
12143        children.add(new Property("identifier", "Identifier", "The EOB Business Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
12144        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
12145        children.add(new Property("type", "CodeableConcept", "The category of claim, eg, oral, pharmacy, vision, insitutional, professional.", 0, 1, type));
12146        children.add(new Property("subType", "CodeableConcept", "A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType.", 0, java.lang.Integer.MAX_VALUE, subType));
12147        children.add(new Property("patient", "Reference(Patient)", "Patient Resource.", 0, 1, patient));
12148        children.add(new Property("billablePeriod", "Period", "The billable period for which charges are being submitted.", 0, 1, billablePeriod));
12149        children.add(new Property("created", "dateTime", "The date when the EOB was created.", 0, 1, created));
12150        children.add(new Property("enterer", "Reference(Practitioner)", "The person who created the explanation of benefit.", 0, 1, enterer));
12151        children.add(new Property("insurer", "Reference(Organization)", "The insurer which is responsible for the explanation of benefit.", 0, 1, insurer));
12152        children.add(new Property("provider", "Reference(Practitioner)", "The provider which is responsible for the claim.", 0, 1, provider));
12153        children.add(new Property("organization", "Reference(Organization)", "The provider which is responsible for the claim.", 0, 1, organization));
12154        children.add(new Property("referral", "Reference(ReferralRequest)", "The referral resource which lists the date, practitioner, reason and other supporting information.", 0, 1, referral));
12155        children.add(new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
12156        children.add(new Property("claim", "Reference(Claim)", "The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.", 0, 1, claim));
12157        children.add(new Property("claimResponse", "Reference(ClaimResponse)", "The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.", 0, 1, claimResponse));
12158        children.add(new Property("outcome", "CodeableConcept", "Processing outcome errror, partial or complete processing.", 0, 1, outcome));
12159        children.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition));
12160        children.add(new Property("related", "", "Other claims which are related to this claim such as prior claim versions or for related services.", 0, java.lang.Integer.MAX_VALUE, related));
12161        children.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of Pharmacy or Vision products.", 0, 1, prescription));
12162        children.add(new Property("originalPrescription", "Reference(MedicationRequest)", "Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.", 0, 1, originalPrescription));
12163        children.add(new Property("payee", "", "The party to be reimbursed for the services.", 0, 1, payee));
12164        children.add(new Property("information", "", "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required.", 0, java.lang.Integer.MAX_VALUE, information));
12165        children.add(new Property("careTeam", "", "The members of the team who provided the overall service as well as their role and whether responsible and qualifications.", 0, java.lang.Integer.MAX_VALUE, careTeam));
12166        children.add(new Property("diagnosis", "", "Ordered list of patient diagnosis for which care is sought.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
12167        children.add(new Property("procedure", "", "Ordered list of patient procedures performed to support the adjudication.", 0, java.lang.Integer.MAX_VALUE, procedure));
12168        children.add(new Property("precedence", "positiveInt", "Precedence (primary, secondary, etc.).", 0, 1, precedence));
12169        children.add(new Property("insurance", "", "Financial instrument by which payment information for health care.", 0, 1, insurance));
12170        children.add(new Property("accident", "", "An accident which resulted in the need for healthcare services.", 0, 1, accident));
12171        children.add(new Property("employmentImpacted", "Period", "The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).", 0, 1, employmentImpacted));
12172        children.add(new Property("hospitalization", "Period", "The start and optional end dates of when the patient was confined to a treatment center.", 0, 1, hospitalization));
12173        children.add(new Property("item", "", "First tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, item));
12174        children.add(new Property("addItem", "", "The first tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, addItem));
12175        children.add(new Property("totalCost", "Money", "The total cost of the services reported.", 0, 1, totalCost));
12176        children.add(new Property("unallocDeductable", "Money", "The amount of deductable applied which was not allocated to any particular service line.", 0, 1, unallocDeductable));
12177        children.add(new Property("totalBenefit", "Money", "Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable).", 0, 1, totalBenefit));
12178        children.add(new Property("payment", "", "Payment details for the claim if the claim has been paid.", 0, 1, payment));
12179        children.add(new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, 1, form));
12180        children.add(new Property("processNote", "", "Note text.", 0, java.lang.Integer.MAX_VALUE, processNote));
12181        children.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
12182      }
12183
12184      @Override
12185      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
12186        switch (_hash) {
12187        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The EOB Business Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier);
12188        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
12189        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The category of claim, eg, oral, pharmacy, vision, insitutional, professional.", 0, 1, type);
12190        case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType.", 0, java.lang.Integer.MAX_VALUE, subType);
12191        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "Patient Resource.", 0, 1, patient);
12192        case -332066046: /*billablePeriod*/  return new Property("billablePeriod", "Period", "The billable period for which charges are being submitted.", 0, 1, billablePeriod);
12193        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date when the EOB was created.", 0, 1, created);
12194        case -1591951995: /*enterer*/  return new Property("enterer", "Reference(Practitioner)", "The person who created the explanation of benefit.", 0, 1, enterer);
12195        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The insurer which is responsible for the explanation of benefit.", 0, 1, insurer);
12196        case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner)", "The provider which is responsible for the claim.", 0, 1, provider);
12197        case 1178922291: /*organization*/  return new Property("organization", "Reference(Organization)", "The provider which is responsible for the claim.", 0, 1, organization);
12198        case -722568291: /*referral*/  return new Property("referral", "Reference(ReferralRequest)", "The referral resource which lists the date, practitioner, reason and other supporting information.", 0, 1, referral);
12199        case 501116579: /*facility*/  return new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility);
12200        case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.", 0, 1, claim);
12201        case 689513629: /*claimResponse*/  return new Property("claimResponse", "Reference(ClaimResponse)", "The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.", 0, 1, claimResponse);
12202        case -1106507950: /*outcome*/  return new Property("outcome", "CodeableConcept", "Processing outcome errror, partial or complete processing.", 0, 1, outcome);
12203        case 583380919: /*disposition*/  return new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition);
12204        case 1090493483: /*related*/  return new Property("related", "", "Other claims which are related to this claim such as prior claim versions or for related services.", 0, java.lang.Integer.MAX_VALUE, related);
12205        case 460301338: /*prescription*/  return new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of Pharmacy or Vision products.", 0, 1, prescription);
12206        case -1814015861: /*originalPrescription*/  return new Property("originalPrescription", "Reference(MedicationRequest)", "Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.", 0, 1, originalPrescription);
12207        case 106443592: /*payee*/  return new Property("payee", "", "The party to be reimbursed for the services.", 0, 1, payee);
12208        case 1968600364: /*information*/  return new Property("information", "", "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required.", 0, java.lang.Integer.MAX_VALUE, information);
12209        case -7323378: /*careTeam*/  return new Property("careTeam", "", "The members of the team who provided the overall service as well as their role and whether responsible and qualifications.", 0, java.lang.Integer.MAX_VALUE, careTeam);
12210        case 1196993265: /*diagnosis*/  return new Property("diagnosis", "", "Ordered list of patient diagnosis for which care is sought.", 0, java.lang.Integer.MAX_VALUE, diagnosis);
12211        case -1095204141: /*procedure*/  return new Property("procedure", "", "Ordered list of patient procedures performed to support the adjudication.", 0, java.lang.Integer.MAX_VALUE, procedure);
12212        case 159695370: /*precedence*/  return new Property("precedence", "positiveInt", "Precedence (primary, secondary, etc.).", 0, 1, precedence);
12213        case 73049818: /*insurance*/  return new Property("insurance", "", "Financial instrument by which payment information for health care.", 0, 1, insurance);
12214        case -2143202801: /*accident*/  return new Property("accident", "", "An accident which resulted in the need for healthcare services.", 0, 1, accident);
12215        case 1051487345: /*employmentImpacted*/  return new Property("employmentImpacted", "Period", "The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).", 0, 1, employmentImpacted);
12216        case 1057894634: /*hospitalization*/  return new Property("hospitalization", "Period", "The start and optional end dates of when the patient was confined to a treatment center.", 0, 1, hospitalization);
12217        case 3242771: /*item*/  return new Property("item", "", "First tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, item);
12218        case -1148899500: /*addItem*/  return new Property("addItem", "", "The first tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, addItem);
12219        case -577782479: /*totalCost*/  return new Property("totalCost", "Money", "The total cost of the services reported.", 0, 1, totalCost);
12220        case 2096309753: /*unallocDeductable*/  return new Property("unallocDeductable", "Money", "The amount of deductable applied which was not allocated to any particular service line.", 0, 1, unallocDeductable);
12221        case 332332211: /*totalBenefit*/  return new Property("totalBenefit", "Money", "Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable).", 0, 1, totalBenefit);
12222        case -786681338: /*payment*/  return new Property("payment", "", "Payment details for the claim if the claim has been paid.", 0, 1, payment);
12223        case 3148996: /*form*/  return new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, 1, form);
12224        case 202339073: /*processNote*/  return new Property("processNote", "", "Note text.", 0, java.lang.Integer.MAX_VALUE, processNote);
12225        case 596003397: /*benefitBalance*/  return new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance);
12226        default: return super.getNamedProperty(_hash, _name, _checkValid);
12227        }
12228
12229      }
12230
12231      @Override
12232      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
12233        switch (hash) {
12234        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
12235        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ExplanationOfBenefitStatus>
12236        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
12237        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : this.subType.toArray(new Base[this.subType.size()]); // CodeableConcept
12238        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
12239        case -332066046: /*billablePeriod*/ return this.billablePeriod == null ? new Base[0] : new Base[] {this.billablePeriod}; // Period
12240        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
12241        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
12242        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
12243        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
12244        case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : new Base[] {this.organization}; // Reference
12245        case -722568291: /*referral*/ return this.referral == null ? new Base[0] : new Base[] {this.referral}; // Reference
12246        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
12247        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
12248        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Reference
12249        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // CodeableConcept
12250        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
12251        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
12252        case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Reference
12253        case -1814015861: /*originalPrescription*/ return this.originalPrescription == null ? new Base[0] : new Base[] {this.originalPrescription}; // Reference
12254        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // PayeeComponent
12255        case 1968600364: /*information*/ return this.information == null ? new Base[0] : this.information.toArray(new Base[this.information.size()]); // SupportingInformationComponent
12256        case -7323378: /*careTeam*/ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
12257        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
12258        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
12259        case 159695370: /*precedence*/ return this.precedence == null ? new Base[0] : new Base[] {this.precedence}; // PositiveIntType
12260        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : new Base[] {this.insurance}; // InsuranceComponent
12261        case -2143202801: /*accident*/ return this.accident == null ? new Base[0] : new Base[] {this.accident}; // AccidentComponent
12262        case 1051487345: /*employmentImpacted*/ return this.employmentImpacted == null ? new Base[0] : new Base[] {this.employmentImpacted}; // Period
12263        case 1057894634: /*hospitalization*/ return this.hospitalization == null ? new Base[0] : new Base[] {this.hospitalization}; // Period
12264        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
12265        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
12266        case -577782479: /*totalCost*/ return this.totalCost == null ? new Base[0] : new Base[] {this.totalCost}; // Money
12267        case 2096309753: /*unallocDeductable*/ return this.unallocDeductable == null ? new Base[0] : new Base[] {this.unallocDeductable}; // Money
12268        case 332332211: /*totalBenefit*/ return this.totalBenefit == null ? new Base[0] : new Base[] {this.totalBenefit}; // Money
12269        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // PaymentComponent
12270        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // CodeableConcept
12271        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
12272        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
12273        default: return super.getProperty(hash, name, checkValid);
12274        }
12275
12276      }
12277
12278      @Override
12279      public Base setProperty(int hash, String name, Base value) throws FHIRException {
12280        switch (hash) {
12281        case -1618432855: // identifier
12282          this.getIdentifier().add(castToIdentifier(value)); // Identifier
12283          return value;
12284        case -892481550: // status
12285          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
12286          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
12287          return value;
12288        case 3575610: // type
12289          this.type = castToCodeableConcept(value); // CodeableConcept
12290          return value;
12291        case -1868521062: // subType
12292          this.getSubType().add(castToCodeableConcept(value)); // CodeableConcept
12293          return value;
12294        case -791418107: // patient
12295          this.patient = castToReference(value); // Reference
12296          return value;
12297        case -332066046: // billablePeriod
12298          this.billablePeriod = castToPeriod(value); // Period
12299          return value;
12300        case 1028554472: // created
12301          this.created = castToDateTime(value); // DateTimeType
12302          return value;
12303        case -1591951995: // enterer
12304          this.enterer = castToReference(value); // Reference
12305          return value;
12306        case 1957615864: // insurer
12307          this.insurer = castToReference(value); // Reference
12308          return value;
12309        case -987494927: // provider
12310          this.provider = castToReference(value); // Reference
12311          return value;
12312        case 1178922291: // organization
12313          this.organization = castToReference(value); // Reference
12314          return value;
12315        case -722568291: // referral
12316          this.referral = castToReference(value); // Reference
12317          return value;
12318        case 501116579: // facility
12319          this.facility = castToReference(value); // Reference
12320          return value;
12321        case 94742588: // claim
12322          this.claim = castToReference(value); // Reference
12323          return value;
12324        case 689513629: // claimResponse
12325          this.claimResponse = castToReference(value); // Reference
12326          return value;
12327        case -1106507950: // outcome
12328          this.outcome = castToCodeableConcept(value); // CodeableConcept
12329          return value;
12330        case 583380919: // disposition
12331          this.disposition = castToString(value); // StringType
12332          return value;
12333        case 1090493483: // related
12334          this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
12335          return value;
12336        case 460301338: // prescription
12337          this.prescription = castToReference(value); // Reference
12338          return value;
12339        case -1814015861: // originalPrescription
12340          this.originalPrescription = castToReference(value); // Reference
12341          return value;
12342        case 106443592: // payee
12343          this.payee = (PayeeComponent) value; // PayeeComponent
12344          return value;
12345        case 1968600364: // information
12346          this.getInformation().add((SupportingInformationComponent) value); // SupportingInformationComponent
12347          return value;
12348        case -7323378: // careTeam
12349          this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
12350          return value;
12351        case 1196993265: // diagnosis
12352          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
12353          return value;
12354        case -1095204141: // procedure
12355          this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
12356          return value;
12357        case 159695370: // precedence
12358          this.precedence = castToPositiveInt(value); // PositiveIntType
12359          return value;
12360        case 73049818: // insurance
12361          this.insurance = (InsuranceComponent) value; // InsuranceComponent
12362          return value;
12363        case -2143202801: // accident
12364          this.accident = (AccidentComponent) value; // AccidentComponent
12365          return value;
12366        case 1051487345: // employmentImpacted
12367          this.employmentImpacted = castToPeriod(value); // Period
12368          return value;
12369        case 1057894634: // hospitalization
12370          this.hospitalization = castToPeriod(value); // Period
12371          return value;
12372        case 3242771: // item
12373          this.getItem().add((ItemComponent) value); // ItemComponent
12374          return value;
12375        case -1148899500: // addItem
12376          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
12377          return value;
12378        case -577782479: // totalCost
12379          this.totalCost = castToMoney(value); // Money
12380          return value;
12381        case 2096309753: // unallocDeductable
12382          this.unallocDeductable = castToMoney(value); // Money
12383          return value;
12384        case 332332211: // totalBenefit
12385          this.totalBenefit = castToMoney(value); // Money
12386          return value;
12387        case -786681338: // payment
12388          this.payment = (PaymentComponent) value; // PaymentComponent
12389          return value;
12390        case 3148996: // form
12391          this.form = castToCodeableConcept(value); // CodeableConcept
12392          return value;
12393        case 202339073: // processNote
12394          this.getProcessNote().add((NoteComponent) value); // NoteComponent
12395          return value;
12396        case 596003397: // benefitBalance
12397          this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
12398          return value;
12399        default: return super.setProperty(hash, name, value);
12400        }
12401
12402      }
12403
12404      @Override
12405      public Base setProperty(String name, Base value) throws FHIRException {
12406        if (name.equals("identifier")) {
12407          this.getIdentifier().add(castToIdentifier(value));
12408        } else if (name.equals("status")) {
12409          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
12410          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
12411        } else if (name.equals("type")) {
12412          this.type = castToCodeableConcept(value); // CodeableConcept
12413        } else if (name.equals("subType")) {
12414          this.getSubType().add(castToCodeableConcept(value));
12415        } else if (name.equals("patient")) {
12416          this.patient = castToReference(value); // Reference
12417        } else if (name.equals("billablePeriod")) {
12418          this.billablePeriod = castToPeriod(value); // Period
12419        } else if (name.equals("created")) {
12420          this.created = castToDateTime(value); // DateTimeType
12421        } else if (name.equals("enterer")) {
12422          this.enterer = castToReference(value); // Reference
12423        } else if (name.equals("insurer")) {
12424          this.insurer = castToReference(value); // Reference
12425        } else if (name.equals("provider")) {
12426          this.provider = castToReference(value); // Reference
12427        } else if (name.equals("organization")) {
12428          this.organization = castToReference(value); // Reference
12429        } else if (name.equals("referral")) {
12430          this.referral = castToReference(value); // Reference
12431        } else if (name.equals("facility")) {
12432          this.facility = castToReference(value); // Reference
12433        } else if (name.equals("claim")) {
12434          this.claim = castToReference(value); // Reference
12435        } else if (name.equals("claimResponse")) {
12436          this.claimResponse = castToReference(value); // Reference
12437        } else if (name.equals("outcome")) {
12438          this.outcome = castToCodeableConcept(value); // CodeableConcept
12439        } else if (name.equals("disposition")) {
12440          this.disposition = castToString(value); // StringType
12441        } else if (name.equals("related")) {
12442          this.getRelated().add((RelatedClaimComponent) value);
12443        } else if (name.equals("prescription")) {
12444          this.prescription = castToReference(value); // Reference
12445        } else if (name.equals("originalPrescription")) {
12446          this.originalPrescription = castToReference(value); // Reference
12447        } else if (name.equals("payee")) {
12448          this.payee = (PayeeComponent) value; // PayeeComponent
12449        } else if (name.equals("information")) {
12450          this.getInformation().add((SupportingInformationComponent) value);
12451        } else if (name.equals("careTeam")) {
12452          this.getCareTeam().add((CareTeamComponent) value);
12453        } else if (name.equals("diagnosis")) {
12454          this.getDiagnosis().add((DiagnosisComponent) value);
12455        } else if (name.equals("procedure")) {
12456          this.getProcedure().add((ProcedureComponent) value);
12457        } else if (name.equals("precedence")) {
12458          this.precedence = castToPositiveInt(value); // PositiveIntType
12459        } else if (name.equals("insurance")) {
12460          this.insurance = (InsuranceComponent) value; // InsuranceComponent
12461        } else if (name.equals("accident")) {
12462          this.accident = (AccidentComponent) value; // AccidentComponent
12463        } else if (name.equals("employmentImpacted")) {
12464          this.employmentImpacted = castToPeriod(value); // Period
12465        } else if (name.equals("hospitalization")) {
12466          this.hospitalization = castToPeriod(value); // Period
12467        } else if (name.equals("item")) {
12468          this.getItem().add((ItemComponent) value);
12469        } else if (name.equals("addItem")) {
12470          this.getAddItem().add((AddedItemComponent) value);
12471        } else if (name.equals("totalCost")) {
12472          this.totalCost = castToMoney(value); // Money
12473        } else if (name.equals("unallocDeductable")) {
12474          this.unallocDeductable = castToMoney(value); // Money
12475        } else if (name.equals("totalBenefit")) {
12476          this.totalBenefit = castToMoney(value); // Money
12477        } else if (name.equals("payment")) {
12478          this.payment = (PaymentComponent) value; // PaymentComponent
12479        } else if (name.equals("form")) {
12480          this.form = castToCodeableConcept(value); // CodeableConcept
12481        } else if (name.equals("processNote")) {
12482          this.getProcessNote().add((NoteComponent) value);
12483        } else if (name.equals("benefitBalance")) {
12484          this.getBenefitBalance().add((BenefitBalanceComponent) value);
12485        } else
12486          return super.setProperty(name, value);
12487        return value;
12488      }
12489
12490      @Override
12491      public Base makeProperty(int hash, String name) throws FHIRException {
12492        switch (hash) {
12493        case -1618432855:  return addIdentifier(); 
12494        case -892481550:  return getStatusElement();
12495        case 3575610:  return getType(); 
12496        case -1868521062:  return addSubType(); 
12497        case -791418107:  return getPatient(); 
12498        case -332066046:  return getBillablePeriod(); 
12499        case 1028554472:  return getCreatedElement();
12500        case -1591951995:  return getEnterer(); 
12501        case 1957615864:  return getInsurer(); 
12502        case -987494927:  return getProvider(); 
12503        case 1178922291:  return getOrganization(); 
12504        case -722568291:  return getReferral(); 
12505        case 501116579:  return getFacility(); 
12506        case 94742588:  return getClaim(); 
12507        case 689513629:  return getClaimResponse(); 
12508        case -1106507950:  return getOutcome(); 
12509        case 583380919:  return getDispositionElement();
12510        case 1090493483:  return addRelated(); 
12511        case 460301338:  return getPrescription(); 
12512        case -1814015861:  return getOriginalPrescription(); 
12513        case 106443592:  return getPayee(); 
12514        case 1968600364:  return addInformation(); 
12515        case -7323378:  return addCareTeam(); 
12516        case 1196993265:  return addDiagnosis(); 
12517        case -1095204141:  return addProcedure(); 
12518        case 159695370:  return getPrecedenceElement();
12519        case 73049818:  return getInsurance(); 
12520        case -2143202801:  return getAccident(); 
12521        case 1051487345:  return getEmploymentImpacted(); 
12522        case 1057894634:  return getHospitalization(); 
12523        case 3242771:  return addItem(); 
12524        case -1148899500:  return addAddItem(); 
12525        case -577782479:  return getTotalCost(); 
12526        case 2096309753:  return getUnallocDeductable(); 
12527        case 332332211:  return getTotalBenefit(); 
12528        case -786681338:  return getPayment(); 
12529        case 3148996:  return getForm(); 
12530        case 202339073:  return addProcessNote(); 
12531        case 596003397:  return addBenefitBalance(); 
12532        default: return super.makeProperty(hash, name);
12533        }
12534
12535      }
12536
12537      @Override
12538      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12539        switch (hash) {
12540        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
12541        case -892481550: /*status*/ return new String[] {"code"};
12542        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
12543        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
12544        case -791418107: /*patient*/ return new String[] {"Reference"};
12545        case -332066046: /*billablePeriod*/ return new String[] {"Period"};
12546        case 1028554472: /*created*/ return new String[] {"dateTime"};
12547        case -1591951995: /*enterer*/ return new String[] {"Reference"};
12548        case 1957615864: /*insurer*/ return new String[] {"Reference"};
12549        case -987494927: /*provider*/ return new String[] {"Reference"};
12550        case 1178922291: /*organization*/ return new String[] {"Reference"};
12551        case -722568291: /*referral*/ return new String[] {"Reference"};
12552        case 501116579: /*facility*/ return new String[] {"Reference"};
12553        case 94742588: /*claim*/ return new String[] {"Reference"};
12554        case 689513629: /*claimResponse*/ return new String[] {"Reference"};
12555        case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
12556        case 583380919: /*disposition*/ return new String[] {"string"};
12557        case 1090493483: /*related*/ return new String[] {};
12558        case 460301338: /*prescription*/ return new String[] {"Reference"};
12559        case -1814015861: /*originalPrescription*/ return new String[] {"Reference"};
12560        case 106443592: /*payee*/ return new String[] {};
12561        case 1968600364: /*information*/ return new String[] {};
12562        case -7323378: /*careTeam*/ return new String[] {};
12563        case 1196993265: /*diagnosis*/ return new String[] {};
12564        case -1095204141: /*procedure*/ return new String[] {};
12565        case 159695370: /*precedence*/ return new String[] {"positiveInt"};
12566        case 73049818: /*insurance*/ return new String[] {};
12567        case -2143202801: /*accident*/ return new String[] {};
12568        case 1051487345: /*employmentImpacted*/ return new String[] {"Period"};
12569        case 1057894634: /*hospitalization*/ return new String[] {"Period"};
12570        case 3242771: /*item*/ return new String[] {};
12571        case -1148899500: /*addItem*/ return new String[] {};
12572        case -577782479: /*totalCost*/ return new String[] {"Money"};
12573        case 2096309753: /*unallocDeductable*/ return new String[] {"Money"};
12574        case 332332211: /*totalBenefit*/ return new String[] {"Money"};
12575        case -786681338: /*payment*/ return new String[] {};
12576        case 3148996: /*form*/ return new String[] {"CodeableConcept"};
12577        case 202339073: /*processNote*/ return new String[] {};
12578        case 596003397: /*benefitBalance*/ return new String[] {};
12579        default: return super.getTypesForProperty(hash, name);
12580        }
12581
12582      }
12583
12584      @Override
12585      public Base addChild(String name) throws FHIRException {
12586        if (name.equals("identifier")) {
12587          return addIdentifier();
12588        }
12589        else if (name.equals("status")) {
12590          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.status");
12591        }
12592        else if (name.equals("type")) {
12593          this.type = new CodeableConcept();
12594          return this.type;
12595        }
12596        else if (name.equals("subType")) {
12597          return addSubType();
12598        }
12599        else if (name.equals("patient")) {
12600          this.patient = new Reference();
12601          return this.patient;
12602        }
12603        else if (name.equals("billablePeriod")) {
12604          this.billablePeriod = new Period();
12605          return this.billablePeriod;
12606        }
12607        else if (name.equals("created")) {
12608          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.created");
12609        }
12610        else if (name.equals("enterer")) {
12611          this.enterer = new Reference();
12612          return this.enterer;
12613        }
12614        else if (name.equals("insurer")) {
12615          this.insurer = new Reference();
12616          return this.insurer;
12617        }
12618        else if (name.equals("provider")) {
12619          this.provider = new Reference();
12620          return this.provider;
12621        }
12622        else if (name.equals("organization")) {
12623          this.organization = new Reference();
12624          return this.organization;
12625        }
12626        else if (name.equals("referral")) {
12627          this.referral = new Reference();
12628          return this.referral;
12629        }
12630        else if (name.equals("facility")) {
12631          this.facility = new Reference();
12632          return this.facility;
12633        }
12634        else if (name.equals("claim")) {
12635          this.claim = new Reference();
12636          return this.claim;
12637        }
12638        else if (name.equals("claimResponse")) {
12639          this.claimResponse = new Reference();
12640          return this.claimResponse;
12641        }
12642        else if (name.equals("outcome")) {
12643          this.outcome = new CodeableConcept();
12644          return this.outcome;
12645        }
12646        else if (name.equals("disposition")) {
12647          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.disposition");
12648        }
12649        else if (name.equals("related")) {
12650          return addRelated();
12651        }
12652        else if (name.equals("prescription")) {
12653          this.prescription = new Reference();
12654          return this.prescription;
12655        }
12656        else if (name.equals("originalPrescription")) {
12657          this.originalPrescription = new Reference();
12658          return this.originalPrescription;
12659        }
12660        else if (name.equals("payee")) {
12661          this.payee = new PayeeComponent();
12662          return this.payee;
12663        }
12664        else if (name.equals("information")) {
12665          return addInformation();
12666        }
12667        else if (name.equals("careTeam")) {
12668          return addCareTeam();
12669        }
12670        else if (name.equals("diagnosis")) {
12671          return addDiagnosis();
12672        }
12673        else if (name.equals("procedure")) {
12674          return addProcedure();
12675        }
12676        else if (name.equals("precedence")) {
12677          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.precedence");
12678        }
12679        else if (name.equals("insurance")) {
12680          this.insurance = new InsuranceComponent();
12681          return this.insurance;
12682        }
12683        else if (name.equals("accident")) {
12684          this.accident = new AccidentComponent();
12685          return this.accident;
12686        }
12687        else if (name.equals("employmentImpacted")) {
12688          this.employmentImpacted = new Period();
12689          return this.employmentImpacted;
12690        }
12691        else if (name.equals("hospitalization")) {
12692          this.hospitalization = new Period();
12693          return this.hospitalization;
12694        }
12695        else if (name.equals("item")) {
12696          return addItem();
12697        }
12698        else if (name.equals("addItem")) {
12699          return addAddItem();
12700        }
12701        else if (name.equals("totalCost")) {
12702          this.totalCost = new Money();
12703          return this.totalCost;
12704        }
12705        else if (name.equals("unallocDeductable")) {
12706          this.unallocDeductable = new Money();
12707          return this.unallocDeductable;
12708        }
12709        else if (name.equals("totalBenefit")) {
12710          this.totalBenefit = new Money();
12711          return this.totalBenefit;
12712        }
12713        else if (name.equals("payment")) {
12714          this.payment = new PaymentComponent();
12715          return this.payment;
12716        }
12717        else if (name.equals("form")) {
12718          this.form = new CodeableConcept();
12719          return this.form;
12720        }
12721        else if (name.equals("processNote")) {
12722          return addProcessNote();
12723        }
12724        else if (name.equals("benefitBalance")) {
12725          return addBenefitBalance();
12726        }
12727        else
12728          return super.addChild(name);
12729      }
12730
12731  public String fhirType() {
12732    return "ExplanationOfBenefit";
12733
12734  }
12735
12736      public ExplanationOfBenefit copy() {
12737        ExplanationOfBenefit dst = new ExplanationOfBenefit();
12738        copyValues(dst);
12739        if (identifier != null) {
12740          dst.identifier = new ArrayList<Identifier>();
12741          for (Identifier i : identifier)
12742            dst.identifier.add(i.copy());
12743        };
12744        dst.status = status == null ? null : status.copy();
12745        dst.type = type == null ? null : type.copy();
12746        if (subType != null) {
12747          dst.subType = new ArrayList<CodeableConcept>();
12748          for (CodeableConcept i : subType)
12749            dst.subType.add(i.copy());
12750        };
12751        dst.patient = patient == null ? null : patient.copy();
12752        dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
12753        dst.created = created == null ? null : created.copy();
12754        dst.enterer = enterer == null ? null : enterer.copy();
12755        dst.insurer = insurer == null ? null : insurer.copy();
12756        dst.provider = provider == null ? null : provider.copy();
12757        dst.organization = organization == null ? null : organization.copy();
12758        dst.referral = referral == null ? null : referral.copy();
12759        dst.facility = facility == null ? null : facility.copy();
12760        dst.claim = claim == null ? null : claim.copy();
12761        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
12762        dst.outcome = outcome == null ? null : outcome.copy();
12763        dst.disposition = disposition == null ? null : disposition.copy();
12764        if (related != null) {
12765          dst.related = new ArrayList<RelatedClaimComponent>();
12766          for (RelatedClaimComponent i : related)
12767            dst.related.add(i.copy());
12768        };
12769        dst.prescription = prescription == null ? null : prescription.copy();
12770        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
12771        dst.payee = payee == null ? null : payee.copy();
12772        if (information != null) {
12773          dst.information = new ArrayList<SupportingInformationComponent>();
12774          for (SupportingInformationComponent i : information)
12775            dst.information.add(i.copy());
12776        };
12777        if (careTeam != null) {
12778          dst.careTeam = new ArrayList<CareTeamComponent>();
12779          for (CareTeamComponent i : careTeam)
12780            dst.careTeam.add(i.copy());
12781        };
12782        if (diagnosis != null) {
12783          dst.diagnosis = new ArrayList<DiagnosisComponent>();
12784          for (DiagnosisComponent i : diagnosis)
12785            dst.diagnosis.add(i.copy());
12786        };
12787        if (procedure != null) {
12788          dst.procedure = new ArrayList<ProcedureComponent>();
12789          for (ProcedureComponent i : procedure)
12790            dst.procedure.add(i.copy());
12791        };
12792        dst.precedence = precedence == null ? null : precedence.copy();
12793        dst.insurance = insurance == null ? null : insurance.copy();
12794        dst.accident = accident == null ? null : accident.copy();
12795        dst.employmentImpacted = employmentImpacted == null ? null : employmentImpacted.copy();
12796        dst.hospitalization = hospitalization == null ? null : hospitalization.copy();
12797        if (item != null) {
12798          dst.item = new ArrayList<ItemComponent>();
12799          for (ItemComponent i : item)
12800            dst.item.add(i.copy());
12801        };
12802        if (addItem != null) {
12803          dst.addItem = new ArrayList<AddedItemComponent>();
12804          for (AddedItemComponent i : addItem)
12805            dst.addItem.add(i.copy());
12806        };
12807        dst.totalCost = totalCost == null ? null : totalCost.copy();
12808        dst.unallocDeductable = unallocDeductable == null ? null : unallocDeductable.copy();
12809        dst.totalBenefit = totalBenefit == null ? null : totalBenefit.copy();
12810        dst.payment = payment == null ? null : payment.copy();
12811        dst.form = form == null ? null : form.copy();
12812        if (processNote != null) {
12813          dst.processNote = new ArrayList<NoteComponent>();
12814          for (NoteComponent i : processNote)
12815            dst.processNote.add(i.copy());
12816        };
12817        if (benefitBalance != null) {
12818          dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
12819          for (BenefitBalanceComponent i : benefitBalance)
12820            dst.benefitBalance.add(i.copy());
12821        };
12822        return dst;
12823      }
12824
12825      protected ExplanationOfBenefit typedCopy() {
12826        return copy();
12827      }
12828
12829      @Override
12830      public boolean equalsDeep(Base other_) {
12831        if (!super.equalsDeep(other_))
12832          return false;
12833        if (!(other_ instanceof ExplanationOfBenefit))
12834          return false;
12835        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
12836        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
12837           && compareDeep(subType, o.subType, true) && compareDeep(patient, o.patient, true) && compareDeep(billablePeriod, o.billablePeriod, true)
12838           && compareDeep(created, o.created, true) && compareDeep(enterer, o.enterer, true) && compareDeep(insurer, o.insurer, true)
12839           && compareDeep(provider, o.provider, true) && compareDeep(organization, o.organization, true) && compareDeep(referral, o.referral, true)
12840           && compareDeep(facility, o.facility, true) && compareDeep(claim, o.claim, true) && compareDeep(claimResponse, o.claimResponse, true)
12841           && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true) && compareDeep(related, o.related, true)
12842           && compareDeep(prescription, o.prescription, true) && compareDeep(originalPrescription, o.originalPrescription, true)
12843           && compareDeep(payee, o.payee, true) && compareDeep(information, o.information, true) && compareDeep(careTeam, o.careTeam, true)
12844           && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true) && compareDeep(precedence, o.precedence, true)
12845           && compareDeep(insurance, o.insurance, true) && compareDeep(accident, o.accident, true) && compareDeep(employmentImpacted, o.employmentImpacted, true)
12846           && compareDeep(hospitalization, o.hospitalization, true) && compareDeep(item, o.item, true) && compareDeep(addItem, o.addItem, true)
12847           && compareDeep(totalCost, o.totalCost, true) && compareDeep(unallocDeductable, o.unallocDeductable, true)
12848           && compareDeep(totalBenefit, o.totalBenefit, true) && compareDeep(payment, o.payment, true) && compareDeep(form, o.form, true)
12849           && compareDeep(processNote, o.processNote, true) && compareDeep(benefitBalance, o.benefitBalance, true)
12850          ;
12851      }
12852
12853      @Override
12854      public boolean equalsShallow(Base other_) {
12855        if (!super.equalsShallow(other_))
12856          return false;
12857        if (!(other_ instanceof ExplanationOfBenefit))
12858          return false;
12859        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
12860        return compareValues(status, o.status, true) && compareValues(created, o.created, true) && compareValues(disposition, o.disposition, true)
12861           && compareValues(precedence, o.precedence, true);
12862      }
12863
12864      public boolean isEmpty() {
12865        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
12866          , subType, patient, billablePeriod, created, enterer, insurer, provider, organization
12867          , referral, facility, claim, claimResponse, outcome, disposition, related, prescription
12868          , originalPrescription, payee, information, careTeam, diagnosis, procedure, precedence
12869          , insurance, accident, employmentImpacted, hospitalization, item, addItem, totalCost
12870          , unallocDeductable, totalBenefit, payment, form, processNote, benefitBalance);
12871      }
12872
12873  @Override
12874  public ResourceType getResourceType() {
12875    return ResourceType.ExplanationOfBenefit;
12876   }
12877
12878 /**
12879   * Search parameter: <b>coverage</b>
12880   * <p>
12881   * Description: <b>The plan under which the claim was adjudicated</b><br>
12882   * Type: <b>reference</b><br>
12883   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
12884   * </p>
12885   */
12886  @SearchParamDefinition(name="coverage", path="ExplanationOfBenefit.insurance.coverage", description="The plan under which the claim was adjudicated", type="reference", target={Coverage.class } )
12887  public static final String SP_COVERAGE = "coverage";
12888 /**
12889   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
12890   * <p>
12891   * Description: <b>The plan under which the claim was adjudicated</b><br>
12892   * Type: <b>reference</b><br>
12893   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
12894   * </p>
12895   */
12896  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COVERAGE);
12897
12898/**
12899   * Constant for fluent queries to be used to add include statements. Specifies
12900   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
12901   */
12902  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:coverage").toLocked();
12903
12904 /**
12905   * Search parameter: <b>care-team</b>
12906   * <p>
12907   * Description: <b>Member of the CareTeam</b><br>
12908   * Type: <b>reference</b><br>
12909   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
12910   * </p>
12911   */
12912  @SearchParamDefinition(name="care-team", path="ExplanationOfBenefit.careTeam.provider", description="Member of the CareTeam", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Organization.class, Practitioner.class } )
12913  public static final String SP_CARE_TEAM = "care-team";
12914 /**
12915   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
12916   * <p>
12917   * Description: <b>Member of the CareTeam</b><br>
12918   * Type: <b>reference</b><br>
12919   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
12920   * </p>
12921   */
12922  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_TEAM);
12923
12924/**
12925   * Constant for fluent queries to be used to add include statements. Specifies
12926   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
12927   */
12928  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:care-team").toLocked();
12929
12930 /**
12931   * Search parameter: <b>identifier</b>
12932   * <p>
12933   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
12934   * Type: <b>token</b><br>
12935   * Path: <b>ExplanationOfBenefit.identifier</b><br>
12936   * </p>
12937   */
12938  @SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
12939  public static final String SP_IDENTIFIER = "identifier";
12940 /**
12941   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
12942   * <p>
12943   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
12944   * Type: <b>token</b><br>
12945   * Path: <b>ExplanationOfBenefit.identifier</b><br>
12946   * </p>
12947   */
12948  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
12949
12950 /**
12951   * Search parameter: <b>created</b>
12952   * <p>
12953   * Description: <b>The creation date for the EOB</b><br>
12954   * Type: <b>date</b><br>
12955   * Path: <b>ExplanationOfBenefit.created</b><br>
12956   * </p>
12957   */
12958  @SearchParamDefinition(name="created", path="ExplanationOfBenefit.created", description="The creation date for the EOB", type="date" )
12959  public static final String SP_CREATED = "created";
12960 /**
12961   * <b>Fluent Client</b> search parameter constant for <b>created</b>
12962   * <p>
12963   * Description: <b>The creation date for the EOB</b><br>
12964   * Type: <b>date</b><br>
12965   * Path: <b>ExplanationOfBenefit.created</b><br>
12966   * </p>
12967   */
12968  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
12969
12970 /**
12971   * Search parameter: <b>encounter</b>
12972   * <p>
12973   * Description: <b>Encounters associated with a billed line item</b><br>
12974   * Type: <b>reference</b><br>
12975   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
12976   * </p>
12977   */
12978  @SearchParamDefinition(name="encounter", path="ExplanationOfBenefit.item.encounter", description="Encounters associated with a billed line item", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter") }, target={Encounter.class } )
12979  public static final String SP_ENCOUNTER = "encounter";
12980 /**
12981   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
12982   * <p>
12983   * Description: <b>Encounters associated with a billed line item</b><br>
12984   * Type: <b>reference</b><br>
12985   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
12986   * </p>
12987   */
12988  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
12989
12990/**
12991   * Constant for fluent queries to be used to add include statements. Specifies
12992   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
12993   */
12994  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:encounter").toLocked();
12995
12996 /**
12997   * Search parameter: <b>payee</b>
12998   * <p>
12999   * Description: <b>The party receiving any payment for the Claim</b><br>
13000   * Type: <b>reference</b><br>
13001   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
13002   * </p>
13003   */
13004  @SearchParamDefinition(name="payee", path="ExplanationOfBenefit.payee.party", description="The party receiving any payment for the Claim", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Organization.class, Patient.class, Practitioner.class, RelatedPerson.class } )
13005  public static final String SP_PAYEE = "payee";
13006 /**
13007   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
13008   * <p>
13009   * Description: <b>The party receiving any payment for the Claim</b><br>
13010   * Type: <b>reference</b><br>
13011   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
13012   * </p>
13013   */
13014  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PAYEE);
13015
13016/**
13017   * Constant for fluent queries to be used to add include statements. Specifies
13018   * the path value of "<b>ExplanationOfBenefit:payee</b>".
13019   */
13020  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:payee").toLocked();
13021
13022 /**
13023   * Search parameter: <b>disposition</b>
13024   * <p>
13025   * Description: <b>The contents of the disposition message</b><br>
13026   * Type: <b>string</b><br>
13027   * Path: <b>ExplanationOfBenefit.disposition</b><br>
13028   * </p>
13029   */
13030  @SearchParamDefinition(name="disposition", path="ExplanationOfBenefit.disposition", description="The contents of the disposition message", type="string" )
13031  public static final String SP_DISPOSITION = "disposition";
13032 /**
13033   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
13034   * <p>
13035   * Description: <b>The contents of the disposition message</b><br>
13036   * Type: <b>string</b><br>
13037   * Path: <b>ExplanationOfBenefit.disposition</b><br>
13038   * </p>
13039   */
13040  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
13041
13042 /**
13043   * Search parameter: <b>provider</b>
13044   * <p>
13045   * Description: <b>The reference to the provider</b><br>
13046   * Type: <b>reference</b><br>
13047   * Path: <b>ExplanationOfBenefit.provider</b><br>
13048   * </p>
13049   */
13050  @SearchParamDefinition(name="provider", path="ExplanationOfBenefit.provider", description="The reference to the provider", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class } )
13051  public static final String SP_PROVIDER = "provider";
13052 /**
13053   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
13054   * <p>
13055   * Description: <b>The reference to the provider</b><br>
13056   * Type: <b>reference</b><br>
13057   * Path: <b>ExplanationOfBenefit.provider</b><br>
13058   * </p>
13059   */
13060  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
13061
13062/**
13063   * Constant for fluent queries to be used to add include statements. Specifies
13064   * the path value of "<b>ExplanationOfBenefit:provider</b>".
13065   */
13066  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:provider").toLocked();
13067
13068 /**
13069   * Search parameter: <b>patient</b>
13070   * <p>
13071   * Description: <b>The reference to the patient</b><br>
13072   * Type: <b>reference</b><br>
13073   * Path: <b>ExplanationOfBenefit.patient</b><br>
13074   * </p>
13075   */
13076  @SearchParamDefinition(name="patient", path="ExplanationOfBenefit.patient", description="The reference to the patient", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
13077  public static final String SP_PATIENT = "patient";
13078 /**
13079   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
13080   * <p>
13081   * Description: <b>The reference to the patient</b><br>
13082   * Type: <b>reference</b><br>
13083   * Path: <b>ExplanationOfBenefit.patient</b><br>
13084   * </p>
13085   */
13086  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
13087
13088/**
13089   * Constant for fluent queries to be used to add include statements. Specifies
13090   * the path value of "<b>ExplanationOfBenefit:patient</b>".
13091   */
13092  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:patient").toLocked();
13093
13094 /**
13095   * Search parameter: <b>organization</b>
13096   * <p>
13097   * Description: <b>The reference to the providing organization</b><br>
13098   * Type: <b>reference</b><br>
13099   * Path: <b>ExplanationOfBenefit.organization</b><br>
13100   * </p>
13101   */
13102  @SearchParamDefinition(name="organization", path="ExplanationOfBenefit.organization", description="The reference to the providing organization", type="reference", target={Organization.class } )
13103  public static final String SP_ORGANIZATION = "organization";
13104 /**
13105   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
13106   * <p>
13107   * Description: <b>The reference to the providing organization</b><br>
13108   * Type: <b>reference</b><br>
13109   * Path: <b>ExplanationOfBenefit.organization</b><br>
13110   * </p>
13111   */
13112  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
13113
13114/**
13115   * Constant for fluent queries to be used to add include statements. Specifies
13116   * the path value of "<b>ExplanationOfBenefit:organization</b>".
13117   */
13118  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:organization").toLocked();
13119
13120 /**
13121   * Search parameter: <b>claim</b>
13122   * <p>
13123   * Description: <b>The reference to the claim</b><br>
13124   * Type: <b>reference</b><br>
13125   * Path: <b>ExplanationOfBenefit.claim</b><br>
13126   * </p>
13127   */
13128  @SearchParamDefinition(name="claim", path="ExplanationOfBenefit.claim", description="The reference to the claim", type="reference", target={Claim.class } )
13129  public static final String SP_CLAIM = "claim";
13130 /**
13131   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
13132   * <p>
13133   * Description: <b>The reference to the claim</b><br>
13134   * Type: <b>reference</b><br>
13135   * Path: <b>ExplanationOfBenefit.claim</b><br>
13136   * </p>
13137   */
13138  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CLAIM);
13139
13140/**
13141   * Constant for fluent queries to be used to add include statements. Specifies
13142   * the path value of "<b>ExplanationOfBenefit:claim</b>".
13143   */
13144  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:claim").toLocked();
13145
13146 /**
13147   * Search parameter: <b>enterer</b>
13148   * <p>
13149   * Description: <b>The party responsible for the entry of the Claim</b><br>
13150   * Type: <b>reference</b><br>
13151   * Path: <b>ExplanationOfBenefit.enterer</b><br>
13152   * </p>
13153   */
13154  @SearchParamDefinition(name="enterer", path="ExplanationOfBenefit.enterer", description="The party responsible for the entry of the Claim", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class } )
13155  public static final String SP_ENTERER = "enterer";
13156 /**
13157   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
13158   * <p>
13159   * Description: <b>The party responsible for the entry of the Claim</b><br>
13160   * Type: <b>reference</b><br>
13161   * Path: <b>ExplanationOfBenefit.enterer</b><br>
13162   * </p>
13163   */
13164  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
13165
13166/**
13167   * Constant for fluent queries to be used to add include statements. Specifies
13168   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
13169   */
13170  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:enterer").toLocked();
13171
13172 /**
13173   * Search parameter: <b>facility</b>
13174   * <p>
13175   * Description: <b>Facility responsible for the goods and services</b><br>
13176   * Type: <b>reference</b><br>
13177   * Path: <b>ExplanationOfBenefit.facility</b><br>
13178   * </p>
13179   */
13180  @SearchParamDefinition(name="facility", path="ExplanationOfBenefit.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class } )
13181  public static final String SP_FACILITY = "facility";
13182 /**
13183   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
13184   * <p>
13185   * Description: <b>Facility responsible for the goods and services</b><br>
13186   * Type: <b>reference</b><br>
13187   * Path: <b>ExplanationOfBenefit.facility</b><br>
13188   * </p>
13189   */
13190  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
13191
13192/**
13193   * Constant for fluent queries to be used to add include statements. Specifies
13194   * the path value of "<b>ExplanationOfBenefit:facility</b>".
13195   */
13196  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:facility").toLocked();
13197
13198
13199}
13200