001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.1
033
034import java.util.*;
035
036import java.math.*;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.dstu3.model.Enumerations.*;
039import ca.uhn.fhir.model.api.annotation.ResourceDef;
040import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.ChildOrder;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.Block;
045import org.hl7.fhir.instance.model.api.*;
046import org.hl7.fhir.exceptions.FHIRException;
047import org.hl7.fhir.exceptions.FHIRFormatError;
048/**
049 * 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.
050 */
051@ResourceDef(name="ExplanationOfBenefit", profile="http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit")
052public class ExplanationOfBenefit extends DomainResource {
053
054    public enum ExplanationOfBenefitStatus {
055        /**
056         * The resource instance is currently in-force.
057         */
058        ACTIVE, 
059        /**
060         * The resource instance is withdrawn, rescinded or reversed.
061         */
062        CANCELLED, 
063        /**
064         * A new resource instance the contents of which is not complete.
065         */
066        DRAFT, 
067        /**
068         * The resource instance was entered in error.
069         */
070        ENTEREDINERROR, 
071        /**
072         * added to help the parsers with the generic types
073         */
074        NULL;
075        public static ExplanationOfBenefitStatus fromCode(String codeString) throws FHIRException {
076            if (codeString == null || "".equals(codeString))
077                return null;
078        if ("active".equals(codeString))
079          return ACTIVE;
080        if ("cancelled".equals(codeString))
081          return CANCELLED;
082        if ("draft".equals(codeString))
083          return DRAFT;
084        if ("entered-in-error".equals(codeString))
085          return ENTEREDINERROR;
086        if (Configuration.isAcceptInvalidEnums())
087          return null;
088        else
089          throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
090        }
091        public String toCode() {
092          switch (this) {
093            case ACTIVE: return "active";
094            case CANCELLED: return "cancelled";
095            case DRAFT: return "draft";
096            case ENTEREDINERROR: return "entered-in-error";
097            default: return "?";
098          }
099        }
100        public String getSystem() {
101          switch (this) {
102            case ACTIVE: return "http://hl7.org/fhir/explanationofbenefit-status";
103            case CANCELLED: return "http://hl7.org/fhir/explanationofbenefit-status";
104            case DRAFT: return "http://hl7.org/fhir/explanationofbenefit-status";
105            case ENTEREDINERROR: return "http://hl7.org/fhir/explanationofbenefit-status";
106            default: return "?";
107          }
108        }
109        public String getDefinition() {
110          switch (this) {
111            case ACTIVE: return "The resource instance is currently in-force.";
112            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
113            case DRAFT: return "A new resource instance the contents of which is not complete.";
114            case ENTEREDINERROR: return "The resource instance was entered in error.";
115            default: return "?";
116          }
117        }
118        public String getDisplay() {
119          switch (this) {
120            case ACTIVE: return "Active";
121            case CANCELLED: return "Cancelled";
122            case DRAFT: return "Draft";
123            case ENTEREDINERROR: return "Entered In Error";
124            default: return "?";
125          }
126        }
127    }
128
129  public static class ExplanationOfBenefitStatusEnumFactory implements EnumFactory<ExplanationOfBenefitStatus> {
130    public ExplanationOfBenefitStatus fromCode(String codeString) throws IllegalArgumentException {
131      if (codeString == null || "".equals(codeString))
132            if (codeString == null || "".equals(codeString))
133                return null;
134        if ("active".equals(codeString))
135          return ExplanationOfBenefitStatus.ACTIVE;
136        if ("cancelled".equals(codeString))
137          return ExplanationOfBenefitStatus.CANCELLED;
138        if ("draft".equals(codeString))
139          return ExplanationOfBenefitStatus.DRAFT;
140        if ("entered-in-error".equals(codeString))
141          return ExplanationOfBenefitStatus.ENTEREDINERROR;
142        throw new IllegalArgumentException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
143        }
144        public Enumeration<ExplanationOfBenefitStatus> fromType(Base code) throws FHIRException {
145          if (code == null)
146            return null;
147          if (code.isEmpty())
148            return new Enumeration<ExplanationOfBenefitStatus>(this);
149          String codeString = ((PrimitiveType) code).asStringValue();
150          if (codeString == null || "".equals(codeString))
151            return null;
152        if ("active".equals(codeString))
153          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ACTIVE);
154        if ("cancelled".equals(codeString))
155          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.CANCELLED);
156        if ("draft".equals(codeString))
157          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.DRAFT);
158        if ("entered-in-error".equals(codeString))
159          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ENTEREDINERROR);
160        throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
161        }
162    public String toCode(ExplanationOfBenefitStatus code) {
163      if (code == ExplanationOfBenefitStatus.ACTIVE)
164        return "active";
165      if (code == ExplanationOfBenefitStatus.CANCELLED)
166        return "cancelled";
167      if (code == ExplanationOfBenefitStatus.DRAFT)
168        return "draft";
169      if (code == ExplanationOfBenefitStatus.ENTEREDINERROR)
170        return "entered-in-error";
171      return "?";
172      }
173    public String toSystem(ExplanationOfBenefitStatus code) {
174      return code.getSystem();
175      }
176    }
177
178    @Block()
179    public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
180        /**
181         * Other claims which are related to this claim such as prior claim versions or for related services.
182         */
183        @Child(name = "claim", type = {Claim.class}, order=1, min=0, max=1, modifier=false, summary=false)
184        @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." )
185        protected Reference claim;
186
187        /**
188         * 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.)
189         */
190        protected Claim claimTarget;
191
192        /**
193         * For example prior or umbrella.
194         */
195        @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
196        @Description(shortDefinition="How the reference claim is related", formalDefinition="For example prior or umbrella." )
197        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-claim-relationship")
198        protected CodeableConcept relationship;
199
200        /**
201         * An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .
202         */
203        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=false)
204        @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 # ." )
205        protected Identifier reference;
206
207        private static final long serialVersionUID = -379338905L;
208
209    /**
210     * Constructor
211     */
212      public RelatedClaimComponent() {
213        super();
214      }
215
216        /**
217         * @return {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
218         */
219        public Reference getClaim() { 
220          if (this.claim == null)
221            if (Configuration.errorOnAutoCreate())
222              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
223            else if (Configuration.doAutoCreate())
224              this.claim = new Reference(); // cc
225          return this.claim;
226        }
227
228        public boolean hasClaim() { 
229          return this.claim != null && !this.claim.isEmpty();
230        }
231
232        /**
233         * @param value {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
234         */
235        public RelatedClaimComponent setClaim(Reference value)  { 
236          this.claim = value;
237          return this;
238        }
239
240        /**
241         * @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.)
242         */
243        public Claim getClaimTarget() { 
244          if (this.claimTarget == null)
245            if (Configuration.errorOnAutoCreate())
246              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
247            else if (Configuration.doAutoCreate())
248              this.claimTarget = new Claim(); // aa
249          return this.claimTarget;
250        }
251
252        /**
253         * @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.)
254         */
255        public RelatedClaimComponent setClaimTarget(Claim value) { 
256          this.claimTarget = value;
257          return this;
258        }
259
260        /**
261         * @return {@link #relationship} (For example prior or umbrella.)
262         */
263        public CodeableConcept getRelationship() { 
264          if (this.relationship == null)
265            if (Configuration.errorOnAutoCreate())
266              throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
267            else if (Configuration.doAutoCreate())
268              this.relationship = new CodeableConcept(); // cc
269          return this.relationship;
270        }
271
272        public boolean hasRelationship() { 
273          return this.relationship != null && !this.relationship.isEmpty();
274        }
275
276        /**
277         * @param value {@link #relationship} (For example prior or umbrella.)
278         */
279        public RelatedClaimComponent setRelationship(CodeableConcept value)  { 
280          this.relationship = value;
281          return this;
282        }
283
284        /**
285         * @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 # .)
286         */
287        public Identifier getReference() { 
288          if (this.reference == null)
289            if (Configuration.errorOnAutoCreate())
290              throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
291            else if (Configuration.doAutoCreate())
292              this.reference = new Identifier(); // cc
293          return this.reference;
294        }
295
296        public boolean hasReference() { 
297          return this.reference != null && !this.reference.isEmpty();
298        }
299
300        /**
301         * @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 # .)
302         */
303        public RelatedClaimComponent setReference(Identifier value)  { 
304          this.reference = value;
305          return this;
306        }
307
308        protected void listChildren(List<Property> children) {
309          super.listChildren(children);
310          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));
311          children.add(new Property("relationship", "CodeableConcept", "For example prior or umbrella.", 0, 1, relationship));
312          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));
313        }
314
315        @Override
316        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
317          switch (_hash) {
318          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);
319          case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "For example prior or umbrella.", 0, 1, relationship);
320          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);
321          default: return super.getNamedProperty(_hash, _name, _checkValid);
322          }
323
324        }
325
326      @Override
327      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
328        switch (hash) {
329        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
330        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
331        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
332        default: return super.getProperty(hash, name, checkValid);
333        }
334
335      }
336
337      @Override
338      public Base setProperty(int hash, String name, Base value) throws FHIRException {
339        switch (hash) {
340        case 94742588: // claim
341          this.claim = castToReference(value); // Reference
342          return value;
343        case -261851592: // relationship
344          this.relationship = castToCodeableConcept(value); // CodeableConcept
345          return value;
346        case -925155509: // reference
347          this.reference = castToIdentifier(value); // Identifier
348          return value;
349        default: return super.setProperty(hash, name, value);
350        }
351
352      }
353
354      @Override
355      public Base setProperty(String name, Base value) throws FHIRException {
356        if (name.equals("claim")) {
357          this.claim = castToReference(value); // Reference
358        } else if (name.equals("relationship")) {
359          this.relationship = castToCodeableConcept(value); // CodeableConcept
360        } else if (name.equals("reference")) {
361          this.reference = castToIdentifier(value); // Identifier
362        } else
363          return super.setProperty(name, value);
364        return value;
365      }
366
367      @Override
368      public Base makeProperty(int hash, String name) throws FHIRException {
369        switch (hash) {
370        case 94742588:  return getClaim(); 
371        case -261851592:  return getRelationship(); 
372        case -925155509:  return getReference(); 
373        default: return super.makeProperty(hash, name);
374        }
375
376      }
377
378      @Override
379      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
380        switch (hash) {
381        case 94742588: /*claim*/ return new String[] {"Reference"};
382        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
383        case -925155509: /*reference*/ return new String[] {"Identifier"};
384        default: return super.getTypesForProperty(hash, name);
385        }
386
387      }
388
389      @Override
390      public Base addChild(String name) throws FHIRException {
391        if (name.equals("claim")) {
392          this.claim = new Reference();
393          return this.claim;
394        }
395        else if (name.equals("relationship")) {
396          this.relationship = new CodeableConcept();
397          return this.relationship;
398        }
399        else if (name.equals("reference")) {
400          this.reference = new Identifier();
401          return this.reference;
402        }
403        else
404          return super.addChild(name);
405      }
406
407      public RelatedClaimComponent copy() {
408        RelatedClaimComponent dst = new RelatedClaimComponent();
409        copyValues(dst);
410        dst.claim = claim == null ? null : claim.copy();
411        dst.relationship = relationship == null ? null : relationship.copy();
412        dst.reference = reference == null ? null : reference.copy();
413        return dst;
414      }
415
416      @Override
417      public boolean equalsDeep(Base other_) {
418        if (!super.equalsDeep(other_))
419          return false;
420        if (!(other_ instanceof RelatedClaimComponent))
421          return false;
422        RelatedClaimComponent o = (RelatedClaimComponent) other_;
423        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
424          ;
425      }
426
427      @Override
428      public boolean equalsShallow(Base other_) {
429        if (!super.equalsShallow(other_))
430          return false;
431        if (!(other_ instanceof RelatedClaimComponent))
432          return false;
433        RelatedClaimComponent o = (RelatedClaimComponent) other_;
434        return true;
435      }
436
437      public boolean isEmpty() {
438        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference
439          );
440      }
441
442  public String fhirType() {
443    return "ExplanationOfBenefit.related";
444
445  }
446
447  }
448
449    @Block()
450    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
451        /**
452         * Type of Party to be reimbursed: Subscriber, provider, other.
453         */
454        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
455        @Description(shortDefinition="Type of party: Subscriber, Provider, other", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
456        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payeetype")
457        protected CodeableConcept type;
458
459        /**
460         * organization | patient | practitioner | relatedperson.
461         */
462        @Child(name = "resourceType", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
463        @Description(shortDefinition="organization | patient | practitioner | relatedperson", formalDefinition="organization | patient | practitioner | relatedperson." )
464        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-type-link")
465        protected CodeableConcept resourceType;
466
467        /**
468         * Party to be reimbursed: Subscriber, provider, other.
469         */
470        @Child(name = "party", type = {Practitioner.class, Organization.class, Patient.class, RelatedPerson.class}, order=3, min=0, max=1, modifier=false, summary=false)
471        @Description(shortDefinition="Party to receive the payable", formalDefinition="Party to be reimbursed: Subscriber, provider, other." )
472        protected Reference party;
473
474        /**
475         * The actual object that is the target of the reference (Party to be reimbursed: Subscriber, provider, other.)
476         */
477        protected Resource partyTarget;
478
479        private static final long serialVersionUID = 1146157718L;
480
481    /**
482     * Constructor
483     */
484      public PayeeComponent() {
485        super();
486      }
487
488        /**
489         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
490         */
491        public CodeableConcept getType() { 
492          if (this.type == null)
493            if (Configuration.errorOnAutoCreate())
494              throw new Error("Attempt to auto-create PayeeComponent.type");
495            else if (Configuration.doAutoCreate())
496              this.type = new CodeableConcept(); // cc
497          return this.type;
498        }
499
500        public boolean hasType() { 
501          return this.type != null && !this.type.isEmpty();
502        }
503
504        /**
505         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
506         */
507        public PayeeComponent setType(CodeableConcept value)  { 
508          this.type = value;
509          return this;
510        }
511
512        /**
513         * @return {@link #resourceType} (organization | patient | practitioner | relatedperson.)
514         */
515        public CodeableConcept getResourceType() { 
516          if (this.resourceType == null)
517            if (Configuration.errorOnAutoCreate())
518              throw new Error("Attempt to auto-create PayeeComponent.resourceType");
519            else if (Configuration.doAutoCreate())
520              this.resourceType = new CodeableConcept(); // cc
521          return this.resourceType;
522        }
523
524        public boolean hasResourceType() { 
525          return this.resourceType != null && !this.resourceType.isEmpty();
526        }
527
528        /**
529         * @param value {@link #resourceType} (organization | patient | practitioner | relatedperson.)
530         */
531        public PayeeComponent setResourceType(CodeableConcept value)  { 
532          this.resourceType = value;
533          return this;
534        }
535
536        /**
537         * @return {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
538         */
539        public Reference getParty() { 
540          if (this.party == null)
541            if (Configuration.errorOnAutoCreate())
542              throw new Error("Attempt to auto-create PayeeComponent.party");
543            else if (Configuration.doAutoCreate())
544              this.party = new Reference(); // cc
545          return this.party;
546        }
547
548        public boolean hasParty() { 
549          return this.party != null && !this.party.isEmpty();
550        }
551
552        /**
553         * @param value {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
554         */
555        public PayeeComponent setParty(Reference value)  { 
556          this.party = value;
557          return this;
558        }
559
560        /**
561         * @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.)
562         */
563        public Resource getPartyTarget() { 
564          return this.partyTarget;
565        }
566
567        /**
568         * @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.)
569         */
570        public PayeeComponent setPartyTarget(Resource value) { 
571          this.partyTarget = value;
572          return this;
573        }
574
575        protected void listChildren(List<Property> children) {
576          super.listChildren(children);
577          children.add(new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
578          children.add(new Property("resourceType", "CodeableConcept", "organization | patient | practitioner | relatedperson.", 0, 1, resourceType));
579          children.add(new Property("party", "Reference(Practitioner|Organization|Patient|RelatedPerson)", "Party to be reimbursed: Subscriber, provider, other.", 0, 1, party));
580        }
581
582        @Override
583        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
584          switch (_hash) {
585          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
586          case -384364440: /*resourceType*/  return new Property("resourceType", "CodeableConcept", "organization | patient | practitioner | relatedperson.", 0, 1, resourceType);
587          case 106437350: /*party*/  return new Property("party", "Reference(Practitioner|Organization|Patient|RelatedPerson)", "Party to be reimbursed: Subscriber, provider, other.", 0, 1, party);
588          default: return super.getNamedProperty(_hash, _name, _checkValid);
589          }
590
591        }
592
593      @Override
594      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
595        switch (hash) {
596        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
597        case -384364440: /*resourceType*/ return this.resourceType == null ? new Base[0] : new Base[] {this.resourceType}; // CodeableConcept
598        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
599        default: return super.getProperty(hash, name, checkValid);
600        }
601
602      }
603
604      @Override
605      public Base setProperty(int hash, String name, Base value) throws FHIRException {
606        switch (hash) {
607        case 3575610: // type
608          this.type = castToCodeableConcept(value); // CodeableConcept
609          return value;
610        case -384364440: // resourceType
611          this.resourceType = castToCodeableConcept(value); // CodeableConcept
612          return value;
613        case 106437350: // party
614          this.party = castToReference(value); // Reference
615          return value;
616        default: return super.setProperty(hash, name, value);
617        }
618
619      }
620
621      @Override
622      public Base setProperty(String name, Base value) throws FHIRException {
623        if (name.equals("type")) {
624          this.type = castToCodeableConcept(value); // CodeableConcept
625        } else if (name.equals("resourceType")) {
626          this.resourceType = castToCodeableConcept(value); // CodeableConcept
627        } else if (name.equals("party")) {
628          this.party = castToReference(value); // Reference
629        } else
630          return super.setProperty(name, value);
631        return value;
632      }
633
634      @Override
635      public Base makeProperty(int hash, String name) throws FHIRException {
636        switch (hash) {
637        case 3575610:  return getType(); 
638        case -384364440:  return getResourceType(); 
639        case 106437350:  return getParty(); 
640        default: return super.makeProperty(hash, name);
641        }
642
643      }
644
645      @Override
646      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
647        switch (hash) {
648        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
649        case -384364440: /*resourceType*/ return new String[] {"CodeableConcept"};
650        case 106437350: /*party*/ return new String[] {"Reference"};
651        default: return super.getTypesForProperty(hash, name);
652        }
653
654      }
655
656      @Override
657      public Base addChild(String name) throws FHIRException {
658        if (name.equals("type")) {
659          this.type = new CodeableConcept();
660          return this.type;
661        }
662        else if (name.equals("resourceType")) {
663          this.resourceType = new CodeableConcept();
664          return this.resourceType;
665        }
666        else if (name.equals("party")) {
667          this.party = new Reference();
668          return this.party;
669        }
670        else
671          return super.addChild(name);
672      }
673
674      public PayeeComponent copy() {
675        PayeeComponent dst = new PayeeComponent();
676        copyValues(dst);
677        dst.type = type == null ? null : type.copy();
678        dst.resourceType = resourceType == null ? null : resourceType.copy();
679        dst.party = party == null ? null : party.copy();
680        return dst;
681      }
682
683      @Override
684      public boolean equalsDeep(Base other_) {
685        if (!super.equalsDeep(other_))
686          return false;
687        if (!(other_ instanceof PayeeComponent))
688          return false;
689        PayeeComponent o = (PayeeComponent) other_;
690        return compareDeep(type, o.type, true) && compareDeep(resourceType, o.resourceType, true) && compareDeep(party, o.party, true)
691          ;
692      }
693
694      @Override
695      public boolean equalsShallow(Base other_) {
696        if (!super.equalsShallow(other_))
697          return false;
698        if (!(other_ instanceof PayeeComponent))
699          return false;
700        PayeeComponent o = (PayeeComponent) other_;
701        return true;
702      }
703
704      public boolean isEmpty() {
705        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, resourceType, party
706          );
707      }
708
709  public String fhirType() {
710    return "ExplanationOfBenefit.payee";
711
712  }
713
714  }
715
716    @Block()
717    public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
718        /**
719         * Sequence of the information element which serves to provide a link.
720         */
721        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
722        @Description(shortDefinition="Information instance identifier", formalDefinition="Sequence of the information element which serves to provide a link." )
723        protected PositiveIntType sequence;
724
725        /**
726         * The general class of the information supplied: information; exception; accident, employment; onset, etc.
727         */
728        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
729        @Description(shortDefinition="General class of information", formalDefinition="The general class of the information supplied: information; exception; accident, employment; onset, etc." )
730        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-informationcategory")
731        protected CodeableConcept category;
732
733        /**
734         * 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.
735         */
736        @Child(name = "code", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
737        @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." )
738        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-exception")
739        protected CodeableConcept code;
740
741        /**
742         * The date when or period to which this information refers.
743         */
744        @Child(name = "timing", type = {DateType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
745        @Description(shortDefinition="When it occurred", formalDefinition="The date when or period to which this information refers." )
746        protected Type timing;
747
748        /**
749         * Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.
750         */
751        @Child(name = "value", type = {StringType.class, Quantity.class, Attachment.class, Reference.class}, order=5, min=0, max=1, modifier=false, summary=false)
752        @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." )
753        protected Type value;
754
755        /**
756         * 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.
757         */
758        @Child(name = "reason", type = {Coding.class}, order=6, min=0, max=1, modifier=false, summary=false)
759        @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." )
760        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/missing-tooth-reason")
761        protected Coding reason;
762
763        private static final long serialVersionUID = -410136661L;
764
765    /**
766     * Constructor
767     */
768      public SupportingInformationComponent() {
769        super();
770      }
771
772    /**
773     * Constructor
774     */
775      public SupportingInformationComponent(PositiveIntType sequence, CodeableConcept category) {
776        super();
777        this.sequence = sequence;
778        this.category = category;
779      }
780
781        /**
782         * @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
783         */
784        public PositiveIntType getSequenceElement() { 
785          if (this.sequence == null)
786            if (Configuration.errorOnAutoCreate())
787              throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
788            else if (Configuration.doAutoCreate())
789              this.sequence = new PositiveIntType(); // bb
790          return this.sequence;
791        }
792
793        public boolean hasSequenceElement() { 
794          return this.sequence != null && !this.sequence.isEmpty();
795        }
796
797        public boolean hasSequence() { 
798          return this.sequence != null && !this.sequence.isEmpty();
799        }
800
801        /**
802         * @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
803         */
804        public SupportingInformationComponent setSequenceElement(PositiveIntType value) { 
805          this.sequence = value;
806          return this;
807        }
808
809        /**
810         * @return Sequence of the information element which serves to provide a link.
811         */
812        public int getSequence() { 
813          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
814        }
815
816        /**
817         * @param value Sequence of the information element which serves to provide a link.
818         */
819        public SupportingInformationComponent setSequence(int value) { 
820            if (this.sequence == null)
821              this.sequence = new PositiveIntType();
822            this.sequence.setValue(value);
823          return this;
824        }
825
826        /**
827         * @return {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
828         */
829        public CodeableConcept getCategory() { 
830          if (this.category == null)
831            if (Configuration.errorOnAutoCreate())
832              throw new Error("Attempt to auto-create SupportingInformationComponent.category");
833            else if (Configuration.doAutoCreate())
834              this.category = new CodeableConcept(); // cc
835          return this.category;
836        }
837
838        public boolean hasCategory() { 
839          return this.category != null && !this.category.isEmpty();
840        }
841
842        /**
843         * @param value {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
844         */
845        public SupportingInformationComponent setCategory(CodeableConcept value)  { 
846          this.category = value;
847          return this;
848        }
849
850        /**
851         * @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.)
852         */
853        public CodeableConcept getCode() { 
854          if (this.code == null)
855            if (Configuration.errorOnAutoCreate())
856              throw new Error("Attempt to auto-create SupportingInformationComponent.code");
857            else if (Configuration.doAutoCreate())
858              this.code = new CodeableConcept(); // cc
859          return this.code;
860        }
861
862        public boolean hasCode() { 
863          return this.code != null && !this.code.isEmpty();
864        }
865
866        /**
867         * @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.)
868         */
869        public SupportingInformationComponent setCode(CodeableConcept value)  { 
870          this.code = value;
871          return this;
872        }
873
874        /**
875         * @return {@link #timing} (The date when or period to which this information refers.)
876         */
877        public Type getTiming() { 
878          return this.timing;
879        }
880
881        /**
882         * @return {@link #timing} (The date when or period to which this information refers.)
883         */
884        public DateType getTimingDateType() throws FHIRException { 
885          if (this.timing == null)
886            return null;
887          if (!(this.timing instanceof DateType))
888            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.timing.getClass().getName()+" was encountered");
889          return (DateType) this.timing;
890        }
891
892        public boolean hasTimingDateType() { 
893          return this != null && this.timing instanceof DateType;
894        }
895
896        /**
897         * @return {@link #timing} (The date when or period to which this information refers.)
898         */
899        public Period getTimingPeriod() throws FHIRException { 
900          if (this.timing == null)
901            return null;
902          if (!(this.timing instanceof Period))
903            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
904          return (Period) this.timing;
905        }
906
907        public boolean hasTimingPeriod() { 
908          return this != null && this.timing instanceof Period;
909        }
910
911        public boolean hasTiming() { 
912          return this.timing != null && !this.timing.isEmpty();
913        }
914
915        /**
916         * @param value {@link #timing} (The date when or period to which this information refers.)
917         */
918        public SupportingInformationComponent setTiming(Type value) throws FHIRFormatError { 
919          if (value != null && !(value instanceof DateType || value instanceof Period))
920            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.information.timing[x]: "+value.fhirType());
921          this.timing = value;
922          return this;
923        }
924
925        /**
926         * @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.)
927         */
928        public Type getValue() { 
929          return this.value;
930        }
931
932        /**
933         * @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.)
934         */
935        public StringType getValueStringType() throws FHIRException { 
936          if (this.value == null)
937            return null;
938          if (!(this.value instanceof StringType))
939            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
940          return (StringType) this.value;
941        }
942
943        public boolean hasValueStringType() { 
944          return this != null && this.value instanceof StringType;
945        }
946
947        /**
948         * @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.)
949         */
950        public Quantity getValueQuantity() throws FHIRException { 
951          if (this.value == null)
952            return null;
953          if (!(this.value instanceof Quantity))
954            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
955          return (Quantity) this.value;
956        }
957
958        public boolean hasValueQuantity() { 
959          return this != null && this.value instanceof Quantity;
960        }
961
962        /**
963         * @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.)
964         */
965        public Attachment getValueAttachment() throws FHIRException { 
966          if (this.value == null)
967            return null;
968          if (!(this.value instanceof Attachment))
969            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
970          return (Attachment) this.value;
971        }
972
973        public boolean hasValueAttachment() { 
974          return this != null && this.value instanceof Attachment;
975        }
976
977        /**
978         * @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.)
979         */
980        public Reference getValueReference() throws FHIRException { 
981          if (this.value == null)
982            return null;
983          if (!(this.value instanceof Reference))
984            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
985          return (Reference) this.value;
986        }
987
988        public boolean hasValueReference() { 
989          return this != null && this.value instanceof Reference;
990        }
991
992        public boolean hasValue() { 
993          return this.value != null && !this.value.isEmpty();
994        }
995
996        /**
997         * @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.)
998         */
999        public SupportingInformationComponent setValue(Type value) throws FHIRFormatError { 
1000          if (value != null && !(value instanceof StringType || value instanceof Quantity || value instanceof Attachment || value instanceof Reference))
1001            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.information.value[x]: "+value.fhirType());
1002          this.value = value;
1003          return this;
1004        }
1005
1006        /**
1007         * @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.)
1008         */
1009        public Coding getReason() { 
1010          if (this.reason == null)
1011            if (Configuration.errorOnAutoCreate())
1012              throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1013            else if (Configuration.doAutoCreate())
1014              this.reason = new Coding(); // cc
1015          return this.reason;
1016        }
1017
1018        public boolean hasReason() { 
1019          return this.reason != null && !this.reason.isEmpty();
1020        }
1021
1022        /**
1023         * @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.)
1024         */
1025        public SupportingInformationComponent setReason(Coding value)  { 
1026          this.reason = value;
1027          return this;
1028        }
1029
1030        protected void listChildren(List<Property> children) {
1031          super.listChildren(children);
1032          children.add(new Property("sequence", "positiveInt", "Sequence of the information element which serves to provide a link.", 0, 1, sequence));
1033          children.add(new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category));
1034          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));
1035          children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing));
1036          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));
1037          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));
1038        }
1039
1040        @Override
1041        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1042          switch (_hash) {
1043          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of the information element which serves to provide a link.", 0, 1, sequence);
1044          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category);
1045          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);
1046          case 164632566: /*timing[x]*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1047          case -873664438: /*timing*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1048          case 807935768: /*timingDate*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1049          case -615615829: /*timingPeriod*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1050          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);
1051          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);
1052          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);
1053          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);
1054          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);
1055          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);
1056          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);
1057          default: return super.getNamedProperty(_hash, _name, _checkValid);
1058          }
1059
1060        }
1061
1062      @Override
1063      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1064        switch (hash) {
1065        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1066        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1067        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1068        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type
1069        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
1070        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
1071        default: return super.getProperty(hash, name, checkValid);
1072        }
1073
1074      }
1075
1076      @Override
1077      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1078        switch (hash) {
1079        case 1349547969: // sequence
1080          this.sequence = castToPositiveInt(value); // PositiveIntType
1081          return value;
1082        case 50511102: // category
1083          this.category = castToCodeableConcept(value); // CodeableConcept
1084          return value;
1085        case 3059181: // code
1086          this.code = castToCodeableConcept(value); // CodeableConcept
1087          return value;
1088        case -873664438: // timing
1089          this.timing = castToType(value); // Type
1090          return value;
1091        case 111972721: // value
1092          this.value = castToType(value); // Type
1093          return value;
1094        case -934964668: // reason
1095          this.reason = castToCoding(value); // Coding
1096          return value;
1097        default: return super.setProperty(hash, name, value);
1098        }
1099
1100      }
1101
1102      @Override
1103      public Base setProperty(String name, Base value) throws FHIRException {
1104        if (name.equals("sequence")) {
1105          this.sequence = castToPositiveInt(value); // PositiveIntType
1106        } else if (name.equals("category")) {
1107          this.category = castToCodeableConcept(value); // CodeableConcept
1108        } else if (name.equals("code")) {
1109          this.code = castToCodeableConcept(value); // CodeableConcept
1110        } else if (name.equals("timing[x]")) {
1111          this.timing = castToType(value); // Type
1112        } else if (name.equals("value[x]")) {
1113          this.value = castToType(value); // Type
1114        } else if (name.equals("reason")) {
1115          this.reason = castToCoding(value); // Coding
1116        } else
1117          return super.setProperty(name, value);
1118        return value;
1119      }
1120
1121      @Override
1122      public Base makeProperty(int hash, String name) throws FHIRException {
1123        switch (hash) {
1124        case 1349547969:  return getSequenceElement();
1125        case 50511102:  return getCategory(); 
1126        case 3059181:  return getCode(); 
1127        case 164632566:  return getTiming(); 
1128        case -873664438:  return getTiming(); 
1129        case -1410166417:  return getValue(); 
1130        case 111972721:  return getValue(); 
1131        case -934964668:  return getReason(); 
1132        default: return super.makeProperty(hash, name);
1133        }
1134
1135      }
1136
1137      @Override
1138      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1139        switch (hash) {
1140        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1141        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1142        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1143        case -873664438: /*timing*/ return new String[] {"date", "Period"};
1144        case 111972721: /*value*/ return new String[] {"string", "Quantity", "Attachment", "Reference"};
1145        case -934964668: /*reason*/ return new String[] {"Coding"};
1146        default: return super.getTypesForProperty(hash, name);
1147        }
1148
1149      }
1150
1151      @Override
1152      public Base addChild(String name) throws FHIRException {
1153        if (name.equals("sequence")) {
1154          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1155        }
1156        else if (name.equals("category")) {
1157          this.category = new CodeableConcept();
1158          return this.category;
1159        }
1160        else if (name.equals("code")) {
1161          this.code = new CodeableConcept();
1162          return this.code;
1163        }
1164        else if (name.equals("timingDate")) {
1165          this.timing = new DateType();
1166          return this.timing;
1167        }
1168        else if (name.equals("timingPeriod")) {
1169          this.timing = new Period();
1170          return this.timing;
1171        }
1172        else if (name.equals("valueString")) {
1173          this.value = new StringType();
1174          return this.value;
1175        }
1176        else if (name.equals("valueQuantity")) {
1177          this.value = new Quantity();
1178          return this.value;
1179        }
1180        else if (name.equals("valueAttachment")) {
1181          this.value = new Attachment();
1182          return this.value;
1183        }
1184        else if (name.equals("valueReference")) {
1185          this.value = new Reference();
1186          return this.value;
1187        }
1188        else if (name.equals("reason")) {
1189          this.reason = new Coding();
1190          return this.reason;
1191        }
1192        else
1193          return super.addChild(name);
1194      }
1195
1196      public SupportingInformationComponent copy() {
1197        SupportingInformationComponent dst = new SupportingInformationComponent();
1198        copyValues(dst);
1199        dst.sequence = sequence == null ? null : sequence.copy();
1200        dst.category = category == null ? null : category.copy();
1201        dst.code = code == null ? null : code.copy();
1202        dst.timing = timing == null ? null : timing.copy();
1203        dst.value = value == null ? null : value.copy();
1204        dst.reason = reason == null ? null : reason.copy();
1205        return dst;
1206      }
1207
1208      @Override
1209      public boolean equalsDeep(Base other_) {
1210        if (!super.equalsDeep(other_))
1211          return false;
1212        if (!(other_ instanceof SupportingInformationComponent))
1213          return false;
1214        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1215        return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true) && compareDeep(code, o.code, true)
1216           && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true) && compareDeep(reason, o.reason, true)
1217          ;
1218      }
1219
1220      @Override
1221      public boolean equalsShallow(Base other_) {
1222        if (!super.equalsShallow(other_))
1223          return false;
1224        if (!(other_ instanceof SupportingInformationComponent))
1225          return false;
1226        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1227        return compareValues(sequence, o.sequence, true);
1228      }
1229
1230      public boolean isEmpty() {
1231        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code
1232          , timing, value, reason);
1233      }
1234
1235  public String fhirType() {
1236    return "ExplanationOfBenefit.information";
1237
1238  }
1239
1240  }
1241
1242    @Block()
1243    public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
1244        /**
1245         * Sequence of careteam which serves to order and provide a link.
1246         */
1247        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1248        @Description(shortDefinition="Number to covey order of careteam", formalDefinition="Sequence of careteam which serves to order and provide a link." )
1249        protected PositiveIntType sequence;
1250
1251        /**
1252         * The members of the team who provided the overall service.
1253         */
1254        @Child(name = "provider", type = {Practitioner.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=false)
1255        @Description(shortDefinition="Member of the Care Team", formalDefinition="The members of the team who provided the overall service." )
1256        protected Reference provider;
1257
1258        /**
1259         * The actual object that is the target of the reference (The members of the team who provided the overall service.)
1260         */
1261        protected Resource providerTarget;
1262
1263        /**
1264         * The practitioner who is billing and responsible for the claimed services rendered to the patient.
1265         */
1266        @Child(name = "responsible", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
1267        @Description(shortDefinition="Billing practitioner", formalDefinition="The practitioner who is billing and responsible for the claimed services rendered to the patient." )
1268        protected BooleanType responsible;
1269
1270        /**
1271         * The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.
1272         */
1273        @Child(name = "role", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1274        @Description(shortDefinition="Role on the team", formalDefinition="The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team." )
1275        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-careteamrole")
1276        protected CodeableConcept role;
1277
1278        /**
1279         * The qualification which is applicable for this service.
1280         */
1281        @Child(name = "qualification", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1282        @Description(shortDefinition="Type, classification or Specialization", formalDefinition="The qualification which is applicable for this service." )
1283        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provider-qualification")
1284        protected CodeableConcept qualification;
1285
1286        private static final long serialVersionUID = 1758966968L;
1287
1288    /**
1289     * Constructor
1290     */
1291      public CareTeamComponent() {
1292        super();
1293      }
1294
1295    /**
1296     * Constructor
1297     */
1298      public CareTeamComponent(PositiveIntType sequence, Reference provider) {
1299        super();
1300        this.sequence = sequence;
1301        this.provider = provider;
1302      }
1303
1304        /**
1305         * @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
1306         */
1307        public PositiveIntType getSequenceElement() { 
1308          if (this.sequence == null)
1309            if (Configuration.errorOnAutoCreate())
1310              throw new Error("Attempt to auto-create CareTeamComponent.sequence");
1311            else if (Configuration.doAutoCreate())
1312              this.sequence = new PositiveIntType(); // bb
1313          return this.sequence;
1314        }
1315
1316        public boolean hasSequenceElement() { 
1317          return this.sequence != null && !this.sequence.isEmpty();
1318        }
1319
1320        public boolean hasSequence() { 
1321          return this.sequence != null && !this.sequence.isEmpty();
1322        }
1323
1324        /**
1325         * @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
1326         */
1327        public CareTeamComponent setSequenceElement(PositiveIntType value) { 
1328          this.sequence = value;
1329          return this;
1330        }
1331
1332        /**
1333         * @return Sequence of careteam which serves to order and provide a link.
1334         */
1335        public int getSequence() { 
1336          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1337        }
1338
1339        /**
1340         * @param value Sequence of careteam which serves to order and provide a link.
1341         */
1342        public CareTeamComponent setSequence(int value) { 
1343            if (this.sequence == null)
1344              this.sequence = new PositiveIntType();
1345            this.sequence.setValue(value);
1346          return this;
1347        }
1348
1349        /**
1350         * @return {@link #provider} (The members of the team who provided the overall service.)
1351         */
1352        public Reference getProvider() { 
1353          if (this.provider == null)
1354            if (Configuration.errorOnAutoCreate())
1355              throw new Error("Attempt to auto-create CareTeamComponent.provider");
1356            else if (Configuration.doAutoCreate())
1357              this.provider = new Reference(); // cc
1358          return this.provider;
1359        }
1360
1361        public boolean hasProvider() { 
1362          return this.provider != null && !this.provider.isEmpty();
1363        }
1364
1365        /**
1366         * @param value {@link #provider} (The members of the team who provided the overall service.)
1367         */
1368        public CareTeamComponent setProvider(Reference value)  { 
1369          this.provider = value;
1370          return this;
1371        }
1372
1373        /**
1374         * @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.)
1375         */
1376        public Resource getProviderTarget() { 
1377          return this.providerTarget;
1378        }
1379
1380        /**
1381         * @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.)
1382         */
1383        public CareTeamComponent setProviderTarget(Resource value) { 
1384          this.providerTarget = value;
1385          return this;
1386        }
1387
1388        /**
1389         * @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
1390         */
1391        public BooleanType getResponsibleElement() { 
1392          if (this.responsible == null)
1393            if (Configuration.errorOnAutoCreate())
1394              throw new Error("Attempt to auto-create CareTeamComponent.responsible");
1395            else if (Configuration.doAutoCreate())
1396              this.responsible = new BooleanType(); // bb
1397          return this.responsible;
1398        }
1399
1400        public boolean hasResponsibleElement() { 
1401          return this.responsible != null && !this.responsible.isEmpty();
1402        }
1403
1404        public boolean hasResponsible() { 
1405          return this.responsible != null && !this.responsible.isEmpty();
1406        }
1407
1408        /**
1409         * @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
1410         */
1411        public CareTeamComponent setResponsibleElement(BooleanType value) { 
1412          this.responsible = value;
1413          return this;
1414        }
1415
1416        /**
1417         * @return The practitioner who is billing and responsible for the claimed services rendered to the patient.
1418         */
1419        public boolean getResponsible() { 
1420          return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
1421        }
1422
1423        /**
1424         * @param value The practitioner who is billing and responsible for the claimed services rendered to the patient.
1425         */
1426        public CareTeamComponent setResponsible(boolean value) { 
1427            if (this.responsible == null)
1428              this.responsible = new BooleanType();
1429            this.responsible.setValue(value);
1430          return this;
1431        }
1432
1433        /**
1434         * @return {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.)
1435         */
1436        public CodeableConcept getRole() { 
1437          if (this.role == null)
1438            if (Configuration.errorOnAutoCreate())
1439              throw new Error("Attempt to auto-create CareTeamComponent.role");
1440            else if (Configuration.doAutoCreate())
1441              this.role = new CodeableConcept(); // cc
1442          return this.role;
1443        }
1444
1445        public boolean hasRole() { 
1446          return this.role != null && !this.role.isEmpty();
1447        }
1448
1449        /**
1450         * @param value {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.)
1451         */
1452        public CareTeamComponent setRole(CodeableConcept value)  { 
1453          this.role = value;
1454          return this;
1455        }
1456
1457        /**
1458         * @return {@link #qualification} (The qualification which is applicable for this service.)
1459         */
1460        public CodeableConcept getQualification() { 
1461          if (this.qualification == null)
1462            if (Configuration.errorOnAutoCreate())
1463              throw new Error("Attempt to auto-create CareTeamComponent.qualification");
1464            else if (Configuration.doAutoCreate())
1465              this.qualification = new CodeableConcept(); // cc
1466          return this.qualification;
1467        }
1468
1469        public boolean hasQualification() { 
1470          return this.qualification != null && !this.qualification.isEmpty();
1471        }
1472
1473        /**
1474         * @param value {@link #qualification} (The qualification which is applicable for this service.)
1475         */
1476        public CareTeamComponent setQualification(CodeableConcept value)  { 
1477          this.qualification = value;
1478          return this;
1479        }
1480
1481        protected void listChildren(List<Property> children) {
1482          super.listChildren(children);
1483          children.add(new Property("sequence", "positiveInt", "Sequence of careteam which serves to order and provide a link.", 0, 1, sequence));
1484          children.add(new Property("provider", "Reference(Practitioner|Organization)", "The members of the team who provided the overall service.", 0, 1, provider));
1485          children.add(new Property("responsible", "boolean", "The practitioner who is billing and responsible for the claimed services rendered to the patient.", 0, 1, responsible));
1486          children.add(new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.", 0, 1, role));
1487          children.add(new Property("qualification", "CodeableConcept", "The qualification which is applicable for this service.", 0, 1, qualification));
1488        }
1489
1490        @Override
1491        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1492          switch (_hash) {
1493          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of careteam which serves to order and provide a link.", 0, 1, sequence);
1494          case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|Organization)", "The members of the team who provided the overall service.", 0, 1, provider);
1495          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);
1496          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.", 0, 1, role);
1497          case -631333393: /*qualification*/  return new Property("qualification", "CodeableConcept", "The qualification which is applicable for this service.", 0, 1, qualification);
1498          default: return super.getNamedProperty(_hash, _name, _checkValid);
1499          }
1500
1501        }
1502
1503      @Override
1504      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1505        switch (hash) {
1506        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1507        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
1508        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // BooleanType
1509        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
1510        case -631333393: /*qualification*/ return this.qualification == null ? new Base[0] : new Base[] {this.qualification}; // CodeableConcept
1511        default: return super.getProperty(hash, name, checkValid);
1512        }
1513
1514      }
1515
1516      @Override
1517      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1518        switch (hash) {
1519        case 1349547969: // sequence
1520          this.sequence = castToPositiveInt(value); // PositiveIntType
1521          return value;
1522        case -987494927: // provider
1523          this.provider = castToReference(value); // Reference
1524          return value;
1525        case 1847674614: // responsible
1526          this.responsible = castToBoolean(value); // BooleanType
1527          return value;
1528        case 3506294: // role
1529          this.role = castToCodeableConcept(value); // CodeableConcept
1530          return value;
1531        case -631333393: // qualification
1532          this.qualification = castToCodeableConcept(value); // CodeableConcept
1533          return value;
1534        default: return super.setProperty(hash, name, value);
1535        }
1536
1537      }
1538
1539      @Override
1540      public Base setProperty(String name, Base value) throws FHIRException {
1541        if (name.equals("sequence")) {
1542          this.sequence = castToPositiveInt(value); // PositiveIntType
1543        } else if (name.equals("provider")) {
1544          this.provider = castToReference(value); // Reference
1545        } else if (name.equals("responsible")) {
1546          this.responsible = castToBoolean(value); // BooleanType
1547        } else if (name.equals("role")) {
1548          this.role = castToCodeableConcept(value); // CodeableConcept
1549        } else if (name.equals("qualification")) {
1550          this.qualification = castToCodeableConcept(value); // CodeableConcept
1551        } else
1552          return super.setProperty(name, value);
1553        return value;
1554      }
1555
1556      @Override
1557      public Base makeProperty(int hash, String name) throws FHIRException {
1558        switch (hash) {
1559        case 1349547969:  return getSequenceElement();
1560        case -987494927:  return getProvider(); 
1561        case 1847674614:  return getResponsibleElement();
1562        case 3506294:  return getRole(); 
1563        case -631333393:  return getQualification(); 
1564        default: return super.makeProperty(hash, name);
1565        }
1566
1567      }
1568
1569      @Override
1570      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1571        switch (hash) {
1572        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1573        case -987494927: /*provider*/ return new String[] {"Reference"};
1574        case 1847674614: /*responsible*/ return new String[] {"boolean"};
1575        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
1576        case -631333393: /*qualification*/ return new String[] {"CodeableConcept"};
1577        default: return super.getTypesForProperty(hash, name);
1578        }
1579
1580      }
1581
1582      @Override
1583      public Base addChild(String name) throws FHIRException {
1584        if (name.equals("sequence")) {
1585          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1586        }
1587        else if (name.equals("provider")) {
1588          this.provider = new Reference();
1589          return this.provider;
1590        }
1591        else if (name.equals("responsible")) {
1592          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.responsible");
1593        }
1594        else if (name.equals("role")) {
1595          this.role = new CodeableConcept();
1596          return this.role;
1597        }
1598        else if (name.equals("qualification")) {
1599          this.qualification = new CodeableConcept();
1600          return this.qualification;
1601        }
1602        else
1603          return super.addChild(name);
1604      }
1605
1606      public CareTeamComponent copy() {
1607        CareTeamComponent dst = new CareTeamComponent();
1608        copyValues(dst);
1609        dst.sequence = sequence == null ? null : sequence.copy();
1610        dst.provider = provider == null ? null : provider.copy();
1611        dst.responsible = responsible == null ? null : responsible.copy();
1612        dst.role = role == null ? null : role.copy();
1613        dst.qualification = qualification == null ? null : qualification.copy();
1614        return dst;
1615      }
1616
1617      @Override
1618      public boolean equalsDeep(Base other_) {
1619        if (!super.equalsDeep(other_))
1620          return false;
1621        if (!(other_ instanceof CareTeamComponent))
1622          return false;
1623        CareTeamComponent o = (CareTeamComponent) other_;
1624        return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true) && compareDeep(responsible, o.responsible, true)
1625           && compareDeep(role, o.role, true) && compareDeep(qualification, o.qualification, true);
1626      }
1627
1628      @Override
1629      public boolean equalsShallow(Base other_) {
1630        if (!super.equalsShallow(other_))
1631          return false;
1632        if (!(other_ instanceof CareTeamComponent))
1633          return false;
1634        CareTeamComponent o = (CareTeamComponent) other_;
1635        return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true)
1636          ;
1637      }
1638
1639      public boolean isEmpty() {
1640        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible
1641          , role, qualification);
1642      }
1643
1644  public String fhirType() {
1645    return "ExplanationOfBenefit.careTeam";
1646
1647  }
1648
1649  }
1650
1651    @Block()
1652    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1653        /**
1654         * Sequence of diagnosis which serves to provide a link.
1655         */
1656        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1657        @Description(shortDefinition="Number to covey order of diagnosis", formalDefinition="Sequence of diagnosis which serves to provide a link." )
1658        protected PositiveIntType sequence;
1659
1660        /**
1661         * The diagnosis.
1662         */
1663        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=2, min=1, max=1, modifier=false, summary=false)
1664        @Description(shortDefinition="Patient's diagnosis", formalDefinition="The diagnosis." )
1665        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
1666        protected Type diagnosis;
1667
1668        /**
1669         * The type of the Diagnosis, for example: admitting, primary, secondary, discharge.
1670         */
1671        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1672        @Description(shortDefinition="Timing or nature of the diagnosis", formalDefinition="The type of the Diagnosis, for example: admitting, primary, secondary, discharge." )
1673        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosistype")
1674        protected List<CodeableConcept> type;
1675
1676        /**
1677         * The package billing code, for example DRG, based on the assigned grouping code system.
1678         */
1679        @Child(name = "packageCode", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1680        @Description(shortDefinition="Package billing code", formalDefinition="The package billing code, for example DRG, based on the assigned grouping code system." )
1681        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
1682        protected CodeableConcept packageCode;
1683
1684        private static final long serialVersionUID = -350960873L;
1685
1686    /**
1687     * Constructor
1688     */
1689      public DiagnosisComponent() {
1690        super();
1691      }
1692
1693    /**
1694     * Constructor
1695     */
1696      public DiagnosisComponent(PositiveIntType sequence, Type diagnosis) {
1697        super();
1698        this.sequence = sequence;
1699        this.diagnosis = diagnosis;
1700      }
1701
1702        /**
1703         * @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
1704         */
1705        public PositiveIntType getSequenceElement() { 
1706          if (this.sequence == null)
1707            if (Configuration.errorOnAutoCreate())
1708              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
1709            else if (Configuration.doAutoCreate())
1710              this.sequence = new PositiveIntType(); // bb
1711          return this.sequence;
1712        }
1713
1714        public boolean hasSequenceElement() { 
1715          return this.sequence != null && !this.sequence.isEmpty();
1716        }
1717
1718        public boolean hasSequence() { 
1719          return this.sequence != null && !this.sequence.isEmpty();
1720        }
1721
1722        /**
1723         * @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
1724         */
1725        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
1726          this.sequence = value;
1727          return this;
1728        }
1729
1730        /**
1731         * @return Sequence of diagnosis which serves to provide a link.
1732         */
1733        public int getSequence() { 
1734          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1735        }
1736
1737        /**
1738         * @param value Sequence of diagnosis which serves to provide a link.
1739         */
1740        public DiagnosisComponent setSequence(int value) { 
1741            if (this.sequence == null)
1742              this.sequence = new PositiveIntType();
1743            this.sequence.setValue(value);
1744          return this;
1745        }
1746
1747        /**
1748         * @return {@link #diagnosis} (The diagnosis.)
1749         */
1750        public Type getDiagnosis() { 
1751          return this.diagnosis;
1752        }
1753
1754        /**
1755         * @return {@link #diagnosis} (The diagnosis.)
1756         */
1757        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
1758          if (this.diagnosis == null)
1759            return null;
1760          if (!(this.diagnosis instanceof CodeableConcept))
1761            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1762          return (CodeableConcept) this.diagnosis;
1763        }
1764
1765        public boolean hasDiagnosisCodeableConcept() { 
1766          return this != null && this.diagnosis instanceof CodeableConcept;
1767        }
1768
1769        /**
1770         * @return {@link #diagnosis} (The diagnosis.)
1771         */
1772        public Reference getDiagnosisReference() throws FHIRException { 
1773          if (this.diagnosis == null)
1774            return null;
1775          if (!(this.diagnosis instanceof Reference))
1776            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1777          return (Reference) this.diagnosis;
1778        }
1779
1780        public boolean hasDiagnosisReference() { 
1781          return this != null && this.diagnosis instanceof Reference;
1782        }
1783
1784        public boolean hasDiagnosis() { 
1785          return this.diagnosis != null && !this.diagnosis.isEmpty();
1786        }
1787
1788        /**
1789         * @param value {@link #diagnosis} (The diagnosis.)
1790         */
1791        public DiagnosisComponent setDiagnosis(Type value) throws FHIRFormatError { 
1792          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1793            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: "+value.fhirType());
1794          this.diagnosis = value;
1795          return this;
1796        }
1797
1798        /**
1799         * @return {@link #type} (The type of the Diagnosis, for example: admitting, primary, secondary, discharge.)
1800         */
1801        public List<CodeableConcept> getType() { 
1802          if (this.type == null)
1803            this.type = new ArrayList<CodeableConcept>();
1804          return this.type;
1805        }
1806
1807        /**
1808         * @return Returns a reference to <code>this</code> for easy method chaining
1809         */
1810        public DiagnosisComponent setType(List<CodeableConcept> theType) { 
1811          this.type = theType;
1812          return this;
1813        }
1814
1815        public boolean hasType() { 
1816          if (this.type == null)
1817            return false;
1818          for (CodeableConcept item : this.type)
1819            if (!item.isEmpty())
1820              return true;
1821          return false;
1822        }
1823
1824        public CodeableConcept addType() { //3
1825          CodeableConcept t = new CodeableConcept();
1826          if (this.type == null)
1827            this.type = new ArrayList<CodeableConcept>();
1828          this.type.add(t);
1829          return t;
1830        }
1831
1832        public DiagnosisComponent addType(CodeableConcept t) { //3
1833          if (t == null)
1834            return this;
1835          if (this.type == null)
1836            this.type = new ArrayList<CodeableConcept>();
1837          this.type.add(t);
1838          return this;
1839        }
1840
1841        /**
1842         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
1843         */
1844        public CodeableConcept getTypeFirstRep() { 
1845          if (getType().isEmpty()) {
1846            addType();
1847          }
1848          return getType().get(0);
1849        }
1850
1851        /**
1852         * @return {@link #packageCode} (The package billing code, for example DRG, based on the assigned grouping code system.)
1853         */
1854        public CodeableConcept getPackageCode() { 
1855          if (this.packageCode == null)
1856            if (Configuration.errorOnAutoCreate())
1857              throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
1858            else if (Configuration.doAutoCreate())
1859              this.packageCode = new CodeableConcept(); // cc
1860          return this.packageCode;
1861        }
1862
1863        public boolean hasPackageCode() { 
1864          return this.packageCode != null && !this.packageCode.isEmpty();
1865        }
1866
1867        /**
1868         * @param value {@link #packageCode} (The package billing code, for example DRG, based on the assigned grouping code system.)
1869         */
1870        public DiagnosisComponent setPackageCode(CodeableConcept value)  { 
1871          this.packageCode = value;
1872          return this;
1873        }
1874
1875        protected void listChildren(List<Property> children) {
1876          super.listChildren(children);
1877          children.add(new Property("sequence", "positiveInt", "Sequence of diagnosis which serves to provide a link.", 0, 1, sequence));
1878          children.add(new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis));
1879          children.add(new Property("type", "CodeableConcept", "The type of the Diagnosis, for example: admitting, primary, secondary, discharge.", 0, java.lang.Integer.MAX_VALUE, type));
1880          children.add(new Property("packageCode", "CodeableConcept", "The package billing code, for example DRG, based on the assigned grouping code system.", 0, 1, packageCode));
1881        }
1882
1883        @Override
1884        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1885          switch (_hash) {
1886          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of diagnosis which serves to provide a link.", 0, 1, sequence);
1887          case -1487009809: /*diagnosis[x]*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
1888          case 1196993265: /*diagnosis*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
1889          case 277781616: /*diagnosisCodeableConcept*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
1890          case 2050454362: /*diagnosisReference*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
1891          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);
1892          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);
1893          default: return super.getNamedProperty(_hash, _name, _checkValid);
1894          }
1895
1896        }
1897
1898      @Override
1899      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1900        switch (hash) {
1901        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1902        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // Type
1903        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
1904        case 908444499: /*packageCode*/ return this.packageCode == null ? new Base[0] : new Base[] {this.packageCode}; // CodeableConcept
1905        default: return super.getProperty(hash, name, checkValid);
1906        }
1907
1908      }
1909
1910      @Override
1911      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1912        switch (hash) {
1913        case 1349547969: // sequence
1914          this.sequence = castToPositiveInt(value); // PositiveIntType
1915          return value;
1916        case 1196993265: // diagnosis
1917          this.diagnosis = castToType(value); // Type
1918          return value;
1919        case 3575610: // type
1920          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
1921          return value;
1922        case 908444499: // packageCode
1923          this.packageCode = castToCodeableConcept(value); // CodeableConcept
1924          return value;
1925        default: return super.setProperty(hash, name, value);
1926        }
1927
1928      }
1929
1930      @Override
1931      public Base setProperty(String name, Base value) throws FHIRException {
1932        if (name.equals("sequence")) {
1933          this.sequence = castToPositiveInt(value); // PositiveIntType
1934        } else if (name.equals("diagnosis[x]")) {
1935          this.diagnosis = castToType(value); // Type
1936        } else if (name.equals("type")) {
1937          this.getType().add(castToCodeableConcept(value));
1938        } else if (name.equals("packageCode")) {
1939          this.packageCode = castToCodeableConcept(value); // CodeableConcept
1940        } else
1941          return super.setProperty(name, value);
1942        return value;
1943      }
1944
1945      @Override
1946      public Base makeProperty(int hash, String name) throws FHIRException {
1947        switch (hash) {
1948        case 1349547969:  return getSequenceElement();
1949        case -1487009809:  return getDiagnosis(); 
1950        case 1196993265:  return getDiagnosis(); 
1951        case 3575610:  return addType(); 
1952        case 908444499:  return getPackageCode(); 
1953        default: return super.makeProperty(hash, name);
1954        }
1955
1956      }
1957
1958      @Override
1959      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1960        switch (hash) {
1961        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1962        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
1963        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1964        case 908444499: /*packageCode*/ return new String[] {"CodeableConcept"};
1965        default: return super.getTypesForProperty(hash, name);
1966        }
1967
1968      }
1969
1970      @Override
1971      public Base addChild(String name) throws FHIRException {
1972        if (name.equals("sequence")) {
1973          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1974        }
1975        else if (name.equals("diagnosisCodeableConcept")) {
1976          this.diagnosis = new CodeableConcept();
1977          return this.diagnosis;
1978        }
1979        else if (name.equals("diagnosisReference")) {
1980          this.diagnosis = new Reference();
1981          return this.diagnosis;
1982        }
1983        else if (name.equals("type")) {
1984          return addType();
1985        }
1986        else if (name.equals("packageCode")) {
1987          this.packageCode = new CodeableConcept();
1988          return this.packageCode;
1989        }
1990        else
1991          return super.addChild(name);
1992      }
1993
1994      public DiagnosisComponent copy() {
1995        DiagnosisComponent dst = new DiagnosisComponent();
1996        copyValues(dst);
1997        dst.sequence = sequence == null ? null : sequence.copy();
1998        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
1999        if (type != null) {
2000          dst.type = new ArrayList<CodeableConcept>();
2001          for (CodeableConcept i : type)
2002            dst.type.add(i.copy());
2003        };
2004        dst.packageCode = packageCode == null ? null : packageCode.copy();
2005        return dst;
2006      }
2007
2008      @Override
2009      public boolean equalsDeep(Base other_) {
2010        if (!super.equalsDeep(other_))
2011          return false;
2012        if (!(other_ instanceof DiagnosisComponent))
2013          return false;
2014        DiagnosisComponent o = (DiagnosisComponent) other_;
2015        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(type, o.type, true)
2016           && compareDeep(packageCode, o.packageCode, true);
2017      }
2018
2019      @Override
2020      public boolean equalsShallow(Base other_) {
2021        if (!super.equalsShallow(other_))
2022          return false;
2023        if (!(other_ instanceof DiagnosisComponent))
2024          return false;
2025        DiagnosisComponent o = (DiagnosisComponent) other_;
2026        return compareValues(sequence, o.sequence, true);
2027      }
2028
2029      public boolean isEmpty() {
2030        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type
2031          , packageCode);
2032      }
2033
2034  public String fhirType() {
2035    return "ExplanationOfBenefit.diagnosis";
2036
2037  }
2038
2039  }
2040
2041    @Block()
2042    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2043        /**
2044         * Sequence of procedures which serves to order and provide a link.
2045         */
2046        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2047        @Description(shortDefinition="Procedure sequence for reference", formalDefinition="Sequence of procedures which serves to order and provide a link." )
2048        protected PositiveIntType sequence;
2049
2050        /**
2051         * Date and optionally time the procedure was performed .
2052         */
2053        @Child(name = "date", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2054        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed ." )
2055        protected DateTimeType date;
2056
2057        /**
2058         * The procedure code.
2059         */
2060        @Child(name = "procedure", type = {CodeableConcept.class, Procedure.class}, order=3, min=1, max=1, modifier=false, summary=false)
2061        @Description(shortDefinition="Patient's list of procedures performed", formalDefinition="The procedure code." )
2062        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10-procedures")
2063        protected Type procedure;
2064
2065        private static final long serialVersionUID = 864307347L;
2066
2067    /**
2068     * Constructor
2069     */
2070      public ProcedureComponent() {
2071        super();
2072      }
2073
2074    /**
2075     * Constructor
2076     */
2077      public ProcedureComponent(PositiveIntType sequence, Type procedure) {
2078        super();
2079        this.sequence = sequence;
2080        this.procedure = procedure;
2081      }
2082
2083        /**
2084         * @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
2085         */
2086        public PositiveIntType getSequenceElement() { 
2087          if (this.sequence == null)
2088            if (Configuration.errorOnAutoCreate())
2089              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2090            else if (Configuration.doAutoCreate())
2091              this.sequence = new PositiveIntType(); // bb
2092          return this.sequence;
2093        }
2094
2095        public boolean hasSequenceElement() { 
2096          return this.sequence != null && !this.sequence.isEmpty();
2097        }
2098
2099        public boolean hasSequence() { 
2100          return this.sequence != null && !this.sequence.isEmpty();
2101        }
2102
2103        /**
2104         * @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
2105         */
2106        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
2107          this.sequence = value;
2108          return this;
2109        }
2110
2111        /**
2112         * @return Sequence of procedures which serves to order and provide a link.
2113         */
2114        public int getSequence() { 
2115          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2116        }
2117
2118        /**
2119         * @param value Sequence of procedures which serves to order and provide a link.
2120         */
2121        public ProcedureComponent setSequence(int value) { 
2122            if (this.sequence == null)
2123              this.sequence = new PositiveIntType();
2124            this.sequence.setValue(value);
2125          return this;
2126        }
2127
2128        /**
2129         * @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
2130         */
2131        public DateTimeType getDateElement() { 
2132          if (this.date == null)
2133            if (Configuration.errorOnAutoCreate())
2134              throw new Error("Attempt to auto-create ProcedureComponent.date");
2135            else if (Configuration.doAutoCreate())
2136              this.date = new DateTimeType(); // bb
2137          return this.date;
2138        }
2139
2140        public boolean hasDateElement() { 
2141          return this.date != null && !this.date.isEmpty();
2142        }
2143
2144        public boolean hasDate() { 
2145          return this.date != null && !this.date.isEmpty();
2146        }
2147
2148        /**
2149         * @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
2150         */
2151        public ProcedureComponent setDateElement(DateTimeType value) { 
2152          this.date = value;
2153          return this;
2154        }
2155
2156        /**
2157         * @return Date and optionally time the procedure was performed .
2158         */
2159        public Date getDate() { 
2160          return this.date == null ? null : this.date.getValue();
2161        }
2162
2163        /**
2164         * @param value Date and optionally time the procedure was performed .
2165         */
2166        public ProcedureComponent setDate(Date value) { 
2167          if (value == null)
2168            this.date = null;
2169          else {
2170            if (this.date == null)
2171              this.date = new DateTimeType();
2172            this.date.setValue(value);
2173          }
2174          return this;
2175        }
2176
2177        /**
2178         * @return {@link #procedure} (The procedure code.)
2179         */
2180        public Type getProcedure() { 
2181          return this.procedure;
2182        }
2183
2184        /**
2185         * @return {@link #procedure} (The procedure code.)
2186         */
2187        public CodeableConcept getProcedureCodeableConcept() throws FHIRException { 
2188          if (this.procedure == null)
2189            return null;
2190          if (!(this.procedure instanceof CodeableConcept))
2191            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.procedure.getClass().getName()+" was encountered");
2192          return (CodeableConcept) this.procedure;
2193        }
2194
2195        public boolean hasProcedureCodeableConcept() { 
2196          return this != null && this.procedure instanceof CodeableConcept;
2197        }
2198
2199        /**
2200         * @return {@link #procedure} (The procedure code.)
2201         */
2202        public Reference getProcedureReference() throws FHIRException { 
2203          if (this.procedure == null)
2204            return null;
2205          if (!(this.procedure instanceof Reference))
2206            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
2207          return (Reference) this.procedure;
2208        }
2209
2210        public boolean hasProcedureReference() { 
2211          return this != null && this.procedure instanceof Reference;
2212        }
2213
2214        public boolean hasProcedure() { 
2215          return this.procedure != null && !this.procedure.isEmpty();
2216        }
2217
2218        /**
2219         * @param value {@link #procedure} (The procedure code.)
2220         */
2221        public ProcedureComponent setProcedure(Type value) throws FHIRFormatError { 
2222          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2223            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: "+value.fhirType());
2224          this.procedure = value;
2225          return this;
2226        }
2227
2228        protected void listChildren(List<Property> children) {
2229          super.listChildren(children);
2230          children.add(new Property("sequence", "positiveInt", "Sequence of procedures which serves to order and provide a link.", 0, 1, sequence));
2231          children.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed .", 0, 1, date));
2232          children.add(new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure));
2233        }
2234
2235        @Override
2236        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2237          switch (_hash) {
2238          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of procedures which serves to order and provide a link.", 0, 1, sequence);
2239          case 3076014: /*date*/  return new Property("date", "dateTime", "Date and optionally time the procedure was performed .", 0, 1, date);
2240          case 1640074445: /*procedure[x]*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2241          case -1095204141: /*procedure*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2242          case -1284783026: /*procedureCodeableConcept*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2243          case 881809848: /*procedureReference*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2244          default: return super.getNamedProperty(_hash, _name, _checkValid);
2245          }
2246
2247        }
2248
2249      @Override
2250      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2251        switch (hash) {
2252        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2253        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2254        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // Type
2255        default: return super.getProperty(hash, name, checkValid);
2256        }
2257
2258      }
2259
2260      @Override
2261      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2262        switch (hash) {
2263        case 1349547969: // sequence
2264          this.sequence = castToPositiveInt(value); // PositiveIntType
2265          return value;
2266        case 3076014: // date
2267          this.date = castToDateTime(value); // DateTimeType
2268          return value;
2269        case -1095204141: // procedure
2270          this.procedure = castToType(value); // Type
2271          return value;
2272        default: return super.setProperty(hash, name, value);
2273        }
2274
2275      }
2276
2277      @Override
2278      public Base setProperty(String name, Base value) throws FHIRException {
2279        if (name.equals("sequence")) {
2280          this.sequence = castToPositiveInt(value); // PositiveIntType
2281        } else if (name.equals("date")) {
2282          this.date = castToDateTime(value); // DateTimeType
2283        } else if (name.equals("procedure[x]")) {
2284          this.procedure = castToType(value); // Type
2285        } else
2286          return super.setProperty(name, value);
2287        return value;
2288      }
2289
2290      @Override
2291      public Base makeProperty(int hash, String name) throws FHIRException {
2292        switch (hash) {
2293        case 1349547969:  return getSequenceElement();
2294        case 3076014:  return getDateElement();
2295        case 1640074445:  return getProcedure(); 
2296        case -1095204141:  return getProcedure(); 
2297        default: return super.makeProperty(hash, name);
2298        }
2299
2300      }
2301
2302      @Override
2303      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2304        switch (hash) {
2305        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2306        case 3076014: /*date*/ return new String[] {"dateTime"};
2307        case -1095204141: /*procedure*/ return new String[] {"CodeableConcept", "Reference"};
2308        default: return super.getTypesForProperty(hash, name);
2309        }
2310
2311      }
2312
2313      @Override
2314      public Base addChild(String name) throws FHIRException {
2315        if (name.equals("sequence")) {
2316          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2317        }
2318        else if (name.equals("date")) {
2319          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
2320        }
2321        else if (name.equals("procedureCodeableConcept")) {
2322          this.procedure = new CodeableConcept();
2323          return this.procedure;
2324        }
2325        else if (name.equals("procedureReference")) {
2326          this.procedure = new Reference();
2327          return this.procedure;
2328        }
2329        else
2330          return super.addChild(name);
2331      }
2332
2333      public ProcedureComponent copy() {
2334        ProcedureComponent dst = new ProcedureComponent();
2335        copyValues(dst);
2336        dst.sequence = sequence == null ? null : sequence.copy();
2337        dst.date = date == null ? null : date.copy();
2338        dst.procedure = procedure == null ? null : procedure.copy();
2339        return dst;
2340      }
2341
2342      @Override
2343      public boolean equalsDeep(Base other_) {
2344        if (!super.equalsDeep(other_))
2345          return false;
2346        if (!(other_ instanceof ProcedureComponent))
2347          return false;
2348        ProcedureComponent o = (ProcedureComponent) other_;
2349        return compareDeep(sequence, o.sequence, true) && compareDeep(date, o.date, true) && compareDeep(procedure, o.procedure, true)
2350          ;
2351      }
2352
2353      @Override
2354      public boolean equalsShallow(Base other_) {
2355        if (!super.equalsShallow(other_))
2356          return false;
2357        if (!(other_ instanceof ProcedureComponent))
2358          return false;
2359        ProcedureComponent o = (ProcedureComponent) other_;
2360        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
2361      }
2362
2363      public boolean isEmpty() {
2364        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, date, procedure
2365          );
2366      }
2367
2368  public String fhirType() {
2369    return "ExplanationOfBenefit.procedure";
2370
2371  }
2372
2373  }
2374
2375    @Block()
2376    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
2377        /**
2378         * Reference to the program or plan identification, underwriter or payor.
2379         */
2380        @Child(name = "coverage", type = {Coverage.class}, order=1, min=0, max=1, modifier=false, summary=false)
2381        @Description(shortDefinition="Insurance information", formalDefinition="Reference to the program or plan identification, underwriter or payor." )
2382        protected Reference coverage;
2383
2384        /**
2385         * The actual object that is the target of the reference (Reference to the program or plan identification, underwriter or payor.)
2386         */
2387        protected Coverage coverageTarget;
2388
2389        /**
2390         * A list of references from the Insurer to which these services pertain.
2391         */
2392        @Child(name = "preAuthRef", type = {StringType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2393        @Description(shortDefinition="Pre-Authorization/Determination Reference", formalDefinition="A list of references from the Insurer to which these services pertain." )
2394        protected List<StringType> preAuthRef;
2395
2396        private static final long serialVersionUID = -870298727L;
2397
2398    /**
2399     * Constructor
2400     */
2401      public InsuranceComponent() {
2402        super();
2403      }
2404
2405        /**
2406         * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
2407         */
2408        public Reference getCoverage() { 
2409          if (this.coverage == null)
2410            if (Configuration.errorOnAutoCreate())
2411              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2412            else if (Configuration.doAutoCreate())
2413              this.coverage = new Reference(); // cc
2414          return this.coverage;
2415        }
2416
2417        public boolean hasCoverage() { 
2418          return this.coverage != null && !this.coverage.isEmpty();
2419        }
2420
2421        /**
2422         * @param value {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
2423         */
2424        public InsuranceComponent setCoverage(Reference value)  { 
2425          this.coverage = value;
2426          return this;
2427        }
2428
2429        /**
2430         * @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.)
2431         */
2432        public Coverage getCoverageTarget() { 
2433          if (this.coverageTarget == null)
2434            if (Configuration.errorOnAutoCreate())
2435              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2436            else if (Configuration.doAutoCreate())
2437              this.coverageTarget = new Coverage(); // aa
2438          return this.coverageTarget;
2439        }
2440
2441        /**
2442         * @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.)
2443         */
2444        public InsuranceComponent setCoverageTarget(Coverage value) { 
2445          this.coverageTarget = value;
2446          return this;
2447        }
2448
2449        /**
2450         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2451         */
2452        public List<StringType> getPreAuthRef() { 
2453          if (this.preAuthRef == null)
2454            this.preAuthRef = new ArrayList<StringType>();
2455          return this.preAuthRef;
2456        }
2457
2458        /**
2459         * @return Returns a reference to <code>this</code> for easy method chaining
2460         */
2461        public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) { 
2462          this.preAuthRef = thePreAuthRef;
2463          return this;
2464        }
2465
2466        public boolean hasPreAuthRef() { 
2467          if (this.preAuthRef == null)
2468            return false;
2469          for (StringType item : this.preAuthRef)
2470            if (!item.isEmpty())
2471              return true;
2472          return false;
2473        }
2474
2475        /**
2476         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2477         */
2478        public StringType addPreAuthRefElement() {//2 
2479          StringType t = new StringType();
2480          if (this.preAuthRef == null)
2481            this.preAuthRef = new ArrayList<StringType>();
2482          this.preAuthRef.add(t);
2483          return t;
2484        }
2485
2486        /**
2487         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2488         */
2489        public InsuranceComponent addPreAuthRef(String value) { //1
2490          StringType t = new StringType();
2491          t.setValue(value);
2492          if (this.preAuthRef == null)
2493            this.preAuthRef = new ArrayList<StringType>();
2494          this.preAuthRef.add(t);
2495          return this;
2496        }
2497
2498        /**
2499         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2500         */
2501        public boolean hasPreAuthRef(String value) { 
2502          if (this.preAuthRef == null)
2503            return false;
2504          for (StringType v : this.preAuthRef)
2505            if (v.getValue().equals(value)) // string
2506              return true;
2507          return false;
2508        }
2509
2510        protected void listChildren(List<Property> children) {
2511          super.listChildren(children);
2512          children.add(new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, 1, coverage));
2513          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));
2514        }
2515
2516        @Override
2517        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2518          switch (_hash) {
2519          case -351767064: /*coverage*/  return new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, 1, coverage);
2520          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);
2521          default: return super.getNamedProperty(_hash, _name, _checkValid);
2522          }
2523
2524        }
2525
2526      @Override
2527      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2528        switch (hash) {
2529        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
2530        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
2531        default: return super.getProperty(hash, name, checkValid);
2532        }
2533
2534      }
2535
2536      @Override
2537      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2538        switch (hash) {
2539        case -351767064: // coverage
2540          this.coverage = castToReference(value); // Reference
2541          return value;
2542        case 522246568: // preAuthRef
2543          this.getPreAuthRef().add(castToString(value)); // StringType
2544          return value;
2545        default: return super.setProperty(hash, name, value);
2546        }
2547
2548      }
2549
2550      @Override
2551      public Base setProperty(String name, Base value) throws FHIRException {
2552        if (name.equals("coverage")) {
2553          this.coverage = castToReference(value); // Reference
2554        } else if (name.equals("preAuthRef")) {
2555          this.getPreAuthRef().add(castToString(value));
2556        } else
2557          return super.setProperty(name, value);
2558        return value;
2559      }
2560
2561      @Override
2562      public Base makeProperty(int hash, String name) throws FHIRException {
2563        switch (hash) {
2564        case -351767064:  return getCoverage(); 
2565        case 522246568:  return addPreAuthRefElement();
2566        default: return super.makeProperty(hash, name);
2567        }
2568
2569      }
2570
2571      @Override
2572      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2573        switch (hash) {
2574        case -351767064: /*coverage*/ return new String[] {"Reference"};
2575        case 522246568: /*preAuthRef*/ return new String[] {"string"};
2576        default: return super.getTypesForProperty(hash, name);
2577        }
2578
2579      }
2580
2581      @Override
2582      public Base addChild(String name) throws FHIRException {
2583        if (name.equals("coverage")) {
2584          this.coverage = new Reference();
2585          return this.coverage;
2586        }
2587        else if (name.equals("preAuthRef")) {
2588          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
2589        }
2590        else
2591          return super.addChild(name);
2592      }
2593
2594      public InsuranceComponent copy() {
2595        InsuranceComponent dst = new InsuranceComponent();
2596        copyValues(dst);
2597        dst.coverage = coverage == null ? null : coverage.copy();
2598        if (preAuthRef != null) {
2599          dst.preAuthRef = new ArrayList<StringType>();
2600          for (StringType i : preAuthRef)
2601            dst.preAuthRef.add(i.copy());
2602        };
2603        return dst;
2604      }
2605
2606      @Override
2607      public boolean equalsDeep(Base other_) {
2608        if (!super.equalsDeep(other_))
2609          return false;
2610        if (!(other_ instanceof InsuranceComponent))
2611          return false;
2612        InsuranceComponent o = (InsuranceComponent) other_;
2613        return compareDeep(coverage, o.coverage, true) && compareDeep(preAuthRef, o.preAuthRef, true);
2614      }
2615
2616      @Override
2617      public boolean equalsShallow(Base other_) {
2618        if (!super.equalsShallow(other_))
2619          return false;
2620        if (!(other_ instanceof InsuranceComponent))
2621          return false;
2622        InsuranceComponent o = (InsuranceComponent) other_;
2623        return compareValues(preAuthRef, o.preAuthRef, true);
2624      }
2625
2626      public boolean isEmpty() {
2627        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(coverage, preAuthRef);
2628      }
2629
2630  public String fhirType() {
2631    return "ExplanationOfBenefit.insurance";
2632
2633  }
2634
2635  }
2636
2637    @Block()
2638    public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
2639        /**
2640         * Date of an accident which these services are addressing.
2641         */
2642        @Child(name = "date", type = {DateType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2643        @Description(shortDefinition="When the accident occurred", formalDefinition="Date of an accident which these services are addressing." )
2644        protected DateType date;
2645
2646        /**
2647         * Type of accident: work, auto, etc.
2648         */
2649        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
2650        @Description(shortDefinition="The nature of the accident", formalDefinition="Type of accident: work, auto, etc." )
2651        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActIncidentCode")
2652        protected CodeableConcept type;
2653
2654        /**
2655         * Where the accident occurred.
2656         */
2657        @Child(name = "location", type = {Address.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=false)
2658        @Description(shortDefinition="Accident Place", formalDefinition="Where the accident occurred." )
2659        protected Type location;
2660
2661        private static final long serialVersionUID = 622904984L;
2662
2663    /**
2664     * Constructor
2665     */
2666      public AccidentComponent() {
2667        super();
2668      }
2669
2670        /**
2671         * @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
2672         */
2673        public DateType getDateElement() { 
2674          if (this.date == null)
2675            if (Configuration.errorOnAutoCreate())
2676              throw new Error("Attempt to auto-create AccidentComponent.date");
2677            else if (Configuration.doAutoCreate())
2678              this.date = new DateType(); // bb
2679          return this.date;
2680        }
2681
2682        public boolean hasDateElement() { 
2683          return this.date != null && !this.date.isEmpty();
2684        }
2685
2686        public boolean hasDate() { 
2687          return this.date != null && !this.date.isEmpty();
2688        }
2689
2690        /**
2691         * @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
2692         */
2693        public AccidentComponent setDateElement(DateType value) { 
2694          this.date = value;
2695          return this;
2696        }
2697
2698        /**
2699         * @return Date of an accident which these services are addressing.
2700         */
2701        public Date getDate() { 
2702          return this.date == null ? null : this.date.getValue();
2703        }
2704
2705        /**
2706         * @param value Date of an accident which these services are addressing.
2707         */
2708        public AccidentComponent setDate(Date value) { 
2709          if (value == null)
2710            this.date = null;
2711          else {
2712            if (this.date == null)
2713              this.date = new DateType();
2714            this.date.setValue(value);
2715          }
2716          return this;
2717        }
2718
2719        /**
2720         * @return {@link #type} (Type of accident: work, auto, etc.)
2721         */
2722        public CodeableConcept getType() { 
2723          if (this.type == null)
2724            if (Configuration.errorOnAutoCreate())
2725              throw new Error("Attempt to auto-create AccidentComponent.type");
2726            else if (Configuration.doAutoCreate())
2727              this.type = new CodeableConcept(); // cc
2728          return this.type;
2729        }
2730
2731        public boolean hasType() { 
2732          return this.type != null && !this.type.isEmpty();
2733        }
2734
2735        /**
2736         * @param value {@link #type} (Type of accident: work, auto, etc.)
2737         */
2738        public AccidentComponent setType(CodeableConcept value)  { 
2739          this.type = value;
2740          return this;
2741        }
2742
2743        /**
2744         * @return {@link #location} (Where the accident occurred.)
2745         */
2746        public Type getLocation() { 
2747          return this.location;
2748        }
2749
2750        /**
2751         * @return {@link #location} (Where the accident occurred.)
2752         */
2753        public Address getLocationAddress() throws FHIRException { 
2754          if (this.location == null)
2755            return null;
2756          if (!(this.location instanceof Address))
2757            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
2758          return (Address) this.location;
2759        }
2760
2761        public boolean hasLocationAddress() { 
2762          return this != null && this.location instanceof Address;
2763        }
2764
2765        /**
2766         * @return {@link #location} (Where the accident occurred.)
2767         */
2768        public Reference getLocationReference() throws FHIRException { 
2769          if (this.location == null)
2770            return null;
2771          if (!(this.location instanceof Reference))
2772            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
2773          return (Reference) this.location;
2774        }
2775
2776        public boolean hasLocationReference() { 
2777          return this != null && this.location instanceof Reference;
2778        }
2779
2780        public boolean hasLocation() { 
2781          return this.location != null && !this.location.isEmpty();
2782        }
2783
2784        /**
2785         * @param value {@link #location} (Where the accident occurred.)
2786         */
2787        public AccidentComponent setLocation(Type value) throws FHIRFormatError { 
2788          if (value != null && !(value instanceof Address || value instanceof Reference))
2789            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.accident.location[x]: "+value.fhirType());
2790          this.location = value;
2791          return this;
2792        }
2793
2794        protected void listChildren(List<Property> children) {
2795          super.listChildren(children);
2796          children.add(new Property("date", "date", "Date of an accident which these services are addressing.", 0, 1, date));
2797          children.add(new Property("type", "CodeableConcept", "Type of accident: work, auto, etc.", 0, 1, type));
2798          children.add(new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location));
2799        }
2800
2801        @Override
2802        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2803          switch (_hash) {
2804          case 3076014: /*date*/  return new Property("date", "date", "Date of an accident which these services are addressing.", 0, 1, date);
2805          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of accident: work, auto, etc.", 0, 1, type);
2806          case 552316075: /*location[x]*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
2807          case 1901043637: /*location*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
2808          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
2809          case 755866390: /*locationReference*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
2810          default: return super.getNamedProperty(_hash, _name, _checkValid);
2811          }
2812
2813        }
2814
2815      @Override
2816      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2817        switch (hash) {
2818        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
2819        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2820        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
2821        default: return super.getProperty(hash, name, checkValid);
2822        }
2823
2824      }
2825
2826      @Override
2827      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2828        switch (hash) {
2829        case 3076014: // date
2830          this.date = castToDate(value); // DateType
2831          return value;
2832        case 3575610: // type
2833          this.type = castToCodeableConcept(value); // CodeableConcept
2834          return value;
2835        case 1901043637: // location
2836          this.location = castToType(value); // Type
2837          return value;
2838        default: return super.setProperty(hash, name, value);
2839        }
2840
2841      }
2842
2843      @Override
2844      public Base setProperty(String name, Base value) throws FHIRException {
2845        if (name.equals("date")) {
2846          this.date = castToDate(value); // DateType
2847        } else if (name.equals("type")) {
2848          this.type = castToCodeableConcept(value); // CodeableConcept
2849        } else if (name.equals("location[x]")) {
2850          this.location = castToType(value); // Type
2851        } else
2852          return super.setProperty(name, value);
2853        return value;
2854      }
2855
2856      @Override
2857      public Base makeProperty(int hash, String name) throws FHIRException {
2858        switch (hash) {
2859        case 3076014:  return getDateElement();
2860        case 3575610:  return getType(); 
2861        case 552316075:  return getLocation(); 
2862        case 1901043637:  return getLocation(); 
2863        default: return super.makeProperty(hash, name);
2864        }
2865
2866      }
2867
2868      @Override
2869      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2870        switch (hash) {
2871        case 3076014: /*date*/ return new String[] {"date"};
2872        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2873        case 1901043637: /*location*/ return new String[] {"Address", "Reference"};
2874        default: return super.getTypesForProperty(hash, name);
2875        }
2876
2877      }
2878
2879      @Override
2880      public Base addChild(String name) throws FHIRException {
2881        if (name.equals("date")) {
2882          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
2883        }
2884        else if (name.equals("type")) {
2885          this.type = new CodeableConcept();
2886          return this.type;
2887        }
2888        else if (name.equals("locationAddress")) {
2889          this.location = new Address();
2890          return this.location;
2891        }
2892        else if (name.equals("locationReference")) {
2893          this.location = new Reference();
2894          return this.location;
2895        }
2896        else
2897          return super.addChild(name);
2898      }
2899
2900      public AccidentComponent copy() {
2901        AccidentComponent dst = new AccidentComponent();
2902        copyValues(dst);
2903        dst.date = date == null ? null : date.copy();
2904        dst.type = type == null ? null : type.copy();
2905        dst.location = location == null ? null : location.copy();
2906        return dst;
2907      }
2908
2909      @Override
2910      public boolean equalsDeep(Base other_) {
2911        if (!super.equalsDeep(other_))
2912          return false;
2913        if (!(other_ instanceof AccidentComponent))
2914          return false;
2915        AccidentComponent o = (AccidentComponent) other_;
2916        return compareDeep(date, o.date, true) && compareDeep(type, o.type, true) && compareDeep(location, o.location, true)
2917          ;
2918      }
2919
2920      @Override
2921      public boolean equalsShallow(Base other_) {
2922        if (!super.equalsShallow(other_))
2923          return false;
2924        if (!(other_ instanceof AccidentComponent))
2925          return false;
2926        AccidentComponent o = (AccidentComponent) other_;
2927        return compareValues(date, o.date, true);
2928      }
2929
2930      public boolean isEmpty() {
2931        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
2932      }
2933
2934  public String fhirType() {
2935    return "ExplanationOfBenefit.accident";
2936
2937  }
2938
2939  }
2940
2941    @Block()
2942    public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
2943        /**
2944         * A service line number.
2945         */
2946        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2947        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
2948        protected PositiveIntType sequence;
2949
2950        /**
2951         * Careteam applicable for this service or product line.
2952         */
2953        @Child(name = "careTeamLinkId", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2954        @Description(shortDefinition="Applicable careteam members", formalDefinition="Careteam applicable for this service or product line." )
2955        protected List<PositiveIntType> careTeamLinkId;
2956
2957        /**
2958         * Diagnosis applicable for this service or product line.
2959         */
2960        @Child(name = "diagnosisLinkId", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2961        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnosis applicable for this service or product line." )
2962        protected List<PositiveIntType> diagnosisLinkId;
2963
2964        /**
2965         * Procedures applicable for this service or product line.
2966         */
2967        @Child(name = "procedureLinkId", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2968        @Description(shortDefinition="Applicable procedures", formalDefinition="Procedures applicable for this service or product line." )
2969        protected List<PositiveIntType> procedureLinkId;
2970
2971        /**
2972         * Exceptions, special conditions and supporting information pplicable for this service or product line.
2973         */
2974        @Child(name = "informationLinkId", type = {PositiveIntType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2975        @Description(shortDefinition="Applicable exception and supporting information", formalDefinition="Exceptions, special conditions and supporting information pplicable for this service or product line." )
2976        protected List<PositiveIntType> informationLinkId;
2977
2978        /**
2979         * The type of reveneu or cost center providing the product and/or service.
2980         */
2981        @Child(name = "revenue", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
2982        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
2983        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
2984        protected CodeableConcept revenue;
2985
2986        /**
2987         * Health Care Service Type Codes  to identify the classification of service or benefits.
2988         */
2989        @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
2990        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
2991        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
2992        protected CodeableConcept category;
2993
2994        /**
2995         * 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'.
2996         */
2997        @Child(name = "service", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
2998        @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'." )
2999        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
3000        protected CodeableConcept service;
3001
3002        /**
3003         * 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.
3004         */
3005        @Child(name = "modifier", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3006        @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." )
3007        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
3008        protected List<CodeableConcept> modifier;
3009
3010        /**
3011         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
3012         */
3013        @Child(name = "programCode", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3014        @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." )
3015        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
3016        protected List<CodeableConcept> programCode;
3017
3018        /**
3019         * The date or dates when the enclosed suite of services were performed or completed.
3020         */
3021        @Child(name = "serviced", type = {DateType.class, Period.class}, order=11, min=0, max=1, modifier=false, summary=false)
3022        @Description(shortDefinition="Date or dates of Service", formalDefinition="The date or dates when the enclosed suite of services were performed or completed." )
3023        protected Type serviced;
3024
3025        /**
3026         * Where the service was provided.
3027         */
3028        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
3029        @Description(shortDefinition="Place of service", formalDefinition="Where the service was provided." )
3030        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
3031        protected Type location;
3032
3033        /**
3034         * The number of repetitions of a service or product.
3035         */
3036        @Child(name = "quantity", type = {SimpleQuantity.class}, order=13, min=0, max=1, modifier=false, summary=false)
3037        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
3038        protected SimpleQuantity quantity;
3039
3040        /**
3041         * 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.
3042         */
3043        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
3044        @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." )
3045        protected Money unitPrice;
3046
3047        /**
3048         * 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.
3049         */
3050        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=false)
3051        @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." )
3052        protected DecimalType factor;
3053
3054        /**
3055         * 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.
3056         */
3057        @Child(name = "net", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
3058        @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." )
3059        protected Money net;
3060
3061        /**
3062         * List of Unique Device Identifiers associated with this line item.
3063         */
3064        @Child(name = "udi", type = {Device.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3065        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
3066        protected List<Reference> udi;
3067        /**
3068         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
3069         */
3070        protected List<Device> udiTarget;
3071
3072
3073        /**
3074         * Physical service site on the patient (limb, tooth, etc).
3075         */
3076        @Child(name = "bodySite", type = {CodeableConcept.class}, order=18, min=0, max=1, modifier=false, summary=false)
3077        @Description(shortDefinition="Service Location", formalDefinition="Physical service site on the patient (limb, tooth, etc)." )
3078        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
3079        protected CodeableConcept bodySite;
3080
3081        /**
3082         * A region or surface of the site, eg. limb region or tooth surface(s).
3083         */
3084        @Child(name = "subSite", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3085        @Description(shortDefinition="Service Sub-location", formalDefinition="A region or surface of the site, eg. limb region or tooth surface(s)." )
3086        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
3087        protected List<CodeableConcept> subSite;
3088
3089        /**
3090         * A billed item may include goods or services provided in multiple encounters.
3091         */
3092        @Child(name = "encounter", type = {Encounter.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3093        @Description(shortDefinition="Encounters related to this billed item", formalDefinition="A billed item may include goods or services provided in multiple encounters." )
3094        protected List<Reference> encounter;
3095        /**
3096         * The actual objects that are the target of the reference (A billed item may include goods or services provided in multiple encounters.)
3097         */
3098        protected List<Encounter> encounterTarget;
3099
3100
3101        /**
3102         * A list of note references to the notes provided below.
3103         */
3104        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3105        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
3106        protected List<PositiveIntType> noteNumber;
3107
3108        /**
3109         * The adjudications results.
3110         */
3111        @Child(name = "adjudication", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3112        @Description(shortDefinition="Adjudication details", formalDefinition="The adjudications results." )
3113        protected List<AdjudicationComponent> adjudication;
3114
3115        /**
3116         * Second tier of goods and services.
3117         */
3118        @Child(name = "detail", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3119        @Description(shortDefinition="Additional items", formalDefinition="Second tier of goods and services." )
3120        protected List<DetailComponent> detail;
3121
3122        private static final long serialVersionUID = -1567825229L;
3123
3124    /**
3125     * Constructor
3126     */
3127      public ItemComponent() {
3128        super();
3129      }
3130
3131    /**
3132     * Constructor
3133     */
3134      public ItemComponent(PositiveIntType sequence) {
3135        super();
3136        this.sequence = sequence;
3137      }
3138
3139        /**
3140         * @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
3141         */
3142        public PositiveIntType getSequenceElement() { 
3143          if (this.sequence == null)
3144            if (Configuration.errorOnAutoCreate())
3145              throw new Error("Attempt to auto-create ItemComponent.sequence");
3146            else if (Configuration.doAutoCreate())
3147              this.sequence = new PositiveIntType(); // bb
3148          return this.sequence;
3149        }
3150
3151        public boolean hasSequenceElement() { 
3152          return this.sequence != null && !this.sequence.isEmpty();
3153        }
3154
3155        public boolean hasSequence() { 
3156          return this.sequence != null && !this.sequence.isEmpty();
3157        }
3158
3159        /**
3160         * @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
3161         */
3162        public ItemComponent setSequenceElement(PositiveIntType value) { 
3163          this.sequence = value;
3164          return this;
3165        }
3166
3167        /**
3168         * @return A service line number.
3169         */
3170        public int getSequence() { 
3171          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3172        }
3173
3174        /**
3175         * @param value A service line number.
3176         */
3177        public ItemComponent setSequence(int value) { 
3178            if (this.sequence == null)
3179              this.sequence = new PositiveIntType();
3180            this.sequence.setValue(value);
3181          return this;
3182        }
3183
3184        /**
3185         * @return {@link #careTeamLinkId} (Careteam applicable for this service or product line.)
3186         */
3187        public List<PositiveIntType> getCareTeamLinkId() { 
3188          if (this.careTeamLinkId == null)
3189            this.careTeamLinkId = new ArrayList<PositiveIntType>();
3190          return this.careTeamLinkId;
3191        }
3192
3193        /**
3194         * @return Returns a reference to <code>this</code> for easy method chaining
3195         */
3196        public ItemComponent setCareTeamLinkId(List<PositiveIntType> theCareTeamLinkId) { 
3197          this.careTeamLinkId = theCareTeamLinkId;
3198          return this;
3199        }
3200
3201        public boolean hasCareTeamLinkId() { 
3202          if (this.careTeamLinkId == null)
3203            return false;
3204          for (PositiveIntType item : this.careTeamLinkId)
3205            if (!item.isEmpty())
3206              return true;
3207          return false;
3208        }
3209
3210        /**
3211         * @return {@link #careTeamLinkId} (Careteam applicable for this service or product line.)
3212         */
3213        public PositiveIntType addCareTeamLinkIdElement() {//2 
3214          PositiveIntType t = new PositiveIntType();
3215          if (this.careTeamLinkId == null)
3216            this.careTeamLinkId = new ArrayList<PositiveIntType>();
3217          this.careTeamLinkId.add(t);
3218          return t;
3219        }
3220
3221        /**
3222         * @param value {@link #careTeamLinkId} (Careteam applicable for this service or product line.)
3223         */
3224        public ItemComponent addCareTeamLinkId(int value) { //1
3225          PositiveIntType t = new PositiveIntType();
3226          t.setValue(value);
3227          if (this.careTeamLinkId == null)
3228            this.careTeamLinkId = new ArrayList<PositiveIntType>();
3229          this.careTeamLinkId.add(t);
3230          return this;
3231        }
3232
3233        /**
3234         * @param value {@link #careTeamLinkId} (Careteam applicable for this service or product line.)
3235         */
3236        public boolean hasCareTeamLinkId(int value) { 
3237          if (this.careTeamLinkId == null)
3238            return false;
3239          for (PositiveIntType v : this.careTeamLinkId)
3240            if (v.getValue().equals(value)) // positiveInt
3241              return true;
3242          return false;
3243        }
3244
3245        /**
3246         * @return {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
3247         */
3248        public List<PositiveIntType> getDiagnosisLinkId() { 
3249          if (this.diagnosisLinkId == null)
3250            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
3251          return this.diagnosisLinkId;
3252        }
3253
3254        /**
3255         * @return Returns a reference to <code>this</code> for easy method chaining
3256         */
3257        public ItemComponent setDiagnosisLinkId(List<PositiveIntType> theDiagnosisLinkId) { 
3258          this.diagnosisLinkId = theDiagnosisLinkId;
3259          return this;
3260        }
3261
3262        public boolean hasDiagnosisLinkId() { 
3263          if (this.diagnosisLinkId == null)
3264            return false;
3265          for (PositiveIntType item : this.diagnosisLinkId)
3266            if (!item.isEmpty())
3267              return true;
3268          return false;
3269        }
3270
3271        /**
3272         * @return {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
3273         */
3274        public PositiveIntType addDiagnosisLinkIdElement() {//2 
3275          PositiveIntType t = new PositiveIntType();
3276          if (this.diagnosisLinkId == null)
3277            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
3278          this.diagnosisLinkId.add(t);
3279          return t;
3280        }
3281
3282        /**
3283         * @param value {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
3284         */
3285        public ItemComponent addDiagnosisLinkId(int value) { //1
3286          PositiveIntType t = new PositiveIntType();
3287          t.setValue(value);
3288          if (this.diagnosisLinkId == null)
3289            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
3290          this.diagnosisLinkId.add(t);
3291          return this;
3292        }
3293
3294        /**
3295         * @param value {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
3296         */
3297        public boolean hasDiagnosisLinkId(int value) { 
3298          if (this.diagnosisLinkId == null)
3299            return false;
3300          for (PositiveIntType v : this.diagnosisLinkId)
3301            if (v.getValue().equals(value)) // positiveInt
3302              return true;
3303          return false;
3304        }
3305
3306        /**
3307         * @return {@link #procedureLinkId} (Procedures applicable for this service or product line.)
3308         */
3309        public List<PositiveIntType> getProcedureLinkId() { 
3310          if (this.procedureLinkId == null)
3311            this.procedureLinkId = new ArrayList<PositiveIntType>();
3312          return this.procedureLinkId;
3313        }
3314
3315        /**
3316         * @return Returns a reference to <code>this</code> for easy method chaining
3317         */
3318        public ItemComponent setProcedureLinkId(List<PositiveIntType> theProcedureLinkId) { 
3319          this.procedureLinkId = theProcedureLinkId;
3320          return this;
3321        }
3322
3323        public boolean hasProcedureLinkId() { 
3324          if (this.procedureLinkId == null)
3325            return false;
3326          for (PositiveIntType item : this.procedureLinkId)
3327            if (!item.isEmpty())
3328              return true;
3329          return false;
3330        }
3331
3332        /**
3333         * @return {@link #procedureLinkId} (Procedures applicable for this service or product line.)
3334         */
3335        public PositiveIntType addProcedureLinkIdElement() {//2 
3336          PositiveIntType t = new PositiveIntType();
3337          if (this.procedureLinkId == null)
3338            this.procedureLinkId = new ArrayList<PositiveIntType>();
3339          this.procedureLinkId.add(t);
3340          return t;
3341        }
3342
3343        /**
3344         * @param value {@link #procedureLinkId} (Procedures applicable for this service or product line.)
3345         */
3346        public ItemComponent addProcedureLinkId(int value) { //1
3347          PositiveIntType t = new PositiveIntType();
3348          t.setValue(value);
3349          if (this.procedureLinkId == null)
3350            this.procedureLinkId = new ArrayList<PositiveIntType>();
3351          this.procedureLinkId.add(t);
3352          return this;
3353        }
3354
3355        /**
3356         * @param value {@link #procedureLinkId} (Procedures applicable for this service or product line.)
3357         */
3358        public boolean hasProcedureLinkId(int value) { 
3359          if (this.procedureLinkId == null)
3360            return false;
3361          for (PositiveIntType v : this.procedureLinkId)
3362            if (v.getValue().equals(value)) // positiveInt
3363              return true;
3364          return false;
3365        }
3366
3367        /**
3368         * @return {@link #informationLinkId} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3369         */
3370        public List<PositiveIntType> getInformationLinkId() { 
3371          if (this.informationLinkId == null)
3372            this.informationLinkId = new ArrayList<PositiveIntType>();
3373          return this.informationLinkId;
3374        }
3375
3376        /**
3377         * @return Returns a reference to <code>this</code> for easy method chaining
3378         */
3379        public ItemComponent setInformationLinkId(List<PositiveIntType> theInformationLinkId) { 
3380          this.informationLinkId = theInformationLinkId;
3381          return this;
3382        }
3383
3384        public boolean hasInformationLinkId() { 
3385          if (this.informationLinkId == null)
3386            return false;
3387          for (PositiveIntType item : this.informationLinkId)
3388            if (!item.isEmpty())
3389              return true;
3390          return false;
3391        }
3392
3393        /**
3394         * @return {@link #informationLinkId} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3395         */
3396        public PositiveIntType addInformationLinkIdElement() {//2 
3397          PositiveIntType t = new PositiveIntType();
3398          if (this.informationLinkId == null)
3399            this.informationLinkId = new ArrayList<PositiveIntType>();
3400          this.informationLinkId.add(t);
3401          return t;
3402        }
3403
3404        /**
3405         * @param value {@link #informationLinkId} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3406         */
3407        public ItemComponent addInformationLinkId(int value) { //1
3408          PositiveIntType t = new PositiveIntType();
3409          t.setValue(value);
3410          if (this.informationLinkId == null)
3411            this.informationLinkId = new ArrayList<PositiveIntType>();
3412          this.informationLinkId.add(t);
3413          return this;
3414        }
3415
3416        /**
3417         * @param value {@link #informationLinkId} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3418         */
3419        public boolean hasInformationLinkId(int value) { 
3420          if (this.informationLinkId == null)
3421            return false;
3422          for (PositiveIntType v : this.informationLinkId)
3423            if (v.getValue().equals(value)) // positiveInt
3424              return true;
3425          return false;
3426        }
3427
3428        /**
3429         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
3430         */
3431        public CodeableConcept getRevenue() { 
3432          if (this.revenue == null)
3433            if (Configuration.errorOnAutoCreate())
3434              throw new Error("Attempt to auto-create ItemComponent.revenue");
3435            else if (Configuration.doAutoCreate())
3436              this.revenue = new CodeableConcept(); // cc
3437          return this.revenue;
3438        }
3439
3440        public boolean hasRevenue() { 
3441          return this.revenue != null && !this.revenue.isEmpty();
3442        }
3443
3444        /**
3445         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
3446         */
3447        public ItemComponent setRevenue(CodeableConcept value)  { 
3448          this.revenue = value;
3449          return this;
3450        }
3451
3452        /**
3453         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
3454         */
3455        public CodeableConcept getCategory() { 
3456          if (this.category == null)
3457            if (Configuration.errorOnAutoCreate())
3458              throw new Error("Attempt to auto-create ItemComponent.category");
3459            else if (Configuration.doAutoCreate())
3460              this.category = new CodeableConcept(); // cc
3461          return this.category;
3462        }
3463
3464        public boolean hasCategory() { 
3465          return this.category != null && !this.category.isEmpty();
3466        }
3467
3468        /**
3469         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
3470         */
3471        public ItemComponent setCategory(CodeableConcept value)  { 
3472          this.category = value;
3473          return this;
3474        }
3475
3476        /**
3477         * @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'.)
3478         */
3479        public CodeableConcept getService() { 
3480          if (this.service == null)
3481            if (Configuration.errorOnAutoCreate())
3482              throw new Error("Attempt to auto-create ItemComponent.service");
3483            else if (Configuration.doAutoCreate())
3484              this.service = new CodeableConcept(); // cc
3485          return this.service;
3486        }
3487
3488        public boolean hasService() { 
3489          return this.service != null && !this.service.isEmpty();
3490        }
3491
3492        /**
3493         * @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'.)
3494         */
3495        public ItemComponent setService(CodeableConcept value)  { 
3496          this.service = value;
3497          return this;
3498        }
3499
3500        /**
3501         * @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.)
3502         */
3503        public List<CodeableConcept> getModifier() { 
3504          if (this.modifier == null)
3505            this.modifier = new ArrayList<CodeableConcept>();
3506          return this.modifier;
3507        }
3508
3509        /**
3510         * @return Returns a reference to <code>this</code> for easy method chaining
3511         */
3512        public ItemComponent setModifier(List<CodeableConcept> theModifier) { 
3513          this.modifier = theModifier;
3514          return this;
3515        }
3516
3517        public boolean hasModifier() { 
3518          if (this.modifier == null)
3519            return false;
3520          for (CodeableConcept item : this.modifier)
3521            if (!item.isEmpty())
3522              return true;
3523          return false;
3524        }
3525
3526        public CodeableConcept addModifier() { //3
3527          CodeableConcept t = new CodeableConcept();
3528          if (this.modifier == null)
3529            this.modifier = new ArrayList<CodeableConcept>();
3530          this.modifier.add(t);
3531          return t;
3532        }
3533
3534        public ItemComponent addModifier(CodeableConcept t) { //3
3535          if (t == null)
3536            return this;
3537          if (this.modifier == null)
3538            this.modifier = new ArrayList<CodeableConcept>();
3539          this.modifier.add(t);
3540          return this;
3541        }
3542
3543        /**
3544         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
3545         */
3546        public CodeableConcept getModifierFirstRep() { 
3547          if (getModifier().isEmpty()) {
3548            addModifier();
3549          }
3550          return getModifier().get(0);
3551        }
3552
3553        /**
3554         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
3555         */
3556        public List<CodeableConcept> getProgramCode() { 
3557          if (this.programCode == null)
3558            this.programCode = new ArrayList<CodeableConcept>();
3559          return this.programCode;
3560        }
3561
3562        /**
3563         * @return Returns a reference to <code>this</code> for easy method chaining
3564         */
3565        public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
3566          this.programCode = theProgramCode;
3567          return this;
3568        }
3569
3570        public boolean hasProgramCode() { 
3571          if (this.programCode == null)
3572            return false;
3573          for (CodeableConcept item : this.programCode)
3574            if (!item.isEmpty())
3575              return true;
3576          return false;
3577        }
3578
3579        public CodeableConcept addProgramCode() { //3
3580          CodeableConcept t = new CodeableConcept();
3581          if (this.programCode == null)
3582            this.programCode = new ArrayList<CodeableConcept>();
3583          this.programCode.add(t);
3584          return t;
3585        }
3586
3587        public ItemComponent addProgramCode(CodeableConcept t) { //3
3588          if (t == null)
3589            return this;
3590          if (this.programCode == null)
3591            this.programCode = new ArrayList<CodeableConcept>();
3592          this.programCode.add(t);
3593          return this;
3594        }
3595
3596        /**
3597         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
3598         */
3599        public CodeableConcept getProgramCodeFirstRep() { 
3600          if (getProgramCode().isEmpty()) {
3601            addProgramCode();
3602          }
3603          return getProgramCode().get(0);
3604        }
3605
3606        /**
3607         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3608         */
3609        public Type getServiced() { 
3610          return this.serviced;
3611        }
3612
3613        /**
3614         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3615         */
3616        public DateType getServicedDateType() throws FHIRException { 
3617          if (this.serviced == null)
3618            return null;
3619          if (!(this.serviced instanceof DateType))
3620            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
3621          return (DateType) this.serviced;
3622        }
3623
3624        public boolean hasServicedDateType() { 
3625          return this != null && this.serviced instanceof DateType;
3626        }
3627
3628        /**
3629         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3630         */
3631        public Period getServicedPeriod() throws FHIRException { 
3632          if (this.serviced == null)
3633            return null;
3634          if (!(this.serviced instanceof Period))
3635            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
3636          return (Period) this.serviced;
3637        }
3638
3639        public boolean hasServicedPeriod() { 
3640          return this != null && this.serviced instanceof Period;
3641        }
3642
3643        public boolean hasServiced() { 
3644          return this.serviced != null && !this.serviced.isEmpty();
3645        }
3646
3647        /**
3648         * @param value {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3649         */
3650        public ItemComponent setServiced(Type value) throws FHIRFormatError { 
3651          if (value != null && !(value instanceof DateType || value instanceof Period))
3652            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.item.serviced[x]: "+value.fhirType());
3653          this.serviced = value;
3654          return this;
3655        }
3656
3657        /**
3658         * @return {@link #location} (Where the service was provided.)
3659         */
3660        public Type getLocation() { 
3661          return this.location;
3662        }
3663
3664        /**
3665         * @return {@link #location} (Where the service was provided.)
3666         */
3667        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
3668          if (this.location == null)
3669            return null;
3670          if (!(this.location instanceof CodeableConcept))
3671            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
3672          return (CodeableConcept) this.location;
3673        }
3674
3675        public boolean hasLocationCodeableConcept() { 
3676          return this != null && this.location instanceof CodeableConcept;
3677        }
3678
3679        /**
3680         * @return {@link #location} (Where the service was provided.)
3681         */
3682        public Address getLocationAddress() throws FHIRException { 
3683          if (this.location == null)
3684            return null;
3685          if (!(this.location instanceof Address))
3686            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3687          return (Address) this.location;
3688        }
3689
3690        public boolean hasLocationAddress() { 
3691          return this != null && this.location instanceof Address;
3692        }
3693
3694        /**
3695         * @return {@link #location} (Where the service was provided.)
3696         */
3697        public Reference getLocationReference() throws FHIRException { 
3698          if (this.location == null)
3699            return null;
3700          if (!(this.location instanceof Reference))
3701            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3702          return (Reference) this.location;
3703        }
3704
3705        public boolean hasLocationReference() { 
3706          return this != null && this.location instanceof Reference;
3707        }
3708
3709        public boolean hasLocation() { 
3710          return this.location != null && !this.location.isEmpty();
3711        }
3712
3713        /**
3714         * @param value {@link #location} (Where the service was provided.)
3715         */
3716        public ItemComponent setLocation(Type value) throws FHIRFormatError { 
3717          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
3718            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.item.location[x]: "+value.fhirType());
3719          this.location = value;
3720          return this;
3721        }
3722
3723        /**
3724         * @return {@link #quantity} (The number of repetitions of a service or product.)
3725         */
3726        public SimpleQuantity getQuantity() { 
3727          if (this.quantity == null)
3728            if (Configuration.errorOnAutoCreate())
3729              throw new Error("Attempt to auto-create ItemComponent.quantity");
3730            else if (Configuration.doAutoCreate())
3731              this.quantity = new SimpleQuantity(); // cc
3732          return this.quantity;
3733        }
3734
3735        public boolean hasQuantity() { 
3736          return this.quantity != null && !this.quantity.isEmpty();
3737        }
3738
3739        /**
3740         * @param value {@link #quantity} (The number of repetitions of a service or product.)
3741         */
3742        public ItemComponent setQuantity(SimpleQuantity value)  { 
3743          this.quantity = value;
3744          return this;
3745        }
3746
3747        /**
3748         * @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.)
3749         */
3750        public Money getUnitPrice() { 
3751          if (this.unitPrice == null)
3752            if (Configuration.errorOnAutoCreate())
3753              throw new Error("Attempt to auto-create ItemComponent.unitPrice");
3754            else if (Configuration.doAutoCreate())
3755              this.unitPrice = new Money(); // cc
3756          return this.unitPrice;
3757        }
3758
3759        public boolean hasUnitPrice() { 
3760          return this.unitPrice != null && !this.unitPrice.isEmpty();
3761        }
3762
3763        /**
3764         * @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.)
3765         */
3766        public ItemComponent setUnitPrice(Money value)  { 
3767          this.unitPrice = value;
3768          return this;
3769        }
3770
3771        /**
3772         * @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
3773         */
3774        public DecimalType getFactorElement() { 
3775          if (this.factor == null)
3776            if (Configuration.errorOnAutoCreate())
3777              throw new Error("Attempt to auto-create ItemComponent.factor");
3778            else if (Configuration.doAutoCreate())
3779              this.factor = new DecimalType(); // bb
3780          return this.factor;
3781        }
3782
3783        public boolean hasFactorElement() { 
3784          return this.factor != null && !this.factor.isEmpty();
3785        }
3786
3787        public boolean hasFactor() { 
3788          return this.factor != null && !this.factor.isEmpty();
3789        }
3790
3791        /**
3792         * @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
3793         */
3794        public ItemComponent setFactorElement(DecimalType value) { 
3795          this.factor = value;
3796          return this;
3797        }
3798
3799        /**
3800         * @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.
3801         */
3802        public BigDecimal getFactor() { 
3803          return this.factor == null ? null : this.factor.getValue();
3804        }
3805
3806        /**
3807         * @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.
3808         */
3809        public ItemComponent setFactor(BigDecimal value) { 
3810          if (value == null)
3811            this.factor = null;
3812          else {
3813            if (this.factor == null)
3814              this.factor = new DecimalType();
3815            this.factor.setValue(value);
3816          }
3817          return this;
3818        }
3819
3820        /**
3821         * @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.
3822         */
3823        public ItemComponent setFactor(long value) { 
3824              this.factor = new DecimalType();
3825            this.factor.setValue(value);
3826          return this;
3827        }
3828
3829        /**
3830         * @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.
3831         */
3832        public ItemComponent setFactor(double value) { 
3833              this.factor = new DecimalType();
3834            this.factor.setValue(value);
3835          return this;
3836        }
3837
3838        /**
3839         * @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.)
3840         */
3841        public Money getNet() { 
3842          if (this.net == null)
3843            if (Configuration.errorOnAutoCreate())
3844              throw new Error("Attempt to auto-create ItemComponent.net");
3845            else if (Configuration.doAutoCreate())
3846              this.net = new Money(); // cc
3847          return this.net;
3848        }
3849
3850        public boolean hasNet() { 
3851          return this.net != null && !this.net.isEmpty();
3852        }
3853
3854        /**
3855         * @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.)
3856         */
3857        public ItemComponent setNet(Money value)  { 
3858          this.net = value;
3859          return this;
3860        }
3861
3862        /**
3863         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
3864         */
3865        public List<Reference> getUdi() { 
3866          if (this.udi == null)
3867            this.udi = new ArrayList<Reference>();
3868          return this.udi;
3869        }
3870
3871        /**
3872         * @return Returns a reference to <code>this</code> for easy method chaining
3873         */
3874        public ItemComponent setUdi(List<Reference> theUdi) { 
3875          this.udi = theUdi;
3876          return this;
3877        }
3878
3879        public boolean hasUdi() { 
3880          if (this.udi == null)
3881            return false;
3882          for (Reference item : this.udi)
3883            if (!item.isEmpty())
3884              return true;
3885          return false;
3886        }
3887
3888        public Reference addUdi() { //3
3889          Reference t = new Reference();
3890          if (this.udi == null)
3891            this.udi = new ArrayList<Reference>();
3892          this.udi.add(t);
3893          return t;
3894        }
3895
3896        public ItemComponent addUdi(Reference t) { //3
3897          if (t == null)
3898            return this;
3899          if (this.udi == null)
3900            this.udi = new ArrayList<Reference>();
3901          this.udi.add(t);
3902          return this;
3903        }
3904
3905        /**
3906         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
3907         */
3908        public Reference getUdiFirstRep() { 
3909          if (getUdi().isEmpty()) {
3910            addUdi();
3911          }
3912          return getUdi().get(0);
3913        }
3914
3915        /**
3916         * @deprecated Use Reference#setResource(IBaseResource) instead
3917         */
3918        @Deprecated
3919        public List<Device> getUdiTarget() { 
3920          if (this.udiTarget == null)
3921            this.udiTarget = new ArrayList<Device>();
3922          return this.udiTarget;
3923        }
3924
3925        /**
3926         * @deprecated Use Reference#setResource(IBaseResource) instead
3927         */
3928        @Deprecated
3929        public Device addUdiTarget() { 
3930          Device r = new Device();
3931          if (this.udiTarget == null)
3932            this.udiTarget = new ArrayList<Device>();
3933          this.udiTarget.add(r);
3934          return r;
3935        }
3936
3937        /**
3938         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc).)
3939         */
3940        public CodeableConcept getBodySite() { 
3941          if (this.bodySite == null)
3942            if (Configuration.errorOnAutoCreate())
3943              throw new Error("Attempt to auto-create ItemComponent.bodySite");
3944            else if (Configuration.doAutoCreate())
3945              this.bodySite = new CodeableConcept(); // cc
3946          return this.bodySite;
3947        }
3948
3949        public boolean hasBodySite() { 
3950          return this.bodySite != null && !this.bodySite.isEmpty();
3951        }
3952
3953        /**
3954         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc).)
3955         */
3956        public ItemComponent setBodySite(CodeableConcept value)  { 
3957          this.bodySite = value;
3958          return this;
3959        }
3960
3961        /**
3962         * @return {@link #subSite} (A region or surface of the site, eg. limb region or tooth surface(s).)
3963         */
3964        public List<CodeableConcept> getSubSite() { 
3965          if (this.subSite == null)
3966            this.subSite = new ArrayList<CodeableConcept>();
3967          return this.subSite;
3968        }
3969
3970        /**
3971         * @return Returns a reference to <code>this</code> for easy method chaining
3972         */
3973        public ItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
3974          this.subSite = theSubSite;
3975          return this;
3976        }
3977
3978        public boolean hasSubSite() { 
3979          if (this.subSite == null)
3980            return false;
3981          for (CodeableConcept item : this.subSite)
3982            if (!item.isEmpty())
3983              return true;
3984          return false;
3985        }
3986
3987        public CodeableConcept addSubSite() { //3
3988          CodeableConcept t = new CodeableConcept();
3989          if (this.subSite == null)
3990            this.subSite = new ArrayList<CodeableConcept>();
3991          this.subSite.add(t);
3992          return t;
3993        }
3994
3995        public ItemComponent addSubSite(CodeableConcept t) { //3
3996          if (t == null)
3997            return this;
3998          if (this.subSite == null)
3999            this.subSite = new ArrayList<CodeableConcept>();
4000          this.subSite.add(t);
4001          return this;
4002        }
4003
4004        /**
4005         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist
4006         */
4007        public CodeableConcept getSubSiteFirstRep() { 
4008          if (getSubSite().isEmpty()) {
4009            addSubSite();
4010          }
4011          return getSubSite().get(0);
4012        }
4013
4014        /**
4015         * @return {@link #encounter} (A billed item may include goods or services provided in multiple encounters.)
4016         */
4017        public List<Reference> getEncounter() { 
4018          if (this.encounter == null)
4019            this.encounter = new ArrayList<Reference>();
4020          return this.encounter;
4021        }
4022
4023        /**
4024         * @return Returns a reference to <code>this</code> for easy method chaining
4025         */
4026        public ItemComponent setEncounter(List<Reference> theEncounter) { 
4027          this.encounter = theEncounter;
4028          return this;
4029        }
4030
4031        public boolean hasEncounter() { 
4032          if (this.encounter == null)
4033            return false;
4034          for (Reference item : this.encounter)
4035            if (!item.isEmpty())
4036              return true;
4037          return false;
4038        }
4039
4040        public Reference addEncounter() { //3
4041          Reference t = new Reference();
4042          if (this.encounter == null)
4043            this.encounter = new ArrayList<Reference>();
4044          this.encounter.add(t);
4045          return t;
4046        }
4047
4048        public ItemComponent addEncounter(Reference t) { //3
4049          if (t == null)
4050            return this;
4051          if (this.encounter == null)
4052            this.encounter = new ArrayList<Reference>();
4053          this.encounter.add(t);
4054          return this;
4055        }
4056
4057        /**
4058         * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist
4059         */
4060        public Reference getEncounterFirstRep() { 
4061          if (getEncounter().isEmpty()) {
4062            addEncounter();
4063          }
4064          return getEncounter().get(0);
4065        }
4066
4067        /**
4068         * @deprecated Use Reference#setResource(IBaseResource) instead
4069         */
4070        @Deprecated
4071        public List<Encounter> getEncounterTarget() { 
4072          if (this.encounterTarget == null)
4073            this.encounterTarget = new ArrayList<Encounter>();
4074          return this.encounterTarget;
4075        }
4076
4077        /**
4078         * @deprecated Use Reference#setResource(IBaseResource) instead
4079         */
4080        @Deprecated
4081        public Encounter addEncounterTarget() { 
4082          Encounter r = new Encounter();
4083          if (this.encounterTarget == null)
4084            this.encounterTarget = new ArrayList<Encounter>();
4085          this.encounterTarget.add(r);
4086          return r;
4087        }
4088
4089        /**
4090         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
4091         */
4092        public List<PositiveIntType> getNoteNumber() { 
4093          if (this.noteNumber == null)
4094            this.noteNumber = new ArrayList<PositiveIntType>();
4095          return this.noteNumber;
4096        }
4097
4098        /**
4099         * @return Returns a reference to <code>this</code> for easy method chaining
4100         */
4101        public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
4102          this.noteNumber = theNoteNumber;
4103          return this;
4104        }
4105
4106        public boolean hasNoteNumber() { 
4107          if (this.noteNumber == null)
4108            return false;
4109          for (PositiveIntType item : this.noteNumber)
4110            if (!item.isEmpty())
4111              return true;
4112          return false;
4113        }
4114
4115        /**
4116         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
4117         */
4118        public PositiveIntType addNoteNumberElement() {//2 
4119          PositiveIntType t = new PositiveIntType();
4120          if (this.noteNumber == null)
4121            this.noteNumber = new ArrayList<PositiveIntType>();
4122          this.noteNumber.add(t);
4123          return t;
4124        }
4125
4126        /**
4127         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
4128         */
4129        public ItemComponent addNoteNumber(int value) { //1
4130          PositiveIntType t = new PositiveIntType();
4131          t.setValue(value);
4132          if (this.noteNumber == null)
4133            this.noteNumber = new ArrayList<PositiveIntType>();
4134          this.noteNumber.add(t);
4135          return this;
4136        }
4137
4138        /**
4139         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
4140         */
4141        public boolean hasNoteNumber(int value) { 
4142          if (this.noteNumber == null)
4143            return false;
4144          for (PositiveIntType v : this.noteNumber)
4145            if (v.getValue().equals(value)) // positiveInt
4146              return true;
4147          return false;
4148        }
4149
4150        /**
4151         * @return {@link #adjudication} (The adjudications results.)
4152         */
4153        public List<AdjudicationComponent> getAdjudication() { 
4154          if (this.adjudication == null)
4155            this.adjudication = new ArrayList<AdjudicationComponent>();
4156          return this.adjudication;
4157        }
4158
4159        /**
4160         * @return Returns a reference to <code>this</code> for easy method chaining
4161         */
4162        public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
4163          this.adjudication = theAdjudication;
4164          return this;
4165        }
4166
4167        public boolean hasAdjudication() { 
4168          if (this.adjudication == null)
4169            return false;
4170          for (AdjudicationComponent item : this.adjudication)
4171            if (!item.isEmpty())
4172              return true;
4173          return false;
4174        }
4175
4176        public AdjudicationComponent addAdjudication() { //3
4177          AdjudicationComponent t = new AdjudicationComponent();
4178          if (this.adjudication == null)
4179            this.adjudication = new ArrayList<AdjudicationComponent>();
4180          this.adjudication.add(t);
4181          return t;
4182        }
4183
4184        public ItemComponent addAdjudication(AdjudicationComponent t) { //3
4185          if (t == null)
4186            return this;
4187          if (this.adjudication == null)
4188            this.adjudication = new ArrayList<AdjudicationComponent>();
4189          this.adjudication.add(t);
4190          return this;
4191        }
4192
4193        /**
4194         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
4195         */
4196        public AdjudicationComponent getAdjudicationFirstRep() { 
4197          if (getAdjudication().isEmpty()) {
4198            addAdjudication();
4199          }
4200          return getAdjudication().get(0);
4201        }
4202
4203        /**
4204         * @return {@link #detail} (Second tier of goods and services.)
4205         */
4206        public List<DetailComponent> getDetail() { 
4207          if (this.detail == null)
4208            this.detail = new ArrayList<DetailComponent>();
4209          return this.detail;
4210        }
4211
4212        /**
4213         * @return Returns a reference to <code>this</code> for easy method chaining
4214         */
4215        public ItemComponent setDetail(List<DetailComponent> theDetail) { 
4216          this.detail = theDetail;
4217          return this;
4218        }
4219
4220        public boolean hasDetail() { 
4221          if (this.detail == null)
4222            return false;
4223          for (DetailComponent item : this.detail)
4224            if (!item.isEmpty())
4225              return true;
4226          return false;
4227        }
4228
4229        public DetailComponent addDetail() { //3
4230          DetailComponent t = new DetailComponent();
4231          if (this.detail == null)
4232            this.detail = new ArrayList<DetailComponent>();
4233          this.detail.add(t);
4234          return t;
4235        }
4236
4237        public ItemComponent addDetail(DetailComponent t) { //3
4238          if (t == null)
4239            return this;
4240          if (this.detail == null)
4241            this.detail = new ArrayList<DetailComponent>();
4242          this.detail.add(t);
4243          return this;
4244        }
4245
4246        /**
4247         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
4248         */
4249        public DetailComponent getDetailFirstRep() { 
4250          if (getDetail().isEmpty()) {
4251            addDetail();
4252          }
4253          return getDetail().get(0);
4254        }
4255
4256        protected void listChildren(List<Property> children) {
4257          super.listChildren(children);
4258          children.add(new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence));
4259          children.add(new Property("careTeamLinkId", "positiveInt", "Careteam applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, careTeamLinkId));
4260          children.add(new Property("diagnosisLinkId", "positiveInt", "Diagnosis applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, diagnosisLinkId));
4261          children.add(new Property("procedureLinkId", "positiveInt", "Procedures applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, procedureLinkId));
4262          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));
4263          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
4264          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
4265          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));
4266          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));
4267          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));
4268          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));
4269          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location));
4270          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
4271          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));
4272          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));
4273          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));
4274          children.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
4275          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc).", 0, 1, bodySite));
4276          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));
4277          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));
4278          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
4279          children.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
4280          children.add(new Property("detail", "", "Second tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
4281        }
4282
4283        @Override
4284        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4285          switch (_hash) {
4286          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence);
4287          case -186757789: /*careTeamLinkId*/  return new Property("careTeamLinkId", "positiveInt", "Careteam applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, careTeamLinkId);
4288          case -1659207418: /*diagnosisLinkId*/  return new Property("diagnosisLinkId", "positiveInt", "Diagnosis applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, diagnosisLinkId);
4289          case -532846744: /*procedureLinkId*/  return new Property("procedureLinkId", "positiveInt", "Procedures applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, procedureLinkId);
4290          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);
4291          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
4292          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
4293          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);
4294          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);
4295          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);
4296          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);
4297          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);
4298          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);
4299          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);
4300          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4301          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4302          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4303          case -1280020865: /*locationAddress*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4304          case 755866390: /*locationReference*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4305          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
4306          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);
4307          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);
4308          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);
4309          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);
4310          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc).", 0, 1, bodySite);
4311          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);
4312          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);
4313          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);
4314          case -231349275: /*adjudication*/  return new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
4315          case -1335224239: /*detail*/  return new Property("detail", "", "Second tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail);
4316          default: return super.getNamedProperty(_hash, _name, _checkValid);
4317          }
4318
4319        }
4320
4321      @Override
4322      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4323        switch (hash) {
4324        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
4325        case -186757789: /*careTeamLinkId*/ return this.careTeamLinkId == null ? new Base[0] : this.careTeamLinkId.toArray(new Base[this.careTeamLinkId.size()]); // PositiveIntType
4326        case -1659207418: /*diagnosisLinkId*/ return this.diagnosisLinkId == null ? new Base[0] : this.diagnosisLinkId.toArray(new Base[this.diagnosisLinkId.size()]); // PositiveIntType
4327        case -532846744: /*procedureLinkId*/ return this.procedureLinkId == null ? new Base[0] : this.procedureLinkId.toArray(new Base[this.procedureLinkId.size()]); // PositiveIntType
4328        case 1965585153: /*informationLinkId*/ return this.informationLinkId == null ? new Base[0] : this.informationLinkId.toArray(new Base[this.informationLinkId.size()]); // PositiveIntType
4329        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
4330        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4331        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
4332        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
4333        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
4334        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
4335        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
4336        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
4337        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
4338        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
4339        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
4340        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
4341        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
4342        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
4343        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
4344        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
4345        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
4346        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
4347        default: return super.getProperty(hash, name, checkValid);
4348        }
4349
4350      }
4351
4352      @Override
4353      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4354        switch (hash) {
4355        case 1349547969: // sequence
4356          this.sequence = castToPositiveInt(value); // PositiveIntType
4357          return value;
4358        case -186757789: // careTeamLinkId
4359          this.getCareTeamLinkId().add(castToPositiveInt(value)); // PositiveIntType
4360          return value;
4361        case -1659207418: // diagnosisLinkId
4362          this.getDiagnosisLinkId().add(castToPositiveInt(value)); // PositiveIntType
4363          return value;
4364        case -532846744: // procedureLinkId
4365          this.getProcedureLinkId().add(castToPositiveInt(value)); // PositiveIntType
4366          return value;
4367        case 1965585153: // informationLinkId
4368          this.getInformationLinkId().add(castToPositiveInt(value)); // PositiveIntType
4369          return value;
4370        case 1099842588: // revenue
4371          this.revenue = castToCodeableConcept(value); // CodeableConcept
4372          return value;
4373        case 50511102: // category
4374          this.category = castToCodeableConcept(value); // CodeableConcept
4375          return value;
4376        case 1984153269: // service
4377          this.service = castToCodeableConcept(value); // CodeableConcept
4378          return value;
4379        case -615513385: // modifier
4380          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
4381          return value;
4382        case 1010065041: // programCode
4383          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
4384          return value;
4385        case 1379209295: // serviced
4386          this.serviced = castToType(value); // Type
4387          return value;
4388        case 1901043637: // location
4389          this.location = castToType(value); // Type
4390          return value;
4391        case -1285004149: // quantity
4392          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
4393          return value;
4394        case -486196699: // unitPrice
4395          this.unitPrice = castToMoney(value); // Money
4396          return value;
4397        case -1282148017: // factor
4398          this.factor = castToDecimal(value); // DecimalType
4399          return value;
4400        case 108957: // net
4401          this.net = castToMoney(value); // Money
4402          return value;
4403        case 115642: // udi
4404          this.getUdi().add(castToReference(value)); // Reference
4405          return value;
4406        case 1702620169: // bodySite
4407          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4408          return value;
4409        case -1868566105: // subSite
4410          this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
4411          return value;
4412        case 1524132147: // encounter
4413          this.getEncounter().add(castToReference(value)); // Reference
4414          return value;
4415        case -1110033957: // noteNumber
4416          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
4417          return value;
4418        case -231349275: // adjudication
4419          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
4420          return value;
4421        case -1335224239: // detail
4422          this.getDetail().add((DetailComponent) value); // DetailComponent
4423          return value;
4424        default: return super.setProperty(hash, name, value);
4425        }
4426
4427      }
4428
4429      @Override
4430      public Base setProperty(String name, Base value) throws FHIRException {
4431        if (name.equals("sequence")) {
4432          this.sequence = castToPositiveInt(value); // PositiveIntType
4433        } else if (name.equals("careTeamLinkId")) {
4434          this.getCareTeamLinkId().add(castToPositiveInt(value));
4435        } else if (name.equals("diagnosisLinkId")) {
4436          this.getDiagnosisLinkId().add(castToPositiveInt(value));
4437        } else if (name.equals("procedureLinkId")) {
4438          this.getProcedureLinkId().add(castToPositiveInt(value));
4439        } else if (name.equals("informationLinkId")) {
4440          this.getInformationLinkId().add(castToPositiveInt(value));
4441        } else if (name.equals("revenue")) {
4442          this.revenue = castToCodeableConcept(value); // CodeableConcept
4443        } else if (name.equals("category")) {
4444          this.category = castToCodeableConcept(value); // CodeableConcept
4445        } else if (name.equals("service")) {
4446          this.service = castToCodeableConcept(value); // CodeableConcept
4447        } else if (name.equals("modifier")) {
4448          this.getModifier().add(castToCodeableConcept(value));
4449        } else if (name.equals("programCode")) {
4450          this.getProgramCode().add(castToCodeableConcept(value));
4451        } else if (name.equals("serviced[x]")) {
4452          this.serviced = castToType(value); // Type
4453        } else if (name.equals("location[x]")) {
4454          this.location = castToType(value); // Type
4455        } else if (name.equals("quantity")) {
4456          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
4457        } else if (name.equals("unitPrice")) {
4458          this.unitPrice = castToMoney(value); // Money
4459        } else if (name.equals("factor")) {
4460          this.factor = castToDecimal(value); // DecimalType
4461        } else if (name.equals("net")) {
4462          this.net = castToMoney(value); // Money
4463        } else if (name.equals("udi")) {
4464          this.getUdi().add(castToReference(value));
4465        } else if (name.equals("bodySite")) {
4466          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4467        } else if (name.equals("subSite")) {
4468          this.getSubSite().add(castToCodeableConcept(value));
4469        } else if (name.equals("encounter")) {
4470          this.getEncounter().add(castToReference(value));
4471        } else if (name.equals("noteNumber")) {
4472          this.getNoteNumber().add(castToPositiveInt(value));
4473        } else if (name.equals("adjudication")) {
4474          this.getAdjudication().add((AdjudicationComponent) value);
4475        } else if (name.equals("detail")) {
4476          this.getDetail().add((DetailComponent) value);
4477        } else
4478          return super.setProperty(name, value);
4479        return value;
4480      }
4481
4482      @Override
4483      public Base makeProperty(int hash, String name) throws FHIRException {
4484        switch (hash) {
4485        case 1349547969:  return getSequenceElement();
4486        case -186757789:  return addCareTeamLinkIdElement();
4487        case -1659207418:  return addDiagnosisLinkIdElement();
4488        case -532846744:  return addProcedureLinkIdElement();
4489        case 1965585153:  return addInformationLinkIdElement();
4490        case 1099842588:  return getRevenue(); 
4491        case 50511102:  return getCategory(); 
4492        case 1984153269:  return getService(); 
4493        case -615513385:  return addModifier(); 
4494        case 1010065041:  return addProgramCode(); 
4495        case -1927922223:  return getServiced(); 
4496        case 1379209295:  return getServiced(); 
4497        case 552316075:  return getLocation(); 
4498        case 1901043637:  return getLocation(); 
4499        case -1285004149:  return getQuantity(); 
4500        case -486196699:  return getUnitPrice(); 
4501        case -1282148017:  return getFactorElement();
4502        case 108957:  return getNet(); 
4503        case 115642:  return addUdi(); 
4504        case 1702620169:  return getBodySite(); 
4505        case -1868566105:  return addSubSite(); 
4506        case 1524132147:  return addEncounter(); 
4507        case -1110033957:  return addNoteNumberElement();
4508        case -231349275:  return addAdjudication(); 
4509        case -1335224239:  return addDetail(); 
4510        default: return super.makeProperty(hash, name);
4511        }
4512
4513      }
4514
4515      @Override
4516      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4517        switch (hash) {
4518        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
4519        case -186757789: /*careTeamLinkId*/ return new String[] {"positiveInt"};
4520        case -1659207418: /*diagnosisLinkId*/ return new String[] {"positiveInt"};
4521        case -532846744: /*procedureLinkId*/ return new String[] {"positiveInt"};
4522        case 1965585153: /*informationLinkId*/ return new String[] {"positiveInt"};
4523        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
4524        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4525        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
4526        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
4527        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
4528        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
4529        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
4530        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
4531        case -486196699: /*unitPrice*/ return new String[] {"Money"};
4532        case -1282148017: /*factor*/ return new String[] {"decimal"};
4533        case 108957: /*net*/ return new String[] {"Money"};
4534        case 115642: /*udi*/ return new String[] {"Reference"};
4535        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
4536        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
4537        case 1524132147: /*encounter*/ return new String[] {"Reference"};
4538        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
4539        case -231349275: /*adjudication*/ return new String[] {};
4540        case -1335224239: /*detail*/ return new String[] {};
4541        default: return super.getTypesForProperty(hash, name);
4542        }
4543
4544      }
4545
4546      @Override
4547      public Base addChild(String name) throws FHIRException {
4548        if (name.equals("sequence")) {
4549          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
4550        }
4551        else if (name.equals("careTeamLinkId")) {
4552          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeamLinkId");
4553        }
4554        else if (name.equals("diagnosisLinkId")) {
4555          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.diagnosisLinkId");
4556        }
4557        else if (name.equals("procedureLinkId")) {
4558          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedureLinkId");
4559        }
4560        else if (name.equals("informationLinkId")) {
4561          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.informationLinkId");
4562        }
4563        else if (name.equals("revenue")) {
4564          this.revenue = new CodeableConcept();
4565          return this.revenue;
4566        }
4567        else if (name.equals("category")) {
4568          this.category = new CodeableConcept();
4569          return this.category;
4570        }
4571        else if (name.equals("service")) {
4572          this.service = new CodeableConcept();
4573          return this.service;
4574        }
4575        else if (name.equals("modifier")) {
4576          return addModifier();
4577        }
4578        else if (name.equals("programCode")) {
4579          return addProgramCode();
4580        }
4581        else if (name.equals("servicedDate")) {
4582          this.serviced = new DateType();
4583          return this.serviced;
4584        }
4585        else if (name.equals("servicedPeriod")) {
4586          this.serviced = new Period();
4587          return this.serviced;
4588        }
4589        else if (name.equals("locationCodeableConcept")) {
4590          this.location = new CodeableConcept();
4591          return this.location;
4592        }
4593        else if (name.equals("locationAddress")) {
4594          this.location = new Address();
4595          return this.location;
4596        }
4597        else if (name.equals("locationReference")) {
4598          this.location = new Reference();
4599          return this.location;
4600        }
4601        else if (name.equals("quantity")) {
4602          this.quantity = new SimpleQuantity();
4603          return this.quantity;
4604        }
4605        else if (name.equals("unitPrice")) {
4606          this.unitPrice = new Money();
4607          return this.unitPrice;
4608        }
4609        else if (name.equals("factor")) {
4610          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
4611        }
4612        else if (name.equals("net")) {
4613          this.net = new Money();
4614          return this.net;
4615        }
4616        else if (name.equals("udi")) {
4617          return addUdi();
4618        }
4619        else if (name.equals("bodySite")) {
4620          this.bodySite = new CodeableConcept();
4621          return this.bodySite;
4622        }
4623        else if (name.equals("subSite")) {
4624          return addSubSite();
4625        }
4626        else if (name.equals("encounter")) {
4627          return addEncounter();
4628        }
4629        else if (name.equals("noteNumber")) {
4630          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
4631        }
4632        else if (name.equals("adjudication")) {
4633          return addAdjudication();
4634        }
4635        else if (name.equals("detail")) {
4636          return addDetail();
4637        }
4638        else
4639          return super.addChild(name);
4640      }
4641
4642      public ItemComponent copy() {
4643        ItemComponent dst = new ItemComponent();
4644        copyValues(dst);
4645        dst.sequence = sequence == null ? null : sequence.copy();
4646        if (careTeamLinkId != null) {
4647          dst.careTeamLinkId = new ArrayList<PositiveIntType>();
4648          for (PositiveIntType i : careTeamLinkId)
4649            dst.careTeamLinkId.add(i.copy());
4650        };
4651        if (diagnosisLinkId != null) {
4652          dst.diagnosisLinkId = new ArrayList<PositiveIntType>();
4653          for (PositiveIntType i : diagnosisLinkId)
4654            dst.diagnosisLinkId.add(i.copy());
4655        };
4656        if (procedureLinkId != null) {
4657          dst.procedureLinkId = new ArrayList<PositiveIntType>();
4658          for (PositiveIntType i : procedureLinkId)
4659            dst.procedureLinkId.add(i.copy());
4660        };
4661        if (informationLinkId != null) {
4662          dst.informationLinkId = new ArrayList<PositiveIntType>();
4663          for (PositiveIntType i : informationLinkId)
4664            dst.informationLinkId.add(i.copy());
4665        };
4666        dst.revenue = revenue == null ? null : revenue.copy();
4667        dst.category = category == null ? null : category.copy();
4668        dst.service = service == null ? null : service.copy();
4669        if (modifier != null) {
4670          dst.modifier = new ArrayList<CodeableConcept>();
4671          for (CodeableConcept i : modifier)
4672            dst.modifier.add(i.copy());
4673        };
4674        if (programCode != null) {
4675          dst.programCode = new ArrayList<CodeableConcept>();
4676          for (CodeableConcept i : programCode)
4677            dst.programCode.add(i.copy());
4678        };
4679        dst.serviced = serviced == null ? null : serviced.copy();
4680        dst.location = location == null ? null : location.copy();
4681        dst.quantity = quantity == null ? null : quantity.copy();
4682        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
4683        dst.factor = factor == null ? null : factor.copy();
4684        dst.net = net == null ? null : net.copy();
4685        if (udi != null) {
4686          dst.udi = new ArrayList<Reference>();
4687          for (Reference i : udi)
4688            dst.udi.add(i.copy());
4689        };
4690        dst.bodySite = bodySite == null ? null : bodySite.copy();
4691        if (subSite != null) {
4692          dst.subSite = new ArrayList<CodeableConcept>();
4693          for (CodeableConcept i : subSite)
4694            dst.subSite.add(i.copy());
4695        };
4696        if (encounter != null) {
4697          dst.encounter = new ArrayList<Reference>();
4698          for (Reference i : encounter)
4699            dst.encounter.add(i.copy());
4700        };
4701        if (noteNumber != null) {
4702          dst.noteNumber = new ArrayList<PositiveIntType>();
4703          for (PositiveIntType i : noteNumber)
4704            dst.noteNumber.add(i.copy());
4705        };
4706        if (adjudication != null) {
4707          dst.adjudication = new ArrayList<AdjudicationComponent>();
4708          for (AdjudicationComponent i : adjudication)
4709            dst.adjudication.add(i.copy());
4710        };
4711        if (detail != null) {
4712          dst.detail = new ArrayList<DetailComponent>();
4713          for (DetailComponent i : detail)
4714            dst.detail.add(i.copy());
4715        };
4716        return dst;
4717      }
4718
4719      @Override
4720      public boolean equalsDeep(Base other_) {
4721        if (!super.equalsDeep(other_))
4722          return false;
4723        if (!(other_ instanceof ItemComponent))
4724          return false;
4725        ItemComponent o = (ItemComponent) other_;
4726        return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamLinkId, o.careTeamLinkId, true)
4727           && compareDeep(diagnosisLinkId, o.diagnosisLinkId, true) && compareDeep(procedureLinkId, o.procedureLinkId, true)
4728           && compareDeep(informationLinkId, o.informationLinkId, true) && compareDeep(revenue, o.revenue, true)
4729           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
4730           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
4731           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
4732           && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true) && compareDeep(bodySite, o.bodySite, true)
4733           && compareDeep(subSite, o.subSite, true) && compareDeep(encounter, o.encounter, true) && compareDeep(noteNumber, o.noteNumber, true)
4734           && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
4735      }
4736
4737      @Override
4738      public boolean equalsShallow(Base other_) {
4739        if (!super.equalsShallow(other_))
4740          return false;
4741        if (!(other_ instanceof ItemComponent))
4742          return false;
4743        ItemComponent o = (ItemComponent) other_;
4744        return compareValues(sequence, o.sequence, true) && compareValues(careTeamLinkId, o.careTeamLinkId, true)
4745           && compareValues(diagnosisLinkId, o.diagnosisLinkId, true) && compareValues(procedureLinkId, o.procedureLinkId, true)
4746           && compareValues(informationLinkId, o.informationLinkId, true) && compareValues(factor, o.factor, true)
4747           && compareValues(noteNumber, o.noteNumber, true);
4748      }
4749
4750      public boolean isEmpty() {
4751        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamLinkId, diagnosisLinkId
4752          , procedureLinkId, informationLinkId, revenue, category, service, modifier, programCode
4753          , serviced, location, quantity, unitPrice, factor, net, udi, bodySite, subSite
4754          , encounter, noteNumber, adjudication, detail);
4755      }
4756
4757  public String fhirType() {
4758    return "ExplanationOfBenefit.item";
4759
4760  }
4761
4762  }
4763
4764    @Block()
4765    public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
4766        /**
4767         * Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.
4768         */
4769        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
4770        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc." )
4771        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
4772        protected CodeableConcept category;
4773
4774        /**
4775         * Adjudication reason such as limit reached.
4776         */
4777        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
4778        @Description(shortDefinition="Explanation of Adjudication outcome", formalDefinition="Adjudication reason such as limit reached." )
4779        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-reason")
4780        protected CodeableConcept reason;
4781
4782        /**
4783         * Monitory amount associated with the code.
4784         */
4785        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
4786        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
4787        protected Money amount;
4788
4789        /**
4790         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4791         */
4792        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
4793        @Description(shortDefinition="Non-monitory value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
4794        protected DecimalType value;
4795
4796        private static final long serialVersionUID = 1559898786L;
4797
4798    /**
4799     * Constructor
4800     */
4801      public AdjudicationComponent() {
4802        super();
4803      }
4804
4805    /**
4806     * Constructor
4807     */
4808      public AdjudicationComponent(CodeableConcept category) {
4809        super();
4810        this.category = category;
4811      }
4812
4813        /**
4814         * @return {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
4815         */
4816        public CodeableConcept getCategory() { 
4817          if (this.category == null)
4818            if (Configuration.errorOnAutoCreate())
4819              throw new Error("Attempt to auto-create AdjudicationComponent.category");
4820            else if (Configuration.doAutoCreate())
4821              this.category = new CodeableConcept(); // cc
4822          return this.category;
4823        }
4824
4825        public boolean hasCategory() { 
4826          return this.category != null && !this.category.isEmpty();
4827        }
4828
4829        /**
4830         * @param value {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
4831         */
4832        public AdjudicationComponent setCategory(CodeableConcept value)  { 
4833          this.category = value;
4834          return this;
4835        }
4836
4837        /**
4838         * @return {@link #reason} (Adjudication reason such as limit reached.)
4839         */
4840        public CodeableConcept getReason() { 
4841          if (this.reason == null)
4842            if (Configuration.errorOnAutoCreate())
4843              throw new Error("Attempt to auto-create AdjudicationComponent.reason");
4844            else if (Configuration.doAutoCreate())
4845              this.reason = new CodeableConcept(); // cc
4846          return this.reason;
4847        }
4848
4849        public boolean hasReason() { 
4850          return this.reason != null && !this.reason.isEmpty();
4851        }
4852
4853        /**
4854         * @param value {@link #reason} (Adjudication reason such as limit reached.)
4855         */
4856        public AdjudicationComponent setReason(CodeableConcept value)  { 
4857          this.reason = value;
4858          return this;
4859        }
4860
4861        /**
4862         * @return {@link #amount} (Monitory amount associated with the code.)
4863         */
4864        public Money getAmount() { 
4865          if (this.amount == null)
4866            if (Configuration.errorOnAutoCreate())
4867              throw new Error("Attempt to auto-create AdjudicationComponent.amount");
4868            else if (Configuration.doAutoCreate())
4869              this.amount = new Money(); // cc
4870          return this.amount;
4871        }
4872
4873        public boolean hasAmount() { 
4874          return this.amount != null && !this.amount.isEmpty();
4875        }
4876
4877        /**
4878         * @param value {@link #amount} (Monitory amount associated with the code.)
4879         */
4880        public AdjudicationComponent setAmount(Money value)  { 
4881          this.amount = value;
4882          return this;
4883        }
4884
4885        /**
4886         * @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
4887         */
4888        public DecimalType getValueElement() { 
4889          if (this.value == null)
4890            if (Configuration.errorOnAutoCreate())
4891              throw new Error("Attempt to auto-create AdjudicationComponent.value");
4892            else if (Configuration.doAutoCreate())
4893              this.value = new DecimalType(); // bb
4894          return this.value;
4895        }
4896
4897        public boolean hasValueElement() { 
4898          return this.value != null && !this.value.isEmpty();
4899        }
4900
4901        public boolean hasValue() { 
4902          return this.value != null && !this.value.isEmpty();
4903        }
4904
4905        /**
4906         * @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
4907         */
4908        public AdjudicationComponent setValueElement(DecimalType value) { 
4909          this.value = value;
4910          return this;
4911        }
4912
4913        /**
4914         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4915         */
4916        public BigDecimal getValue() { 
4917          return this.value == null ? null : this.value.getValue();
4918        }
4919
4920        /**
4921         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4922         */
4923        public AdjudicationComponent setValue(BigDecimal value) { 
4924          if (value == null)
4925            this.value = null;
4926          else {
4927            if (this.value == null)
4928              this.value = new DecimalType();
4929            this.value.setValue(value);
4930          }
4931          return this;
4932        }
4933
4934        /**
4935         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4936         */
4937        public AdjudicationComponent setValue(long value) { 
4938              this.value = new DecimalType();
4939            this.value.setValue(value);
4940          return this;
4941        }
4942
4943        /**
4944         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4945         */
4946        public AdjudicationComponent setValue(double value) { 
4947              this.value = new DecimalType();
4948            this.value.setValue(value);
4949          return this;
4950        }
4951
4952        protected void listChildren(List<Property> children) {
4953          super.listChildren(children);
4954          children.add(new Property("category", "CodeableConcept", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, 1, category));
4955          children.add(new Property("reason", "CodeableConcept", "Adjudication reason such as limit reached.", 0, 1, reason));
4956          children.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, 1, amount));
4957          children.add(new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, 1, value));
4958        }
4959
4960        @Override
4961        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4962          switch (_hash) {
4963          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, 1, category);
4964          case -934964668: /*reason*/  return new Property("reason", "CodeableConcept", "Adjudication reason such as limit reached.", 0, 1, reason);
4965          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monitory amount associated with the code.", 0, 1, amount);
4966          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);
4967          default: return super.getNamedProperty(_hash, _name, _checkValid);
4968          }
4969
4970        }
4971
4972      @Override
4973      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4974        switch (hash) {
4975        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4976        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
4977        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
4978        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
4979        default: return super.getProperty(hash, name, checkValid);
4980        }
4981
4982      }
4983
4984      @Override
4985      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4986        switch (hash) {
4987        case 50511102: // category
4988          this.category = castToCodeableConcept(value); // CodeableConcept
4989          return value;
4990        case -934964668: // reason
4991          this.reason = castToCodeableConcept(value); // CodeableConcept
4992          return value;
4993        case -1413853096: // amount
4994          this.amount = castToMoney(value); // Money
4995          return value;
4996        case 111972721: // value
4997          this.value = castToDecimal(value); // DecimalType
4998          return value;
4999        default: return super.setProperty(hash, name, value);
5000        }
5001
5002      }
5003
5004      @Override
5005      public Base setProperty(String name, Base value) throws FHIRException {
5006        if (name.equals("category")) {
5007          this.category = castToCodeableConcept(value); // CodeableConcept
5008        } else if (name.equals("reason")) {
5009          this.reason = castToCodeableConcept(value); // CodeableConcept
5010        } else if (name.equals("amount")) {
5011          this.amount = castToMoney(value); // Money
5012        } else if (name.equals("value")) {
5013          this.value = castToDecimal(value); // DecimalType
5014        } else
5015          return super.setProperty(name, value);
5016        return value;
5017      }
5018
5019      @Override
5020      public Base makeProperty(int hash, String name) throws FHIRException {
5021        switch (hash) {
5022        case 50511102:  return getCategory(); 
5023        case -934964668:  return getReason(); 
5024        case -1413853096:  return getAmount(); 
5025        case 111972721:  return getValueElement();
5026        default: return super.makeProperty(hash, name);
5027        }
5028
5029      }
5030
5031      @Override
5032      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5033        switch (hash) {
5034        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5035        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
5036        case -1413853096: /*amount*/ return new String[] {"Money"};
5037        case 111972721: /*value*/ return new String[] {"decimal"};
5038        default: return super.getTypesForProperty(hash, name);
5039        }
5040
5041      }
5042
5043      @Override
5044      public Base addChild(String name) throws FHIRException {
5045        if (name.equals("category")) {
5046          this.category = new CodeableConcept();
5047          return this.category;
5048        }
5049        else if (name.equals("reason")) {
5050          this.reason = new CodeableConcept();
5051          return this.reason;
5052        }
5053        else if (name.equals("amount")) {
5054          this.amount = new Money();
5055          return this.amount;
5056        }
5057        else if (name.equals("value")) {
5058          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
5059        }
5060        else
5061          return super.addChild(name);
5062      }
5063
5064      public AdjudicationComponent copy() {
5065        AdjudicationComponent dst = new AdjudicationComponent();
5066        copyValues(dst);
5067        dst.category = category == null ? null : category.copy();
5068        dst.reason = reason == null ? null : reason.copy();
5069        dst.amount = amount == null ? null : amount.copy();
5070        dst.value = value == null ? null : value.copy();
5071        return dst;
5072      }
5073
5074      @Override
5075      public boolean equalsDeep(Base other_) {
5076        if (!super.equalsDeep(other_))
5077          return false;
5078        if (!(other_ instanceof AdjudicationComponent))
5079          return false;
5080        AdjudicationComponent o = (AdjudicationComponent) other_;
5081        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
5082           && compareDeep(value, o.value, true);
5083      }
5084
5085      @Override
5086      public boolean equalsShallow(Base other_) {
5087        if (!super.equalsShallow(other_))
5088          return false;
5089        if (!(other_ instanceof AdjudicationComponent))
5090          return false;
5091        AdjudicationComponent o = (AdjudicationComponent) other_;
5092        return compareValues(value, o.value, true);
5093      }
5094
5095      public boolean isEmpty() {
5096        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount
5097          , value);
5098      }
5099
5100  public String fhirType() {
5101    return "ExplanationOfBenefit.item.adjudication";
5102
5103  }
5104
5105  }
5106
5107    @Block()
5108    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
5109        /**
5110         * A service line number.
5111         */
5112        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
5113        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
5114        protected PositiveIntType sequence;
5115
5116        /**
5117         * The type of product or service.
5118         */
5119        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
5120        @Description(shortDefinition="Group or type of product or service", formalDefinition="The type of product or service." )
5121        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActInvoiceGroupCode")
5122        protected CodeableConcept type;
5123
5124        /**
5125         * The type of reveneu or cost center providing the product and/or service.
5126         */
5127        @Child(name = "revenue", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
5128        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
5129        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
5130        protected CodeableConcept revenue;
5131
5132        /**
5133         * Health Care Service Type Codes  to identify the classification of service or benefits.
5134         */
5135        @Child(name = "category", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
5136        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
5137        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
5138        protected CodeableConcept category;
5139
5140        /**
5141         * 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'.
5142         */
5143        @Child(name = "service", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
5144        @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'." )
5145        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
5146        protected CodeableConcept service;
5147
5148        /**
5149         * 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.
5150         */
5151        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5152        @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." )
5153        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
5154        protected List<CodeableConcept> modifier;
5155
5156        /**
5157         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
5158         */
5159        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5160        @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." )
5161        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
5162        protected List<CodeableConcept> programCode;
5163
5164        /**
5165         * The number of repetitions of a service or product.
5166         */
5167        @Child(name = "quantity", type = {SimpleQuantity.class}, order=8, min=0, max=1, modifier=false, summary=false)
5168        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
5169        protected SimpleQuantity quantity;
5170
5171        /**
5172         * 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.
5173         */
5174        @Child(name = "unitPrice", type = {Money.class}, order=9, min=0, max=1, modifier=false, summary=false)
5175        @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." )
5176        protected Money unitPrice;
5177
5178        /**
5179         * 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.
5180         */
5181        @Child(name = "factor", type = {DecimalType.class}, order=10, min=0, max=1, modifier=false, summary=false)
5182        @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." )
5183        protected DecimalType factor;
5184
5185        /**
5186         * 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.
5187         */
5188        @Child(name = "net", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=false)
5189        @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." )
5190        protected Money net;
5191
5192        /**
5193         * List of Unique Device Identifiers associated with this line item.
5194         */
5195        @Child(name = "udi", type = {Device.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5196        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
5197        protected List<Reference> udi;
5198        /**
5199         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
5200         */
5201        protected List<Device> udiTarget;
5202
5203
5204        /**
5205         * A list of note references to the notes provided below.
5206         */
5207        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5208        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
5209        protected List<PositiveIntType> noteNumber;
5210
5211        /**
5212         * The adjudications results.
5213         */
5214        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5215        @Description(shortDefinition="Detail level adjudication details", formalDefinition="The adjudications results." )
5216        protected List<AdjudicationComponent> adjudication;
5217
5218        /**
5219         * Third tier of goods and services.
5220         */
5221        @Child(name = "subDetail", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5222        @Description(shortDefinition="Additional items", formalDefinition="Third tier of goods and services." )
5223        protected List<SubDetailComponent> subDetail;
5224
5225        private static final long serialVersionUID = -276371489L;
5226
5227    /**
5228     * Constructor
5229     */
5230      public DetailComponent() {
5231        super();
5232      }
5233
5234    /**
5235     * Constructor
5236     */
5237      public DetailComponent(PositiveIntType sequence, CodeableConcept type) {
5238        super();
5239        this.sequence = sequence;
5240        this.type = type;
5241      }
5242
5243        /**
5244         * @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
5245         */
5246        public PositiveIntType getSequenceElement() { 
5247          if (this.sequence == null)
5248            if (Configuration.errorOnAutoCreate())
5249              throw new Error("Attempt to auto-create DetailComponent.sequence");
5250            else if (Configuration.doAutoCreate())
5251              this.sequence = new PositiveIntType(); // bb
5252          return this.sequence;
5253        }
5254
5255        public boolean hasSequenceElement() { 
5256          return this.sequence != null && !this.sequence.isEmpty();
5257        }
5258
5259        public boolean hasSequence() { 
5260          return this.sequence != null && !this.sequence.isEmpty();
5261        }
5262
5263        /**
5264         * @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
5265         */
5266        public DetailComponent setSequenceElement(PositiveIntType value) { 
5267          this.sequence = value;
5268          return this;
5269        }
5270
5271        /**
5272         * @return A service line number.
5273         */
5274        public int getSequence() { 
5275          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
5276        }
5277
5278        /**
5279         * @param value A service line number.
5280         */
5281        public DetailComponent setSequence(int value) { 
5282            if (this.sequence == null)
5283              this.sequence = new PositiveIntType();
5284            this.sequence.setValue(value);
5285          return this;
5286        }
5287
5288        /**
5289         * @return {@link #type} (The type of product or service.)
5290         */
5291        public CodeableConcept getType() { 
5292          if (this.type == null)
5293            if (Configuration.errorOnAutoCreate())
5294              throw new Error("Attempt to auto-create DetailComponent.type");
5295            else if (Configuration.doAutoCreate())
5296              this.type = new CodeableConcept(); // cc
5297          return this.type;
5298        }
5299
5300        public boolean hasType() { 
5301          return this.type != null && !this.type.isEmpty();
5302        }
5303
5304        /**
5305         * @param value {@link #type} (The type of product or service.)
5306         */
5307        public DetailComponent setType(CodeableConcept value)  { 
5308          this.type = value;
5309          return this;
5310        }
5311
5312        /**
5313         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
5314         */
5315        public CodeableConcept getRevenue() { 
5316          if (this.revenue == null)
5317            if (Configuration.errorOnAutoCreate())
5318              throw new Error("Attempt to auto-create DetailComponent.revenue");
5319            else if (Configuration.doAutoCreate())
5320              this.revenue = new CodeableConcept(); // cc
5321          return this.revenue;
5322        }
5323
5324        public boolean hasRevenue() { 
5325          return this.revenue != null && !this.revenue.isEmpty();
5326        }
5327
5328        /**
5329         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
5330         */
5331        public DetailComponent setRevenue(CodeableConcept value)  { 
5332          this.revenue = value;
5333          return this;
5334        }
5335
5336        /**
5337         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
5338         */
5339        public CodeableConcept getCategory() { 
5340          if (this.category == null)
5341            if (Configuration.errorOnAutoCreate())
5342              throw new Error("Attempt to auto-create DetailComponent.category");
5343            else if (Configuration.doAutoCreate())
5344              this.category = new CodeableConcept(); // cc
5345          return this.category;
5346        }
5347
5348        public boolean hasCategory() { 
5349          return this.category != null && !this.category.isEmpty();
5350        }
5351
5352        /**
5353         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
5354         */
5355        public DetailComponent setCategory(CodeableConcept value)  { 
5356          this.category = value;
5357          return this;
5358        }
5359
5360        /**
5361         * @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'.)
5362         */
5363        public CodeableConcept getService() { 
5364          if (this.service == null)
5365            if (Configuration.errorOnAutoCreate())
5366              throw new Error("Attempt to auto-create DetailComponent.service");
5367            else if (Configuration.doAutoCreate())
5368              this.service = new CodeableConcept(); // cc
5369          return this.service;
5370        }
5371
5372        public boolean hasService() { 
5373          return this.service != null && !this.service.isEmpty();
5374        }
5375
5376        /**
5377         * @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'.)
5378         */
5379        public DetailComponent setService(CodeableConcept value)  { 
5380          this.service = value;
5381          return this;
5382        }
5383
5384        /**
5385         * @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.)
5386         */
5387        public List<CodeableConcept> getModifier() { 
5388          if (this.modifier == null)
5389            this.modifier = new ArrayList<CodeableConcept>();
5390          return this.modifier;
5391        }
5392
5393        /**
5394         * @return Returns a reference to <code>this</code> for easy method chaining
5395         */
5396        public DetailComponent setModifier(List<CodeableConcept> theModifier) { 
5397          this.modifier = theModifier;
5398          return this;
5399        }
5400
5401        public boolean hasModifier() { 
5402          if (this.modifier == null)
5403            return false;
5404          for (CodeableConcept item : this.modifier)
5405            if (!item.isEmpty())
5406              return true;
5407          return false;
5408        }
5409
5410        public CodeableConcept addModifier() { //3
5411          CodeableConcept t = new CodeableConcept();
5412          if (this.modifier == null)
5413            this.modifier = new ArrayList<CodeableConcept>();
5414          this.modifier.add(t);
5415          return t;
5416        }
5417
5418        public DetailComponent addModifier(CodeableConcept t) { //3
5419          if (t == null)
5420            return this;
5421          if (this.modifier == null)
5422            this.modifier = new ArrayList<CodeableConcept>();
5423          this.modifier.add(t);
5424          return this;
5425        }
5426
5427        /**
5428         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
5429         */
5430        public CodeableConcept getModifierFirstRep() { 
5431          if (getModifier().isEmpty()) {
5432            addModifier();
5433          }
5434          return getModifier().get(0);
5435        }
5436
5437        /**
5438         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
5439         */
5440        public List<CodeableConcept> getProgramCode() { 
5441          if (this.programCode == null)
5442            this.programCode = new ArrayList<CodeableConcept>();
5443          return this.programCode;
5444        }
5445
5446        /**
5447         * @return Returns a reference to <code>this</code> for easy method chaining
5448         */
5449        public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
5450          this.programCode = theProgramCode;
5451          return this;
5452        }
5453
5454        public boolean hasProgramCode() { 
5455          if (this.programCode == null)
5456            return false;
5457          for (CodeableConcept item : this.programCode)
5458            if (!item.isEmpty())
5459              return true;
5460          return false;
5461        }
5462
5463        public CodeableConcept addProgramCode() { //3
5464          CodeableConcept t = new CodeableConcept();
5465          if (this.programCode == null)
5466            this.programCode = new ArrayList<CodeableConcept>();
5467          this.programCode.add(t);
5468          return t;
5469        }
5470
5471        public DetailComponent addProgramCode(CodeableConcept t) { //3
5472          if (t == null)
5473            return this;
5474          if (this.programCode == null)
5475            this.programCode = new ArrayList<CodeableConcept>();
5476          this.programCode.add(t);
5477          return this;
5478        }
5479
5480        /**
5481         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
5482         */
5483        public CodeableConcept getProgramCodeFirstRep() { 
5484          if (getProgramCode().isEmpty()) {
5485            addProgramCode();
5486          }
5487          return getProgramCode().get(0);
5488        }
5489
5490        /**
5491         * @return {@link #quantity} (The number of repetitions of a service or product.)
5492         */
5493        public SimpleQuantity getQuantity() { 
5494          if (this.quantity == null)
5495            if (Configuration.errorOnAutoCreate())
5496              throw new Error("Attempt to auto-create DetailComponent.quantity");
5497            else if (Configuration.doAutoCreate())
5498              this.quantity = new SimpleQuantity(); // cc
5499          return this.quantity;
5500        }
5501
5502        public boolean hasQuantity() { 
5503          return this.quantity != null && !this.quantity.isEmpty();
5504        }
5505
5506        /**
5507         * @param value {@link #quantity} (The number of repetitions of a service or product.)
5508         */
5509        public DetailComponent setQuantity(SimpleQuantity value)  { 
5510          this.quantity = value;
5511          return this;
5512        }
5513
5514        /**
5515         * @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.)
5516         */
5517        public Money getUnitPrice() { 
5518          if (this.unitPrice == null)
5519            if (Configuration.errorOnAutoCreate())
5520              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
5521            else if (Configuration.doAutoCreate())
5522              this.unitPrice = new Money(); // cc
5523          return this.unitPrice;
5524        }
5525
5526        public boolean hasUnitPrice() { 
5527          return this.unitPrice != null && !this.unitPrice.isEmpty();
5528        }
5529
5530        /**
5531         * @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.)
5532         */
5533        public DetailComponent setUnitPrice(Money value)  { 
5534          this.unitPrice = value;
5535          return this;
5536        }
5537
5538        /**
5539         * @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
5540         */
5541        public DecimalType getFactorElement() { 
5542          if (this.factor == null)
5543            if (Configuration.errorOnAutoCreate())
5544              throw new Error("Attempt to auto-create DetailComponent.factor");
5545            else if (Configuration.doAutoCreate())
5546              this.factor = new DecimalType(); // bb
5547          return this.factor;
5548        }
5549
5550        public boolean hasFactorElement() { 
5551          return this.factor != null && !this.factor.isEmpty();
5552        }
5553
5554        public boolean hasFactor() { 
5555          return this.factor != null && !this.factor.isEmpty();
5556        }
5557
5558        /**
5559         * @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
5560         */
5561        public DetailComponent setFactorElement(DecimalType value) { 
5562          this.factor = value;
5563          return this;
5564        }
5565
5566        /**
5567         * @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.
5568         */
5569        public BigDecimal getFactor() { 
5570          return this.factor == null ? null : this.factor.getValue();
5571        }
5572
5573        /**
5574         * @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.
5575         */
5576        public DetailComponent setFactor(BigDecimal value) { 
5577          if (value == null)
5578            this.factor = null;
5579          else {
5580            if (this.factor == null)
5581              this.factor = new DecimalType();
5582            this.factor.setValue(value);
5583          }
5584          return this;
5585        }
5586
5587        /**
5588         * @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.
5589         */
5590        public DetailComponent setFactor(long value) { 
5591              this.factor = new DecimalType();
5592            this.factor.setValue(value);
5593          return this;
5594        }
5595
5596        /**
5597         * @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.
5598         */
5599        public DetailComponent setFactor(double value) { 
5600              this.factor = new DecimalType();
5601            this.factor.setValue(value);
5602          return this;
5603        }
5604
5605        /**
5606         * @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.)
5607         */
5608        public Money getNet() { 
5609          if (this.net == null)
5610            if (Configuration.errorOnAutoCreate())
5611              throw new Error("Attempt to auto-create DetailComponent.net");
5612            else if (Configuration.doAutoCreate())
5613              this.net = new Money(); // cc
5614          return this.net;
5615        }
5616
5617        public boolean hasNet() { 
5618          return this.net != null && !this.net.isEmpty();
5619        }
5620
5621        /**
5622         * @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.)
5623         */
5624        public DetailComponent setNet(Money value)  { 
5625          this.net = value;
5626          return this;
5627        }
5628
5629        /**
5630         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
5631         */
5632        public List<Reference> getUdi() { 
5633          if (this.udi == null)
5634            this.udi = new ArrayList<Reference>();
5635          return this.udi;
5636        }
5637
5638        /**
5639         * @return Returns a reference to <code>this</code> for easy method chaining
5640         */
5641        public DetailComponent setUdi(List<Reference> theUdi) { 
5642          this.udi = theUdi;
5643          return this;
5644        }
5645
5646        public boolean hasUdi() { 
5647          if (this.udi == null)
5648            return false;
5649          for (Reference item : this.udi)
5650            if (!item.isEmpty())
5651              return true;
5652          return false;
5653        }
5654
5655        public Reference addUdi() { //3
5656          Reference t = new Reference();
5657          if (this.udi == null)
5658            this.udi = new ArrayList<Reference>();
5659          this.udi.add(t);
5660          return t;
5661        }
5662
5663        public DetailComponent addUdi(Reference t) { //3
5664          if (t == null)
5665            return this;
5666          if (this.udi == null)
5667            this.udi = new ArrayList<Reference>();
5668          this.udi.add(t);
5669          return this;
5670        }
5671
5672        /**
5673         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
5674         */
5675        public Reference getUdiFirstRep() { 
5676          if (getUdi().isEmpty()) {
5677            addUdi();
5678          }
5679          return getUdi().get(0);
5680        }
5681
5682        /**
5683         * @deprecated Use Reference#setResource(IBaseResource) instead
5684         */
5685        @Deprecated
5686        public List<Device> getUdiTarget() { 
5687          if (this.udiTarget == null)
5688            this.udiTarget = new ArrayList<Device>();
5689          return this.udiTarget;
5690        }
5691
5692        /**
5693         * @deprecated Use Reference#setResource(IBaseResource) instead
5694         */
5695        @Deprecated
5696        public Device addUdiTarget() { 
5697          Device r = new Device();
5698          if (this.udiTarget == null)
5699            this.udiTarget = new ArrayList<Device>();
5700          this.udiTarget.add(r);
5701          return r;
5702        }
5703
5704        /**
5705         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
5706         */
5707        public List<PositiveIntType> getNoteNumber() { 
5708          if (this.noteNumber == null)
5709            this.noteNumber = new ArrayList<PositiveIntType>();
5710          return this.noteNumber;
5711        }
5712
5713        /**
5714         * @return Returns a reference to <code>this</code> for easy method chaining
5715         */
5716        public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
5717          this.noteNumber = theNoteNumber;
5718          return this;
5719        }
5720
5721        public boolean hasNoteNumber() { 
5722          if (this.noteNumber == null)
5723            return false;
5724          for (PositiveIntType item : this.noteNumber)
5725            if (!item.isEmpty())
5726              return true;
5727          return false;
5728        }
5729
5730        /**
5731         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
5732         */
5733        public PositiveIntType addNoteNumberElement() {//2 
5734          PositiveIntType t = new PositiveIntType();
5735          if (this.noteNumber == null)
5736            this.noteNumber = new ArrayList<PositiveIntType>();
5737          this.noteNumber.add(t);
5738          return t;
5739        }
5740
5741        /**
5742         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
5743         */
5744        public DetailComponent addNoteNumber(int value) { //1
5745          PositiveIntType t = new PositiveIntType();
5746          t.setValue(value);
5747          if (this.noteNumber == null)
5748            this.noteNumber = new ArrayList<PositiveIntType>();
5749          this.noteNumber.add(t);
5750          return this;
5751        }
5752
5753        /**
5754         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
5755         */
5756        public boolean hasNoteNumber(int value) { 
5757          if (this.noteNumber == null)
5758            return false;
5759          for (PositiveIntType v : this.noteNumber)
5760            if (v.getValue().equals(value)) // positiveInt
5761              return true;
5762          return false;
5763        }
5764
5765        /**
5766         * @return {@link #adjudication} (The adjudications results.)
5767         */
5768        public List<AdjudicationComponent> getAdjudication() { 
5769          if (this.adjudication == null)
5770            this.adjudication = new ArrayList<AdjudicationComponent>();
5771          return this.adjudication;
5772        }
5773
5774        /**
5775         * @return Returns a reference to <code>this</code> for easy method chaining
5776         */
5777        public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
5778          this.adjudication = theAdjudication;
5779          return this;
5780        }
5781
5782        public boolean hasAdjudication() { 
5783          if (this.adjudication == null)
5784            return false;
5785          for (AdjudicationComponent item : this.adjudication)
5786            if (!item.isEmpty())
5787              return true;
5788          return false;
5789        }
5790
5791        public AdjudicationComponent addAdjudication() { //3
5792          AdjudicationComponent t = new AdjudicationComponent();
5793          if (this.adjudication == null)
5794            this.adjudication = new ArrayList<AdjudicationComponent>();
5795          this.adjudication.add(t);
5796          return t;
5797        }
5798
5799        public DetailComponent addAdjudication(AdjudicationComponent t) { //3
5800          if (t == null)
5801            return this;
5802          if (this.adjudication == null)
5803            this.adjudication = new ArrayList<AdjudicationComponent>();
5804          this.adjudication.add(t);
5805          return this;
5806        }
5807
5808        /**
5809         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
5810         */
5811        public AdjudicationComponent getAdjudicationFirstRep() { 
5812          if (getAdjudication().isEmpty()) {
5813            addAdjudication();
5814          }
5815          return getAdjudication().get(0);
5816        }
5817
5818        /**
5819         * @return {@link #subDetail} (Third tier of goods and services.)
5820         */
5821        public List<SubDetailComponent> getSubDetail() { 
5822          if (this.subDetail == null)
5823            this.subDetail = new ArrayList<SubDetailComponent>();
5824          return this.subDetail;
5825        }
5826
5827        /**
5828         * @return Returns a reference to <code>this</code> for easy method chaining
5829         */
5830        public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) { 
5831          this.subDetail = theSubDetail;
5832          return this;
5833        }
5834
5835        public boolean hasSubDetail() { 
5836          if (this.subDetail == null)
5837            return false;
5838          for (SubDetailComponent item : this.subDetail)
5839            if (!item.isEmpty())
5840              return true;
5841          return false;
5842        }
5843
5844        public SubDetailComponent addSubDetail() { //3
5845          SubDetailComponent t = new SubDetailComponent();
5846          if (this.subDetail == null)
5847            this.subDetail = new ArrayList<SubDetailComponent>();
5848          this.subDetail.add(t);
5849          return t;
5850        }
5851
5852        public DetailComponent addSubDetail(SubDetailComponent t) { //3
5853          if (t == null)
5854            return this;
5855          if (this.subDetail == null)
5856            this.subDetail = new ArrayList<SubDetailComponent>();
5857          this.subDetail.add(t);
5858          return this;
5859        }
5860
5861        /**
5862         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
5863         */
5864        public SubDetailComponent getSubDetailFirstRep() { 
5865          if (getSubDetail().isEmpty()) {
5866            addSubDetail();
5867          }
5868          return getSubDetail().get(0);
5869        }
5870
5871        protected void listChildren(List<Property> children) {
5872          super.listChildren(children);
5873          children.add(new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence));
5874          children.add(new Property("type", "CodeableConcept", "The type of product or service.", 0, 1, type));
5875          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
5876          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
5877          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));
5878          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));
5879          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));
5880          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
5881          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));
5882          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));
5883          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));
5884          children.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
5885          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
5886          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
5887          children.add(new Property("subDetail", "", "Third tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
5888        }
5889
5890        @Override
5891        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5892          switch (_hash) {
5893          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence);
5894          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of product or service.", 0, 1, type);
5895          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
5896          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
5897          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);
5898          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);
5899          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);
5900          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
5901          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);
5902          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);
5903          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);
5904          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);
5905          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);
5906          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
5907          case -828829007: /*subDetail*/  return new Property("subDetail", "", "Third tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
5908          default: return super.getNamedProperty(_hash, _name, _checkValid);
5909          }
5910
5911        }
5912
5913      @Override
5914      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5915        switch (hash) {
5916        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
5917        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
5918        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
5919        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
5920        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
5921        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
5922        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
5923        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
5924        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
5925        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
5926        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
5927        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
5928        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
5929        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
5930        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
5931        default: return super.getProperty(hash, name, checkValid);
5932        }
5933
5934      }
5935
5936      @Override
5937      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5938        switch (hash) {
5939        case 1349547969: // sequence
5940          this.sequence = castToPositiveInt(value); // PositiveIntType
5941          return value;
5942        case 3575610: // type
5943          this.type = castToCodeableConcept(value); // CodeableConcept
5944          return value;
5945        case 1099842588: // revenue
5946          this.revenue = castToCodeableConcept(value); // CodeableConcept
5947          return value;
5948        case 50511102: // category
5949          this.category = castToCodeableConcept(value); // CodeableConcept
5950          return value;
5951        case 1984153269: // service
5952          this.service = castToCodeableConcept(value); // CodeableConcept
5953          return value;
5954        case -615513385: // modifier
5955          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
5956          return value;
5957        case 1010065041: // programCode
5958          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
5959          return value;
5960        case -1285004149: // quantity
5961          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
5962          return value;
5963        case -486196699: // unitPrice
5964          this.unitPrice = castToMoney(value); // Money
5965          return value;
5966        case -1282148017: // factor
5967          this.factor = castToDecimal(value); // DecimalType
5968          return value;
5969        case 108957: // net
5970          this.net = castToMoney(value); // Money
5971          return value;
5972        case 115642: // udi
5973          this.getUdi().add(castToReference(value)); // Reference
5974          return value;
5975        case -1110033957: // noteNumber
5976          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
5977          return value;
5978        case -231349275: // adjudication
5979          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
5980          return value;
5981        case -828829007: // subDetail
5982          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
5983          return value;
5984        default: return super.setProperty(hash, name, value);
5985        }
5986
5987      }
5988
5989      @Override
5990      public Base setProperty(String name, Base value) throws FHIRException {
5991        if (name.equals("sequence")) {
5992          this.sequence = castToPositiveInt(value); // PositiveIntType
5993        } else if (name.equals("type")) {
5994          this.type = castToCodeableConcept(value); // CodeableConcept
5995        } else if (name.equals("revenue")) {
5996          this.revenue = castToCodeableConcept(value); // CodeableConcept
5997        } else if (name.equals("category")) {
5998          this.category = castToCodeableConcept(value); // CodeableConcept
5999        } else if (name.equals("service")) {
6000          this.service = castToCodeableConcept(value); // CodeableConcept
6001        } else if (name.equals("modifier")) {
6002          this.getModifier().add(castToCodeableConcept(value));
6003        } else if (name.equals("programCode")) {
6004          this.getProgramCode().add(castToCodeableConcept(value));
6005        } else if (name.equals("quantity")) {
6006          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
6007        } else if (name.equals("unitPrice")) {
6008          this.unitPrice = castToMoney(value); // Money
6009        } else if (name.equals("factor")) {
6010          this.factor = castToDecimal(value); // DecimalType
6011        } else if (name.equals("net")) {
6012          this.net = castToMoney(value); // Money
6013        } else if (name.equals("udi")) {
6014          this.getUdi().add(castToReference(value));
6015        } else if (name.equals("noteNumber")) {
6016          this.getNoteNumber().add(castToPositiveInt(value));
6017        } else if (name.equals("adjudication")) {
6018          this.getAdjudication().add((AdjudicationComponent) value);
6019        } else if (name.equals("subDetail")) {
6020          this.getSubDetail().add((SubDetailComponent) value);
6021        } else
6022          return super.setProperty(name, value);
6023        return value;
6024      }
6025
6026      @Override
6027      public Base makeProperty(int hash, String name) throws FHIRException {
6028        switch (hash) {
6029        case 1349547969:  return getSequenceElement();
6030        case 3575610:  return getType(); 
6031        case 1099842588:  return getRevenue(); 
6032        case 50511102:  return getCategory(); 
6033        case 1984153269:  return getService(); 
6034        case -615513385:  return addModifier(); 
6035        case 1010065041:  return addProgramCode(); 
6036        case -1285004149:  return getQuantity(); 
6037        case -486196699:  return getUnitPrice(); 
6038        case -1282148017:  return getFactorElement();
6039        case 108957:  return getNet(); 
6040        case 115642:  return addUdi(); 
6041        case -1110033957:  return addNoteNumberElement();
6042        case -231349275:  return addAdjudication(); 
6043        case -828829007:  return addSubDetail(); 
6044        default: return super.makeProperty(hash, name);
6045        }
6046
6047      }
6048
6049      @Override
6050      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6051        switch (hash) {
6052        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
6053        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
6054        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
6055        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
6056        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
6057        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
6058        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
6059        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
6060        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6061        case -1282148017: /*factor*/ return new String[] {"decimal"};
6062        case 108957: /*net*/ return new String[] {"Money"};
6063        case 115642: /*udi*/ return new String[] {"Reference"};
6064        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
6065        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
6066        case -828829007: /*subDetail*/ return new String[] {};
6067        default: return super.getTypesForProperty(hash, name);
6068        }
6069
6070      }
6071
6072      @Override
6073      public Base addChild(String name) throws FHIRException {
6074        if (name.equals("sequence")) {
6075          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
6076        }
6077        else if (name.equals("type")) {
6078          this.type = new CodeableConcept();
6079          return this.type;
6080        }
6081        else if (name.equals("revenue")) {
6082          this.revenue = new CodeableConcept();
6083          return this.revenue;
6084        }
6085        else if (name.equals("category")) {
6086          this.category = new CodeableConcept();
6087          return this.category;
6088        }
6089        else if (name.equals("service")) {
6090          this.service = new CodeableConcept();
6091          return this.service;
6092        }
6093        else if (name.equals("modifier")) {
6094          return addModifier();
6095        }
6096        else if (name.equals("programCode")) {
6097          return addProgramCode();
6098        }
6099        else if (name.equals("quantity")) {
6100          this.quantity = new SimpleQuantity();
6101          return this.quantity;
6102        }
6103        else if (name.equals("unitPrice")) {
6104          this.unitPrice = new Money();
6105          return this.unitPrice;
6106        }
6107        else if (name.equals("factor")) {
6108          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
6109        }
6110        else if (name.equals("net")) {
6111          this.net = new Money();
6112          return this.net;
6113        }
6114        else if (name.equals("udi")) {
6115          return addUdi();
6116        }
6117        else if (name.equals("noteNumber")) {
6118          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
6119        }
6120        else if (name.equals("adjudication")) {
6121          return addAdjudication();
6122        }
6123        else if (name.equals("subDetail")) {
6124          return addSubDetail();
6125        }
6126        else
6127          return super.addChild(name);
6128      }
6129
6130      public DetailComponent copy() {
6131        DetailComponent dst = new DetailComponent();
6132        copyValues(dst);
6133        dst.sequence = sequence == null ? null : sequence.copy();
6134        dst.type = type == null ? null : type.copy();
6135        dst.revenue = revenue == null ? null : revenue.copy();
6136        dst.category = category == null ? null : category.copy();
6137        dst.service = service == null ? null : service.copy();
6138        if (modifier != null) {
6139          dst.modifier = new ArrayList<CodeableConcept>();
6140          for (CodeableConcept i : modifier)
6141            dst.modifier.add(i.copy());
6142        };
6143        if (programCode != null) {
6144          dst.programCode = new ArrayList<CodeableConcept>();
6145          for (CodeableConcept i : programCode)
6146            dst.programCode.add(i.copy());
6147        };
6148        dst.quantity = quantity == null ? null : quantity.copy();
6149        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6150        dst.factor = factor == null ? null : factor.copy();
6151        dst.net = net == null ? null : net.copy();
6152        if (udi != null) {
6153          dst.udi = new ArrayList<Reference>();
6154          for (Reference i : udi)
6155            dst.udi.add(i.copy());
6156        };
6157        if (noteNumber != null) {
6158          dst.noteNumber = new ArrayList<PositiveIntType>();
6159          for (PositiveIntType i : noteNumber)
6160            dst.noteNumber.add(i.copy());
6161        };
6162        if (adjudication != null) {
6163          dst.adjudication = new ArrayList<AdjudicationComponent>();
6164          for (AdjudicationComponent i : adjudication)
6165            dst.adjudication.add(i.copy());
6166        };
6167        if (subDetail != null) {
6168          dst.subDetail = new ArrayList<SubDetailComponent>();
6169          for (SubDetailComponent i : subDetail)
6170            dst.subDetail.add(i.copy());
6171        };
6172        return dst;
6173      }
6174
6175      @Override
6176      public boolean equalsDeep(Base other_) {
6177        if (!super.equalsDeep(other_))
6178          return false;
6179        if (!(other_ instanceof DetailComponent))
6180          return false;
6181        DetailComponent o = (DetailComponent) other_;
6182        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(revenue, o.revenue, true)
6183           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
6184           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
6185           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6186           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
6187           && compareDeep(subDetail, o.subDetail, true);
6188      }
6189
6190      @Override
6191      public boolean equalsShallow(Base other_) {
6192        if (!super.equalsShallow(other_))
6193          return false;
6194        if (!(other_ instanceof DetailComponent))
6195          return false;
6196        DetailComponent o = (DetailComponent) other_;
6197        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
6198          ;
6199      }
6200
6201      public boolean isEmpty() {
6202        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, revenue
6203          , category, service, modifier, programCode, quantity, unitPrice, factor, net
6204          , udi, noteNumber, adjudication, subDetail);
6205      }
6206
6207  public String fhirType() {
6208    return "ExplanationOfBenefit.item.detail";
6209
6210  }
6211
6212  }
6213
6214    @Block()
6215    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
6216        /**
6217         * A service line number.
6218         */
6219        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
6220        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
6221        protected PositiveIntType sequence;
6222
6223        /**
6224         * The type of product or service.
6225         */
6226        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
6227        @Description(shortDefinition="Type of product or service", formalDefinition="The type of product or service." )
6228        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActInvoiceGroupCode")
6229        protected CodeableConcept type;
6230
6231        /**
6232         * The type of reveneu or cost center providing the product and/or service.
6233         */
6234        @Child(name = "revenue", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
6235        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
6236        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
6237        protected CodeableConcept revenue;
6238
6239        /**
6240         * Health Care Service Type Codes  to identify the classification of service or benefits.
6241         */
6242        @Child(name = "category", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
6243        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
6244        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
6245        protected CodeableConcept category;
6246
6247        /**
6248         * A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).
6249         */
6250        @Child(name = "service", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
6251        @Description(shortDefinition="Billing Code", formalDefinition="A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI)." )
6252        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6253        protected CodeableConcept service;
6254
6255        /**
6256         * 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.
6257         */
6258        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6259        @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." )
6260        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
6261        protected List<CodeableConcept> modifier;
6262
6263        /**
6264         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
6265         */
6266        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6267        @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." )
6268        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
6269        protected List<CodeableConcept> programCode;
6270
6271        /**
6272         * The number of repetitions of a service or product.
6273         */
6274        @Child(name = "quantity", type = {SimpleQuantity.class}, order=8, min=0, max=1, modifier=false, summary=false)
6275        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
6276        protected SimpleQuantity quantity;
6277
6278        /**
6279         * The fee for an addittional service or product or charge.
6280         */
6281        @Child(name = "unitPrice", type = {Money.class}, order=9, min=0, max=1, modifier=false, summary=false)
6282        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="The fee for an addittional service or product or charge." )
6283        protected Money unitPrice;
6284
6285        /**
6286         * 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.
6287         */
6288        @Child(name = "factor", type = {DecimalType.class}, order=10, min=0, max=1, modifier=false, summary=false)
6289        @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." )
6290        protected DecimalType factor;
6291
6292        /**
6293         * 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.
6294         */
6295        @Child(name = "net", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=false)
6296        @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." )
6297        protected Money net;
6298
6299        /**
6300         * List of Unique Device Identifiers associated with this line item.
6301         */
6302        @Child(name = "udi", type = {Device.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6303        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
6304        protected List<Reference> udi;
6305        /**
6306         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
6307         */
6308        protected List<Device> udiTarget;
6309
6310
6311        /**
6312         * A list of note references to the notes provided below.
6313         */
6314        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6315        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
6316        protected List<PositiveIntType> noteNumber;
6317
6318        /**
6319         * The adjudications results.
6320         */
6321        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6322        @Description(shortDefinition="Language if different from the resource", formalDefinition="The adjudications results." )
6323        protected List<AdjudicationComponent> adjudication;
6324
6325        private static final long serialVersionUID = 1621872130L;
6326
6327    /**
6328     * Constructor
6329     */
6330      public SubDetailComponent() {
6331        super();
6332      }
6333
6334    /**
6335     * Constructor
6336     */
6337      public SubDetailComponent(PositiveIntType sequence, CodeableConcept type) {
6338        super();
6339        this.sequence = sequence;
6340        this.type = type;
6341      }
6342
6343        /**
6344         * @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
6345         */
6346        public PositiveIntType getSequenceElement() { 
6347          if (this.sequence == null)
6348            if (Configuration.errorOnAutoCreate())
6349              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
6350            else if (Configuration.doAutoCreate())
6351              this.sequence = new PositiveIntType(); // bb
6352          return this.sequence;
6353        }
6354
6355        public boolean hasSequenceElement() { 
6356          return this.sequence != null && !this.sequence.isEmpty();
6357        }
6358
6359        public boolean hasSequence() { 
6360          return this.sequence != null && !this.sequence.isEmpty();
6361        }
6362
6363        /**
6364         * @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
6365         */
6366        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
6367          this.sequence = value;
6368          return this;
6369        }
6370
6371        /**
6372         * @return A service line number.
6373         */
6374        public int getSequence() { 
6375          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6376        }
6377
6378        /**
6379         * @param value A service line number.
6380         */
6381        public SubDetailComponent setSequence(int value) { 
6382            if (this.sequence == null)
6383              this.sequence = new PositiveIntType();
6384            this.sequence.setValue(value);
6385          return this;
6386        }
6387
6388        /**
6389         * @return {@link #type} (The type of product or service.)
6390         */
6391        public CodeableConcept getType() { 
6392          if (this.type == null)
6393            if (Configuration.errorOnAutoCreate())
6394              throw new Error("Attempt to auto-create SubDetailComponent.type");
6395            else if (Configuration.doAutoCreate())
6396              this.type = new CodeableConcept(); // cc
6397          return this.type;
6398        }
6399
6400        public boolean hasType() { 
6401          return this.type != null && !this.type.isEmpty();
6402        }
6403
6404        /**
6405         * @param value {@link #type} (The type of product or service.)
6406         */
6407        public SubDetailComponent setType(CodeableConcept value)  { 
6408          this.type = value;
6409          return this;
6410        }
6411
6412        /**
6413         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
6414         */
6415        public CodeableConcept getRevenue() { 
6416          if (this.revenue == null)
6417            if (Configuration.errorOnAutoCreate())
6418              throw new Error("Attempt to auto-create SubDetailComponent.revenue");
6419            else if (Configuration.doAutoCreate())
6420              this.revenue = new CodeableConcept(); // cc
6421          return this.revenue;
6422        }
6423
6424        public boolean hasRevenue() { 
6425          return this.revenue != null && !this.revenue.isEmpty();
6426        }
6427
6428        /**
6429         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
6430         */
6431        public SubDetailComponent setRevenue(CodeableConcept value)  { 
6432          this.revenue = value;
6433          return this;
6434        }
6435
6436        /**
6437         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
6438         */
6439        public CodeableConcept getCategory() { 
6440          if (this.category == null)
6441            if (Configuration.errorOnAutoCreate())
6442              throw new Error("Attempt to auto-create SubDetailComponent.category");
6443            else if (Configuration.doAutoCreate())
6444              this.category = new CodeableConcept(); // cc
6445          return this.category;
6446        }
6447
6448        public boolean hasCategory() { 
6449          return this.category != null && !this.category.isEmpty();
6450        }
6451
6452        /**
6453         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
6454         */
6455        public SubDetailComponent setCategory(CodeableConcept value)  { 
6456          this.category = value;
6457          return this;
6458        }
6459
6460        /**
6461         * @return {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
6462         */
6463        public CodeableConcept getService() { 
6464          if (this.service == null)
6465            if (Configuration.errorOnAutoCreate())
6466              throw new Error("Attempt to auto-create SubDetailComponent.service");
6467            else if (Configuration.doAutoCreate())
6468              this.service = new CodeableConcept(); // cc
6469          return this.service;
6470        }
6471
6472        public boolean hasService() { 
6473          return this.service != null && !this.service.isEmpty();
6474        }
6475
6476        /**
6477         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
6478         */
6479        public SubDetailComponent setService(CodeableConcept value)  { 
6480          this.service = value;
6481          return this;
6482        }
6483
6484        /**
6485         * @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.)
6486         */
6487        public List<CodeableConcept> getModifier() { 
6488          if (this.modifier == null)
6489            this.modifier = new ArrayList<CodeableConcept>();
6490          return this.modifier;
6491        }
6492
6493        /**
6494         * @return Returns a reference to <code>this</code> for easy method chaining
6495         */
6496        public SubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
6497          this.modifier = theModifier;
6498          return this;
6499        }
6500
6501        public boolean hasModifier() { 
6502          if (this.modifier == null)
6503            return false;
6504          for (CodeableConcept item : this.modifier)
6505            if (!item.isEmpty())
6506              return true;
6507          return false;
6508        }
6509
6510        public CodeableConcept addModifier() { //3
6511          CodeableConcept t = new CodeableConcept();
6512          if (this.modifier == null)
6513            this.modifier = new ArrayList<CodeableConcept>();
6514          this.modifier.add(t);
6515          return t;
6516        }
6517
6518        public SubDetailComponent addModifier(CodeableConcept t) { //3
6519          if (t == null)
6520            return this;
6521          if (this.modifier == null)
6522            this.modifier = new ArrayList<CodeableConcept>();
6523          this.modifier.add(t);
6524          return this;
6525        }
6526
6527        /**
6528         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
6529         */
6530        public CodeableConcept getModifierFirstRep() { 
6531          if (getModifier().isEmpty()) {
6532            addModifier();
6533          }
6534          return getModifier().get(0);
6535        }
6536
6537        /**
6538         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
6539         */
6540        public List<CodeableConcept> getProgramCode() { 
6541          if (this.programCode == null)
6542            this.programCode = new ArrayList<CodeableConcept>();
6543          return this.programCode;
6544        }
6545
6546        /**
6547         * @return Returns a reference to <code>this</code> for easy method chaining
6548         */
6549        public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
6550          this.programCode = theProgramCode;
6551          return this;
6552        }
6553
6554        public boolean hasProgramCode() { 
6555          if (this.programCode == null)
6556            return false;
6557          for (CodeableConcept item : this.programCode)
6558            if (!item.isEmpty())
6559              return true;
6560          return false;
6561        }
6562
6563        public CodeableConcept addProgramCode() { //3
6564          CodeableConcept t = new CodeableConcept();
6565          if (this.programCode == null)
6566            this.programCode = new ArrayList<CodeableConcept>();
6567          this.programCode.add(t);
6568          return t;
6569        }
6570
6571        public SubDetailComponent addProgramCode(CodeableConcept t) { //3
6572          if (t == null)
6573            return this;
6574          if (this.programCode == null)
6575            this.programCode = new ArrayList<CodeableConcept>();
6576          this.programCode.add(t);
6577          return this;
6578        }
6579
6580        /**
6581         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
6582         */
6583        public CodeableConcept getProgramCodeFirstRep() { 
6584          if (getProgramCode().isEmpty()) {
6585            addProgramCode();
6586          }
6587          return getProgramCode().get(0);
6588        }
6589
6590        /**
6591         * @return {@link #quantity} (The number of repetitions of a service or product.)
6592         */
6593        public SimpleQuantity getQuantity() { 
6594          if (this.quantity == null)
6595            if (Configuration.errorOnAutoCreate())
6596              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
6597            else if (Configuration.doAutoCreate())
6598              this.quantity = new SimpleQuantity(); // cc
6599          return this.quantity;
6600        }
6601
6602        public boolean hasQuantity() { 
6603          return this.quantity != null && !this.quantity.isEmpty();
6604        }
6605
6606        /**
6607         * @param value {@link #quantity} (The number of repetitions of a service or product.)
6608         */
6609        public SubDetailComponent setQuantity(SimpleQuantity value)  { 
6610          this.quantity = value;
6611          return this;
6612        }
6613
6614        /**
6615         * @return {@link #unitPrice} (The fee for an addittional service or product or charge.)
6616         */
6617        public Money getUnitPrice() { 
6618          if (this.unitPrice == null)
6619            if (Configuration.errorOnAutoCreate())
6620              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
6621            else if (Configuration.doAutoCreate())
6622              this.unitPrice = new Money(); // cc
6623          return this.unitPrice;
6624        }
6625
6626        public boolean hasUnitPrice() { 
6627          return this.unitPrice != null && !this.unitPrice.isEmpty();
6628        }
6629
6630        /**
6631         * @param value {@link #unitPrice} (The fee for an addittional service or product or charge.)
6632         */
6633        public SubDetailComponent setUnitPrice(Money value)  { 
6634          this.unitPrice = value;
6635          return this;
6636        }
6637
6638        /**
6639         * @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
6640         */
6641        public DecimalType getFactorElement() { 
6642          if (this.factor == null)
6643            if (Configuration.errorOnAutoCreate())
6644              throw new Error("Attempt to auto-create SubDetailComponent.factor");
6645            else if (Configuration.doAutoCreate())
6646              this.factor = new DecimalType(); // bb
6647          return this.factor;
6648        }
6649
6650        public boolean hasFactorElement() { 
6651          return this.factor != null && !this.factor.isEmpty();
6652        }
6653
6654        public boolean hasFactor() { 
6655          return this.factor != null && !this.factor.isEmpty();
6656        }
6657
6658        /**
6659         * @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
6660         */
6661        public SubDetailComponent setFactorElement(DecimalType value) { 
6662          this.factor = value;
6663          return this;
6664        }
6665
6666        /**
6667         * @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.
6668         */
6669        public BigDecimal getFactor() { 
6670          return this.factor == null ? null : this.factor.getValue();
6671        }
6672
6673        /**
6674         * @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.
6675         */
6676        public SubDetailComponent setFactor(BigDecimal value) { 
6677          if (value == null)
6678            this.factor = null;
6679          else {
6680            if (this.factor == null)
6681              this.factor = new DecimalType();
6682            this.factor.setValue(value);
6683          }
6684          return this;
6685        }
6686
6687        /**
6688         * @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.
6689         */
6690        public SubDetailComponent setFactor(long value) { 
6691              this.factor = new DecimalType();
6692            this.factor.setValue(value);
6693          return this;
6694        }
6695
6696        /**
6697         * @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.
6698         */
6699        public SubDetailComponent setFactor(double value) { 
6700              this.factor = new DecimalType();
6701            this.factor.setValue(value);
6702          return this;
6703        }
6704
6705        /**
6706         * @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.)
6707         */
6708        public Money getNet() { 
6709          if (this.net == null)
6710            if (Configuration.errorOnAutoCreate())
6711              throw new Error("Attempt to auto-create SubDetailComponent.net");
6712            else if (Configuration.doAutoCreate())
6713              this.net = new Money(); // cc
6714          return this.net;
6715        }
6716
6717        public boolean hasNet() { 
6718          return this.net != null && !this.net.isEmpty();
6719        }
6720
6721        /**
6722         * @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.)
6723         */
6724        public SubDetailComponent setNet(Money value)  { 
6725          this.net = value;
6726          return this;
6727        }
6728
6729        /**
6730         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
6731         */
6732        public List<Reference> getUdi() { 
6733          if (this.udi == null)
6734            this.udi = new ArrayList<Reference>();
6735          return this.udi;
6736        }
6737
6738        /**
6739         * @return Returns a reference to <code>this</code> for easy method chaining
6740         */
6741        public SubDetailComponent setUdi(List<Reference> theUdi) { 
6742          this.udi = theUdi;
6743          return this;
6744        }
6745
6746        public boolean hasUdi() { 
6747          if (this.udi == null)
6748            return false;
6749          for (Reference item : this.udi)
6750            if (!item.isEmpty())
6751              return true;
6752          return false;
6753        }
6754
6755        public Reference addUdi() { //3
6756          Reference t = new Reference();
6757          if (this.udi == null)
6758            this.udi = new ArrayList<Reference>();
6759          this.udi.add(t);
6760          return t;
6761        }
6762
6763        public SubDetailComponent addUdi(Reference t) { //3
6764          if (t == null)
6765            return this;
6766          if (this.udi == null)
6767            this.udi = new ArrayList<Reference>();
6768          this.udi.add(t);
6769          return this;
6770        }
6771
6772        /**
6773         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
6774         */
6775        public Reference getUdiFirstRep() { 
6776          if (getUdi().isEmpty()) {
6777            addUdi();
6778          }
6779          return getUdi().get(0);
6780        }
6781
6782        /**
6783         * @deprecated Use Reference#setResource(IBaseResource) instead
6784         */
6785        @Deprecated
6786        public List<Device> getUdiTarget() { 
6787          if (this.udiTarget == null)
6788            this.udiTarget = new ArrayList<Device>();
6789          return this.udiTarget;
6790        }
6791
6792        /**
6793         * @deprecated Use Reference#setResource(IBaseResource) instead
6794         */
6795        @Deprecated
6796        public Device addUdiTarget() { 
6797          Device r = new Device();
6798          if (this.udiTarget == null)
6799            this.udiTarget = new ArrayList<Device>();
6800          this.udiTarget.add(r);
6801          return r;
6802        }
6803
6804        /**
6805         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
6806         */
6807        public List<PositiveIntType> getNoteNumber() { 
6808          if (this.noteNumber == null)
6809            this.noteNumber = new ArrayList<PositiveIntType>();
6810          return this.noteNumber;
6811        }
6812
6813        /**
6814         * @return Returns a reference to <code>this</code> for easy method chaining
6815         */
6816        public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
6817          this.noteNumber = theNoteNumber;
6818          return this;
6819        }
6820
6821        public boolean hasNoteNumber() { 
6822          if (this.noteNumber == null)
6823            return false;
6824          for (PositiveIntType item : this.noteNumber)
6825            if (!item.isEmpty())
6826              return true;
6827          return false;
6828        }
6829
6830        /**
6831         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
6832         */
6833        public PositiveIntType addNoteNumberElement() {//2 
6834          PositiveIntType t = new PositiveIntType();
6835          if (this.noteNumber == null)
6836            this.noteNumber = new ArrayList<PositiveIntType>();
6837          this.noteNumber.add(t);
6838          return t;
6839        }
6840
6841        /**
6842         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
6843         */
6844        public SubDetailComponent addNoteNumber(int value) { //1
6845          PositiveIntType t = new PositiveIntType();
6846          t.setValue(value);
6847          if (this.noteNumber == null)
6848            this.noteNumber = new ArrayList<PositiveIntType>();
6849          this.noteNumber.add(t);
6850          return this;
6851        }
6852
6853        /**
6854         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
6855         */
6856        public boolean hasNoteNumber(int value) { 
6857          if (this.noteNumber == null)
6858            return false;
6859          for (PositiveIntType v : this.noteNumber)
6860            if (v.getValue().equals(value)) // positiveInt
6861              return true;
6862          return false;
6863        }
6864
6865        /**
6866         * @return {@link #adjudication} (The adjudications results.)
6867         */
6868        public List<AdjudicationComponent> getAdjudication() { 
6869          if (this.adjudication == null)
6870            this.adjudication = new ArrayList<AdjudicationComponent>();
6871          return this.adjudication;
6872        }
6873
6874        /**
6875         * @return Returns a reference to <code>this</code> for easy method chaining
6876         */
6877        public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
6878          this.adjudication = theAdjudication;
6879          return this;
6880        }
6881
6882        public boolean hasAdjudication() { 
6883          if (this.adjudication == null)
6884            return false;
6885          for (AdjudicationComponent item : this.adjudication)
6886            if (!item.isEmpty())
6887              return true;
6888          return false;
6889        }
6890
6891        public AdjudicationComponent addAdjudication() { //3
6892          AdjudicationComponent t = new AdjudicationComponent();
6893          if (this.adjudication == null)
6894            this.adjudication = new ArrayList<AdjudicationComponent>();
6895          this.adjudication.add(t);
6896          return t;
6897        }
6898
6899        public SubDetailComponent addAdjudication(AdjudicationComponent t) { //3
6900          if (t == null)
6901            return this;
6902          if (this.adjudication == null)
6903            this.adjudication = new ArrayList<AdjudicationComponent>();
6904          this.adjudication.add(t);
6905          return this;
6906        }
6907
6908        /**
6909         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
6910         */
6911        public AdjudicationComponent getAdjudicationFirstRep() { 
6912          if (getAdjudication().isEmpty()) {
6913            addAdjudication();
6914          }
6915          return getAdjudication().get(0);
6916        }
6917
6918        protected void listChildren(List<Property> children) {
6919          super.listChildren(children);
6920          children.add(new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence));
6921          children.add(new Property("type", "CodeableConcept", "The type of product or service.", 0, 1, type));
6922          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
6923          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
6924          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));
6925          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));
6926          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));
6927          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
6928          children.add(new Property("unitPrice", "Money", "The fee for an addittional service or product or charge.", 0, 1, unitPrice));
6929          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));
6930          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));
6931          children.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
6932          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
6933          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6934        }
6935
6936        @Override
6937        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6938          switch (_hash) {
6939          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence);
6940          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of product or service.", 0, 1, type);
6941          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
6942          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
6943          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);
6944          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);
6945          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);
6946          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
6947          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "The fee for an addittional service or product or charge.", 0, 1, unitPrice);
6948          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);
6949          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);
6950          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);
6951          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);
6952          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6953          default: return super.getNamedProperty(_hash, _name, _checkValid);
6954          }
6955
6956        }
6957
6958      @Override
6959      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6960        switch (hash) {
6961        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6962        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
6963        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6964        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6965        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
6966        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6967        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6968        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
6969        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6970        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6971        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6972        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6973        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
6974        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
6975        default: return super.getProperty(hash, name, checkValid);
6976        }
6977
6978      }
6979
6980      @Override
6981      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6982        switch (hash) {
6983        case 1349547969: // sequence
6984          this.sequence = castToPositiveInt(value); // PositiveIntType
6985          return value;
6986        case 3575610: // type
6987          this.type = castToCodeableConcept(value); // CodeableConcept
6988          return value;
6989        case 1099842588: // revenue
6990          this.revenue = castToCodeableConcept(value); // CodeableConcept
6991          return value;
6992        case 50511102: // category
6993          this.category = castToCodeableConcept(value); // CodeableConcept
6994          return value;
6995        case 1984153269: // service
6996          this.service = castToCodeableConcept(value); // CodeableConcept
6997          return value;
6998        case -615513385: // modifier
6999          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7000          return value;
7001        case 1010065041: // programCode
7002          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
7003          return value;
7004        case -1285004149: // quantity
7005          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
7006          return value;
7007        case -486196699: // unitPrice
7008          this.unitPrice = castToMoney(value); // Money
7009          return value;
7010        case -1282148017: // factor
7011          this.factor = castToDecimal(value); // DecimalType
7012          return value;
7013        case 108957: // net
7014          this.net = castToMoney(value); // Money
7015          return value;
7016        case 115642: // udi
7017          this.getUdi().add(castToReference(value)); // Reference
7018          return value;
7019        case -1110033957: // noteNumber
7020          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
7021          return value;
7022        case -231349275: // adjudication
7023          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7024          return value;
7025        default: return super.setProperty(hash, name, value);
7026        }
7027
7028      }
7029
7030      @Override
7031      public Base setProperty(String name, Base value) throws FHIRException {
7032        if (name.equals("sequence")) {
7033          this.sequence = castToPositiveInt(value); // PositiveIntType
7034        } else if (name.equals("type")) {
7035          this.type = castToCodeableConcept(value); // CodeableConcept
7036        } else if (name.equals("revenue")) {
7037          this.revenue = castToCodeableConcept(value); // CodeableConcept
7038        } else if (name.equals("category")) {
7039          this.category = castToCodeableConcept(value); // CodeableConcept
7040        } else if (name.equals("service")) {
7041          this.service = castToCodeableConcept(value); // CodeableConcept
7042        } else if (name.equals("modifier")) {
7043          this.getModifier().add(castToCodeableConcept(value));
7044        } else if (name.equals("programCode")) {
7045          this.getProgramCode().add(castToCodeableConcept(value));
7046        } else if (name.equals("quantity")) {
7047          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
7048        } else if (name.equals("unitPrice")) {
7049          this.unitPrice = castToMoney(value); // Money
7050        } else if (name.equals("factor")) {
7051          this.factor = castToDecimal(value); // DecimalType
7052        } else if (name.equals("net")) {
7053          this.net = castToMoney(value); // Money
7054        } else if (name.equals("udi")) {
7055          this.getUdi().add(castToReference(value));
7056        } else if (name.equals("noteNumber")) {
7057          this.getNoteNumber().add(castToPositiveInt(value));
7058        } else if (name.equals("adjudication")) {
7059          this.getAdjudication().add((AdjudicationComponent) value);
7060        } else
7061          return super.setProperty(name, value);
7062        return value;
7063      }
7064
7065      @Override
7066      public Base makeProperty(int hash, String name) throws FHIRException {
7067        switch (hash) {
7068        case 1349547969:  return getSequenceElement();
7069        case 3575610:  return getType(); 
7070        case 1099842588:  return getRevenue(); 
7071        case 50511102:  return getCategory(); 
7072        case 1984153269:  return getService(); 
7073        case -615513385:  return addModifier(); 
7074        case 1010065041:  return addProgramCode(); 
7075        case -1285004149:  return getQuantity(); 
7076        case -486196699:  return getUnitPrice(); 
7077        case -1282148017:  return getFactorElement();
7078        case 108957:  return getNet(); 
7079        case 115642:  return addUdi(); 
7080        case -1110033957:  return addNoteNumberElement();
7081        case -231349275:  return addAdjudication(); 
7082        default: return super.makeProperty(hash, name);
7083        }
7084
7085      }
7086
7087      @Override
7088      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7089        switch (hash) {
7090        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
7091        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
7092        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7093        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7094        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
7095        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7096        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
7097        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
7098        case -486196699: /*unitPrice*/ return new String[] {"Money"};
7099        case -1282148017: /*factor*/ return new String[] {"decimal"};
7100        case 108957: /*net*/ return new String[] {"Money"};
7101        case 115642: /*udi*/ return new String[] {"Reference"};
7102        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7103        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7104        default: return super.getTypesForProperty(hash, name);
7105        }
7106
7107      }
7108
7109      @Override
7110      public Base addChild(String name) throws FHIRException {
7111        if (name.equals("sequence")) {
7112          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
7113        }
7114        else if (name.equals("type")) {
7115          this.type = new CodeableConcept();
7116          return this.type;
7117        }
7118        else if (name.equals("revenue")) {
7119          this.revenue = new CodeableConcept();
7120          return this.revenue;
7121        }
7122        else if (name.equals("category")) {
7123          this.category = new CodeableConcept();
7124          return this.category;
7125        }
7126        else if (name.equals("service")) {
7127          this.service = new CodeableConcept();
7128          return this.service;
7129        }
7130        else if (name.equals("modifier")) {
7131          return addModifier();
7132        }
7133        else if (name.equals("programCode")) {
7134          return addProgramCode();
7135        }
7136        else if (name.equals("quantity")) {
7137          this.quantity = new SimpleQuantity();
7138          return this.quantity;
7139        }
7140        else if (name.equals("unitPrice")) {
7141          this.unitPrice = new Money();
7142          return this.unitPrice;
7143        }
7144        else if (name.equals("factor")) {
7145          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
7146        }
7147        else if (name.equals("net")) {
7148          this.net = new Money();
7149          return this.net;
7150        }
7151        else if (name.equals("udi")) {
7152          return addUdi();
7153        }
7154        else if (name.equals("noteNumber")) {
7155          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
7156        }
7157        else if (name.equals("adjudication")) {
7158          return addAdjudication();
7159        }
7160        else
7161          return super.addChild(name);
7162      }
7163
7164      public SubDetailComponent copy() {
7165        SubDetailComponent dst = new SubDetailComponent();
7166        copyValues(dst);
7167        dst.sequence = sequence == null ? null : sequence.copy();
7168        dst.type = type == null ? null : type.copy();
7169        dst.revenue = revenue == null ? null : revenue.copy();
7170        dst.category = category == null ? null : category.copy();
7171        dst.service = service == null ? null : service.copy();
7172        if (modifier != null) {
7173          dst.modifier = new ArrayList<CodeableConcept>();
7174          for (CodeableConcept i : modifier)
7175            dst.modifier.add(i.copy());
7176        };
7177        if (programCode != null) {
7178          dst.programCode = new ArrayList<CodeableConcept>();
7179          for (CodeableConcept i : programCode)
7180            dst.programCode.add(i.copy());
7181        };
7182        dst.quantity = quantity == null ? null : quantity.copy();
7183        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7184        dst.factor = factor == null ? null : factor.copy();
7185        dst.net = net == null ? null : net.copy();
7186        if (udi != null) {
7187          dst.udi = new ArrayList<Reference>();
7188          for (Reference i : udi)
7189            dst.udi.add(i.copy());
7190        };
7191        if (noteNumber != null) {
7192          dst.noteNumber = new ArrayList<PositiveIntType>();
7193          for (PositiveIntType i : noteNumber)
7194            dst.noteNumber.add(i.copy());
7195        };
7196        if (adjudication != null) {
7197          dst.adjudication = new ArrayList<AdjudicationComponent>();
7198          for (AdjudicationComponent i : adjudication)
7199            dst.adjudication.add(i.copy());
7200        };
7201        return dst;
7202      }
7203
7204      @Override
7205      public boolean equalsDeep(Base other_) {
7206        if (!super.equalsDeep(other_))
7207          return false;
7208        if (!(other_ instanceof SubDetailComponent))
7209          return false;
7210        SubDetailComponent o = (SubDetailComponent) other_;
7211        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(revenue, o.revenue, true)
7212           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
7213           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
7214           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
7215           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
7216          ;
7217      }
7218
7219      @Override
7220      public boolean equalsShallow(Base other_) {
7221        if (!super.equalsShallow(other_))
7222          return false;
7223        if (!(other_ instanceof SubDetailComponent))
7224          return false;
7225        SubDetailComponent o = (SubDetailComponent) other_;
7226        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
7227          ;
7228      }
7229
7230      public boolean isEmpty() {
7231        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, revenue
7232          , category, service, modifier, programCode, quantity, unitPrice, factor, net
7233          , udi, noteNumber, adjudication);
7234      }
7235
7236  public String fhirType() {
7237    return "ExplanationOfBenefit.item.detail.subDetail";
7238
7239  }
7240
7241  }
7242
7243    @Block()
7244    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
7245        /**
7246         * List of input service items which this service line is intended to replace.
7247         */
7248        @Child(name = "sequenceLinkId", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7249        @Description(shortDefinition="Service instances", formalDefinition="List of input service items which this service line is intended to replace." )
7250        protected List<PositiveIntType> sequenceLinkId;
7251
7252        /**
7253         * The type of reveneu or cost center providing the product and/or service.
7254         */
7255        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
7256        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
7257        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
7258        protected CodeableConcept revenue;
7259
7260        /**
7261         * Health Care Service Type Codes  to identify the classification of service or benefits.
7262         */
7263        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
7264        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
7265        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
7266        protected CodeableConcept category;
7267
7268        /**
7269         * 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'.
7270         */
7271        @Child(name = "service", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
7272        @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'." )
7273        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7274        protected CodeableConcept service;
7275
7276        /**
7277         * 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.
7278         */
7279        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7280        @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." )
7281        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
7282        protected List<CodeableConcept> modifier;
7283
7284        /**
7285         * The fee charged for the professional service or product.
7286         */
7287        @Child(name = "fee", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
7288        @Description(shortDefinition="Professional fee or Product charge", formalDefinition="The fee charged for the professional service or product." )
7289        protected Money fee;
7290
7291        /**
7292         * A list of note references to the notes provided below.
7293         */
7294        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7295        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
7296        protected List<PositiveIntType> noteNumber;
7297
7298        /**
7299         * The adjudications results.
7300         */
7301        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7302        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudications results." )
7303        protected List<AdjudicationComponent> adjudication;
7304
7305        /**
7306         * The second tier service adjudications for payor added services.
7307         */
7308        @Child(name = "detail", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7309        @Description(shortDefinition="Added items details", formalDefinition="The second tier service adjudications for payor added services." )
7310        protected List<AddedItemsDetailComponent> detail;
7311
7312        private static final long serialVersionUID = 1969703165L;
7313
7314    /**
7315     * Constructor
7316     */
7317      public AddedItemComponent() {
7318        super();
7319      }
7320
7321        /**
7322         * @return {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
7323         */
7324        public List<PositiveIntType> getSequenceLinkId() { 
7325          if (this.sequenceLinkId == null)
7326            this.sequenceLinkId = new ArrayList<PositiveIntType>();
7327          return this.sequenceLinkId;
7328        }
7329
7330        /**
7331         * @return Returns a reference to <code>this</code> for easy method chaining
7332         */
7333        public AddedItemComponent setSequenceLinkId(List<PositiveIntType> theSequenceLinkId) { 
7334          this.sequenceLinkId = theSequenceLinkId;
7335          return this;
7336        }
7337
7338        public boolean hasSequenceLinkId() { 
7339          if (this.sequenceLinkId == null)
7340            return false;
7341          for (PositiveIntType item : this.sequenceLinkId)
7342            if (!item.isEmpty())
7343              return true;
7344          return false;
7345        }
7346
7347        /**
7348         * @return {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
7349         */
7350        public PositiveIntType addSequenceLinkIdElement() {//2 
7351          PositiveIntType t = new PositiveIntType();
7352          if (this.sequenceLinkId == null)
7353            this.sequenceLinkId = new ArrayList<PositiveIntType>();
7354          this.sequenceLinkId.add(t);
7355          return t;
7356        }
7357
7358        /**
7359         * @param value {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
7360         */
7361        public AddedItemComponent addSequenceLinkId(int value) { //1
7362          PositiveIntType t = new PositiveIntType();
7363          t.setValue(value);
7364          if (this.sequenceLinkId == null)
7365            this.sequenceLinkId = new ArrayList<PositiveIntType>();
7366          this.sequenceLinkId.add(t);
7367          return this;
7368        }
7369
7370        /**
7371         * @param value {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
7372         */
7373        public boolean hasSequenceLinkId(int value) { 
7374          if (this.sequenceLinkId == null)
7375            return false;
7376          for (PositiveIntType v : this.sequenceLinkId)
7377            if (v.getValue().equals(value)) // positiveInt
7378              return true;
7379          return false;
7380        }
7381
7382        /**
7383         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
7384         */
7385        public CodeableConcept getRevenue() { 
7386          if (this.revenue == null)
7387            if (Configuration.errorOnAutoCreate())
7388              throw new Error("Attempt to auto-create AddedItemComponent.revenue");
7389            else if (Configuration.doAutoCreate())
7390              this.revenue = new CodeableConcept(); // cc
7391          return this.revenue;
7392        }
7393
7394        public boolean hasRevenue() { 
7395          return this.revenue != null && !this.revenue.isEmpty();
7396        }
7397
7398        /**
7399         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
7400         */
7401        public AddedItemComponent setRevenue(CodeableConcept value)  { 
7402          this.revenue = value;
7403          return this;
7404        }
7405
7406        /**
7407         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
7408         */
7409        public CodeableConcept getCategory() { 
7410          if (this.category == null)
7411            if (Configuration.errorOnAutoCreate())
7412              throw new Error("Attempt to auto-create AddedItemComponent.category");
7413            else if (Configuration.doAutoCreate())
7414              this.category = new CodeableConcept(); // cc
7415          return this.category;
7416        }
7417
7418        public boolean hasCategory() { 
7419          return this.category != null && !this.category.isEmpty();
7420        }
7421
7422        /**
7423         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
7424         */
7425        public AddedItemComponent setCategory(CodeableConcept value)  { 
7426          this.category = value;
7427          return this;
7428        }
7429
7430        /**
7431         * @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'.)
7432         */
7433        public CodeableConcept getService() { 
7434          if (this.service == null)
7435            if (Configuration.errorOnAutoCreate())
7436              throw new Error("Attempt to auto-create AddedItemComponent.service");
7437            else if (Configuration.doAutoCreate())
7438              this.service = new CodeableConcept(); // cc
7439          return this.service;
7440        }
7441
7442        public boolean hasService() { 
7443          return this.service != null && !this.service.isEmpty();
7444        }
7445
7446        /**
7447         * @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'.)
7448         */
7449        public AddedItemComponent setService(CodeableConcept value)  { 
7450          this.service = value;
7451          return this;
7452        }
7453
7454        /**
7455         * @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.)
7456         */
7457        public List<CodeableConcept> getModifier() { 
7458          if (this.modifier == null)
7459            this.modifier = new ArrayList<CodeableConcept>();
7460          return this.modifier;
7461        }
7462
7463        /**
7464         * @return Returns a reference to <code>this</code> for easy method chaining
7465         */
7466        public AddedItemComponent setModifier(List<CodeableConcept> theModifier) { 
7467          this.modifier = theModifier;
7468          return this;
7469        }
7470
7471        public boolean hasModifier() { 
7472          if (this.modifier == null)
7473            return false;
7474          for (CodeableConcept item : this.modifier)
7475            if (!item.isEmpty())
7476              return true;
7477          return false;
7478        }
7479
7480        public CodeableConcept addModifier() { //3
7481          CodeableConcept t = new CodeableConcept();
7482          if (this.modifier == null)
7483            this.modifier = new ArrayList<CodeableConcept>();
7484          this.modifier.add(t);
7485          return t;
7486        }
7487
7488        public AddedItemComponent addModifier(CodeableConcept t) { //3
7489          if (t == null)
7490            return this;
7491          if (this.modifier == null)
7492            this.modifier = new ArrayList<CodeableConcept>();
7493          this.modifier.add(t);
7494          return this;
7495        }
7496
7497        /**
7498         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
7499         */
7500        public CodeableConcept getModifierFirstRep() { 
7501          if (getModifier().isEmpty()) {
7502            addModifier();
7503          }
7504          return getModifier().get(0);
7505        }
7506
7507        /**
7508         * @return {@link #fee} (The fee charged for the professional service or product.)
7509         */
7510        public Money getFee() { 
7511          if (this.fee == null)
7512            if (Configuration.errorOnAutoCreate())
7513              throw new Error("Attempt to auto-create AddedItemComponent.fee");
7514            else if (Configuration.doAutoCreate())
7515              this.fee = new Money(); // cc
7516          return this.fee;
7517        }
7518
7519        public boolean hasFee() { 
7520          return this.fee != null && !this.fee.isEmpty();
7521        }
7522
7523        /**
7524         * @param value {@link #fee} (The fee charged for the professional service or product.)
7525         */
7526        public AddedItemComponent setFee(Money value)  { 
7527          this.fee = value;
7528          return this;
7529        }
7530
7531        /**
7532         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
7533         */
7534        public List<PositiveIntType> getNoteNumber() { 
7535          if (this.noteNumber == null)
7536            this.noteNumber = new ArrayList<PositiveIntType>();
7537          return this.noteNumber;
7538        }
7539
7540        /**
7541         * @return Returns a reference to <code>this</code> for easy method chaining
7542         */
7543        public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
7544          this.noteNumber = theNoteNumber;
7545          return this;
7546        }
7547
7548        public boolean hasNoteNumber() { 
7549          if (this.noteNumber == null)
7550            return false;
7551          for (PositiveIntType item : this.noteNumber)
7552            if (!item.isEmpty())
7553              return true;
7554          return false;
7555        }
7556
7557        /**
7558         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
7559         */
7560        public PositiveIntType addNoteNumberElement() {//2 
7561          PositiveIntType t = new PositiveIntType();
7562          if (this.noteNumber == null)
7563            this.noteNumber = new ArrayList<PositiveIntType>();
7564          this.noteNumber.add(t);
7565          return t;
7566        }
7567
7568        /**
7569         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
7570         */
7571        public AddedItemComponent addNoteNumber(int value) { //1
7572          PositiveIntType t = new PositiveIntType();
7573          t.setValue(value);
7574          if (this.noteNumber == null)
7575            this.noteNumber = new ArrayList<PositiveIntType>();
7576          this.noteNumber.add(t);
7577          return this;
7578        }
7579
7580        /**
7581         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
7582         */
7583        public boolean hasNoteNumber(int value) { 
7584          if (this.noteNumber == null)
7585            return false;
7586          for (PositiveIntType v : this.noteNumber)
7587            if (v.getValue().equals(value)) // positiveInt
7588              return true;
7589          return false;
7590        }
7591
7592        /**
7593         * @return {@link #adjudication} (The adjudications results.)
7594         */
7595        public List<AdjudicationComponent> getAdjudication() { 
7596          if (this.adjudication == null)
7597            this.adjudication = new ArrayList<AdjudicationComponent>();
7598          return this.adjudication;
7599        }
7600
7601        /**
7602         * @return Returns a reference to <code>this</code> for easy method chaining
7603         */
7604        public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
7605          this.adjudication = theAdjudication;
7606          return this;
7607        }
7608
7609        public boolean hasAdjudication() { 
7610          if (this.adjudication == null)
7611            return false;
7612          for (AdjudicationComponent item : this.adjudication)
7613            if (!item.isEmpty())
7614              return true;
7615          return false;
7616        }
7617
7618        public AdjudicationComponent addAdjudication() { //3
7619          AdjudicationComponent t = new AdjudicationComponent();
7620          if (this.adjudication == null)
7621            this.adjudication = new ArrayList<AdjudicationComponent>();
7622          this.adjudication.add(t);
7623          return t;
7624        }
7625
7626        public AddedItemComponent addAdjudication(AdjudicationComponent t) { //3
7627          if (t == null)
7628            return this;
7629          if (this.adjudication == null)
7630            this.adjudication = new ArrayList<AdjudicationComponent>();
7631          this.adjudication.add(t);
7632          return this;
7633        }
7634
7635        /**
7636         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
7637         */
7638        public AdjudicationComponent getAdjudicationFirstRep() { 
7639          if (getAdjudication().isEmpty()) {
7640            addAdjudication();
7641          }
7642          return getAdjudication().get(0);
7643        }
7644
7645        /**
7646         * @return {@link #detail} (The second tier service adjudications for payor added services.)
7647         */
7648        public List<AddedItemsDetailComponent> getDetail() { 
7649          if (this.detail == null)
7650            this.detail = new ArrayList<AddedItemsDetailComponent>();
7651          return this.detail;
7652        }
7653
7654        /**
7655         * @return Returns a reference to <code>this</code> for easy method chaining
7656         */
7657        public AddedItemComponent setDetail(List<AddedItemsDetailComponent> theDetail) { 
7658          this.detail = theDetail;
7659          return this;
7660        }
7661
7662        public boolean hasDetail() { 
7663          if (this.detail == null)
7664            return false;
7665          for (AddedItemsDetailComponent item : this.detail)
7666            if (!item.isEmpty())
7667              return true;
7668          return false;
7669        }
7670
7671        public AddedItemsDetailComponent addDetail() { //3
7672          AddedItemsDetailComponent t = new AddedItemsDetailComponent();
7673          if (this.detail == null)
7674            this.detail = new ArrayList<AddedItemsDetailComponent>();
7675          this.detail.add(t);
7676          return t;
7677        }
7678
7679        public AddedItemComponent addDetail(AddedItemsDetailComponent t) { //3
7680          if (t == null)
7681            return this;
7682          if (this.detail == null)
7683            this.detail = new ArrayList<AddedItemsDetailComponent>();
7684          this.detail.add(t);
7685          return this;
7686        }
7687
7688        /**
7689         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
7690         */
7691        public AddedItemsDetailComponent getDetailFirstRep() { 
7692          if (getDetail().isEmpty()) {
7693            addDetail();
7694          }
7695          return getDetail().get(0);
7696        }
7697
7698        protected void listChildren(List<Property> children) {
7699          super.listChildren(children);
7700          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));
7701          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
7702          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
7703          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));
7704          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));
7705          children.add(new Property("fee", "Money", "The fee charged for the professional service or product.", 0, 1, fee));
7706          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
7707          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
7708          children.add(new Property("detail", "", "The second tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
7709        }
7710
7711        @Override
7712        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7713          switch (_hash) {
7714          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);
7715          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
7716          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
7717          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);
7718          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);
7719          case 101254: /*fee*/  return new Property("fee", "Money", "The fee charged for the professional service or product.", 0, 1, fee);
7720          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);
7721          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
7722          case -1335224239: /*detail*/  return new Property("detail", "", "The second tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail);
7723          default: return super.getNamedProperty(_hash, _name, _checkValid);
7724          }
7725
7726        }
7727
7728      @Override
7729      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7730        switch (hash) {
7731        case -1422298666: /*sequenceLinkId*/ return this.sequenceLinkId == null ? new Base[0] : this.sequenceLinkId.toArray(new Base[this.sequenceLinkId.size()]); // PositiveIntType
7732        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
7733        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
7734        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
7735        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7736        case 101254: /*fee*/ return this.fee == null ? new Base[0] : new Base[] {this.fee}; // Money
7737        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7738        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7739        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemsDetailComponent
7740        default: return super.getProperty(hash, name, checkValid);
7741        }
7742
7743      }
7744
7745      @Override
7746      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7747        switch (hash) {
7748        case -1422298666: // sequenceLinkId
7749          this.getSequenceLinkId().add(castToPositiveInt(value)); // PositiveIntType
7750          return value;
7751        case 1099842588: // revenue
7752          this.revenue = castToCodeableConcept(value); // CodeableConcept
7753          return value;
7754        case 50511102: // category
7755          this.category = castToCodeableConcept(value); // CodeableConcept
7756          return value;
7757        case 1984153269: // service
7758          this.service = castToCodeableConcept(value); // CodeableConcept
7759          return value;
7760        case -615513385: // modifier
7761          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7762          return value;
7763        case 101254: // fee
7764          this.fee = castToMoney(value); // Money
7765          return value;
7766        case -1110033957: // noteNumber
7767          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
7768          return value;
7769        case -231349275: // adjudication
7770          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7771          return value;
7772        case -1335224239: // detail
7773          this.getDetail().add((AddedItemsDetailComponent) value); // AddedItemsDetailComponent
7774          return value;
7775        default: return super.setProperty(hash, name, value);
7776        }
7777
7778      }
7779
7780      @Override
7781      public Base setProperty(String name, Base value) throws FHIRException {
7782        if (name.equals("sequenceLinkId")) {
7783          this.getSequenceLinkId().add(castToPositiveInt(value));
7784        } else if (name.equals("revenue")) {
7785          this.revenue = castToCodeableConcept(value); // CodeableConcept
7786        } else if (name.equals("category")) {
7787          this.category = castToCodeableConcept(value); // CodeableConcept
7788        } else if (name.equals("service")) {
7789          this.service = castToCodeableConcept(value); // CodeableConcept
7790        } else if (name.equals("modifier")) {
7791          this.getModifier().add(castToCodeableConcept(value));
7792        } else if (name.equals("fee")) {
7793          this.fee = castToMoney(value); // Money
7794        } else if (name.equals("noteNumber")) {
7795          this.getNoteNumber().add(castToPositiveInt(value));
7796        } else if (name.equals("adjudication")) {
7797          this.getAdjudication().add((AdjudicationComponent) value);
7798        } else if (name.equals("detail")) {
7799          this.getDetail().add((AddedItemsDetailComponent) value);
7800        } else
7801          return super.setProperty(name, value);
7802        return value;
7803      }
7804
7805      @Override
7806      public Base makeProperty(int hash, String name) throws FHIRException {
7807        switch (hash) {
7808        case -1422298666:  return addSequenceLinkIdElement();
7809        case 1099842588:  return getRevenue(); 
7810        case 50511102:  return getCategory(); 
7811        case 1984153269:  return getService(); 
7812        case -615513385:  return addModifier(); 
7813        case 101254:  return getFee(); 
7814        case -1110033957:  return addNoteNumberElement();
7815        case -231349275:  return addAdjudication(); 
7816        case -1335224239:  return addDetail(); 
7817        default: return super.makeProperty(hash, name);
7818        }
7819
7820      }
7821
7822      @Override
7823      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7824        switch (hash) {
7825        case -1422298666: /*sequenceLinkId*/ return new String[] {"positiveInt"};
7826        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7827        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7828        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
7829        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7830        case 101254: /*fee*/ return new String[] {"Money"};
7831        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7832        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7833        case -1335224239: /*detail*/ return new String[] {};
7834        default: return super.getTypesForProperty(hash, name);
7835        }
7836
7837      }
7838
7839      @Override
7840      public Base addChild(String name) throws FHIRException {
7841        if (name.equals("sequenceLinkId")) {
7842          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequenceLinkId");
7843        }
7844        else if (name.equals("revenue")) {
7845          this.revenue = new CodeableConcept();
7846          return this.revenue;
7847        }
7848        else if (name.equals("category")) {
7849          this.category = new CodeableConcept();
7850          return this.category;
7851        }
7852        else if (name.equals("service")) {
7853          this.service = new CodeableConcept();
7854          return this.service;
7855        }
7856        else if (name.equals("modifier")) {
7857          return addModifier();
7858        }
7859        else if (name.equals("fee")) {
7860          this.fee = new Money();
7861          return this.fee;
7862        }
7863        else if (name.equals("noteNumber")) {
7864          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
7865        }
7866        else if (name.equals("adjudication")) {
7867          return addAdjudication();
7868        }
7869        else if (name.equals("detail")) {
7870          return addDetail();
7871        }
7872        else
7873          return super.addChild(name);
7874      }
7875
7876      public AddedItemComponent copy() {
7877        AddedItemComponent dst = new AddedItemComponent();
7878        copyValues(dst);
7879        if (sequenceLinkId != null) {
7880          dst.sequenceLinkId = new ArrayList<PositiveIntType>();
7881          for (PositiveIntType i : sequenceLinkId)
7882            dst.sequenceLinkId.add(i.copy());
7883        };
7884        dst.revenue = revenue == null ? null : revenue.copy();
7885        dst.category = category == null ? null : category.copy();
7886        dst.service = service == null ? null : service.copy();
7887        if (modifier != null) {
7888          dst.modifier = new ArrayList<CodeableConcept>();
7889          for (CodeableConcept i : modifier)
7890            dst.modifier.add(i.copy());
7891        };
7892        dst.fee = fee == null ? null : fee.copy();
7893        if (noteNumber != null) {
7894          dst.noteNumber = new ArrayList<PositiveIntType>();
7895          for (PositiveIntType i : noteNumber)
7896            dst.noteNumber.add(i.copy());
7897        };
7898        if (adjudication != null) {
7899          dst.adjudication = new ArrayList<AdjudicationComponent>();
7900          for (AdjudicationComponent i : adjudication)
7901            dst.adjudication.add(i.copy());
7902        };
7903        if (detail != null) {
7904          dst.detail = new ArrayList<AddedItemsDetailComponent>();
7905          for (AddedItemsDetailComponent i : detail)
7906            dst.detail.add(i.copy());
7907        };
7908        return dst;
7909      }
7910
7911      @Override
7912      public boolean equalsDeep(Base other_) {
7913        if (!super.equalsDeep(other_))
7914          return false;
7915        if (!(other_ instanceof AddedItemComponent))
7916          return false;
7917        AddedItemComponent o = (AddedItemComponent) other_;
7918        return compareDeep(sequenceLinkId, o.sequenceLinkId, true) && compareDeep(revenue, o.revenue, true)
7919           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
7920           && compareDeep(fee, o.fee, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
7921           && compareDeep(detail, o.detail, true);
7922      }
7923
7924      @Override
7925      public boolean equalsShallow(Base other_) {
7926        if (!super.equalsShallow(other_))
7927          return false;
7928        if (!(other_ instanceof AddedItemComponent))
7929          return false;
7930        AddedItemComponent o = (AddedItemComponent) other_;
7931        return compareValues(sequenceLinkId, o.sequenceLinkId, true) && compareValues(noteNumber, o.noteNumber, true)
7932          ;
7933      }
7934
7935      public boolean isEmpty() {
7936        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequenceLinkId, revenue, category
7937          , service, modifier, fee, noteNumber, adjudication, detail);
7938      }
7939
7940  public String fhirType() {
7941    return "ExplanationOfBenefit.addItem";
7942
7943  }
7944
7945  }
7946
7947    @Block()
7948    public static class AddedItemsDetailComponent extends BackboneElement implements IBaseBackboneElement {
7949        /**
7950         * The type of reveneu or cost center providing the product and/or service.
7951         */
7952        @Child(name = "revenue", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
7953        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
7954        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
7955        protected CodeableConcept revenue;
7956
7957        /**
7958         * Health Care Service Type Codes  to identify the classification of service or benefits.
7959         */
7960        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
7961        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
7962        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
7963        protected CodeableConcept category;
7964
7965        /**
7966         * A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).
7967         */
7968        @Child(name = "service", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
7969        @Description(shortDefinition="Billing Code", formalDefinition="A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI)." )
7970        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7971        protected CodeableConcept service;
7972
7973        /**
7974         * 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.
7975         */
7976        @Child(name = "modifier", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7977        @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." )
7978        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
7979        protected List<CodeableConcept> modifier;
7980
7981        /**
7982         * The fee charged for the professional service or product.
7983         */
7984        @Child(name = "fee", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
7985        @Description(shortDefinition="Professional fee or Product charge", formalDefinition="The fee charged for the professional service or product." )
7986        protected Money fee;
7987
7988        /**
7989         * A list of note references to the notes provided below.
7990         */
7991        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7992        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
7993        protected List<PositiveIntType> noteNumber;
7994
7995        /**
7996         * The adjudications results.
7997         */
7998        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7999        @Description(shortDefinition="Added items detail adjudication", formalDefinition="The adjudications results." )
8000        protected List<AdjudicationComponent> adjudication;
8001
8002        private static final long serialVersionUID = -311484980L;
8003
8004    /**
8005     * Constructor
8006     */
8007      public AddedItemsDetailComponent() {
8008        super();
8009      }
8010
8011        /**
8012         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
8013         */
8014        public CodeableConcept getRevenue() { 
8015          if (this.revenue == null)
8016            if (Configuration.errorOnAutoCreate())
8017              throw new Error("Attempt to auto-create AddedItemsDetailComponent.revenue");
8018            else if (Configuration.doAutoCreate())
8019              this.revenue = new CodeableConcept(); // cc
8020          return this.revenue;
8021        }
8022
8023        public boolean hasRevenue() { 
8024          return this.revenue != null && !this.revenue.isEmpty();
8025        }
8026
8027        /**
8028         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
8029         */
8030        public AddedItemsDetailComponent setRevenue(CodeableConcept value)  { 
8031          this.revenue = value;
8032          return this;
8033        }
8034
8035        /**
8036         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
8037         */
8038        public CodeableConcept getCategory() { 
8039          if (this.category == null)
8040            if (Configuration.errorOnAutoCreate())
8041              throw new Error("Attempt to auto-create AddedItemsDetailComponent.category");
8042            else if (Configuration.doAutoCreate())
8043              this.category = new CodeableConcept(); // cc
8044          return this.category;
8045        }
8046
8047        public boolean hasCategory() { 
8048          return this.category != null && !this.category.isEmpty();
8049        }
8050
8051        /**
8052         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
8053         */
8054        public AddedItemsDetailComponent setCategory(CodeableConcept value)  { 
8055          this.category = value;
8056          return this;
8057        }
8058
8059        /**
8060         * @return {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
8061         */
8062        public CodeableConcept getService() { 
8063          if (this.service == null)
8064            if (Configuration.errorOnAutoCreate())
8065              throw new Error("Attempt to auto-create AddedItemsDetailComponent.service");
8066            else if (Configuration.doAutoCreate())
8067              this.service = new CodeableConcept(); // cc
8068          return this.service;
8069        }
8070
8071        public boolean hasService() { 
8072          return this.service != null && !this.service.isEmpty();
8073        }
8074
8075        /**
8076         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
8077         */
8078        public AddedItemsDetailComponent setService(CodeableConcept value)  { 
8079          this.service = value;
8080          return this;
8081        }
8082
8083        /**
8084         * @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.)
8085         */
8086        public List<CodeableConcept> getModifier() { 
8087          if (this.modifier == null)
8088            this.modifier = new ArrayList<CodeableConcept>();
8089          return this.modifier;
8090        }
8091
8092        /**
8093         * @return Returns a reference to <code>this</code> for easy method chaining
8094         */
8095        public AddedItemsDetailComponent setModifier(List<CodeableConcept> theModifier) { 
8096          this.modifier = theModifier;
8097          return this;
8098        }
8099
8100        public boolean hasModifier() { 
8101          if (this.modifier == null)
8102            return false;
8103          for (CodeableConcept item : this.modifier)
8104            if (!item.isEmpty())
8105              return true;
8106          return false;
8107        }
8108
8109        public CodeableConcept addModifier() { //3
8110          CodeableConcept t = new CodeableConcept();
8111          if (this.modifier == null)
8112            this.modifier = new ArrayList<CodeableConcept>();
8113          this.modifier.add(t);
8114          return t;
8115        }
8116
8117        public AddedItemsDetailComponent addModifier(CodeableConcept t) { //3
8118          if (t == null)
8119            return this;
8120          if (this.modifier == null)
8121            this.modifier = new ArrayList<CodeableConcept>();
8122          this.modifier.add(t);
8123          return this;
8124        }
8125
8126        /**
8127         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
8128         */
8129        public CodeableConcept getModifierFirstRep() { 
8130          if (getModifier().isEmpty()) {
8131            addModifier();
8132          }
8133          return getModifier().get(0);
8134        }
8135
8136        /**
8137         * @return {@link #fee} (The fee charged for the professional service or product.)
8138         */
8139        public Money getFee() { 
8140          if (this.fee == null)
8141            if (Configuration.errorOnAutoCreate())
8142              throw new Error("Attempt to auto-create AddedItemsDetailComponent.fee");
8143            else if (Configuration.doAutoCreate())
8144              this.fee = new Money(); // cc
8145          return this.fee;
8146        }
8147
8148        public boolean hasFee() { 
8149          return this.fee != null && !this.fee.isEmpty();
8150        }
8151
8152        /**
8153         * @param value {@link #fee} (The fee charged for the professional service or product.)
8154         */
8155        public AddedItemsDetailComponent setFee(Money value)  { 
8156          this.fee = value;
8157          return this;
8158        }
8159
8160        /**
8161         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
8162         */
8163        public List<PositiveIntType> getNoteNumber() { 
8164          if (this.noteNumber == null)
8165            this.noteNumber = new ArrayList<PositiveIntType>();
8166          return this.noteNumber;
8167        }
8168
8169        /**
8170         * @return Returns a reference to <code>this</code> for easy method chaining
8171         */
8172        public AddedItemsDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
8173          this.noteNumber = theNoteNumber;
8174          return this;
8175        }
8176
8177        public boolean hasNoteNumber() { 
8178          if (this.noteNumber == null)
8179            return false;
8180          for (PositiveIntType item : this.noteNumber)
8181            if (!item.isEmpty())
8182              return true;
8183          return false;
8184        }
8185
8186        /**
8187         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
8188         */
8189        public PositiveIntType addNoteNumberElement() {//2 
8190          PositiveIntType t = new PositiveIntType();
8191          if (this.noteNumber == null)
8192            this.noteNumber = new ArrayList<PositiveIntType>();
8193          this.noteNumber.add(t);
8194          return t;
8195        }
8196
8197        /**
8198         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
8199         */
8200        public AddedItemsDetailComponent addNoteNumber(int value) { //1
8201          PositiveIntType t = new PositiveIntType();
8202          t.setValue(value);
8203          if (this.noteNumber == null)
8204            this.noteNumber = new ArrayList<PositiveIntType>();
8205          this.noteNumber.add(t);
8206          return this;
8207        }
8208
8209        /**
8210         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
8211         */
8212        public boolean hasNoteNumber(int value) { 
8213          if (this.noteNumber == null)
8214            return false;
8215          for (PositiveIntType v : this.noteNumber)
8216            if (v.getValue().equals(value)) // positiveInt
8217              return true;
8218          return false;
8219        }
8220
8221        /**
8222         * @return {@link #adjudication} (The adjudications results.)
8223         */
8224        public List<AdjudicationComponent> getAdjudication() { 
8225          if (this.adjudication == null)
8226            this.adjudication = new ArrayList<AdjudicationComponent>();
8227          return this.adjudication;
8228        }
8229
8230        /**
8231         * @return Returns a reference to <code>this</code> for easy method chaining
8232         */
8233        public AddedItemsDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
8234          this.adjudication = theAdjudication;
8235          return this;
8236        }
8237
8238        public boolean hasAdjudication() { 
8239          if (this.adjudication == null)
8240            return false;
8241          for (AdjudicationComponent item : this.adjudication)
8242            if (!item.isEmpty())
8243              return true;
8244          return false;
8245        }
8246
8247        public AdjudicationComponent addAdjudication() { //3
8248          AdjudicationComponent t = new AdjudicationComponent();
8249          if (this.adjudication == null)
8250            this.adjudication = new ArrayList<AdjudicationComponent>();
8251          this.adjudication.add(t);
8252          return t;
8253        }
8254
8255        public AddedItemsDetailComponent addAdjudication(AdjudicationComponent t) { //3
8256          if (t == null)
8257            return this;
8258          if (this.adjudication == null)
8259            this.adjudication = new ArrayList<AdjudicationComponent>();
8260          this.adjudication.add(t);
8261          return this;
8262        }
8263
8264        /**
8265         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
8266         */
8267        public AdjudicationComponent getAdjudicationFirstRep() { 
8268          if (getAdjudication().isEmpty()) {
8269            addAdjudication();
8270          }
8271          return getAdjudication().get(0);
8272        }
8273
8274        protected void listChildren(List<Property> children) {
8275          super.listChildren(children);
8276          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
8277          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
8278          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));
8279          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));
8280          children.add(new Property("fee", "Money", "The fee charged for the professional service or product.", 0, 1, fee));
8281          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
8282          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
8283        }
8284
8285        @Override
8286        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8287          switch (_hash) {
8288          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
8289          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
8290          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);
8291          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);
8292          case 101254: /*fee*/  return new Property("fee", "Money", "The fee charged for the professional service or product.", 0, 1, fee);
8293          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);
8294          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
8295          default: return super.getNamedProperty(_hash, _name, _checkValid);
8296          }
8297
8298        }
8299
8300      @Override
8301      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8302        switch (hash) {
8303        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
8304        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
8305        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
8306        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
8307        case 101254: /*fee*/ return this.fee == null ? new Base[0] : new Base[] {this.fee}; // Money
8308        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
8309        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
8310        default: return super.getProperty(hash, name, checkValid);
8311        }
8312
8313      }
8314
8315      @Override
8316      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8317        switch (hash) {
8318        case 1099842588: // revenue
8319          this.revenue = castToCodeableConcept(value); // CodeableConcept
8320          return value;
8321        case 50511102: // category
8322          this.category = castToCodeableConcept(value); // CodeableConcept
8323          return value;
8324        case 1984153269: // service
8325          this.service = castToCodeableConcept(value); // CodeableConcept
8326          return value;
8327        case -615513385: // modifier
8328          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
8329          return value;
8330        case 101254: // fee
8331          this.fee = castToMoney(value); // Money
8332          return value;
8333        case -1110033957: // noteNumber
8334          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
8335          return value;
8336        case -231349275: // adjudication
8337          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
8338          return value;
8339        default: return super.setProperty(hash, name, value);
8340        }
8341
8342      }
8343
8344      @Override
8345      public Base setProperty(String name, Base value) throws FHIRException {
8346        if (name.equals("revenue")) {
8347          this.revenue = castToCodeableConcept(value); // CodeableConcept
8348        } else if (name.equals("category")) {
8349          this.category = castToCodeableConcept(value); // CodeableConcept
8350        } else if (name.equals("service")) {
8351          this.service = castToCodeableConcept(value); // CodeableConcept
8352        } else if (name.equals("modifier")) {
8353          this.getModifier().add(castToCodeableConcept(value));
8354        } else if (name.equals("fee")) {
8355          this.fee = castToMoney(value); // Money
8356        } else if (name.equals("noteNumber")) {
8357          this.getNoteNumber().add(castToPositiveInt(value));
8358        } else if (name.equals("adjudication")) {
8359          this.getAdjudication().add((AdjudicationComponent) value);
8360        } else
8361          return super.setProperty(name, value);
8362        return value;
8363      }
8364
8365      @Override
8366      public Base makeProperty(int hash, String name) throws FHIRException {
8367        switch (hash) {
8368        case 1099842588:  return getRevenue(); 
8369        case 50511102:  return getCategory(); 
8370        case 1984153269:  return getService(); 
8371        case -615513385:  return addModifier(); 
8372        case 101254:  return getFee(); 
8373        case -1110033957:  return addNoteNumberElement();
8374        case -231349275:  return addAdjudication(); 
8375        default: return super.makeProperty(hash, name);
8376        }
8377
8378      }
8379
8380      @Override
8381      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8382        switch (hash) {
8383        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
8384        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
8385        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
8386        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
8387        case 101254: /*fee*/ return new String[] {"Money"};
8388        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
8389        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
8390        default: return super.getTypesForProperty(hash, name);
8391        }
8392
8393      }
8394
8395      @Override
8396      public Base addChild(String name) throws FHIRException {
8397        if (name.equals("revenue")) {
8398          this.revenue = new CodeableConcept();
8399          return this.revenue;
8400        }
8401        else if (name.equals("category")) {
8402          this.category = new CodeableConcept();
8403          return this.category;
8404        }
8405        else if (name.equals("service")) {
8406          this.service = new CodeableConcept();
8407          return this.service;
8408        }
8409        else if (name.equals("modifier")) {
8410          return addModifier();
8411        }
8412        else if (name.equals("fee")) {
8413          this.fee = new Money();
8414          return this.fee;
8415        }
8416        else if (name.equals("noteNumber")) {
8417          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
8418        }
8419        else if (name.equals("adjudication")) {
8420          return addAdjudication();
8421        }
8422        else
8423          return super.addChild(name);
8424      }
8425
8426      public AddedItemsDetailComponent copy() {
8427        AddedItemsDetailComponent dst = new AddedItemsDetailComponent();
8428        copyValues(dst);
8429        dst.revenue = revenue == null ? null : revenue.copy();
8430        dst.category = category == null ? null : category.copy();
8431        dst.service = service == null ? null : service.copy();
8432        if (modifier != null) {
8433          dst.modifier = new ArrayList<CodeableConcept>();
8434          for (CodeableConcept i : modifier)
8435            dst.modifier.add(i.copy());
8436        };
8437        dst.fee = fee == null ? null : fee.copy();
8438        if (noteNumber != null) {
8439          dst.noteNumber = new ArrayList<PositiveIntType>();
8440          for (PositiveIntType i : noteNumber)
8441            dst.noteNumber.add(i.copy());
8442        };
8443        if (adjudication != null) {
8444          dst.adjudication = new ArrayList<AdjudicationComponent>();
8445          for (AdjudicationComponent i : adjudication)
8446            dst.adjudication.add(i.copy());
8447        };
8448        return dst;
8449      }
8450
8451      @Override
8452      public boolean equalsDeep(Base other_) {
8453        if (!super.equalsDeep(other_))
8454          return false;
8455        if (!(other_ instanceof AddedItemsDetailComponent))
8456          return false;
8457        AddedItemsDetailComponent o = (AddedItemsDetailComponent) other_;
8458        return compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true) && compareDeep(service, o.service, true)
8459           && compareDeep(modifier, o.modifier, true) && compareDeep(fee, o.fee, true) && compareDeep(noteNumber, o.noteNumber, true)
8460           && compareDeep(adjudication, o.adjudication, true);
8461      }
8462
8463      @Override
8464      public boolean equalsShallow(Base other_) {
8465        if (!super.equalsShallow(other_))
8466          return false;
8467        if (!(other_ instanceof AddedItemsDetailComponent))
8468          return false;
8469        AddedItemsDetailComponent o = (AddedItemsDetailComponent) other_;
8470        return compareValues(noteNumber, o.noteNumber, true);
8471      }
8472
8473      public boolean isEmpty() {
8474        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(revenue, category, service
8475          , modifier, fee, noteNumber, adjudication);
8476      }
8477
8478  public String fhirType() {
8479    return "ExplanationOfBenefit.addItem.detail";
8480
8481  }
8482
8483  }
8484
8485    @Block()
8486    public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
8487        /**
8488         * Whether this represents partial or complete payment of the claim.
8489         */
8490        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
8491        @Description(shortDefinition="Partial or Complete", formalDefinition="Whether this represents partial or complete payment of the claim." )
8492        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-paymenttype")
8493        protected CodeableConcept type;
8494
8495        /**
8496         * Adjustment to the payment of this transaction which is not related to adjudication of this transaction.
8497         */
8498        @Child(name = "adjustment", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
8499        @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." )
8500        protected Money adjustment;
8501
8502        /**
8503         * Reason for the payment adjustment.
8504         */
8505        @Child(name = "adjustmentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
8506        @Description(shortDefinition="Explanation for the non-claim adjustment", formalDefinition="Reason for the payment adjustment." )
8507        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
8508        protected CodeableConcept adjustmentReason;
8509
8510        /**
8511         * Estimated payment date.
8512         */
8513        @Child(name = "date", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=false)
8514        @Description(shortDefinition="Expected date of Payment", formalDefinition="Estimated payment date." )
8515        protected DateType date;
8516
8517        /**
8518         * Payable less any payment adjustment.
8519         */
8520        @Child(name = "amount", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
8521        @Description(shortDefinition="Payable amount after adjustment", formalDefinition="Payable less any payment adjustment." )
8522        protected Money amount;
8523
8524        /**
8525         * Payment identifer.
8526         */
8527        @Child(name = "identifier", type = {Identifier.class}, order=6, min=0, max=1, modifier=false, summary=false)
8528        @Description(shortDefinition="Identifier of the payment instrument", formalDefinition="Payment identifer." )
8529        protected Identifier identifier;
8530
8531        private static final long serialVersionUID = 1539906026L;
8532
8533    /**
8534     * Constructor
8535     */
8536      public PaymentComponent() {
8537        super();
8538      }
8539
8540        /**
8541         * @return {@link #type} (Whether this represents partial or complete payment of the claim.)
8542         */
8543        public CodeableConcept getType() { 
8544          if (this.type == null)
8545            if (Configuration.errorOnAutoCreate())
8546              throw new Error("Attempt to auto-create PaymentComponent.type");
8547            else if (Configuration.doAutoCreate())
8548              this.type = new CodeableConcept(); // cc
8549          return this.type;
8550        }
8551
8552        public boolean hasType() { 
8553          return this.type != null && !this.type.isEmpty();
8554        }
8555
8556        /**
8557         * @param value {@link #type} (Whether this represents partial or complete payment of the claim.)
8558         */
8559        public PaymentComponent setType(CodeableConcept value)  { 
8560          this.type = value;
8561          return this;
8562        }
8563
8564        /**
8565         * @return {@link #adjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
8566         */
8567        public Money getAdjustment() { 
8568          if (this.adjustment == null)
8569            if (Configuration.errorOnAutoCreate())
8570              throw new Error("Attempt to auto-create PaymentComponent.adjustment");
8571            else if (Configuration.doAutoCreate())
8572              this.adjustment = new Money(); // cc
8573          return this.adjustment;
8574        }
8575
8576        public boolean hasAdjustment() { 
8577          return this.adjustment != null && !this.adjustment.isEmpty();
8578        }
8579
8580        /**
8581         * @param value {@link #adjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
8582         */
8583        public PaymentComponent setAdjustment(Money value)  { 
8584          this.adjustment = value;
8585          return this;
8586        }
8587
8588        /**
8589         * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
8590         */
8591        public CodeableConcept getAdjustmentReason() { 
8592          if (this.adjustmentReason == null)
8593            if (Configuration.errorOnAutoCreate())
8594              throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
8595            else if (Configuration.doAutoCreate())
8596              this.adjustmentReason = new CodeableConcept(); // cc
8597          return this.adjustmentReason;
8598        }
8599
8600        public boolean hasAdjustmentReason() { 
8601          return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
8602        }
8603
8604        /**
8605         * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
8606         */
8607        public PaymentComponent setAdjustmentReason(CodeableConcept value)  { 
8608          this.adjustmentReason = value;
8609          return this;
8610        }
8611
8612        /**
8613         * @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
8614         */
8615        public DateType getDateElement() { 
8616          if (this.date == null)
8617            if (Configuration.errorOnAutoCreate())
8618              throw new Error("Attempt to auto-create PaymentComponent.date");
8619            else if (Configuration.doAutoCreate())
8620              this.date = new DateType(); // bb
8621          return this.date;
8622        }
8623
8624        public boolean hasDateElement() { 
8625          return this.date != null && !this.date.isEmpty();
8626        }
8627
8628        public boolean hasDate() { 
8629          return this.date != null && !this.date.isEmpty();
8630        }
8631
8632        /**
8633         * @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
8634         */
8635        public PaymentComponent setDateElement(DateType value) { 
8636          this.date = value;
8637          return this;
8638        }
8639
8640        /**
8641         * @return Estimated payment date.
8642         */
8643        public Date getDate() { 
8644          return this.date == null ? null : this.date.getValue();
8645        }
8646
8647        /**
8648         * @param value Estimated payment date.
8649         */
8650        public PaymentComponent setDate(Date value) { 
8651          if (value == null)
8652            this.date = null;
8653          else {
8654            if (this.date == null)
8655              this.date = new DateType();
8656            this.date.setValue(value);
8657          }
8658          return this;
8659        }
8660
8661        /**
8662         * @return {@link #amount} (Payable less any payment adjustment.)
8663         */
8664        public Money getAmount() { 
8665          if (this.amount == null)
8666            if (Configuration.errorOnAutoCreate())
8667              throw new Error("Attempt to auto-create PaymentComponent.amount");
8668            else if (Configuration.doAutoCreate())
8669              this.amount = new Money(); // cc
8670          return this.amount;
8671        }
8672
8673        public boolean hasAmount() { 
8674          return this.amount != null && !this.amount.isEmpty();
8675        }
8676
8677        /**
8678         * @param value {@link #amount} (Payable less any payment adjustment.)
8679         */
8680        public PaymentComponent setAmount(Money value)  { 
8681          this.amount = value;
8682          return this;
8683        }
8684
8685        /**
8686         * @return {@link #identifier} (Payment identifer.)
8687         */
8688        public Identifier getIdentifier() { 
8689          if (this.identifier == null)
8690            if (Configuration.errorOnAutoCreate())
8691              throw new Error("Attempt to auto-create PaymentComponent.identifier");
8692            else if (Configuration.doAutoCreate())
8693              this.identifier = new Identifier(); // cc
8694          return this.identifier;
8695        }
8696
8697        public boolean hasIdentifier() { 
8698          return this.identifier != null && !this.identifier.isEmpty();
8699        }
8700
8701        /**
8702         * @param value {@link #identifier} (Payment identifer.)
8703         */
8704        public PaymentComponent setIdentifier(Identifier value)  { 
8705          this.identifier = value;
8706          return this;
8707        }
8708
8709        protected void listChildren(List<Property> children) {
8710          super.listChildren(children);
8711          children.add(new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the claim.", 0, 1, type));
8712          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));
8713          children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason));
8714          children.add(new Property("date", "date", "Estimated payment date.", 0, 1, date));
8715          children.add(new Property("amount", "Money", "Payable less any payment adjustment.", 0, 1, amount));
8716          children.add(new Property("identifier", "Identifier", "Payment identifer.", 0, 1, identifier));
8717        }
8718
8719        @Override
8720        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8721          switch (_hash) {
8722          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the claim.", 0, 1, type);
8723          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);
8724          case -1255938543: /*adjustmentReason*/  return new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason);
8725          case 3076014: /*date*/  return new Property("date", "date", "Estimated payment date.", 0, 1, date);
8726          case -1413853096: /*amount*/  return new Property("amount", "Money", "Payable less any payment adjustment.", 0, 1, amount);
8727          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Payment identifer.", 0, 1, identifier);
8728          default: return super.getNamedProperty(_hash, _name, _checkValid);
8729          }
8730
8731        }
8732
8733      @Override
8734      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8735        switch (hash) {
8736        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
8737        case 1977085293: /*adjustment*/ return this.adjustment == null ? new Base[0] : new Base[] {this.adjustment}; // Money
8738        case -1255938543: /*adjustmentReason*/ return this.adjustmentReason == null ? new Base[0] : new Base[] {this.adjustmentReason}; // CodeableConcept
8739        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
8740        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
8741        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
8742        default: return super.getProperty(hash, name, checkValid);
8743        }
8744
8745      }
8746
8747      @Override
8748      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8749        switch (hash) {
8750        case 3575610: // type
8751          this.type = castToCodeableConcept(value); // CodeableConcept
8752          return value;
8753        case 1977085293: // adjustment
8754          this.adjustment = castToMoney(value); // Money
8755          return value;
8756        case -1255938543: // adjustmentReason
8757          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
8758          return value;
8759        case 3076014: // date
8760          this.date = castToDate(value); // DateType
8761          return value;
8762        case -1413853096: // amount
8763          this.amount = castToMoney(value); // Money
8764          return value;
8765        case -1618432855: // identifier
8766          this.identifier = castToIdentifier(value); // Identifier
8767          return value;
8768        default: return super.setProperty(hash, name, value);
8769        }
8770
8771      }
8772
8773      @Override
8774      public Base setProperty(String name, Base value) throws FHIRException {
8775        if (name.equals("type")) {
8776          this.type = castToCodeableConcept(value); // CodeableConcept
8777        } else if (name.equals("adjustment")) {
8778          this.adjustment = castToMoney(value); // Money
8779        } else if (name.equals("adjustmentReason")) {
8780          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
8781        } else if (name.equals("date")) {
8782          this.date = castToDate(value); // DateType
8783        } else if (name.equals("amount")) {
8784          this.amount = castToMoney(value); // Money
8785        } else if (name.equals("identifier")) {
8786          this.identifier = castToIdentifier(value); // Identifier
8787        } else
8788          return super.setProperty(name, value);
8789        return value;
8790      }
8791
8792      @Override
8793      public Base makeProperty(int hash, String name) throws FHIRException {
8794        switch (hash) {
8795        case 3575610:  return getType(); 
8796        case 1977085293:  return getAdjustment(); 
8797        case -1255938543:  return getAdjustmentReason(); 
8798        case 3076014:  return getDateElement();
8799        case -1413853096:  return getAmount(); 
8800        case -1618432855:  return getIdentifier(); 
8801        default: return super.makeProperty(hash, name);
8802        }
8803
8804      }
8805
8806      @Override
8807      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8808        switch (hash) {
8809        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
8810        case 1977085293: /*adjustment*/ return new String[] {"Money"};
8811        case -1255938543: /*adjustmentReason*/ return new String[] {"CodeableConcept"};
8812        case 3076014: /*date*/ return new String[] {"date"};
8813        case -1413853096: /*amount*/ return new String[] {"Money"};
8814        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
8815        default: return super.getTypesForProperty(hash, name);
8816        }
8817
8818      }
8819
8820      @Override
8821      public Base addChild(String name) throws FHIRException {
8822        if (name.equals("type")) {
8823          this.type = new CodeableConcept();
8824          return this.type;
8825        }
8826        else if (name.equals("adjustment")) {
8827          this.adjustment = new Money();
8828          return this.adjustment;
8829        }
8830        else if (name.equals("adjustmentReason")) {
8831          this.adjustmentReason = new CodeableConcept();
8832          return this.adjustmentReason;
8833        }
8834        else if (name.equals("date")) {
8835          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
8836        }
8837        else if (name.equals("amount")) {
8838          this.amount = new Money();
8839          return this.amount;
8840        }
8841        else if (name.equals("identifier")) {
8842          this.identifier = new Identifier();
8843          return this.identifier;
8844        }
8845        else
8846          return super.addChild(name);
8847      }
8848
8849      public PaymentComponent copy() {
8850        PaymentComponent dst = new PaymentComponent();
8851        copyValues(dst);
8852        dst.type = type == null ? null : type.copy();
8853        dst.adjustment = adjustment == null ? null : adjustment.copy();
8854        dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
8855        dst.date = date == null ? null : date.copy();
8856        dst.amount = amount == null ? null : amount.copy();
8857        dst.identifier = identifier == null ? null : identifier.copy();
8858        return dst;
8859      }
8860
8861      @Override
8862      public boolean equalsDeep(Base other_) {
8863        if (!super.equalsDeep(other_))
8864          return false;
8865        if (!(other_ instanceof PaymentComponent))
8866          return false;
8867        PaymentComponent o = (PaymentComponent) other_;
8868        return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true) && compareDeep(adjustmentReason, o.adjustmentReason, true)
8869           && compareDeep(date, o.date, true) && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true)
8870          ;
8871      }
8872
8873      @Override
8874      public boolean equalsShallow(Base other_) {
8875        if (!super.equalsShallow(other_))
8876          return false;
8877        if (!(other_ instanceof PaymentComponent))
8878          return false;
8879        PaymentComponent o = (PaymentComponent) other_;
8880        return compareValues(date, o.date, true);
8881      }
8882
8883      public boolean isEmpty() {
8884        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason
8885          , date, amount, identifier);
8886      }
8887
8888  public String fhirType() {
8889    return "ExplanationOfBenefit.payment";
8890
8891  }
8892
8893  }
8894
8895    @Block()
8896    public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
8897        /**
8898         * An integer associated with each note which may be referred to from each service line item.
8899         */
8900        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
8901        @Description(shortDefinition="Sequence number for this note", formalDefinition="An integer associated with each note which may be referred to from each service line item." )
8902        protected PositiveIntType number;
8903
8904        /**
8905         * The note purpose: Print/Display.
8906         */
8907        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
8908        @Description(shortDefinition="display | print | printoper", formalDefinition="The note purpose: Print/Display." )
8909        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
8910        protected CodeableConcept type;
8911
8912        /**
8913         * The note text.
8914         */
8915        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
8916        @Description(shortDefinition="Note explanitory text", formalDefinition="The note text." )
8917        protected StringType text;
8918
8919        /**
8920         * 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.
8921         */
8922        @Child(name = "language", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
8923        @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." )
8924        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
8925        protected CodeableConcept language;
8926
8927        private static final long serialVersionUID = -944255449L;
8928
8929    /**
8930     * Constructor
8931     */
8932      public NoteComponent() {
8933        super();
8934      }
8935
8936        /**
8937         * @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
8938         */
8939        public PositiveIntType getNumberElement() { 
8940          if (this.number == null)
8941            if (Configuration.errorOnAutoCreate())
8942              throw new Error("Attempt to auto-create NoteComponent.number");
8943            else if (Configuration.doAutoCreate())
8944              this.number = new PositiveIntType(); // bb
8945          return this.number;
8946        }
8947
8948        public boolean hasNumberElement() { 
8949          return this.number != null && !this.number.isEmpty();
8950        }
8951
8952        public boolean hasNumber() { 
8953          return this.number != null && !this.number.isEmpty();
8954        }
8955
8956        /**
8957         * @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
8958         */
8959        public NoteComponent setNumberElement(PositiveIntType value) { 
8960          this.number = value;
8961          return this;
8962        }
8963
8964        /**
8965         * @return An integer associated with each note which may be referred to from each service line item.
8966         */
8967        public int getNumber() { 
8968          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
8969        }
8970
8971        /**
8972         * @param value An integer associated with each note which may be referred to from each service line item.
8973         */
8974        public NoteComponent setNumber(int value) { 
8975            if (this.number == null)
8976              this.number = new PositiveIntType();
8977            this.number.setValue(value);
8978          return this;
8979        }
8980
8981        /**
8982         * @return {@link #type} (The note purpose: Print/Display.)
8983         */
8984        public CodeableConcept getType() { 
8985          if (this.type == null)
8986            if (Configuration.errorOnAutoCreate())
8987              throw new Error("Attempt to auto-create NoteComponent.type");
8988            else if (Configuration.doAutoCreate())
8989              this.type = new CodeableConcept(); // cc
8990          return this.type;
8991        }
8992
8993        public boolean hasType() { 
8994          return this.type != null && !this.type.isEmpty();
8995        }
8996
8997        /**
8998         * @param value {@link #type} (The note purpose: Print/Display.)
8999         */
9000        public NoteComponent setType(CodeableConcept value)  { 
9001          this.type = value;
9002          return this;
9003        }
9004
9005        /**
9006         * @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
9007         */
9008        public StringType getTextElement() { 
9009          if (this.text == null)
9010            if (Configuration.errorOnAutoCreate())
9011              throw new Error("Attempt to auto-create NoteComponent.text");
9012            else if (Configuration.doAutoCreate())
9013              this.text = new StringType(); // bb
9014          return this.text;
9015        }
9016
9017        public boolean hasTextElement() { 
9018          return this.text != null && !this.text.isEmpty();
9019        }
9020
9021        public boolean hasText() { 
9022          return this.text != null && !this.text.isEmpty();
9023        }
9024
9025        /**
9026         * @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
9027         */
9028        public NoteComponent setTextElement(StringType value) { 
9029          this.text = value;
9030          return this;
9031        }
9032
9033        /**
9034         * @return The note text.
9035         */
9036        public String getText() { 
9037          return this.text == null ? null : this.text.getValue();
9038        }
9039
9040        /**
9041         * @param value The note text.
9042         */
9043        public NoteComponent setText(String value) { 
9044          if (Utilities.noString(value))
9045            this.text = null;
9046          else {
9047            if (this.text == null)
9048              this.text = new StringType();
9049            this.text.setValue(value);
9050          }
9051          return this;
9052        }
9053
9054        /**
9055         * @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.)
9056         */
9057        public CodeableConcept getLanguage() { 
9058          if (this.language == null)
9059            if (Configuration.errorOnAutoCreate())
9060              throw new Error("Attempt to auto-create NoteComponent.language");
9061            else if (Configuration.doAutoCreate())
9062              this.language = new CodeableConcept(); // cc
9063          return this.language;
9064        }
9065
9066        public boolean hasLanguage() { 
9067          return this.language != null && !this.language.isEmpty();
9068        }
9069
9070        /**
9071         * @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.)
9072         */
9073        public NoteComponent setLanguage(CodeableConcept value)  { 
9074          this.language = value;
9075          return this;
9076        }
9077
9078        protected void listChildren(List<Property> children) {
9079          super.listChildren(children);
9080          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));
9081          children.add(new Property("type", "CodeableConcept", "The note purpose: Print/Display.", 0, 1, type));
9082          children.add(new Property("text", "string", "The note text.", 0, 1, text));
9083          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));
9084        }
9085
9086        @Override
9087        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9088          switch (_hash) {
9089          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);
9090          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The note purpose: Print/Display.", 0, 1, type);
9091          case 3556653: /*text*/  return new Property("text", "string", "The note text.", 0, 1, text);
9092          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);
9093          default: return super.getNamedProperty(_hash, _name, _checkValid);
9094          }
9095
9096        }
9097
9098      @Override
9099      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9100        switch (hash) {
9101        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
9102        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
9103        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
9104        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
9105        default: return super.getProperty(hash, name, checkValid);
9106        }
9107
9108      }
9109
9110      @Override
9111      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9112        switch (hash) {
9113        case -1034364087: // number
9114          this.number = castToPositiveInt(value); // PositiveIntType
9115          return value;
9116        case 3575610: // type
9117          this.type = castToCodeableConcept(value); // CodeableConcept
9118          return value;
9119        case 3556653: // text
9120          this.text = castToString(value); // StringType
9121          return value;
9122        case -1613589672: // language
9123          this.language = castToCodeableConcept(value); // CodeableConcept
9124          return value;
9125        default: return super.setProperty(hash, name, value);
9126        }
9127
9128      }
9129
9130      @Override
9131      public Base setProperty(String name, Base value) throws FHIRException {
9132        if (name.equals("number")) {
9133          this.number = castToPositiveInt(value); // PositiveIntType
9134        } else if (name.equals("type")) {
9135          this.type = castToCodeableConcept(value); // CodeableConcept
9136        } else if (name.equals("text")) {
9137          this.text = castToString(value); // StringType
9138        } else if (name.equals("language")) {
9139          this.language = castToCodeableConcept(value); // CodeableConcept
9140        } else
9141          return super.setProperty(name, value);
9142        return value;
9143      }
9144
9145      @Override
9146      public Base makeProperty(int hash, String name) throws FHIRException {
9147        switch (hash) {
9148        case -1034364087:  return getNumberElement();
9149        case 3575610:  return getType(); 
9150        case 3556653:  return getTextElement();
9151        case -1613589672:  return getLanguage(); 
9152        default: return super.makeProperty(hash, name);
9153        }
9154
9155      }
9156
9157      @Override
9158      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9159        switch (hash) {
9160        case -1034364087: /*number*/ return new String[] {"positiveInt"};
9161        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
9162        case 3556653: /*text*/ return new String[] {"string"};
9163        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
9164        default: return super.getTypesForProperty(hash, name);
9165        }
9166
9167      }
9168
9169      @Override
9170      public Base addChild(String name) throws FHIRException {
9171        if (name.equals("number")) {
9172          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.number");
9173        }
9174        else if (name.equals("type")) {
9175          this.type = new CodeableConcept();
9176          return this.type;
9177        }
9178        else if (name.equals("text")) {
9179          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.text");
9180        }
9181        else if (name.equals("language")) {
9182          this.language = new CodeableConcept();
9183          return this.language;
9184        }
9185        else
9186          return super.addChild(name);
9187      }
9188
9189      public NoteComponent copy() {
9190        NoteComponent dst = new NoteComponent();
9191        copyValues(dst);
9192        dst.number = number == null ? null : number.copy();
9193        dst.type = type == null ? null : type.copy();
9194        dst.text = text == null ? null : text.copy();
9195        dst.language = language == null ? null : language.copy();
9196        return dst;
9197      }
9198
9199      @Override
9200      public boolean equalsDeep(Base other_) {
9201        if (!super.equalsDeep(other_))
9202          return false;
9203        if (!(other_ instanceof NoteComponent))
9204          return false;
9205        NoteComponent o = (NoteComponent) other_;
9206        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
9207           && compareDeep(language, o.language, true);
9208      }
9209
9210      @Override
9211      public boolean equalsShallow(Base other_) {
9212        if (!super.equalsShallow(other_))
9213          return false;
9214        if (!(other_ instanceof NoteComponent))
9215          return false;
9216        NoteComponent o = (NoteComponent) other_;
9217        return compareValues(number, o.number, true) && compareValues(text, o.text, true);
9218      }
9219
9220      public boolean isEmpty() {
9221        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language
9222          );
9223      }
9224
9225  public String fhirType() {
9226    return "ExplanationOfBenefit.processNote";
9227
9228  }
9229
9230  }
9231
9232    @Block()
9233    public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
9234        /**
9235         * Dental, Vision, Medical, Pharmacy, Rehab etc.
9236         */
9237        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9238        @Description(shortDefinition="Type of services covered", formalDefinition="Dental, Vision, Medical, Pharmacy, Rehab etc." )
9239        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-category")
9240        protected CodeableConcept category;
9241
9242        /**
9243         * Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.
9244         */
9245        @Child(name = "subCategory", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
9246        @Description(shortDefinition="Detailed services covered within the type", formalDefinition="Dental: basic, major, ortho; Vision exam, glasses, contacts; etc." )
9247        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
9248        protected CodeableConcept subCategory;
9249
9250        /**
9251         * True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.
9252         */
9253        @Child(name = "excluded", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
9254        @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." )
9255        protected BooleanType excluded;
9256
9257        /**
9258         * A short name or tag for the benefit, for example MED01, or DENT2.
9259         */
9260        @Child(name = "name", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
9261        @Description(shortDefinition="Short name for the benefit", formalDefinition="A short name or tag for the benefit, for example MED01, or DENT2." )
9262        protected StringType name;
9263
9264        /**
9265         * A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.
9266         */
9267        @Child(name = "description", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
9268        @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'." )
9269        protected StringType description;
9270
9271        /**
9272         * Network designation.
9273         */
9274        @Child(name = "network", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
9275        @Description(shortDefinition="In or out of network", formalDefinition="Network designation." )
9276        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-network")
9277        protected CodeableConcept network;
9278
9279        /**
9280         * Unit designation: individual or family.
9281         */
9282        @Child(name = "unit", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
9283        @Description(shortDefinition="Individual or family", formalDefinition="Unit designation: individual or family." )
9284        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-unit")
9285        protected CodeableConcept unit;
9286
9287        /**
9288         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.
9289         */
9290        @Child(name = "term", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
9291        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'." )
9292        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-term")
9293        protected CodeableConcept term;
9294
9295        /**
9296         * Benefits Used to date.
9297         */
9298        @Child(name = "financial", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9299        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
9300        protected List<BenefitComponent> financial;
9301
9302        private static final long serialVersionUID = 833826021L;
9303
9304    /**
9305     * Constructor
9306     */
9307      public BenefitBalanceComponent() {
9308        super();
9309      }
9310
9311    /**
9312     * Constructor
9313     */
9314      public BenefitBalanceComponent(CodeableConcept category) {
9315        super();
9316        this.category = category;
9317      }
9318
9319        /**
9320         * @return {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
9321         */
9322        public CodeableConcept getCategory() { 
9323          if (this.category == null)
9324            if (Configuration.errorOnAutoCreate())
9325              throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
9326            else if (Configuration.doAutoCreate())
9327              this.category = new CodeableConcept(); // cc
9328          return this.category;
9329        }
9330
9331        public boolean hasCategory() { 
9332          return this.category != null && !this.category.isEmpty();
9333        }
9334
9335        /**
9336         * @param value {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
9337         */
9338        public BenefitBalanceComponent setCategory(CodeableConcept value)  { 
9339          this.category = value;
9340          return this;
9341        }
9342
9343        /**
9344         * @return {@link #subCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
9345         */
9346        public CodeableConcept getSubCategory() { 
9347          if (this.subCategory == null)
9348            if (Configuration.errorOnAutoCreate())
9349              throw new Error("Attempt to auto-create BenefitBalanceComponent.subCategory");
9350            else if (Configuration.doAutoCreate())
9351              this.subCategory = new CodeableConcept(); // cc
9352          return this.subCategory;
9353        }
9354
9355        public boolean hasSubCategory() { 
9356          return this.subCategory != null && !this.subCategory.isEmpty();
9357        }
9358
9359        /**
9360         * @param value {@link #subCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
9361         */
9362        public BenefitBalanceComponent setSubCategory(CodeableConcept value)  { 
9363          this.subCategory = value;
9364          return this;
9365        }
9366
9367        /**
9368         * @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
9369         */
9370        public BooleanType getExcludedElement() { 
9371          if (this.excluded == null)
9372            if (Configuration.errorOnAutoCreate())
9373              throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
9374            else if (Configuration.doAutoCreate())
9375              this.excluded = new BooleanType(); // bb
9376          return this.excluded;
9377        }
9378
9379        public boolean hasExcludedElement() { 
9380          return this.excluded != null && !this.excluded.isEmpty();
9381        }
9382
9383        public boolean hasExcluded() { 
9384          return this.excluded != null && !this.excluded.isEmpty();
9385        }
9386
9387        /**
9388         * @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
9389         */
9390        public BenefitBalanceComponent setExcludedElement(BooleanType value) { 
9391          this.excluded = value;
9392          return this;
9393        }
9394
9395        /**
9396         * @return True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.
9397         */
9398        public boolean getExcluded() { 
9399          return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
9400        }
9401
9402        /**
9403         * @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.
9404         */
9405        public BenefitBalanceComponent setExcluded(boolean value) { 
9406            if (this.excluded == null)
9407              this.excluded = new BooleanType();
9408            this.excluded.setValue(value);
9409          return this;
9410        }
9411
9412        /**
9413         * @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
9414         */
9415        public StringType getNameElement() { 
9416          if (this.name == null)
9417            if (Configuration.errorOnAutoCreate())
9418              throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
9419            else if (Configuration.doAutoCreate())
9420              this.name = new StringType(); // bb
9421          return this.name;
9422        }
9423
9424        public boolean hasNameElement() { 
9425          return this.name != null && !this.name.isEmpty();
9426        }
9427
9428        public boolean hasName() { 
9429          return this.name != null && !this.name.isEmpty();
9430        }
9431
9432        /**
9433         * @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
9434         */
9435        public BenefitBalanceComponent setNameElement(StringType value) { 
9436          this.name = value;
9437          return this;
9438        }
9439
9440        /**
9441         * @return A short name or tag for the benefit, for example MED01, or DENT2.
9442         */
9443        public String getName() { 
9444          return this.name == null ? null : this.name.getValue();
9445        }
9446
9447        /**
9448         * @param value A short name or tag for the benefit, for example MED01, or DENT2.
9449         */
9450        public BenefitBalanceComponent setName(String value) { 
9451          if (Utilities.noString(value))
9452            this.name = null;
9453          else {
9454            if (this.name == null)
9455              this.name = new StringType();
9456            this.name.setValue(value);
9457          }
9458          return this;
9459        }
9460
9461        /**
9462         * @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
9463         */
9464        public StringType getDescriptionElement() { 
9465          if (this.description == null)
9466            if (Configuration.errorOnAutoCreate())
9467              throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
9468            else if (Configuration.doAutoCreate())
9469              this.description = new StringType(); // bb
9470          return this.description;
9471        }
9472
9473        public boolean hasDescriptionElement() { 
9474          return this.description != null && !this.description.isEmpty();
9475        }
9476
9477        public boolean hasDescription() { 
9478          return this.description != null && !this.description.isEmpty();
9479        }
9480
9481        /**
9482         * @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
9483         */
9484        public BenefitBalanceComponent setDescriptionElement(StringType value) { 
9485          this.description = value;
9486          return this;
9487        }
9488
9489        /**
9490         * @return A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.
9491         */
9492        public String getDescription() { 
9493          return this.description == null ? null : this.description.getValue();
9494        }
9495
9496        /**
9497         * @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'.
9498         */
9499        public BenefitBalanceComponent setDescription(String value) { 
9500          if (Utilities.noString(value))
9501            this.description = null;
9502          else {
9503            if (this.description == null)
9504              this.description = new StringType();
9505            this.description.setValue(value);
9506          }
9507          return this;
9508        }
9509
9510        /**
9511         * @return {@link #network} (Network designation.)
9512         */
9513        public CodeableConcept getNetwork() { 
9514          if (this.network == null)
9515            if (Configuration.errorOnAutoCreate())
9516              throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
9517            else if (Configuration.doAutoCreate())
9518              this.network = new CodeableConcept(); // cc
9519          return this.network;
9520        }
9521
9522        public boolean hasNetwork() { 
9523          return this.network != null && !this.network.isEmpty();
9524        }
9525
9526        /**
9527         * @param value {@link #network} (Network designation.)
9528         */
9529        public BenefitBalanceComponent setNetwork(CodeableConcept value)  { 
9530          this.network = value;
9531          return this;
9532        }
9533
9534        /**
9535         * @return {@link #unit} (Unit designation: individual or family.)
9536         */
9537        public CodeableConcept getUnit() { 
9538          if (this.unit == null)
9539            if (Configuration.errorOnAutoCreate())
9540              throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
9541            else if (Configuration.doAutoCreate())
9542              this.unit = new CodeableConcept(); // cc
9543          return this.unit;
9544        }
9545
9546        public boolean hasUnit() { 
9547          return this.unit != null && !this.unit.isEmpty();
9548        }
9549
9550        /**
9551         * @param value {@link #unit} (Unit designation: individual or family.)
9552         */
9553        public BenefitBalanceComponent setUnit(CodeableConcept value)  { 
9554          this.unit = value;
9555          return this;
9556        }
9557
9558        /**
9559         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
9560         */
9561        public CodeableConcept getTerm() { 
9562          if (this.term == null)
9563            if (Configuration.errorOnAutoCreate())
9564              throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
9565            else if (Configuration.doAutoCreate())
9566              this.term = new CodeableConcept(); // cc
9567          return this.term;
9568        }
9569
9570        public boolean hasTerm() { 
9571          return this.term != null && !this.term.isEmpty();
9572        }
9573
9574        /**
9575         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
9576         */
9577        public BenefitBalanceComponent setTerm(CodeableConcept value)  { 
9578          this.term = value;
9579          return this;
9580        }
9581
9582        /**
9583         * @return {@link #financial} (Benefits Used to date.)
9584         */
9585        public List<BenefitComponent> getFinancial() { 
9586          if (this.financial == null)
9587            this.financial = new ArrayList<BenefitComponent>();
9588          return this.financial;
9589        }
9590
9591        /**
9592         * @return Returns a reference to <code>this</code> for easy method chaining
9593         */
9594        public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) { 
9595          this.financial = theFinancial;
9596          return this;
9597        }
9598
9599        public boolean hasFinancial() { 
9600          if (this.financial == null)
9601            return false;
9602          for (BenefitComponent item : this.financial)
9603            if (!item.isEmpty())
9604              return true;
9605          return false;
9606        }
9607
9608        public BenefitComponent addFinancial() { //3
9609          BenefitComponent t = new BenefitComponent();
9610          if (this.financial == null)
9611            this.financial = new ArrayList<BenefitComponent>();
9612          this.financial.add(t);
9613          return t;
9614        }
9615
9616        public BenefitBalanceComponent addFinancial(BenefitComponent t) { //3
9617          if (t == null)
9618            return this;
9619          if (this.financial == null)
9620            this.financial = new ArrayList<BenefitComponent>();
9621          this.financial.add(t);
9622          return this;
9623        }
9624
9625        /**
9626         * @return The first repetition of repeating field {@link #financial}, creating it if it does not already exist
9627         */
9628        public BenefitComponent getFinancialFirstRep() { 
9629          if (getFinancial().isEmpty()) {
9630            addFinancial();
9631          }
9632          return getFinancial().get(0);
9633        }
9634
9635        protected void listChildren(List<Property> children) {
9636          super.listChildren(children);
9637          children.add(new Property("category", "CodeableConcept", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, 1, category));
9638          children.add(new Property("subCategory", "CodeableConcept", "Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.", 0, 1, subCategory));
9639          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));
9640          children.add(new Property("name", "string", "A short name or tag for the benefit, for example MED01, or DENT2.", 0, 1, name));
9641          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));
9642          children.add(new Property("network", "CodeableConcept", "Network designation.", 0, 1, network));
9643          children.add(new Property("unit", "CodeableConcept", "Unit designation: individual or family.", 0, 1, unit));
9644          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));
9645          children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
9646        }
9647
9648        @Override
9649        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9650          switch (_hash) {
9651          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, 1, category);
9652          case 1365024606: /*subCategory*/  return new Property("subCategory", "CodeableConcept", "Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.", 0, 1, subCategory);
9653          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);
9654          case 3373707: /*name*/  return new Property("name", "string", "A short name or tag for the benefit, for example MED01, or DENT2.", 0, 1, name);
9655          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);
9656          case 1843485230: /*network*/  return new Property("network", "CodeableConcept", "Network designation.", 0, 1, network);
9657          case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "Unit designation: individual or family.", 0, 1, unit);
9658          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);
9659          case 357555337: /*financial*/  return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial);
9660          default: return super.getNamedProperty(_hash, _name, _checkValid);
9661          }
9662
9663        }
9664
9665      @Override
9666      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9667        switch (hash) {
9668        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
9669        case 1365024606: /*subCategory*/ return this.subCategory == null ? new Base[0] : new Base[] {this.subCategory}; // CodeableConcept
9670        case 1994055114: /*excluded*/ return this.excluded == null ? new Base[0] : new Base[] {this.excluded}; // BooleanType
9671        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
9672        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
9673        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // CodeableConcept
9674        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
9675        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // CodeableConcept
9676        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
9677        default: return super.getProperty(hash, name, checkValid);
9678        }
9679
9680      }
9681
9682      @Override
9683      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9684        switch (hash) {
9685        case 50511102: // category
9686          this.category = castToCodeableConcept(value); // CodeableConcept
9687          return value;
9688        case 1365024606: // subCategory
9689          this.subCategory = castToCodeableConcept(value); // CodeableConcept
9690          return value;
9691        case 1994055114: // excluded
9692          this.excluded = castToBoolean(value); // BooleanType
9693          return value;
9694        case 3373707: // name
9695          this.name = castToString(value); // StringType
9696          return value;
9697        case -1724546052: // description
9698          this.description = castToString(value); // StringType
9699          return value;
9700        case 1843485230: // network
9701          this.network = castToCodeableConcept(value); // CodeableConcept
9702          return value;
9703        case 3594628: // unit
9704          this.unit = castToCodeableConcept(value); // CodeableConcept
9705          return value;
9706        case 3556460: // term
9707          this.term = castToCodeableConcept(value); // CodeableConcept
9708          return value;
9709        case 357555337: // financial
9710          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
9711          return value;
9712        default: return super.setProperty(hash, name, value);
9713        }
9714
9715      }
9716
9717      @Override
9718      public Base setProperty(String name, Base value) throws FHIRException {
9719        if (name.equals("category")) {
9720          this.category = castToCodeableConcept(value); // CodeableConcept
9721        } else if (name.equals("subCategory")) {
9722          this.subCategory = castToCodeableConcept(value); // CodeableConcept
9723        } else if (name.equals("excluded")) {
9724          this.excluded = castToBoolean(value); // BooleanType
9725        } else if (name.equals("name")) {
9726          this.name = castToString(value); // StringType
9727        } else if (name.equals("description")) {
9728          this.description = castToString(value); // StringType
9729        } else if (name.equals("network")) {
9730          this.network = castToCodeableConcept(value); // CodeableConcept
9731        } else if (name.equals("unit")) {
9732          this.unit = castToCodeableConcept(value); // CodeableConcept
9733        } else if (name.equals("term")) {
9734          this.term = castToCodeableConcept(value); // CodeableConcept
9735        } else if (name.equals("financial")) {
9736          this.getFinancial().add((BenefitComponent) value);
9737        } else
9738          return super.setProperty(name, value);
9739        return value;
9740      }
9741
9742      @Override
9743      public Base makeProperty(int hash, String name) throws FHIRException {
9744        switch (hash) {
9745        case 50511102:  return getCategory(); 
9746        case 1365024606:  return getSubCategory(); 
9747        case 1994055114:  return getExcludedElement();
9748        case 3373707:  return getNameElement();
9749        case -1724546052:  return getDescriptionElement();
9750        case 1843485230:  return getNetwork(); 
9751        case 3594628:  return getUnit(); 
9752        case 3556460:  return getTerm(); 
9753        case 357555337:  return addFinancial(); 
9754        default: return super.makeProperty(hash, name);
9755        }
9756
9757      }
9758
9759      @Override
9760      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9761        switch (hash) {
9762        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
9763        case 1365024606: /*subCategory*/ return new String[] {"CodeableConcept"};
9764        case 1994055114: /*excluded*/ return new String[] {"boolean"};
9765        case 3373707: /*name*/ return new String[] {"string"};
9766        case -1724546052: /*description*/ return new String[] {"string"};
9767        case 1843485230: /*network*/ return new String[] {"CodeableConcept"};
9768        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
9769        case 3556460: /*term*/ return new String[] {"CodeableConcept"};
9770        case 357555337: /*financial*/ return new String[] {};
9771        default: return super.getTypesForProperty(hash, name);
9772        }
9773
9774      }
9775
9776      @Override
9777      public Base addChild(String name) throws FHIRException {
9778        if (name.equals("category")) {
9779          this.category = new CodeableConcept();
9780          return this.category;
9781        }
9782        else if (name.equals("subCategory")) {
9783          this.subCategory = new CodeableConcept();
9784          return this.subCategory;
9785        }
9786        else if (name.equals("excluded")) {
9787          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.excluded");
9788        }
9789        else if (name.equals("name")) {
9790          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.name");
9791        }
9792        else if (name.equals("description")) {
9793          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.description");
9794        }
9795        else if (name.equals("network")) {
9796          this.network = new CodeableConcept();
9797          return this.network;
9798        }
9799        else if (name.equals("unit")) {
9800          this.unit = new CodeableConcept();
9801          return this.unit;
9802        }
9803        else if (name.equals("term")) {
9804          this.term = new CodeableConcept();
9805          return this.term;
9806        }
9807        else if (name.equals("financial")) {
9808          return addFinancial();
9809        }
9810        else
9811          return super.addChild(name);
9812      }
9813
9814      public BenefitBalanceComponent copy() {
9815        BenefitBalanceComponent dst = new BenefitBalanceComponent();
9816        copyValues(dst);
9817        dst.category = category == null ? null : category.copy();
9818        dst.subCategory = subCategory == null ? null : subCategory.copy();
9819        dst.excluded = excluded == null ? null : excluded.copy();
9820        dst.name = name == null ? null : name.copy();
9821        dst.description = description == null ? null : description.copy();
9822        dst.network = network == null ? null : network.copy();
9823        dst.unit = unit == null ? null : unit.copy();
9824        dst.term = term == null ? null : term.copy();
9825        if (financial != null) {
9826          dst.financial = new ArrayList<BenefitComponent>();
9827          for (BenefitComponent i : financial)
9828            dst.financial.add(i.copy());
9829        };
9830        return dst;
9831      }
9832
9833      @Override
9834      public boolean equalsDeep(Base other_) {
9835        if (!super.equalsDeep(other_))
9836          return false;
9837        if (!(other_ instanceof BenefitBalanceComponent))
9838          return false;
9839        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
9840        return compareDeep(category, o.category, true) && compareDeep(subCategory, o.subCategory, true)
9841           && compareDeep(excluded, o.excluded, true) && compareDeep(name, o.name, true) && compareDeep(description, o.description, true)
9842           && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true) && compareDeep(term, o.term, true)
9843           && compareDeep(financial, o.financial, true);
9844      }
9845
9846      @Override
9847      public boolean equalsShallow(Base other_) {
9848        if (!super.equalsShallow(other_))
9849          return false;
9850        if (!(other_ instanceof BenefitBalanceComponent))
9851          return false;
9852        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
9853        return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
9854          ;
9855      }
9856
9857      public boolean isEmpty() {
9858        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, subCategory, excluded
9859          , name, description, network, unit, term, financial);
9860      }
9861
9862  public String fhirType() {
9863    return "ExplanationOfBenefit.benefitBalance";
9864
9865  }
9866
9867  }
9868
9869    @Block()
9870    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
9871        /**
9872         * Deductable, visits, benefit amount.
9873         */
9874        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9875        @Description(shortDefinition="Deductable, visits, benefit amount", formalDefinition="Deductable, visits, benefit amount." )
9876        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-type")
9877        protected CodeableConcept type;
9878
9879        /**
9880         * Benefits allowed.
9881         */
9882        @Child(name = "allowed", type = {UnsignedIntType.class, StringType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
9883        @Description(shortDefinition="Benefits allowed", formalDefinition="Benefits allowed." )
9884        protected Type allowed;
9885
9886        /**
9887         * Benefits used.
9888         */
9889        @Child(name = "used", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
9890        @Description(shortDefinition="Benefits used", formalDefinition="Benefits used." )
9891        protected Type used;
9892
9893        private static final long serialVersionUID = -1506285314L;
9894
9895    /**
9896     * Constructor
9897     */
9898      public BenefitComponent() {
9899        super();
9900      }
9901
9902    /**
9903     * Constructor
9904     */
9905      public BenefitComponent(CodeableConcept type) {
9906        super();
9907        this.type = type;
9908      }
9909
9910        /**
9911         * @return {@link #type} (Deductable, visits, benefit amount.)
9912         */
9913        public CodeableConcept getType() { 
9914          if (this.type == null)
9915            if (Configuration.errorOnAutoCreate())
9916              throw new Error("Attempt to auto-create BenefitComponent.type");
9917            else if (Configuration.doAutoCreate())
9918              this.type = new CodeableConcept(); // cc
9919          return this.type;
9920        }
9921
9922        public boolean hasType() { 
9923          return this.type != null && !this.type.isEmpty();
9924        }
9925
9926        /**
9927         * @param value {@link #type} (Deductable, visits, benefit amount.)
9928         */
9929        public BenefitComponent setType(CodeableConcept value)  { 
9930          this.type = value;
9931          return this;
9932        }
9933
9934        /**
9935         * @return {@link #allowed} (Benefits allowed.)
9936         */
9937        public Type getAllowed() { 
9938          return this.allowed;
9939        }
9940
9941        /**
9942         * @return {@link #allowed} (Benefits allowed.)
9943         */
9944        public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException { 
9945          if (this.allowed == null)
9946            return null;
9947          if (!(this.allowed instanceof UnsignedIntType))
9948            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.allowed.getClass().getName()+" was encountered");
9949          return (UnsignedIntType) this.allowed;
9950        }
9951
9952        public boolean hasAllowedUnsignedIntType() { 
9953          return this != null && this.allowed instanceof UnsignedIntType;
9954        }
9955
9956        /**
9957         * @return {@link #allowed} (Benefits allowed.)
9958         */
9959        public StringType getAllowedStringType() throws FHIRException { 
9960          if (this.allowed == null)
9961            return null;
9962          if (!(this.allowed instanceof StringType))
9963            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.allowed.getClass().getName()+" was encountered");
9964          return (StringType) this.allowed;
9965        }
9966
9967        public boolean hasAllowedStringType() { 
9968          return this != null && this.allowed instanceof StringType;
9969        }
9970
9971        /**
9972         * @return {@link #allowed} (Benefits allowed.)
9973         */
9974        public Money getAllowedMoney() throws FHIRException { 
9975          if (this.allowed == null)
9976            return null;
9977          if (!(this.allowed instanceof Money))
9978            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.allowed.getClass().getName()+" was encountered");
9979          return (Money) this.allowed;
9980        }
9981
9982        public boolean hasAllowedMoney() { 
9983          return this != null && this.allowed instanceof Money;
9984        }
9985
9986        public boolean hasAllowed() { 
9987          return this.allowed != null && !this.allowed.isEmpty();
9988        }
9989
9990        /**
9991         * @param value {@link #allowed} (Benefits allowed.)
9992         */
9993        public BenefitComponent setAllowed(Type value) throws FHIRFormatError { 
9994          if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
9995            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.benefitBalance.financial.allowed[x]: "+value.fhirType());
9996          this.allowed = value;
9997          return this;
9998        }
9999
10000        /**
10001         * @return {@link #used} (Benefits used.)
10002         */
10003        public Type getUsed() { 
10004          return this.used;
10005        }
10006
10007        /**
10008         * @return {@link #used} (Benefits used.)
10009         */
10010        public UnsignedIntType getUsedUnsignedIntType() throws FHIRException { 
10011          if (this.used == null)
10012            return null;
10013          if (!(this.used instanceof UnsignedIntType))
10014            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.used.getClass().getName()+" was encountered");
10015          return (UnsignedIntType) this.used;
10016        }
10017
10018        public boolean hasUsedUnsignedIntType() { 
10019          return this != null && this.used instanceof UnsignedIntType;
10020        }
10021
10022        /**
10023         * @return {@link #used} (Benefits used.)
10024         */
10025        public Money getUsedMoney() throws FHIRException { 
10026          if (this.used == null)
10027            return null;
10028          if (!(this.used instanceof Money))
10029            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.used.getClass().getName()+" was encountered");
10030          return (Money) this.used;
10031        }
10032
10033        public boolean hasUsedMoney() { 
10034          return this != null && this.used instanceof Money;
10035        }
10036
10037        public boolean hasUsed() { 
10038          return this.used != null && !this.used.isEmpty();
10039        }
10040
10041        /**
10042         * @param value {@link #used} (Benefits used.)
10043         */
10044        public BenefitComponent setUsed(Type value) throws FHIRFormatError { 
10045          if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
10046            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.benefitBalance.financial.used[x]: "+value.fhirType());
10047          this.used = value;
10048          return this;
10049        }
10050
10051        protected void listChildren(List<Property> children) {
10052          super.listChildren(children);
10053          children.add(new Property("type", "CodeableConcept", "Deductable, visits, benefit amount.", 0, 1, type));
10054          children.add(new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed));
10055          children.add(new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used));
10056        }
10057
10058        @Override
10059        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10060          switch (_hash) {
10061          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Deductable, visits, benefit amount.", 0, 1, type);
10062          case -1336663592: /*allowed[x]*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
10063          case -911343192: /*allowed*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
10064          case 1668802034: /*allowedUnsignedInt*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
10065          case -2135265319: /*allowedString*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
10066          case -351668232: /*allowedMoney*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
10067          case -147553373: /*used[x]*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
10068          case 3599293: /*used*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
10069          case 1252740285: /*usedUnsignedInt*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
10070          case -78048509: /*usedMoney*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
10071          default: return super.getNamedProperty(_hash, _name, _checkValid);
10072          }
10073
10074        }
10075
10076      @Override
10077      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10078        switch (hash) {
10079        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
10080        case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // Type
10081        case 3599293: /*used*/ return this.used == null ? new Base[0] : new Base[] {this.used}; // Type
10082        default: return super.getProperty(hash, name, checkValid);
10083        }
10084
10085      }
10086
10087      @Override
10088      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10089        switch (hash) {
10090        case 3575610: // type
10091          this.type = castToCodeableConcept(value); // CodeableConcept
10092          return value;
10093        case -911343192: // allowed
10094          this.allowed = castToType(value); // Type
10095          return value;
10096        case 3599293: // used
10097          this.used = castToType(value); // Type
10098          return value;
10099        default: return super.setProperty(hash, name, value);
10100        }
10101
10102      }
10103
10104      @Override
10105      public Base setProperty(String name, Base value) throws FHIRException {
10106        if (name.equals("type")) {
10107          this.type = castToCodeableConcept(value); // CodeableConcept
10108        } else if (name.equals("allowed[x]")) {
10109          this.allowed = castToType(value); // Type
10110        } else if (name.equals("used[x]")) {
10111          this.used = castToType(value); // Type
10112        } else
10113          return super.setProperty(name, value);
10114        return value;
10115      }
10116
10117      @Override
10118      public Base makeProperty(int hash, String name) throws FHIRException {
10119        switch (hash) {
10120        case 3575610:  return getType(); 
10121        case -1336663592:  return getAllowed(); 
10122        case -911343192:  return getAllowed(); 
10123        case -147553373:  return getUsed(); 
10124        case 3599293:  return getUsed(); 
10125        default: return super.makeProperty(hash, name);
10126        }
10127
10128      }
10129
10130      @Override
10131      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10132        switch (hash) {
10133        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
10134        case -911343192: /*allowed*/ return new String[] {"unsignedInt", "string", "Money"};
10135        case 3599293: /*used*/ return new String[] {"unsignedInt", "Money"};
10136        default: return super.getTypesForProperty(hash, name);
10137        }
10138
10139      }
10140
10141      @Override
10142      public Base addChild(String name) throws FHIRException {
10143        if (name.equals("type")) {
10144          this.type = new CodeableConcept();
10145          return this.type;
10146        }
10147        else if (name.equals("allowedUnsignedInt")) {
10148          this.allowed = new UnsignedIntType();
10149          return this.allowed;
10150        }
10151        else if (name.equals("allowedString")) {
10152          this.allowed = new StringType();
10153          return this.allowed;
10154        }
10155        else if (name.equals("allowedMoney")) {
10156          this.allowed = new Money();
10157          return this.allowed;
10158        }
10159        else if (name.equals("usedUnsignedInt")) {
10160          this.used = new UnsignedIntType();
10161          return this.used;
10162        }
10163        else if (name.equals("usedMoney")) {
10164          this.used = new Money();
10165          return this.used;
10166        }
10167        else
10168          return super.addChild(name);
10169      }
10170
10171      public BenefitComponent copy() {
10172        BenefitComponent dst = new BenefitComponent();
10173        copyValues(dst);
10174        dst.type = type == null ? null : type.copy();
10175        dst.allowed = allowed == null ? null : allowed.copy();
10176        dst.used = used == null ? null : used.copy();
10177        return dst;
10178      }
10179
10180      @Override
10181      public boolean equalsDeep(Base other_) {
10182        if (!super.equalsDeep(other_))
10183          return false;
10184        if (!(other_ instanceof BenefitComponent))
10185          return false;
10186        BenefitComponent o = (BenefitComponent) other_;
10187        return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true) && compareDeep(used, o.used, true)
10188          ;
10189      }
10190
10191      @Override
10192      public boolean equalsShallow(Base other_) {
10193        if (!super.equalsShallow(other_))
10194          return false;
10195        if (!(other_ instanceof BenefitComponent))
10196          return false;
10197        BenefitComponent o = (BenefitComponent) other_;
10198        return true;
10199      }
10200
10201      public boolean isEmpty() {
10202        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
10203      }
10204
10205  public String fhirType() {
10206    return "ExplanationOfBenefit.benefitBalance.financial";
10207
10208  }
10209
10210  }
10211
10212    /**
10213     * The EOB Business Identifier.
10214     */
10215    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10216    @Description(shortDefinition="Business Identifier", formalDefinition="The EOB Business Identifier." )
10217    protected List<Identifier> identifier;
10218
10219    /**
10220     * The status of the resource instance.
10221     */
10222    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
10223    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
10224    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
10225    protected Enumeration<ExplanationOfBenefitStatus> status;
10226
10227    /**
10228     * The category of claim, eg, oral, pharmacy, vision, insitutional, professional.
10229     */
10230    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
10231    @Description(shortDefinition="Type or discipline", formalDefinition="The category of claim, eg, oral, pharmacy, vision, insitutional, professional." )
10232    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-type")
10233    protected CodeableConcept type;
10234
10235    /**
10236     * A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType.
10237     */
10238    @Child(name = "subType", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10239    @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." )
10240    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-subtype")
10241    protected List<CodeableConcept> subType;
10242
10243    /**
10244     * Patient Resource.
10245     */
10246    @Child(name = "patient", type = {Patient.class}, order=4, min=0, max=1, modifier=false, summary=false)
10247    @Description(shortDefinition="The subject of the Products and Services", formalDefinition="Patient Resource." )
10248    protected Reference patient;
10249
10250    /**
10251     * The actual object that is the target of the reference (Patient Resource.)
10252     */
10253    protected Patient patientTarget;
10254
10255    /**
10256     * The billable period for which charges are being submitted.
10257     */
10258    @Child(name = "billablePeriod", type = {Period.class}, order=5, min=0, max=1, modifier=false, summary=false)
10259    @Description(shortDefinition="Period for charge submission", formalDefinition="The billable period for which charges are being submitted." )
10260    protected Period billablePeriod;
10261
10262    /**
10263     * The date when the EOB was created.
10264     */
10265    @Child(name = "created", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=false)
10266    @Description(shortDefinition="Creation date", formalDefinition="The date when the EOB was created." )
10267    protected DateTimeType created;
10268
10269    /**
10270     * The person who created the explanation of benefit.
10271     */
10272    @Child(name = "enterer", type = {Practitioner.class}, order=7, min=0, max=1, modifier=false, summary=false)
10273    @Description(shortDefinition="Author", formalDefinition="The person who created the explanation of benefit." )
10274    protected Reference enterer;
10275
10276    /**
10277     * The actual object that is the target of the reference (The person who created the explanation of benefit.)
10278     */
10279    protected Practitioner entererTarget;
10280
10281    /**
10282     * The insurer which is responsible for the explanation of benefit.
10283     */
10284    @Child(name = "insurer", type = {Organization.class}, order=8, min=0, max=1, modifier=false, summary=false)
10285    @Description(shortDefinition="Insurer responsible for the EOB", formalDefinition="The insurer which is responsible for the explanation of benefit." )
10286    protected Reference insurer;
10287
10288    /**
10289     * The actual object that is the target of the reference (The insurer which is responsible for the explanation of benefit.)
10290     */
10291    protected Organization insurerTarget;
10292
10293    /**
10294     * The provider which is responsible for the claim.
10295     */
10296    @Child(name = "provider", type = {Practitioner.class}, order=9, min=0, max=1, modifier=false, summary=false)
10297    @Description(shortDefinition="Responsible provider for the claim", formalDefinition="The provider which is responsible for the claim." )
10298    protected Reference provider;
10299
10300    /**
10301     * The actual object that is the target of the reference (The provider which is responsible for the claim.)
10302     */
10303    protected Practitioner providerTarget;
10304
10305    /**
10306     * The provider which is responsible for the claim.
10307     */
10308    @Child(name = "organization", type = {Organization.class}, order=10, min=0, max=1, modifier=false, summary=false)
10309    @Description(shortDefinition="Responsible organization for the claim", formalDefinition="The provider which is responsible for the claim." )
10310    protected Reference organization;
10311
10312    /**
10313     * The actual object that is the target of the reference (The provider which is responsible for the claim.)
10314     */
10315    protected Organization organizationTarget;
10316
10317    /**
10318     * The referral resource which lists the date, practitioner, reason and other supporting information.
10319     */
10320    @Child(name = "referral", type = {ReferralRequest.class}, order=11, min=0, max=1, modifier=false, summary=false)
10321    @Description(shortDefinition="Treatment Referral", formalDefinition="The referral resource which lists the date, practitioner, reason and other supporting information." )
10322    protected Reference referral;
10323
10324    /**
10325     * The actual object that is the target of the reference (The referral resource which lists the date, practitioner, reason and other supporting information.)
10326     */
10327    protected ReferralRequest referralTarget;
10328
10329    /**
10330     * Facility where the services were provided.
10331     */
10332    @Child(name = "facility", type = {Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
10333    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
10334    protected Reference facility;
10335
10336    /**
10337     * The actual object that is the target of the reference (Facility where the services were provided.)
10338     */
10339    protected Location facilityTarget;
10340
10341    /**
10342     * The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.
10343     */
10344    @Child(name = "claim", type = {Claim.class}, order=13, min=0, max=1, modifier=false, summary=false)
10345    @Description(shortDefinition="Claim reference", formalDefinition="The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number." )
10346    protected Reference claim;
10347
10348    /**
10349     * 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.)
10350     */
10351    protected Claim claimTarget;
10352
10353    /**
10354     * The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.
10355     */
10356    @Child(name = "claimResponse", type = {ClaimResponse.class}, order=14, min=0, max=1, modifier=false, summary=false)
10357    @Description(shortDefinition="Claim response reference", formalDefinition="The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number." )
10358    protected Reference claimResponse;
10359
10360    /**
10361     * 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.)
10362     */
10363    protected ClaimResponse claimResponseTarget;
10364
10365    /**
10366     * Processing outcome errror, partial or complete processing.
10367     */
10368    @Child(name = "outcome", type = {CodeableConcept.class}, order=15, min=0, max=1, modifier=false, summary=false)
10369    @Description(shortDefinition="complete | error | partial", formalDefinition="Processing outcome errror, partial or complete processing." )
10370    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
10371    protected CodeableConcept outcome;
10372
10373    /**
10374     * A description of the status of the adjudication.
10375     */
10376    @Child(name = "disposition", type = {StringType.class}, order=16, min=0, max=1, modifier=false, summary=false)
10377    @Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
10378    protected StringType disposition;
10379
10380    /**
10381     * Other claims which are related to this claim such as prior claim versions or for related services.
10382     */
10383    @Child(name = "related", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10384    @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." )
10385    protected List<RelatedClaimComponent> related;
10386
10387    /**
10388     * Prescription to support the dispensing of Pharmacy or Vision products.
10389     */
10390    @Child(name = "prescription", type = {MedicationRequest.class, VisionPrescription.class}, order=18, min=0, max=1, modifier=false, summary=false)
10391    @Description(shortDefinition="Prescription authorizing services or products", formalDefinition="Prescription to support the dispensing of Pharmacy or Vision products." )
10392    protected Reference prescription;
10393
10394    /**
10395     * The actual object that is the target of the reference (Prescription to support the dispensing of Pharmacy or Vision products.)
10396     */
10397    protected Resource prescriptionTarget;
10398
10399    /**
10400     * 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'.
10401     */
10402    @Child(name = "originalPrescription", type = {MedicationRequest.class}, order=19, min=0, max=1, modifier=false, summary=false)
10403    @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'." )
10404    protected Reference originalPrescription;
10405
10406    /**
10407     * 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'.)
10408     */
10409    protected MedicationRequest originalPrescriptionTarget;
10410
10411    /**
10412     * The party to be reimbursed for the services.
10413     */
10414    @Child(name = "payee", type = {}, order=20, min=0, max=1, modifier=false, summary=false)
10415    @Description(shortDefinition="Party to be paid any benefits payable", formalDefinition="The party to be reimbursed for the services." )
10416    protected PayeeComponent payee;
10417
10418    /**
10419     * Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required.
10420     */
10421    @Child(name = "information", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10422    @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." )
10423    protected List<SupportingInformationComponent> information;
10424
10425    /**
10426     * The members of the team who provided the overall service as well as their role and whether responsible and qualifications.
10427     */
10428    @Child(name = "careTeam", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10429    @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." )
10430    protected List<CareTeamComponent> careTeam;
10431
10432    /**
10433     * Ordered list of patient diagnosis for which care is sought.
10434     */
10435    @Child(name = "diagnosis", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10436    @Description(shortDefinition="List of Diagnosis", formalDefinition="Ordered list of patient diagnosis for which care is sought." )
10437    protected List<DiagnosisComponent> diagnosis;
10438
10439    /**
10440     * Ordered list of patient procedures performed to support the adjudication.
10441     */
10442    @Child(name = "procedure", type = {}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10443    @Description(shortDefinition="Procedures performed", formalDefinition="Ordered list of patient procedures performed to support the adjudication." )
10444    protected List<ProcedureComponent> procedure;
10445
10446    /**
10447     * Precedence (primary, secondary, etc.).
10448     */
10449    @Child(name = "precedence", type = {PositiveIntType.class}, order=25, min=0, max=1, modifier=false, summary=false)
10450    @Description(shortDefinition="Precedence (primary, secondary, etc.)", formalDefinition="Precedence (primary, secondary, etc.)." )
10451    protected PositiveIntType precedence;
10452
10453    /**
10454     * Financial instrument by which payment information for health care.
10455     */
10456    @Child(name = "insurance", type = {}, order=26, min=0, max=1, modifier=false, summary=false)
10457    @Description(shortDefinition="Insurance or medical plan", formalDefinition="Financial instrument by which payment information for health care." )
10458    protected InsuranceComponent insurance;
10459
10460    /**
10461     * An accident which resulted in the need for healthcare services.
10462     */
10463    @Child(name = "accident", type = {}, order=27, min=0, max=1, modifier=false, summary=false)
10464    @Description(shortDefinition="Details of an accident", formalDefinition="An accident which resulted in the need for healthcare services." )
10465    protected AccidentComponent accident;
10466
10467    /**
10468     * The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).
10469     */
10470    @Child(name = "employmentImpacted", type = {Period.class}, order=28, min=0, max=1, modifier=false, summary=false)
10471    @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)." )
10472    protected Period employmentImpacted;
10473
10474    /**
10475     * The start and optional end dates of when the patient was confined to a treatment center.
10476     */
10477    @Child(name = "hospitalization", type = {Period.class}, order=29, min=0, max=1, modifier=false, summary=false)
10478    @Description(shortDefinition="Period in hospital", formalDefinition="The start and optional end dates of when the patient was confined to a treatment center." )
10479    protected Period hospitalization;
10480
10481    /**
10482     * First tier of goods and services.
10483     */
10484    @Child(name = "item", type = {}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10485    @Description(shortDefinition="Goods and Services", formalDefinition="First tier of goods and services." )
10486    protected List<ItemComponent> item;
10487
10488    /**
10489     * The first tier service adjudications for payor added services.
10490     */
10491    @Child(name = "addItem", type = {}, order=31, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10492    @Description(shortDefinition="Insurer added line items", formalDefinition="The first tier service adjudications for payor added services." )
10493    protected List<AddedItemComponent> addItem;
10494
10495    /**
10496     * The total cost of the services reported.
10497     */
10498    @Child(name = "totalCost", type = {Money.class}, order=32, min=0, max=1, modifier=false, summary=false)
10499    @Description(shortDefinition="Total Cost of service from the Claim", formalDefinition="The total cost of the services reported." )
10500    protected Money totalCost;
10501
10502    /**
10503     * The amount of deductable applied which was not allocated to any particular service line.
10504     */
10505    @Child(name = "unallocDeductable", type = {Money.class}, order=33, min=0, max=1, modifier=false, summary=false)
10506    @Description(shortDefinition="Unallocated deductable", formalDefinition="The amount of deductable applied which was not allocated to any particular service line." )
10507    protected Money unallocDeductable;
10508
10509    /**
10510     * Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable).
10511     */
10512    @Child(name = "totalBenefit", type = {Money.class}, order=34, min=0, max=1, modifier=false, summary=false)
10513    @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)." )
10514    protected Money totalBenefit;
10515
10516    /**
10517     * Payment details for the claim if the claim has been paid.
10518     */
10519    @Child(name = "payment", type = {}, order=35, min=0, max=1, modifier=false, summary=false)
10520    @Description(shortDefinition="Payment (if paid)", formalDefinition="Payment details for the claim if the claim has been paid." )
10521    protected PaymentComponent payment;
10522
10523    /**
10524     * The form to be used for printing the content.
10525     */
10526    @Child(name = "form", type = {CodeableConcept.class}, order=36, min=0, max=1, modifier=false, summary=false)
10527    @Description(shortDefinition="Printed Form Identifier", formalDefinition="The form to be used for printing the content." )
10528    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
10529    protected CodeableConcept form;
10530
10531    /**
10532     * Note text.
10533     */
10534    @Child(name = "processNote", type = {}, order=37, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10535    @Description(shortDefinition="Processing notes", formalDefinition="Note text." )
10536    protected List<NoteComponent> processNote;
10537
10538    /**
10539     * Balance by Benefit Category.
10540     */
10541    @Child(name = "benefitBalance", type = {}, order=38, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10542    @Description(shortDefinition="Balance by Benefit Category", formalDefinition="Balance by Benefit Category." )
10543    protected List<BenefitBalanceComponent> benefitBalance;
10544
10545    private static final long serialVersionUID = -1301056913L;
10546
10547  /**
10548   * Constructor
10549   */
10550    public ExplanationOfBenefit() {
10551      super();
10552    }
10553
10554    /**
10555     * @return {@link #identifier} (The EOB Business Identifier.)
10556     */
10557    public List<Identifier> getIdentifier() { 
10558      if (this.identifier == null)
10559        this.identifier = new ArrayList<Identifier>();
10560      return this.identifier;
10561    }
10562
10563    /**
10564     * @return Returns a reference to <code>this</code> for easy method chaining
10565     */
10566    public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) { 
10567      this.identifier = theIdentifier;
10568      return this;
10569    }
10570
10571    public boolean hasIdentifier() { 
10572      if (this.identifier == null)
10573        return false;
10574      for (Identifier item : this.identifier)
10575        if (!item.isEmpty())
10576          return true;
10577      return false;
10578    }
10579
10580    public Identifier addIdentifier() { //3
10581      Identifier t = new Identifier();
10582      if (this.identifier == null)
10583        this.identifier = new ArrayList<Identifier>();
10584      this.identifier.add(t);
10585      return t;
10586    }
10587
10588    public ExplanationOfBenefit addIdentifier(Identifier t) { //3
10589      if (t == null)
10590        return this;
10591      if (this.identifier == null)
10592        this.identifier = new ArrayList<Identifier>();
10593      this.identifier.add(t);
10594      return this;
10595    }
10596
10597    /**
10598     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
10599     */
10600    public Identifier getIdentifierFirstRep() { 
10601      if (getIdentifier().isEmpty()) {
10602        addIdentifier();
10603      }
10604      return getIdentifier().get(0);
10605    }
10606
10607    /**
10608     * @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
10609     */
10610    public Enumeration<ExplanationOfBenefitStatus> getStatusElement() { 
10611      if (this.status == null)
10612        if (Configuration.errorOnAutoCreate())
10613          throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
10614        else if (Configuration.doAutoCreate())
10615          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
10616      return this.status;
10617    }
10618
10619    public boolean hasStatusElement() { 
10620      return this.status != null && !this.status.isEmpty();
10621    }
10622
10623    public boolean hasStatus() { 
10624      return this.status != null && !this.status.isEmpty();
10625    }
10626
10627    /**
10628     * @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
10629     */
10630    public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) { 
10631      this.status = value;
10632      return this;
10633    }
10634
10635    /**
10636     * @return The status of the resource instance.
10637     */
10638    public ExplanationOfBenefitStatus getStatus() { 
10639      return this.status == null ? null : this.status.getValue();
10640    }
10641
10642    /**
10643     * @param value The status of the resource instance.
10644     */
10645    public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) { 
10646      if (value == null)
10647        this.status = null;
10648      else {
10649        if (this.status == null)
10650          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
10651        this.status.setValue(value);
10652      }
10653      return this;
10654    }
10655
10656    /**
10657     * @return {@link #type} (The category of claim, eg, oral, pharmacy, vision, insitutional, professional.)
10658     */
10659    public CodeableConcept getType() { 
10660      if (this.type == null)
10661        if (Configuration.errorOnAutoCreate())
10662          throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
10663        else if (Configuration.doAutoCreate())
10664          this.type = new CodeableConcept(); // cc
10665      return this.type;
10666    }
10667
10668    public boolean hasType() { 
10669      return this.type != null && !this.type.isEmpty();
10670    }
10671
10672    /**
10673     * @param value {@link #type} (The category of claim, eg, oral, pharmacy, vision, insitutional, professional.)
10674     */
10675    public ExplanationOfBenefit setType(CodeableConcept value)  { 
10676      this.type = value;
10677      return this;
10678    }
10679
10680    /**
10681     * @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.)
10682     */
10683    public List<CodeableConcept> getSubType() { 
10684      if (this.subType == null)
10685        this.subType = new ArrayList<CodeableConcept>();
10686      return this.subType;
10687    }
10688
10689    /**
10690     * @return Returns a reference to <code>this</code> for easy method chaining
10691     */
10692    public ExplanationOfBenefit setSubType(List<CodeableConcept> theSubType) { 
10693      this.subType = theSubType;
10694      return this;
10695    }
10696
10697    public boolean hasSubType() { 
10698      if (this.subType == null)
10699        return false;
10700      for (CodeableConcept item : this.subType)
10701        if (!item.isEmpty())
10702          return true;
10703      return false;
10704    }
10705
10706    public CodeableConcept addSubType() { //3
10707      CodeableConcept t = new CodeableConcept();
10708      if (this.subType == null)
10709        this.subType = new ArrayList<CodeableConcept>();
10710      this.subType.add(t);
10711      return t;
10712    }
10713
10714    public ExplanationOfBenefit addSubType(CodeableConcept t) { //3
10715      if (t == null)
10716        return this;
10717      if (this.subType == null)
10718        this.subType = new ArrayList<CodeableConcept>();
10719      this.subType.add(t);
10720      return this;
10721    }
10722
10723    /**
10724     * @return The first repetition of repeating field {@link #subType}, creating it if it does not already exist
10725     */
10726    public CodeableConcept getSubTypeFirstRep() { 
10727      if (getSubType().isEmpty()) {
10728        addSubType();
10729      }
10730      return getSubType().get(0);
10731    }
10732
10733    /**
10734     * @return {@link #patient} (Patient Resource.)
10735     */
10736    public Reference getPatient() { 
10737      if (this.patient == null)
10738        if (Configuration.errorOnAutoCreate())
10739          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
10740        else if (Configuration.doAutoCreate())
10741          this.patient = new Reference(); // cc
10742      return this.patient;
10743    }
10744
10745    public boolean hasPatient() { 
10746      return this.patient != null && !this.patient.isEmpty();
10747    }
10748
10749    /**
10750     * @param value {@link #patient} (Patient Resource.)
10751     */
10752    public ExplanationOfBenefit setPatient(Reference value)  { 
10753      this.patient = value;
10754      return this;
10755    }
10756
10757    /**
10758     * @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.)
10759     */
10760    public Patient getPatientTarget() { 
10761      if (this.patientTarget == null)
10762        if (Configuration.errorOnAutoCreate())
10763          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
10764        else if (Configuration.doAutoCreate())
10765          this.patientTarget = new Patient(); // aa
10766      return this.patientTarget;
10767    }
10768
10769    /**
10770     * @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.)
10771     */
10772    public ExplanationOfBenefit setPatientTarget(Patient value) { 
10773      this.patientTarget = value;
10774      return this;
10775    }
10776
10777    /**
10778     * @return {@link #billablePeriod} (The billable period for which charges are being submitted.)
10779     */
10780    public Period getBillablePeriod() { 
10781      if (this.billablePeriod == null)
10782        if (Configuration.errorOnAutoCreate())
10783          throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
10784        else if (Configuration.doAutoCreate())
10785          this.billablePeriod = new Period(); // cc
10786      return this.billablePeriod;
10787    }
10788
10789    public boolean hasBillablePeriod() { 
10790      return this.billablePeriod != null && !this.billablePeriod.isEmpty();
10791    }
10792
10793    /**
10794     * @param value {@link #billablePeriod} (The billable period for which charges are being submitted.)
10795     */
10796    public ExplanationOfBenefit setBillablePeriod(Period value)  { 
10797      this.billablePeriod = value;
10798      return this;
10799    }
10800
10801    /**
10802     * @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
10803     */
10804    public DateTimeType getCreatedElement() { 
10805      if (this.created == null)
10806        if (Configuration.errorOnAutoCreate())
10807          throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
10808        else if (Configuration.doAutoCreate())
10809          this.created = new DateTimeType(); // bb
10810      return this.created;
10811    }
10812
10813    public boolean hasCreatedElement() { 
10814      return this.created != null && !this.created.isEmpty();
10815    }
10816
10817    public boolean hasCreated() { 
10818      return this.created != null && !this.created.isEmpty();
10819    }
10820
10821    /**
10822     * @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
10823     */
10824    public ExplanationOfBenefit setCreatedElement(DateTimeType value) { 
10825      this.created = value;
10826      return this;
10827    }
10828
10829    /**
10830     * @return The date when the EOB was created.
10831     */
10832    public Date getCreated() { 
10833      return this.created == null ? null : this.created.getValue();
10834    }
10835
10836    /**
10837     * @param value The date when the EOB was created.
10838     */
10839    public ExplanationOfBenefit setCreated(Date value) { 
10840      if (value == null)
10841        this.created = null;
10842      else {
10843        if (this.created == null)
10844          this.created = new DateTimeType();
10845        this.created.setValue(value);
10846      }
10847      return this;
10848    }
10849
10850    /**
10851     * @return {@link #enterer} (The person who created the explanation of benefit.)
10852     */
10853    public Reference getEnterer() { 
10854      if (this.enterer == null)
10855        if (Configuration.errorOnAutoCreate())
10856          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
10857        else if (Configuration.doAutoCreate())
10858          this.enterer = new Reference(); // cc
10859      return this.enterer;
10860    }
10861
10862    public boolean hasEnterer() { 
10863      return this.enterer != null && !this.enterer.isEmpty();
10864    }
10865
10866    /**
10867     * @param value {@link #enterer} (The person who created the explanation of benefit.)
10868     */
10869    public ExplanationOfBenefit setEnterer(Reference value)  { 
10870      this.enterer = value;
10871      return this;
10872    }
10873
10874    /**
10875     * @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.)
10876     */
10877    public Practitioner getEntererTarget() { 
10878      if (this.entererTarget == null)
10879        if (Configuration.errorOnAutoCreate())
10880          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
10881        else if (Configuration.doAutoCreate())
10882          this.entererTarget = new Practitioner(); // aa
10883      return this.entererTarget;
10884    }
10885
10886    /**
10887     * @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.)
10888     */
10889    public ExplanationOfBenefit setEntererTarget(Practitioner value) { 
10890      this.entererTarget = value;
10891      return this;
10892    }
10893
10894    /**
10895     * @return {@link #insurer} (The insurer which is responsible for the explanation of benefit.)
10896     */
10897    public Reference getInsurer() { 
10898      if (this.insurer == null)
10899        if (Configuration.errorOnAutoCreate())
10900          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
10901        else if (Configuration.doAutoCreate())
10902          this.insurer = new Reference(); // cc
10903      return this.insurer;
10904    }
10905
10906    public boolean hasInsurer() { 
10907      return this.insurer != null && !this.insurer.isEmpty();
10908    }
10909
10910    /**
10911     * @param value {@link #insurer} (The insurer which is responsible for the explanation of benefit.)
10912     */
10913    public ExplanationOfBenefit setInsurer(Reference value)  { 
10914      this.insurer = value;
10915      return this;
10916    }
10917
10918    /**
10919     * @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.)
10920     */
10921    public Organization getInsurerTarget() { 
10922      if (this.insurerTarget == null)
10923        if (Configuration.errorOnAutoCreate())
10924          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
10925        else if (Configuration.doAutoCreate())
10926          this.insurerTarget = new Organization(); // aa
10927      return this.insurerTarget;
10928    }
10929
10930    /**
10931     * @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.)
10932     */
10933    public ExplanationOfBenefit setInsurerTarget(Organization value) { 
10934      this.insurerTarget = value;
10935      return this;
10936    }
10937
10938    /**
10939     * @return {@link #provider} (The provider which is responsible for the claim.)
10940     */
10941    public Reference getProvider() { 
10942      if (this.provider == null)
10943        if (Configuration.errorOnAutoCreate())
10944          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
10945        else if (Configuration.doAutoCreate())
10946          this.provider = new Reference(); // cc
10947      return this.provider;
10948    }
10949
10950    public boolean hasProvider() { 
10951      return this.provider != null && !this.provider.isEmpty();
10952    }
10953
10954    /**
10955     * @param value {@link #provider} (The provider which is responsible for the claim.)
10956     */
10957    public ExplanationOfBenefit setProvider(Reference value)  { 
10958      this.provider = value;
10959      return this;
10960    }
10961
10962    /**
10963     * @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.)
10964     */
10965    public Practitioner getProviderTarget() { 
10966      if (this.providerTarget == null)
10967        if (Configuration.errorOnAutoCreate())
10968          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
10969        else if (Configuration.doAutoCreate())
10970          this.providerTarget = new Practitioner(); // aa
10971      return this.providerTarget;
10972    }
10973
10974    /**
10975     * @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.)
10976     */
10977    public ExplanationOfBenefit setProviderTarget(Practitioner value) { 
10978      this.providerTarget = value;
10979      return this;
10980    }
10981
10982    /**
10983     * @return {@link #organization} (The provider which is responsible for the claim.)
10984     */
10985    public Reference getOrganization() { 
10986      if (this.organization == null)
10987        if (Configuration.errorOnAutoCreate())
10988          throw new Error("Attempt to auto-create ExplanationOfBenefit.organization");
10989        else if (Configuration.doAutoCreate())
10990          this.organization = new Reference(); // cc
10991      return this.organization;
10992    }
10993
10994    public boolean hasOrganization() { 
10995      return this.organization != null && !this.organization.isEmpty();
10996    }
10997
10998    /**
10999     * @param value {@link #organization} (The provider which is responsible for the claim.)
11000     */
11001    public ExplanationOfBenefit setOrganization(Reference value)  { 
11002      this.organization = value;
11003      return this;
11004    }
11005
11006    /**
11007     * @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.)
11008     */
11009    public Organization getOrganizationTarget() { 
11010      if (this.organizationTarget == null)
11011        if (Configuration.errorOnAutoCreate())
11012          throw new Error("Attempt to auto-create ExplanationOfBenefit.organization");
11013        else if (Configuration.doAutoCreate())
11014          this.organizationTarget = new Organization(); // aa
11015      return this.organizationTarget;
11016    }
11017
11018    /**
11019     * @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.)
11020     */
11021    public ExplanationOfBenefit setOrganizationTarget(Organization value) { 
11022      this.organizationTarget = value;
11023      return this;
11024    }
11025
11026    /**
11027     * @return {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
11028     */
11029    public Reference getReferral() { 
11030      if (this.referral == null)
11031        if (Configuration.errorOnAutoCreate())
11032          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
11033        else if (Configuration.doAutoCreate())
11034          this.referral = new Reference(); // cc
11035      return this.referral;
11036    }
11037
11038    public boolean hasReferral() { 
11039      return this.referral != null && !this.referral.isEmpty();
11040    }
11041
11042    /**
11043     * @param value {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
11044     */
11045    public ExplanationOfBenefit setReferral(Reference value)  { 
11046      this.referral = value;
11047      return this;
11048    }
11049
11050    /**
11051     * @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.)
11052     */
11053    public ReferralRequest getReferralTarget() { 
11054      if (this.referralTarget == null)
11055        if (Configuration.errorOnAutoCreate())
11056          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
11057        else if (Configuration.doAutoCreate())
11058          this.referralTarget = new ReferralRequest(); // aa
11059      return this.referralTarget;
11060    }
11061
11062    /**
11063     * @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.)
11064     */
11065    public ExplanationOfBenefit setReferralTarget(ReferralRequest value) { 
11066      this.referralTarget = value;
11067      return this;
11068    }
11069
11070    /**
11071     * @return {@link #facility} (Facility where the services were provided.)
11072     */
11073    public Reference getFacility() { 
11074      if (this.facility == null)
11075        if (Configuration.errorOnAutoCreate())
11076          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
11077        else if (Configuration.doAutoCreate())
11078          this.facility = new Reference(); // cc
11079      return this.facility;
11080    }
11081
11082    public boolean hasFacility() { 
11083      return this.facility != null && !this.facility.isEmpty();
11084    }
11085
11086    /**
11087     * @param value {@link #facility} (Facility where the services were provided.)
11088     */
11089    public ExplanationOfBenefit setFacility(Reference value)  { 
11090      this.facility = value;
11091      return this;
11092    }
11093
11094    /**
11095     * @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.)
11096     */
11097    public Location getFacilityTarget() { 
11098      if (this.facilityTarget == null)
11099        if (Configuration.errorOnAutoCreate())
11100          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
11101        else if (Configuration.doAutoCreate())
11102          this.facilityTarget = new Location(); // aa
11103      return this.facilityTarget;
11104    }
11105
11106    /**
11107     * @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.)
11108     */
11109    public ExplanationOfBenefit setFacilityTarget(Location value) { 
11110      this.facilityTarget = value;
11111      return this;
11112    }
11113
11114    /**
11115     * @return {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
11116     */
11117    public Reference getClaim() { 
11118      if (this.claim == null)
11119        if (Configuration.errorOnAutoCreate())
11120          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
11121        else if (Configuration.doAutoCreate())
11122          this.claim = new Reference(); // cc
11123      return this.claim;
11124    }
11125
11126    public boolean hasClaim() { 
11127      return this.claim != null && !this.claim.isEmpty();
11128    }
11129
11130    /**
11131     * @param value {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
11132     */
11133    public ExplanationOfBenefit setClaim(Reference value)  { 
11134      this.claim = value;
11135      return this;
11136    }
11137
11138    /**
11139     * @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.)
11140     */
11141    public Claim getClaimTarget() { 
11142      if (this.claimTarget == null)
11143        if (Configuration.errorOnAutoCreate())
11144          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
11145        else if (Configuration.doAutoCreate())
11146          this.claimTarget = new Claim(); // aa
11147      return this.claimTarget;
11148    }
11149
11150    /**
11151     * @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.)
11152     */
11153    public ExplanationOfBenefit setClaimTarget(Claim value) { 
11154      this.claimTarget = value;
11155      return this;
11156    }
11157
11158    /**
11159     * @return {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
11160     */
11161    public Reference getClaimResponse() { 
11162      if (this.claimResponse == null)
11163        if (Configuration.errorOnAutoCreate())
11164          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
11165        else if (Configuration.doAutoCreate())
11166          this.claimResponse = new Reference(); // cc
11167      return this.claimResponse;
11168    }
11169
11170    public boolean hasClaimResponse() { 
11171      return this.claimResponse != null && !this.claimResponse.isEmpty();
11172    }
11173
11174    /**
11175     * @param value {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
11176     */
11177    public ExplanationOfBenefit setClaimResponse(Reference value)  { 
11178      this.claimResponse = value;
11179      return this;
11180    }
11181
11182    /**
11183     * @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.)
11184     */
11185    public ClaimResponse getClaimResponseTarget() { 
11186      if (this.claimResponseTarget == null)
11187        if (Configuration.errorOnAutoCreate())
11188          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
11189        else if (Configuration.doAutoCreate())
11190          this.claimResponseTarget = new ClaimResponse(); // aa
11191      return this.claimResponseTarget;
11192    }
11193
11194    /**
11195     * @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.)
11196     */
11197    public ExplanationOfBenefit setClaimResponseTarget(ClaimResponse value) { 
11198      this.claimResponseTarget = value;
11199      return this;
11200    }
11201
11202    /**
11203     * @return {@link #outcome} (Processing outcome errror, partial or complete processing.)
11204     */
11205    public CodeableConcept getOutcome() { 
11206      if (this.outcome == null)
11207        if (Configuration.errorOnAutoCreate())
11208          throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
11209        else if (Configuration.doAutoCreate())
11210          this.outcome = new CodeableConcept(); // cc
11211      return this.outcome;
11212    }
11213
11214    public boolean hasOutcome() { 
11215      return this.outcome != null && !this.outcome.isEmpty();
11216    }
11217
11218    /**
11219     * @param value {@link #outcome} (Processing outcome errror, partial or complete processing.)
11220     */
11221    public ExplanationOfBenefit setOutcome(CodeableConcept value)  { 
11222      this.outcome = value;
11223      return this;
11224    }
11225
11226    /**
11227     * @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
11228     */
11229    public StringType getDispositionElement() { 
11230      if (this.disposition == null)
11231        if (Configuration.errorOnAutoCreate())
11232          throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
11233        else if (Configuration.doAutoCreate())
11234          this.disposition = new StringType(); // bb
11235      return this.disposition;
11236    }
11237
11238    public boolean hasDispositionElement() { 
11239      return this.disposition != null && !this.disposition.isEmpty();
11240    }
11241
11242    public boolean hasDisposition() { 
11243      return this.disposition != null && !this.disposition.isEmpty();
11244    }
11245
11246    /**
11247     * @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
11248     */
11249    public ExplanationOfBenefit setDispositionElement(StringType value) { 
11250      this.disposition = value;
11251      return this;
11252    }
11253
11254    /**
11255     * @return A description of the status of the adjudication.
11256     */
11257    public String getDisposition() { 
11258      return this.disposition == null ? null : this.disposition.getValue();
11259    }
11260
11261    /**
11262     * @param value A description of the status of the adjudication.
11263     */
11264    public ExplanationOfBenefit setDisposition(String value) { 
11265      if (Utilities.noString(value))
11266        this.disposition = null;
11267      else {
11268        if (this.disposition == null)
11269          this.disposition = new StringType();
11270        this.disposition.setValue(value);
11271      }
11272      return this;
11273    }
11274
11275    /**
11276     * @return {@link #related} (Other claims which are related to this claim such as prior claim versions or for related services.)
11277     */
11278    public List<RelatedClaimComponent> getRelated() { 
11279      if (this.related == null)
11280        this.related = new ArrayList<RelatedClaimComponent>();
11281      return this.related;
11282    }
11283
11284    /**
11285     * @return Returns a reference to <code>this</code> for easy method chaining
11286     */
11287    public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) { 
11288      this.related = theRelated;
11289      return this;
11290    }
11291
11292    public boolean hasRelated() { 
11293      if (this.related == null)
11294        return false;
11295      for (RelatedClaimComponent item : this.related)
11296        if (!item.isEmpty())
11297          return true;
11298      return false;
11299    }
11300
11301    public RelatedClaimComponent addRelated() { //3
11302      RelatedClaimComponent t = new RelatedClaimComponent();
11303      if (this.related == null)
11304        this.related = new ArrayList<RelatedClaimComponent>();
11305      this.related.add(t);
11306      return t;
11307    }
11308
11309    public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { //3
11310      if (t == null)
11311        return this;
11312      if (this.related == null)
11313        this.related = new ArrayList<RelatedClaimComponent>();
11314      this.related.add(t);
11315      return this;
11316    }
11317
11318    /**
11319     * @return The first repetition of repeating field {@link #related}, creating it if it does not already exist
11320     */
11321    public RelatedClaimComponent getRelatedFirstRep() { 
11322      if (getRelated().isEmpty()) {
11323        addRelated();
11324      }
11325      return getRelated().get(0);
11326    }
11327
11328    /**
11329     * @return {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
11330     */
11331    public Reference getPrescription() { 
11332      if (this.prescription == null)
11333        if (Configuration.errorOnAutoCreate())
11334          throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
11335        else if (Configuration.doAutoCreate())
11336          this.prescription = new Reference(); // cc
11337      return this.prescription;
11338    }
11339
11340    public boolean hasPrescription() { 
11341      return this.prescription != null && !this.prescription.isEmpty();
11342    }
11343
11344    /**
11345     * @param value {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
11346     */
11347    public ExplanationOfBenefit setPrescription(Reference value)  { 
11348      this.prescription = value;
11349      return this;
11350    }
11351
11352    /**
11353     * @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.)
11354     */
11355    public Resource getPrescriptionTarget() { 
11356      return this.prescriptionTarget;
11357    }
11358
11359    /**
11360     * @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.)
11361     */
11362    public ExplanationOfBenefit setPrescriptionTarget(Resource value) { 
11363      this.prescriptionTarget = value;
11364      return this;
11365    }
11366
11367    /**
11368     * @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'.)
11369     */
11370    public Reference getOriginalPrescription() { 
11371      if (this.originalPrescription == null)
11372        if (Configuration.errorOnAutoCreate())
11373          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
11374        else if (Configuration.doAutoCreate())
11375          this.originalPrescription = new Reference(); // cc
11376      return this.originalPrescription;
11377    }
11378
11379    public boolean hasOriginalPrescription() { 
11380      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
11381    }
11382
11383    /**
11384     * @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'.)
11385     */
11386    public ExplanationOfBenefit setOriginalPrescription(Reference value)  { 
11387      this.originalPrescription = value;
11388      return this;
11389    }
11390
11391    /**
11392     * @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'.)
11393     */
11394    public MedicationRequest getOriginalPrescriptionTarget() { 
11395      if (this.originalPrescriptionTarget == null)
11396        if (Configuration.errorOnAutoCreate())
11397          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
11398        else if (Configuration.doAutoCreate())
11399          this.originalPrescriptionTarget = new MedicationRequest(); // aa
11400      return this.originalPrescriptionTarget;
11401    }
11402
11403    /**
11404     * @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'.)
11405     */
11406    public ExplanationOfBenefit setOriginalPrescriptionTarget(MedicationRequest value) { 
11407      this.originalPrescriptionTarget = value;
11408      return this;
11409    }
11410
11411    /**
11412     * @return {@link #payee} (The party to be reimbursed for the services.)
11413     */
11414    public PayeeComponent getPayee() { 
11415      if (this.payee == null)
11416        if (Configuration.errorOnAutoCreate())
11417          throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
11418        else if (Configuration.doAutoCreate())
11419          this.payee = new PayeeComponent(); // cc
11420      return this.payee;
11421    }
11422
11423    public boolean hasPayee() { 
11424      return this.payee != null && !this.payee.isEmpty();
11425    }
11426
11427    /**
11428     * @param value {@link #payee} (The party to be reimbursed for the services.)
11429     */
11430    public ExplanationOfBenefit setPayee(PayeeComponent value)  { 
11431      this.payee = value;
11432      return this;
11433    }
11434
11435    /**
11436     * @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.)
11437     */
11438    public List<SupportingInformationComponent> getInformation() { 
11439      if (this.information == null)
11440        this.information = new ArrayList<SupportingInformationComponent>();
11441      return this.information;
11442    }
11443
11444    /**
11445     * @return Returns a reference to <code>this</code> for easy method chaining
11446     */
11447    public ExplanationOfBenefit setInformation(List<SupportingInformationComponent> theInformation) { 
11448      this.information = theInformation;
11449      return this;
11450    }
11451
11452    public boolean hasInformation() { 
11453      if (this.information == null)
11454        return false;
11455      for (SupportingInformationComponent item : this.information)
11456        if (!item.isEmpty())
11457          return true;
11458      return false;
11459    }
11460
11461    public SupportingInformationComponent addInformation() { //3
11462      SupportingInformationComponent t = new SupportingInformationComponent();
11463      if (this.information == null)
11464        this.information = new ArrayList<SupportingInformationComponent>();
11465      this.information.add(t);
11466      return t;
11467    }
11468
11469    public ExplanationOfBenefit addInformation(SupportingInformationComponent t) { //3
11470      if (t == null)
11471        return this;
11472      if (this.information == null)
11473        this.information = new ArrayList<SupportingInformationComponent>();
11474      this.information.add(t);
11475      return this;
11476    }
11477
11478    /**
11479     * @return The first repetition of repeating field {@link #information}, creating it if it does not already exist
11480     */
11481    public SupportingInformationComponent getInformationFirstRep() { 
11482      if (getInformation().isEmpty()) {
11483        addInformation();
11484      }
11485      return getInformation().get(0);
11486    }
11487
11488    /**
11489     * @return {@link #careTeam} (The members of the team who provided the overall service as well as their role and whether responsible and qualifications.)
11490     */
11491    public List<CareTeamComponent> getCareTeam() { 
11492      if (this.careTeam == null)
11493        this.careTeam = new ArrayList<CareTeamComponent>();
11494      return this.careTeam;
11495    }
11496
11497    /**
11498     * @return Returns a reference to <code>this</code> for easy method chaining
11499     */
11500    public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) { 
11501      this.careTeam = theCareTeam;
11502      return this;
11503    }
11504
11505    public boolean hasCareTeam() { 
11506      if (this.careTeam == null)
11507        return false;
11508      for (CareTeamComponent item : this.careTeam)
11509        if (!item.isEmpty())
11510          return true;
11511      return false;
11512    }
11513
11514    public CareTeamComponent addCareTeam() { //3
11515      CareTeamComponent t = new CareTeamComponent();
11516      if (this.careTeam == null)
11517        this.careTeam = new ArrayList<CareTeamComponent>();
11518      this.careTeam.add(t);
11519      return t;
11520    }
11521
11522    public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { //3
11523      if (t == null)
11524        return this;
11525      if (this.careTeam == null)
11526        this.careTeam = new ArrayList<CareTeamComponent>();
11527      this.careTeam.add(t);
11528      return this;
11529    }
11530
11531    /**
11532     * @return The first repetition of repeating field {@link #careTeam}, creating it if it does not already exist
11533     */
11534    public CareTeamComponent getCareTeamFirstRep() { 
11535      if (getCareTeam().isEmpty()) {
11536        addCareTeam();
11537      }
11538      return getCareTeam().get(0);
11539    }
11540
11541    /**
11542     * @return {@link #diagnosis} (Ordered list of patient diagnosis for which care is sought.)
11543     */
11544    public List<DiagnosisComponent> getDiagnosis() { 
11545      if (this.diagnosis == null)
11546        this.diagnosis = new ArrayList<DiagnosisComponent>();
11547      return this.diagnosis;
11548    }
11549
11550    /**
11551     * @return Returns a reference to <code>this</code> for easy method chaining
11552     */
11553    public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
11554      this.diagnosis = theDiagnosis;
11555      return this;
11556    }
11557
11558    public boolean hasDiagnosis() { 
11559      if (this.diagnosis == null)
11560        return false;
11561      for (DiagnosisComponent item : this.diagnosis)
11562        if (!item.isEmpty())
11563          return true;
11564      return false;
11565    }
11566
11567    public DiagnosisComponent addDiagnosis() { //3
11568      DiagnosisComponent t = new DiagnosisComponent();
11569      if (this.diagnosis == null)
11570        this.diagnosis = new ArrayList<DiagnosisComponent>();
11571      this.diagnosis.add(t);
11572      return t;
11573    }
11574
11575    public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { //3
11576      if (t == null)
11577        return this;
11578      if (this.diagnosis == null)
11579        this.diagnosis = new ArrayList<DiagnosisComponent>();
11580      this.diagnosis.add(t);
11581      return this;
11582    }
11583
11584    /**
11585     * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist
11586     */
11587    public DiagnosisComponent getDiagnosisFirstRep() { 
11588      if (getDiagnosis().isEmpty()) {
11589        addDiagnosis();
11590      }
11591      return getDiagnosis().get(0);
11592    }
11593
11594    /**
11595     * @return {@link #procedure} (Ordered list of patient procedures performed to support the adjudication.)
11596     */
11597    public List<ProcedureComponent> getProcedure() { 
11598      if (this.procedure == null)
11599        this.procedure = new ArrayList<ProcedureComponent>();
11600      return this.procedure;
11601    }
11602
11603    /**
11604     * @return Returns a reference to <code>this</code> for easy method chaining
11605     */
11606    public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) { 
11607      this.procedure = theProcedure;
11608      return this;
11609    }
11610
11611    public boolean hasProcedure() { 
11612      if (this.procedure == null)
11613        return false;
11614      for (ProcedureComponent item : this.procedure)
11615        if (!item.isEmpty())
11616          return true;
11617      return false;
11618    }
11619
11620    public ProcedureComponent addProcedure() { //3
11621      ProcedureComponent t = new ProcedureComponent();
11622      if (this.procedure == null)
11623        this.procedure = new ArrayList<ProcedureComponent>();
11624      this.procedure.add(t);
11625      return t;
11626    }
11627
11628    public ExplanationOfBenefit addProcedure(ProcedureComponent t) { //3
11629      if (t == null)
11630        return this;
11631      if (this.procedure == null)
11632        this.procedure = new ArrayList<ProcedureComponent>();
11633      this.procedure.add(t);
11634      return this;
11635    }
11636
11637    /**
11638     * @return The first repetition of repeating field {@link #procedure}, creating it if it does not already exist
11639     */
11640    public ProcedureComponent getProcedureFirstRep() { 
11641      if (getProcedure().isEmpty()) {
11642        addProcedure();
11643      }
11644      return getProcedure().get(0);
11645    }
11646
11647    /**
11648     * @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
11649     */
11650    public PositiveIntType getPrecedenceElement() { 
11651      if (this.precedence == null)
11652        if (Configuration.errorOnAutoCreate())
11653          throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
11654        else if (Configuration.doAutoCreate())
11655          this.precedence = new PositiveIntType(); // bb
11656      return this.precedence;
11657    }
11658
11659    public boolean hasPrecedenceElement() { 
11660      return this.precedence != null && !this.precedence.isEmpty();
11661    }
11662
11663    public boolean hasPrecedence() { 
11664      return this.precedence != null && !this.precedence.isEmpty();
11665    }
11666
11667    /**
11668     * @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
11669     */
11670    public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) { 
11671      this.precedence = value;
11672      return this;
11673    }
11674
11675    /**
11676     * @return Precedence (primary, secondary, etc.).
11677     */
11678    public int getPrecedence() { 
11679      return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
11680    }
11681
11682    /**
11683     * @param value Precedence (primary, secondary, etc.).
11684     */
11685    public ExplanationOfBenefit setPrecedence(int value) { 
11686        if (this.precedence == null)
11687          this.precedence = new PositiveIntType();
11688        this.precedence.setValue(value);
11689      return this;
11690    }
11691
11692    /**
11693     * @return {@link #insurance} (Financial instrument by which payment information for health care.)
11694     */
11695    public InsuranceComponent getInsurance() { 
11696      if (this.insurance == null)
11697        if (Configuration.errorOnAutoCreate())
11698          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurance");
11699        else if (Configuration.doAutoCreate())
11700          this.insurance = new InsuranceComponent(); // cc
11701      return this.insurance;
11702    }
11703
11704    public boolean hasInsurance() { 
11705      return this.insurance != null && !this.insurance.isEmpty();
11706    }
11707
11708    /**
11709     * @param value {@link #insurance} (Financial instrument by which payment information for health care.)
11710     */
11711    public ExplanationOfBenefit setInsurance(InsuranceComponent value)  { 
11712      this.insurance = value;
11713      return this;
11714    }
11715
11716    /**
11717     * @return {@link #accident} (An accident which resulted in the need for healthcare services.)
11718     */
11719    public AccidentComponent getAccident() { 
11720      if (this.accident == null)
11721        if (Configuration.errorOnAutoCreate())
11722          throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
11723        else if (Configuration.doAutoCreate())
11724          this.accident = new AccidentComponent(); // cc
11725      return this.accident;
11726    }
11727
11728    public boolean hasAccident() { 
11729      return this.accident != null && !this.accident.isEmpty();
11730    }
11731
11732    /**
11733     * @param value {@link #accident} (An accident which resulted in the need for healthcare services.)
11734     */
11735    public ExplanationOfBenefit setAccident(AccidentComponent value)  { 
11736      this.accident = value;
11737      return this;
11738    }
11739
11740    /**
11741     * @return {@link #employmentImpacted} (The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).)
11742     */
11743    public Period getEmploymentImpacted() { 
11744      if (this.employmentImpacted == null)
11745        if (Configuration.errorOnAutoCreate())
11746          throw new Error("Attempt to auto-create ExplanationOfBenefit.employmentImpacted");
11747        else if (Configuration.doAutoCreate())
11748          this.employmentImpacted = new Period(); // cc
11749      return this.employmentImpacted;
11750    }
11751
11752    public boolean hasEmploymentImpacted() { 
11753      return this.employmentImpacted != null && !this.employmentImpacted.isEmpty();
11754    }
11755
11756    /**
11757     * @param value {@link #employmentImpacted} (The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).)
11758     */
11759    public ExplanationOfBenefit setEmploymentImpacted(Period value)  { 
11760      this.employmentImpacted = value;
11761      return this;
11762    }
11763
11764    /**
11765     * @return {@link #hospitalization} (The start and optional end dates of when the patient was confined to a treatment center.)
11766     */
11767    public Period getHospitalization() { 
11768      if (this.hospitalization == null)
11769        if (Configuration.errorOnAutoCreate())
11770          throw new Error("Attempt to auto-create ExplanationOfBenefit.hospitalization");
11771        else if (Configuration.doAutoCreate())
11772          this.hospitalization = new Period(); // cc
11773      return this.hospitalization;
11774    }
11775
11776    public boolean hasHospitalization() { 
11777      return this.hospitalization != null && !this.hospitalization.isEmpty();
11778    }
11779
11780    /**
11781     * @param value {@link #hospitalization} (The start and optional end dates of when the patient was confined to a treatment center.)
11782     */
11783    public ExplanationOfBenefit setHospitalization(Period value)  { 
11784      this.hospitalization = value;
11785      return this;
11786    }
11787
11788    /**
11789     * @return {@link #item} (First tier of goods and services.)
11790     */
11791    public List<ItemComponent> getItem() { 
11792      if (this.item == null)
11793        this.item = new ArrayList<ItemComponent>();
11794      return this.item;
11795    }
11796
11797    /**
11798     * @return Returns a reference to <code>this</code> for easy method chaining
11799     */
11800    public ExplanationOfBenefit setItem(List<ItemComponent> theItem) { 
11801      this.item = theItem;
11802      return this;
11803    }
11804
11805    public boolean hasItem() { 
11806      if (this.item == null)
11807        return false;
11808      for (ItemComponent item : this.item)
11809        if (!item.isEmpty())
11810          return true;
11811      return false;
11812    }
11813
11814    public ItemComponent addItem() { //3
11815      ItemComponent t = new ItemComponent();
11816      if (this.item == null)
11817        this.item = new ArrayList<ItemComponent>();
11818      this.item.add(t);
11819      return t;
11820    }
11821
11822    public ExplanationOfBenefit addItem(ItemComponent t) { //3
11823      if (t == null)
11824        return this;
11825      if (this.item == null)
11826        this.item = new ArrayList<ItemComponent>();
11827      this.item.add(t);
11828      return this;
11829    }
11830
11831    /**
11832     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
11833     */
11834    public ItemComponent getItemFirstRep() { 
11835      if (getItem().isEmpty()) {
11836        addItem();
11837      }
11838      return getItem().get(0);
11839    }
11840
11841    /**
11842     * @return {@link #addItem} (The first tier service adjudications for payor added services.)
11843     */
11844    public List<AddedItemComponent> getAddItem() { 
11845      if (this.addItem == null)
11846        this.addItem = new ArrayList<AddedItemComponent>();
11847      return this.addItem;
11848    }
11849
11850    /**
11851     * @return Returns a reference to <code>this</code> for easy method chaining
11852     */
11853    public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) { 
11854      this.addItem = theAddItem;
11855      return this;
11856    }
11857
11858    public boolean hasAddItem() { 
11859      if (this.addItem == null)
11860        return false;
11861      for (AddedItemComponent item : this.addItem)
11862        if (!item.isEmpty())
11863          return true;
11864      return false;
11865    }
11866
11867    public AddedItemComponent addAddItem() { //3
11868      AddedItemComponent t = new AddedItemComponent();
11869      if (this.addItem == null)
11870        this.addItem = new ArrayList<AddedItemComponent>();
11871      this.addItem.add(t);
11872      return t;
11873    }
11874
11875    public ExplanationOfBenefit addAddItem(AddedItemComponent t) { //3
11876      if (t == null)
11877        return this;
11878      if (this.addItem == null)
11879        this.addItem = new ArrayList<AddedItemComponent>();
11880      this.addItem.add(t);
11881      return this;
11882    }
11883
11884    /**
11885     * @return The first repetition of repeating field {@link #addItem}, creating it if it does not already exist
11886     */
11887    public AddedItemComponent getAddItemFirstRep() { 
11888      if (getAddItem().isEmpty()) {
11889        addAddItem();
11890      }
11891      return getAddItem().get(0);
11892    }
11893
11894    /**
11895     * @return {@link #totalCost} (The total cost of the services reported.)
11896     */
11897    public Money getTotalCost() { 
11898      if (this.totalCost == null)
11899        if (Configuration.errorOnAutoCreate())
11900          throw new Error("Attempt to auto-create ExplanationOfBenefit.totalCost");
11901        else if (Configuration.doAutoCreate())
11902          this.totalCost = new Money(); // cc
11903      return this.totalCost;
11904    }
11905
11906    public boolean hasTotalCost() { 
11907      return this.totalCost != null && !this.totalCost.isEmpty();
11908    }
11909
11910    /**
11911     * @param value {@link #totalCost} (The total cost of the services reported.)
11912     */
11913    public ExplanationOfBenefit setTotalCost(Money value)  { 
11914      this.totalCost = value;
11915      return this;
11916    }
11917
11918    /**
11919     * @return {@link #unallocDeductable} (The amount of deductable applied which was not allocated to any particular service line.)
11920     */
11921    public Money getUnallocDeductable() { 
11922      if (this.unallocDeductable == null)
11923        if (Configuration.errorOnAutoCreate())
11924          throw new Error("Attempt to auto-create ExplanationOfBenefit.unallocDeductable");
11925        else if (Configuration.doAutoCreate())
11926          this.unallocDeductable = new Money(); // cc
11927      return this.unallocDeductable;
11928    }
11929
11930    public boolean hasUnallocDeductable() { 
11931      return this.unallocDeductable != null && !this.unallocDeductable.isEmpty();
11932    }
11933
11934    /**
11935     * @param value {@link #unallocDeductable} (The amount of deductable applied which was not allocated to any particular service line.)
11936     */
11937    public ExplanationOfBenefit setUnallocDeductable(Money value)  { 
11938      this.unallocDeductable = value;
11939      return this;
11940    }
11941
11942    /**
11943     * @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).)
11944     */
11945    public Money getTotalBenefit() { 
11946      if (this.totalBenefit == null)
11947        if (Configuration.errorOnAutoCreate())
11948          throw new Error("Attempt to auto-create ExplanationOfBenefit.totalBenefit");
11949        else if (Configuration.doAutoCreate())
11950          this.totalBenefit = new Money(); // cc
11951      return this.totalBenefit;
11952    }
11953
11954    public boolean hasTotalBenefit() { 
11955      return this.totalBenefit != null && !this.totalBenefit.isEmpty();
11956    }
11957
11958    /**
11959     * @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).)
11960     */
11961    public ExplanationOfBenefit setTotalBenefit(Money value)  { 
11962      this.totalBenefit = value;
11963      return this;
11964    }
11965
11966    /**
11967     * @return {@link #payment} (Payment details for the claim if the claim has been paid.)
11968     */
11969    public PaymentComponent getPayment() { 
11970      if (this.payment == null)
11971        if (Configuration.errorOnAutoCreate())
11972          throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
11973        else if (Configuration.doAutoCreate())
11974          this.payment = new PaymentComponent(); // cc
11975      return this.payment;
11976    }
11977
11978    public boolean hasPayment() { 
11979      return this.payment != null && !this.payment.isEmpty();
11980    }
11981
11982    /**
11983     * @param value {@link #payment} (Payment details for the claim if the claim has been paid.)
11984     */
11985    public ExplanationOfBenefit setPayment(PaymentComponent value)  { 
11986      this.payment = value;
11987      return this;
11988    }
11989
11990    /**
11991     * @return {@link #form} (The form to be used for printing the content.)
11992     */
11993    public CodeableConcept getForm() { 
11994      if (this.form == null)
11995        if (Configuration.errorOnAutoCreate())
11996          throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
11997        else if (Configuration.doAutoCreate())
11998          this.form = new CodeableConcept(); // cc
11999      return this.form;
12000    }
12001
12002    public boolean hasForm() { 
12003      return this.form != null && !this.form.isEmpty();
12004    }
12005
12006    /**
12007     * @param value {@link #form} (The form to be used for printing the content.)
12008     */
12009    public ExplanationOfBenefit setForm(CodeableConcept value)  { 
12010      this.form = value;
12011      return this;
12012    }
12013
12014    /**
12015     * @return {@link #processNote} (Note text.)
12016     */
12017    public List<NoteComponent> getProcessNote() { 
12018      if (this.processNote == null)
12019        this.processNote = new ArrayList<NoteComponent>();
12020      return this.processNote;
12021    }
12022
12023    /**
12024     * @return Returns a reference to <code>this</code> for easy method chaining
12025     */
12026    public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) { 
12027      this.processNote = theProcessNote;
12028      return this;
12029    }
12030
12031    public boolean hasProcessNote() { 
12032      if (this.processNote == null)
12033        return false;
12034      for (NoteComponent item : this.processNote)
12035        if (!item.isEmpty())
12036          return true;
12037      return false;
12038    }
12039
12040    public NoteComponent addProcessNote() { //3
12041      NoteComponent t = new NoteComponent();
12042      if (this.processNote == null)
12043        this.processNote = new ArrayList<NoteComponent>();
12044      this.processNote.add(t);
12045      return t;
12046    }
12047
12048    public ExplanationOfBenefit addProcessNote(NoteComponent t) { //3
12049      if (t == null)
12050        return this;
12051      if (this.processNote == null)
12052        this.processNote = new ArrayList<NoteComponent>();
12053      this.processNote.add(t);
12054      return this;
12055    }
12056
12057    /**
12058     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist
12059     */
12060    public NoteComponent getProcessNoteFirstRep() { 
12061      if (getProcessNote().isEmpty()) {
12062        addProcessNote();
12063      }
12064      return getProcessNote().get(0);
12065    }
12066
12067    /**
12068     * @return {@link #benefitBalance} (Balance by Benefit Category.)
12069     */
12070    public List<BenefitBalanceComponent> getBenefitBalance() { 
12071      if (this.benefitBalance == null)
12072        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
12073      return this.benefitBalance;
12074    }
12075
12076    /**
12077     * @return Returns a reference to <code>this</code> for easy method chaining
12078     */
12079    public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) { 
12080      this.benefitBalance = theBenefitBalance;
12081      return this;
12082    }
12083
12084    public boolean hasBenefitBalance() { 
12085      if (this.benefitBalance == null)
12086        return false;
12087      for (BenefitBalanceComponent item : this.benefitBalance)
12088        if (!item.isEmpty())
12089          return true;
12090      return false;
12091    }
12092
12093    public BenefitBalanceComponent addBenefitBalance() { //3
12094      BenefitBalanceComponent t = new BenefitBalanceComponent();
12095      if (this.benefitBalance == null)
12096        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
12097      this.benefitBalance.add(t);
12098      return t;
12099    }
12100
12101    public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { //3
12102      if (t == null)
12103        return this;
12104      if (this.benefitBalance == null)
12105        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
12106      this.benefitBalance.add(t);
12107      return this;
12108    }
12109
12110    /**
12111     * @return The first repetition of repeating field {@link #benefitBalance}, creating it if it does not already exist
12112     */
12113    public BenefitBalanceComponent getBenefitBalanceFirstRep() { 
12114      if (getBenefitBalance().isEmpty()) {
12115        addBenefitBalance();
12116      }
12117      return getBenefitBalance().get(0);
12118    }
12119
12120      protected void listChildren(List<Property> children) {
12121        super.listChildren(children);
12122        children.add(new Property("identifier", "Identifier", "The EOB Business Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
12123        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
12124        children.add(new Property("type", "CodeableConcept", "The category of claim, eg, oral, pharmacy, vision, insitutional, professional.", 0, 1, type));
12125        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));
12126        children.add(new Property("patient", "Reference(Patient)", "Patient Resource.", 0, 1, patient));
12127        children.add(new Property("billablePeriod", "Period", "The billable period for which charges are being submitted.", 0, 1, billablePeriod));
12128        children.add(new Property("created", "dateTime", "The date when the EOB was created.", 0, 1, created));
12129        children.add(new Property("enterer", "Reference(Practitioner)", "The person who created the explanation of benefit.", 0, 1, enterer));
12130        children.add(new Property("insurer", "Reference(Organization)", "The insurer which is responsible for the explanation of benefit.", 0, 1, insurer));
12131        children.add(new Property("provider", "Reference(Practitioner)", "The provider which is responsible for the claim.", 0, 1, provider));
12132        children.add(new Property("organization", "Reference(Organization)", "The provider which is responsible for the claim.", 0, 1, organization));
12133        children.add(new Property("referral", "Reference(ReferralRequest)", "The referral resource which lists the date, practitioner, reason and other supporting information.", 0, 1, referral));
12134        children.add(new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
12135        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));
12136        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));
12137        children.add(new Property("outcome", "CodeableConcept", "Processing outcome errror, partial or complete processing.", 0, 1, outcome));
12138        children.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition));
12139        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));
12140        children.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of Pharmacy or Vision products.", 0, 1, prescription));
12141        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));
12142        children.add(new Property("payee", "", "The party to be reimbursed for the services.", 0, 1, payee));
12143        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));
12144        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));
12145        children.add(new Property("diagnosis", "", "Ordered list of patient diagnosis for which care is sought.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
12146        children.add(new Property("procedure", "", "Ordered list of patient procedures performed to support the adjudication.", 0, java.lang.Integer.MAX_VALUE, procedure));
12147        children.add(new Property("precedence", "positiveInt", "Precedence (primary, secondary, etc.).", 0, 1, precedence));
12148        children.add(new Property("insurance", "", "Financial instrument by which payment information for health care.", 0, 1, insurance));
12149        children.add(new Property("accident", "", "An accident which resulted in the need for healthcare services.", 0, 1, accident));
12150        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));
12151        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));
12152        children.add(new Property("item", "", "First tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, item));
12153        children.add(new Property("addItem", "", "The first tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, addItem));
12154        children.add(new Property("totalCost", "Money", "The total cost of the services reported.", 0, 1, totalCost));
12155        children.add(new Property("unallocDeductable", "Money", "The amount of deductable applied which was not allocated to any particular service line.", 0, 1, unallocDeductable));
12156        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));
12157        children.add(new Property("payment", "", "Payment details for the claim if the claim has been paid.", 0, 1, payment));
12158        children.add(new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, 1, form));
12159        children.add(new Property("processNote", "", "Note text.", 0, java.lang.Integer.MAX_VALUE, processNote));
12160        children.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
12161      }
12162
12163      @Override
12164      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
12165        switch (_hash) {
12166        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The EOB Business Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier);
12167        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
12168        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The category of claim, eg, oral, pharmacy, vision, insitutional, professional.", 0, 1, type);
12169        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);
12170        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "Patient Resource.", 0, 1, patient);
12171        case -332066046: /*billablePeriod*/  return new Property("billablePeriod", "Period", "The billable period for which charges are being submitted.", 0, 1, billablePeriod);
12172        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date when the EOB was created.", 0, 1, created);
12173        case -1591951995: /*enterer*/  return new Property("enterer", "Reference(Practitioner)", "The person who created the explanation of benefit.", 0, 1, enterer);
12174        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The insurer which is responsible for the explanation of benefit.", 0, 1, insurer);
12175        case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner)", "The provider which is responsible for the claim.", 0, 1, provider);
12176        case 1178922291: /*organization*/  return new Property("organization", "Reference(Organization)", "The provider which is responsible for the claim.", 0, 1, organization);
12177        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);
12178        case 501116579: /*facility*/  return new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility);
12179        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);
12180        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);
12181        case -1106507950: /*outcome*/  return new Property("outcome", "CodeableConcept", "Processing outcome errror, partial or complete processing.", 0, 1, outcome);
12182        case 583380919: /*disposition*/  return new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition);
12183        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);
12184        case 460301338: /*prescription*/  return new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of Pharmacy or Vision products.", 0, 1, prescription);
12185        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);
12186        case 106443592: /*payee*/  return new Property("payee", "", "The party to be reimbursed for the services.", 0, 1, payee);
12187        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);
12188        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);
12189        case 1196993265: /*diagnosis*/  return new Property("diagnosis", "", "Ordered list of patient diagnosis for which care is sought.", 0, java.lang.Integer.MAX_VALUE, diagnosis);
12190        case -1095204141: /*procedure*/  return new Property("procedure", "", "Ordered list of patient procedures performed to support the adjudication.", 0, java.lang.Integer.MAX_VALUE, procedure);
12191        case 159695370: /*precedence*/  return new Property("precedence", "positiveInt", "Precedence (primary, secondary, etc.).", 0, 1, precedence);
12192        case 73049818: /*insurance*/  return new Property("insurance", "", "Financial instrument by which payment information for health care.", 0, 1, insurance);
12193        case -2143202801: /*accident*/  return new Property("accident", "", "An accident which resulted in the need for healthcare services.", 0, 1, accident);
12194        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);
12195        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);
12196        case 3242771: /*item*/  return new Property("item", "", "First tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, item);
12197        case -1148899500: /*addItem*/  return new Property("addItem", "", "The first tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, addItem);
12198        case -577782479: /*totalCost*/  return new Property("totalCost", "Money", "The total cost of the services reported.", 0, 1, totalCost);
12199        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);
12200        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);
12201        case -786681338: /*payment*/  return new Property("payment", "", "Payment details for the claim if the claim has been paid.", 0, 1, payment);
12202        case 3148996: /*form*/  return new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, 1, form);
12203        case 202339073: /*processNote*/  return new Property("processNote", "", "Note text.", 0, java.lang.Integer.MAX_VALUE, processNote);
12204        case 596003397: /*benefitBalance*/  return new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance);
12205        default: return super.getNamedProperty(_hash, _name, _checkValid);
12206        }
12207
12208      }
12209
12210      @Override
12211      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
12212        switch (hash) {
12213        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
12214        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ExplanationOfBenefitStatus>
12215        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
12216        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : this.subType.toArray(new Base[this.subType.size()]); // CodeableConcept
12217        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
12218        case -332066046: /*billablePeriod*/ return this.billablePeriod == null ? new Base[0] : new Base[] {this.billablePeriod}; // Period
12219        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
12220        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
12221        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
12222        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
12223        case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : new Base[] {this.organization}; // Reference
12224        case -722568291: /*referral*/ return this.referral == null ? new Base[0] : new Base[] {this.referral}; // Reference
12225        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
12226        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
12227        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Reference
12228        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // CodeableConcept
12229        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
12230        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
12231        case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Reference
12232        case -1814015861: /*originalPrescription*/ return this.originalPrescription == null ? new Base[0] : new Base[] {this.originalPrescription}; // Reference
12233        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // PayeeComponent
12234        case 1968600364: /*information*/ return this.information == null ? new Base[0] : this.information.toArray(new Base[this.information.size()]); // SupportingInformationComponent
12235        case -7323378: /*careTeam*/ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
12236        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
12237        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
12238        case 159695370: /*precedence*/ return this.precedence == null ? new Base[0] : new Base[] {this.precedence}; // PositiveIntType
12239        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : new Base[] {this.insurance}; // InsuranceComponent
12240        case -2143202801: /*accident*/ return this.accident == null ? new Base[0] : new Base[] {this.accident}; // AccidentComponent
12241        case 1051487345: /*employmentImpacted*/ return this.employmentImpacted == null ? new Base[0] : new Base[] {this.employmentImpacted}; // Period
12242        case 1057894634: /*hospitalization*/ return this.hospitalization == null ? new Base[0] : new Base[] {this.hospitalization}; // Period
12243        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
12244        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
12245        case -577782479: /*totalCost*/ return this.totalCost == null ? new Base[0] : new Base[] {this.totalCost}; // Money
12246        case 2096309753: /*unallocDeductable*/ return this.unallocDeductable == null ? new Base[0] : new Base[] {this.unallocDeductable}; // Money
12247        case 332332211: /*totalBenefit*/ return this.totalBenefit == null ? new Base[0] : new Base[] {this.totalBenefit}; // Money
12248        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // PaymentComponent
12249        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // CodeableConcept
12250        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
12251        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
12252        default: return super.getProperty(hash, name, checkValid);
12253        }
12254
12255      }
12256
12257      @Override
12258      public Base setProperty(int hash, String name, Base value) throws FHIRException {
12259        switch (hash) {
12260        case -1618432855: // identifier
12261          this.getIdentifier().add(castToIdentifier(value)); // Identifier
12262          return value;
12263        case -892481550: // status
12264          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
12265          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
12266          return value;
12267        case 3575610: // type
12268          this.type = castToCodeableConcept(value); // CodeableConcept
12269          return value;
12270        case -1868521062: // subType
12271          this.getSubType().add(castToCodeableConcept(value)); // CodeableConcept
12272          return value;
12273        case -791418107: // patient
12274          this.patient = castToReference(value); // Reference
12275          return value;
12276        case -332066046: // billablePeriod
12277          this.billablePeriod = castToPeriod(value); // Period
12278          return value;
12279        case 1028554472: // created
12280          this.created = castToDateTime(value); // DateTimeType
12281          return value;
12282        case -1591951995: // enterer
12283          this.enterer = castToReference(value); // Reference
12284          return value;
12285        case 1957615864: // insurer
12286          this.insurer = castToReference(value); // Reference
12287          return value;
12288        case -987494927: // provider
12289          this.provider = castToReference(value); // Reference
12290          return value;
12291        case 1178922291: // organization
12292          this.organization = castToReference(value); // Reference
12293          return value;
12294        case -722568291: // referral
12295          this.referral = castToReference(value); // Reference
12296          return value;
12297        case 501116579: // facility
12298          this.facility = castToReference(value); // Reference
12299          return value;
12300        case 94742588: // claim
12301          this.claim = castToReference(value); // Reference
12302          return value;
12303        case 689513629: // claimResponse
12304          this.claimResponse = castToReference(value); // Reference
12305          return value;
12306        case -1106507950: // outcome
12307          this.outcome = castToCodeableConcept(value); // CodeableConcept
12308          return value;
12309        case 583380919: // disposition
12310          this.disposition = castToString(value); // StringType
12311          return value;
12312        case 1090493483: // related
12313          this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
12314          return value;
12315        case 460301338: // prescription
12316          this.prescription = castToReference(value); // Reference
12317          return value;
12318        case -1814015861: // originalPrescription
12319          this.originalPrescription = castToReference(value); // Reference
12320          return value;
12321        case 106443592: // payee
12322          this.payee = (PayeeComponent) value; // PayeeComponent
12323          return value;
12324        case 1968600364: // information
12325          this.getInformation().add((SupportingInformationComponent) value); // SupportingInformationComponent
12326          return value;
12327        case -7323378: // careTeam
12328          this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
12329          return value;
12330        case 1196993265: // diagnosis
12331          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
12332          return value;
12333        case -1095204141: // procedure
12334          this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
12335          return value;
12336        case 159695370: // precedence
12337          this.precedence = castToPositiveInt(value); // PositiveIntType
12338          return value;
12339        case 73049818: // insurance
12340          this.insurance = (InsuranceComponent) value; // InsuranceComponent
12341          return value;
12342        case -2143202801: // accident
12343          this.accident = (AccidentComponent) value; // AccidentComponent
12344          return value;
12345        case 1051487345: // employmentImpacted
12346          this.employmentImpacted = castToPeriod(value); // Period
12347          return value;
12348        case 1057894634: // hospitalization
12349          this.hospitalization = castToPeriod(value); // Period
12350          return value;
12351        case 3242771: // item
12352          this.getItem().add((ItemComponent) value); // ItemComponent
12353          return value;
12354        case -1148899500: // addItem
12355          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
12356          return value;
12357        case -577782479: // totalCost
12358          this.totalCost = castToMoney(value); // Money
12359          return value;
12360        case 2096309753: // unallocDeductable
12361          this.unallocDeductable = castToMoney(value); // Money
12362          return value;
12363        case 332332211: // totalBenefit
12364          this.totalBenefit = castToMoney(value); // Money
12365          return value;
12366        case -786681338: // payment
12367          this.payment = (PaymentComponent) value; // PaymentComponent
12368          return value;
12369        case 3148996: // form
12370          this.form = castToCodeableConcept(value); // CodeableConcept
12371          return value;
12372        case 202339073: // processNote
12373          this.getProcessNote().add((NoteComponent) value); // NoteComponent
12374          return value;
12375        case 596003397: // benefitBalance
12376          this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
12377          return value;
12378        default: return super.setProperty(hash, name, value);
12379        }
12380
12381      }
12382
12383      @Override
12384      public Base setProperty(String name, Base value) throws FHIRException {
12385        if (name.equals("identifier")) {
12386          this.getIdentifier().add(castToIdentifier(value));
12387        } else if (name.equals("status")) {
12388          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
12389          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
12390        } else if (name.equals("type")) {
12391          this.type = castToCodeableConcept(value); // CodeableConcept
12392        } else if (name.equals("subType")) {
12393          this.getSubType().add(castToCodeableConcept(value));
12394        } else if (name.equals("patient")) {
12395          this.patient = castToReference(value); // Reference
12396        } else if (name.equals("billablePeriod")) {
12397          this.billablePeriod = castToPeriod(value); // Period
12398        } else if (name.equals("created")) {
12399          this.created = castToDateTime(value); // DateTimeType
12400        } else if (name.equals("enterer")) {
12401          this.enterer = castToReference(value); // Reference
12402        } else if (name.equals("insurer")) {
12403          this.insurer = castToReference(value); // Reference
12404        } else if (name.equals("provider")) {
12405          this.provider = castToReference(value); // Reference
12406        } else if (name.equals("organization")) {
12407          this.organization = castToReference(value); // Reference
12408        } else if (name.equals("referral")) {
12409          this.referral = castToReference(value); // Reference
12410        } else if (name.equals("facility")) {
12411          this.facility = castToReference(value); // Reference
12412        } else if (name.equals("claim")) {
12413          this.claim = castToReference(value); // Reference
12414        } else if (name.equals("claimResponse")) {
12415          this.claimResponse = castToReference(value); // Reference
12416        } else if (name.equals("outcome")) {
12417          this.outcome = castToCodeableConcept(value); // CodeableConcept
12418        } else if (name.equals("disposition")) {
12419          this.disposition = castToString(value); // StringType
12420        } else if (name.equals("related")) {
12421          this.getRelated().add((RelatedClaimComponent) value);
12422        } else if (name.equals("prescription")) {
12423          this.prescription = castToReference(value); // Reference
12424        } else if (name.equals("originalPrescription")) {
12425          this.originalPrescription = castToReference(value); // Reference
12426        } else if (name.equals("payee")) {
12427          this.payee = (PayeeComponent) value; // PayeeComponent
12428        } else if (name.equals("information")) {
12429          this.getInformation().add((SupportingInformationComponent) value);
12430        } else if (name.equals("careTeam")) {
12431          this.getCareTeam().add((CareTeamComponent) value);
12432        } else if (name.equals("diagnosis")) {
12433          this.getDiagnosis().add((DiagnosisComponent) value);
12434        } else if (name.equals("procedure")) {
12435          this.getProcedure().add((ProcedureComponent) value);
12436        } else if (name.equals("precedence")) {
12437          this.precedence = castToPositiveInt(value); // PositiveIntType
12438        } else if (name.equals("insurance")) {
12439          this.insurance = (InsuranceComponent) value; // InsuranceComponent
12440        } else if (name.equals("accident")) {
12441          this.accident = (AccidentComponent) value; // AccidentComponent
12442        } else if (name.equals("employmentImpacted")) {
12443          this.employmentImpacted = castToPeriod(value); // Period
12444        } else if (name.equals("hospitalization")) {
12445          this.hospitalization = castToPeriod(value); // Period
12446        } else if (name.equals("item")) {
12447          this.getItem().add((ItemComponent) value);
12448        } else if (name.equals("addItem")) {
12449          this.getAddItem().add((AddedItemComponent) value);
12450        } else if (name.equals("totalCost")) {
12451          this.totalCost = castToMoney(value); // Money
12452        } else if (name.equals("unallocDeductable")) {
12453          this.unallocDeductable = castToMoney(value); // Money
12454        } else if (name.equals("totalBenefit")) {
12455          this.totalBenefit = castToMoney(value); // Money
12456        } else if (name.equals("payment")) {
12457          this.payment = (PaymentComponent) value; // PaymentComponent
12458        } else if (name.equals("form")) {
12459          this.form = castToCodeableConcept(value); // CodeableConcept
12460        } else if (name.equals("processNote")) {
12461          this.getProcessNote().add((NoteComponent) value);
12462        } else if (name.equals("benefitBalance")) {
12463          this.getBenefitBalance().add((BenefitBalanceComponent) value);
12464        } else
12465          return super.setProperty(name, value);
12466        return value;
12467      }
12468
12469      @Override
12470      public Base makeProperty(int hash, String name) throws FHIRException {
12471        switch (hash) {
12472        case -1618432855:  return addIdentifier(); 
12473        case -892481550:  return getStatusElement();
12474        case 3575610:  return getType(); 
12475        case -1868521062:  return addSubType(); 
12476        case -791418107:  return getPatient(); 
12477        case -332066046:  return getBillablePeriod(); 
12478        case 1028554472:  return getCreatedElement();
12479        case -1591951995:  return getEnterer(); 
12480        case 1957615864:  return getInsurer(); 
12481        case -987494927:  return getProvider(); 
12482        case 1178922291:  return getOrganization(); 
12483        case -722568291:  return getReferral(); 
12484        case 501116579:  return getFacility(); 
12485        case 94742588:  return getClaim(); 
12486        case 689513629:  return getClaimResponse(); 
12487        case -1106507950:  return getOutcome(); 
12488        case 583380919:  return getDispositionElement();
12489        case 1090493483:  return addRelated(); 
12490        case 460301338:  return getPrescription(); 
12491        case -1814015861:  return getOriginalPrescription(); 
12492        case 106443592:  return getPayee(); 
12493        case 1968600364:  return addInformation(); 
12494        case -7323378:  return addCareTeam(); 
12495        case 1196993265:  return addDiagnosis(); 
12496        case -1095204141:  return addProcedure(); 
12497        case 159695370:  return getPrecedenceElement();
12498        case 73049818:  return getInsurance(); 
12499        case -2143202801:  return getAccident(); 
12500        case 1051487345:  return getEmploymentImpacted(); 
12501        case 1057894634:  return getHospitalization(); 
12502        case 3242771:  return addItem(); 
12503        case -1148899500:  return addAddItem(); 
12504        case -577782479:  return getTotalCost(); 
12505        case 2096309753:  return getUnallocDeductable(); 
12506        case 332332211:  return getTotalBenefit(); 
12507        case -786681338:  return getPayment(); 
12508        case 3148996:  return getForm(); 
12509        case 202339073:  return addProcessNote(); 
12510        case 596003397:  return addBenefitBalance(); 
12511        default: return super.makeProperty(hash, name);
12512        }
12513
12514      }
12515
12516      @Override
12517      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12518        switch (hash) {
12519        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
12520        case -892481550: /*status*/ return new String[] {"code"};
12521        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
12522        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
12523        case -791418107: /*patient*/ return new String[] {"Reference"};
12524        case -332066046: /*billablePeriod*/ return new String[] {"Period"};
12525        case 1028554472: /*created*/ return new String[] {"dateTime"};
12526        case -1591951995: /*enterer*/ return new String[] {"Reference"};
12527        case 1957615864: /*insurer*/ return new String[] {"Reference"};
12528        case -987494927: /*provider*/ return new String[] {"Reference"};
12529        case 1178922291: /*organization*/ return new String[] {"Reference"};
12530        case -722568291: /*referral*/ return new String[] {"Reference"};
12531        case 501116579: /*facility*/ return new String[] {"Reference"};
12532        case 94742588: /*claim*/ return new String[] {"Reference"};
12533        case 689513629: /*claimResponse*/ return new String[] {"Reference"};
12534        case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
12535        case 583380919: /*disposition*/ return new String[] {"string"};
12536        case 1090493483: /*related*/ return new String[] {};
12537        case 460301338: /*prescription*/ return new String[] {"Reference"};
12538        case -1814015861: /*originalPrescription*/ return new String[] {"Reference"};
12539        case 106443592: /*payee*/ return new String[] {};
12540        case 1968600364: /*information*/ return new String[] {};
12541        case -7323378: /*careTeam*/ return new String[] {};
12542        case 1196993265: /*diagnosis*/ return new String[] {};
12543        case -1095204141: /*procedure*/ return new String[] {};
12544        case 159695370: /*precedence*/ return new String[] {"positiveInt"};
12545        case 73049818: /*insurance*/ return new String[] {};
12546        case -2143202801: /*accident*/ return new String[] {};
12547        case 1051487345: /*employmentImpacted*/ return new String[] {"Period"};
12548        case 1057894634: /*hospitalization*/ return new String[] {"Period"};
12549        case 3242771: /*item*/ return new String[] {};
12550        case -1148899500: /*addItem*/ return new String[] {};
12551        case -577782479: /*totalCost*/ return new String[] {"Money"};
12552        case 2096309753: /*unallocDeductable*/ return new String[] {"Money"};
12553        case 332332211: /*totalBenefit*/ return new String[] {"Money"};
12554        case -786681338: /*payment*/ return new String[] {};
12555        case 3148996: /*form*/ return new String[] {"CodeableConcept"};
12556        case 202339073: /*processNote*/ return new String[] {};
12557        case 596003397: /*benefitBalance*/ return new String[] {};
12558        default: return super.getTypesForProperty(hash, name);
12559        }
12560
12561      }
12562
12563      @Override
12564      public Base addChild(String name) throws FHIRException {
12565        if (name.equals("identifier")) {
12566          return addIdentifier();
12567        }
12568        else if (name.equals("status")) {
12569          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.status");
12570        }
12571        else if (name.equals("type")) {
12572          this.type = new CodeableConcept();
12573          return this.type;
12574        }
12575        else if (name.equals("subType")) {
12576          return addSubType();
12577        }
12578        else if (name.equals("patient")) {
12579          this.patient = new Reference();
12580          return this.patient;
12581        }
12582        else if (name.equals("billablePeriod")) {
12583          this.billablePeriod = new Period();
12584          return this.billablePeriod;
12585        }
12586        else if (name.equals("created")) {
12587          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.created");
12588        }
12589        else if (name.equals("enterer")) {
12590          this.enterer = new Reference();
12591          return this.enterer;
12592        }
12593        else if (name.equals("insurer")) {
12594          this.insurer = new Reference();
12595          return this.insurer;
12596        }
12597        else if (name.equals("provider")) {
12598          this.provider = new Reference();
12599          return this.provider;
12600        }
12601        else if (name.equals("organization")) {
12602          this.organization = new Reference();
12603          return this.organization;
12604        }
12605        else if (name.equals("referral")) {
12606          this.referral = new Reference();
12607          return this.referral;
12608        }
12609        else if (name.equals("facility")) {
12610          this.facility = new Reference();
12611          return this.facility;
12612        }
12613        else if (name.equals("claim")) {
12614          this.claim = new Reference();
12615          return this.claim;
12616        }
12617        else if (name.equals("claimResponse")) {
12618          this.claimResponse = new Reference();
12619          return this.claimResponse;
12620        }
12621        else if (name.equals("outcome")) {
12622          this.outcome = new CodeableConcept();
12623          return this.outcome;
12624        }
12625        else if (name.equals("disposition")) {
12626          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.disposition");
12627        }
12628        else if (name.equals("related")) {
12629          return addRelated();
12630        }
12631        else if (name.equals("prescription")) {
12632          this.prescription = new Reference();
12633          return this.prescription;
12634        }
12635        else if (name.equals("originalPrescription")) {
12636          this.originalPrescription = new Reference();
12637          return this.originalPrescription;
12638        }
12639        else if (name.equals("payee")) {
12640          this.payee = new PayeeComponent();
12641          return this.payee;
12642        }
12643        else if (name.equals("information")) {
12644          return addInformation();
12645        }
12646        else if (name.equals("careTeam")) {
12647          return addCareTeam();
12648        }
12649        else if (name.equals("diagnosis")) {
12650          return addDiagnosis();
12651        }
12652        else if (name.equals("procedure")) {
12653          return addProcedure();
12654        }
12655        else if (name.equals("precedence")) {
12656          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.precedence");
12657        }
12658        else if (name.equals("insurance")) {
12659          this.insurance = new InsuranceComponent();
12660          return this.insurance;
12661        }
12662        else if (name.equals("accident")) {
12663          this.accident = new AccidentComponent();
12664          return this.accident;
12665        }
12666        else if (name.equals("employmentImpacted")) {
12667          this.employmentImpacted = new Period();
12668          return this.employmentImpacted;
12669        }
12670        else if (name.equals("hospitalization")) {
12671          this.hospitalization = new Period();
12672          return this.hospitalization;
12673        }
12674        else if (name.equals("item")) {
12675          return addItem();
12676        }
12677        else if (name.equals("addItem")) {
12678          return addAddItem();
12679        }
12680        else if (name.equals("totalCost")) {
12681          this.totalCost = new Money();
12682          return this.totalCost;
12683        }
12684        else if (name.equals("unallocDeductable")) {
12685          this.unallocDeductable = new Money();
12686          return this.unallocDeductable;
12687        }
12688        else if (name.equals("totalBenefit")) {
12689          this.totalBenefit = new Money();
12690          return this.totalBenefit;
12691        }
12692        else if (name.equals("payment")) {
12693          this.payment = new PaymentComponent();
12694          return this.payment;
12695        }
12696        else if (name.equals("form")) {
12697          this.form = new CodeableConcept();
12698          return this.form;
12699        }
12700        else if (name.equals("processNote")) {
12701          return addProcessNote();
12702        }
12703        else if (name.equals("benefitBalance")) {
12704          return addBenefitBalance();
12705        }
12706        else
12707          return super.addChild(name);
12708      }
12709
12710  public String fhirType() {
12711    return "ExplanationOfBenefit";
12712
12713  }
12714
12715      public ExplanationOfBenefit copy() {
12716        ExplanationOfBenefit dst = new ExplanationOfBenefit();
12717        copyValues(dst);
12718        if (identifier != null) {
12719          dst.identifier = new ArrayList<Identifier>();
12720          for (Identifier i : identifier)
12721            dst.identifier.add(i.copy());
12722        };
12723        dst.status = status == null ? null : status.copy();
12724        dst.type = type == null ? null : type.copy();
12725        if (subType != null) {
12726          dst.subType = new ArrayList<CodeableConcept>();
12727          for (CodeableConcept i : subType)
12728            dst.subType.add(i.copy());
12729        };
12730        dst.patient = patient == null ? null : patient.copy();
12731        dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
12732        dst.created = created == null ? null : created.copy();
12733        dst.enterer = enterer == null ? null : enterer.copy();
12734        dst.insurer = insurer == null ? null : insurer.copy();
12735        dst.provider = provider == null ? null : provider.copy();
12736        dst.organization = organization == null ? null : organization.copy();
12737        dst.referral = referral == null ? null : referral.copy();
12738        dst.facility = facility == null ? null : facility.copy();
12739        dst.claim = claim == null ? null : claim.copy();
12740        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
12741        dst.outcome = outcome == null ? null : outcome.copy();
12742        dst.disposition = disposition == null ? null : disposition.copy();
12743        if (related != null) {
12744          dst.related = new ArrayList<RelatedClaimComponent>();
12745          for (RelatedClaimComponent i : related)
12746            dst.related.add(i.copy());
12747        };
12748        dst.prescription = prescription == null ? null : prescription.copy();
12749        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
12750        dst.payee = payee == null ? null : payee.copy();
12751        if (information != null) {
12752          dst.information = new ArrayList<SupportingInformationComponent>();
12753          for (SupportingInformationComponent i : information)
12754            dst.information.add(i.copy());
12755        };
12756        if (careTeam != null) {
12757          dst.careTeam = new ArrayList<CareTeamComponent>();
12758          for (CareTeamComponent i : careTeam)
12759            dst.careTeam.add(i.copy());
12760        };
12761        if (diagnosis != null) {
12762          dst.diagnosis = new ArrayList<DiagnosisComponent>();
12763          for (DiagnosisComponent i : diagnosis)
12764            dst.diagnosis.add(i.copy());
12765        };
12766        if (procedure != null) {
12767          dst.procedure = new ArrayList<ProcedureComponent>();
12768          for (ProcedureComponent i : procedure)
12769            dst.procedure.add(i.copy());
12770        };
12771        dst.precedence = precedence == null ? null : precedence.copy();
12772        dst.insurance = insurance == null ? null : insurance.copy();
12773        dst.accident = accident == null ? null : accident.copy();
12774        dst.employmentImpacted = employmentImpacted == null ? null : employmentImpacted.copy();
12775        dst.hospitalization = hospitalization == null ? null : hospitalization.copy();
12776        if (item != null) {
12777          dst.item = new ArrayList<ItemComponent>();
12778          for (ItemComponent i : item)
12779            dst.item.add(i.copy());
12780        };
12781        if (addItem != null) {
12782          dst.addItem = new ArrayList<AddedItemComponent>();
12783          for (AddedItemComponent i : addItem)
12784            dst.addItem.add(i.copy());
12785        };
12786        dst.totalCost = totalCost == null ? null : totalCost.copy();
12787        dst.unallocDeductable = unallocDeductable == null ? null : unallocDeductable.copy();
12788        dst.totalBenefit = totalBenefit == null ? null : totalBenefit.copy();
12789        dst.payment = payment == null ? null : payment.copy();
12790        dst.form = form == null ? null : form.copy();
12791        if (processNote != null) {
12792          dst.processNote = new ArrayList<NoteComponent>();
12793          for (NoteComponent i : processNote)
12794            dst.processNote.add(i.copy());
12795        };
12796        if (benefitBalance != null) {
12797          dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
12798          for (BenefitBalanceComponent i : benefitBalance)
12799            dst.benefitBalance.add(i.copy());
12800        };
12801        return dst;
12802      }
12803
12804      protected ExplanationOfBenefit typedCopy() {
12805        return copy();
12806      }
12807
12808      @Override
12809      public boolean equalsDeep(Base other_) {
12810        if (!super.equalsDeep(other_))
12811          return false;
12812        if (!(other_ instanceof ExplanationOfBenefit))
12813          return false;
12814        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
12815        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
12816           && compareDeep(subType, o.subType, true) && compareDeep(patient, o.patient, true) && compareDeep(billablePeriod, o.billablePeriod, true)
12817           && compareDeep(created, o.created, true) && compareDeep(enterer, o.enterer, true) && compareDeep(insurer, o.insurer, true)
12818           && compareDeep(provider, o.provider, true) && compareDeep(organization, o.organization, true) && compareDeep(referral, o.referral, true)
12819           && compareDeep(facility, o.facility, true) && compareDeep(claim, o.claim, true) && compareDeep(claimResponse, o.claimResponse, true)
12820           && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true) && compareDeep(related, o.related, true)
12821           && compareDeep(prescription, o.prescription, true) && compareDeep(originalPrescription, o.originalPrescription, true)
12822           && compareDeep(payee, o.payee, true) && compareDeep(information, o.information, true) && compareDeep(careTeam, o.careTeam, true)
12823           && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true) && compareDeep(precedence, o.precedence, true)
12824           && compareDeep(insurance, o.insurance, true) && compareDeep(accident, o.accident, true) && compareDeep(employmentImpacted, o.employmentImpacted, true)
12825           && compareDeep(hospitalization, o.hospitalization, true) && compareDeep(item, o.item, true) && compareDeep(addItem, o.addItem, true)
12826           && compareDeep(totalCost, o.totalCost, true) && compareDeep(unallocDeductable, o.unallocDeductable, true)
12827           && compareDeep(totalBenefit, o.totalBenefit, true) && compareDeep(payment, o.payment, true) && compareDeep(form, o.form, true)
12828           && compareDeep(processNote, o.processNote, true) && compareDeep(benefitBalance, o.benefitBalance, true)
12829          ;
12830      }
12831
12832      @Override
12833      public boolean equalsShallow(Base other_) {
12834        if (!super.equalsShallow(other_))
12835          return false;
12836        if (!(other_ instanceof ExplanationOfBenefit))
12837          return false;
12838        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
12839        return compareValues(status, o.status, true) && compareValues(created, o.created, true) && compareValues(disposition, o.disposition, true)
12840           && compareValues(precedence, o.precedence, true);
12841      }
12842
12843      public boolean isEmpty() {
12844        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
12845          , subType, patient, billablePeriod, created, enterer, insurer, provider, organization
12846          , referral, facility, claim, claimResponse, outcome, disposition, related, prescription
12847          , originalPrescription, payee, information, careTeam, diagnosis, procedure, precedence
12848          , insurance, accident, employmentImpacted, hospitalization, item, addItem, totalCost
12849          , unallocDeductable, totalBenefit, payment, form, processNote, benefitBalance);
12850      }
12851
12852  @Override
12853  public ResourceType getResourceType() {
12854    return ResourceType.ExplanationOfBenefit;
12855   }
12856
12857 /**
12858   * Search parameter: <b>coverage</b>
12859   * <p>
12860   * Description: <b>The plan under which the claim was adjudicated</b><br>
12861   * Type: <b>reference</b><br>
12862   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
12863   * </p>
12864   */
12865  @SearchParamDefinition(name="coverage", path="ExplanationOfBenefit.insurance.coverage", description="The plan under which the claim was adjudicated", type="reference", target={Coverage.class } )
12866  public static final String SP_COVERAGE = "coverage";
12867 /**
12868   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
12869   * <p>
12870   * Description: <b>The plan under which the claim was adjudicated</b><br>
12871   * Type: <b>reference</b><br>
12872   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
12873   * </p>
12874   */
12875  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COVERAGE);
12876
12877/**
12878   * Constant for fluent queries to be used to add include statements. Specifies
12879   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
12880   */
12881  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:coverage").toLocked();
12882
12883 /**
12884   * Search parameter: <b>care-team</b>
12885   * <p>
12886   * Description: <b>Member of the CareTeam</b><br>
12887   * Type: <b>reference</b><br>
12888   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
12889   * </p>
12890   */
12891  @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 } )
12892  public static final String SP_CARE_TEAM = "care-team";
12893 /**
12894   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
12895   * <p>
12896   * Description: <b>Member of the CareTeam</b><br>
12897   * Type: <b>reference</b><br>
12898   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
12899   * </p>
12900   */
12901  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_TEAM);
12902
12903/**
12904   * Constant for fluent queries to be used to add include statements. Specifies
12905   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
12906   */
12907  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:care-team").toLocked();
12908
12909 /**
12910   * Search parameter: <b>identifier</b>
12911   * <p>
12912   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
12913   * Type: <b>token</b><br>
12914   * Path: <b>ExplanationOfBenefit.identifier</b><br>
12915   * </p>
12916   */
12917  @SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
12918  public static final String SP_IDENTIFIER = "identifier";
12919 /**
12920   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
12921   * <p>
12922   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
12923   * Type: <b>token</b><br>
12924   * Path: <b>ExplanationOfBenefit.identifier</b><br>
12925   * </p>
12926   */
12927  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
12928
12929 /**
12930   * Search parameter: <b>created</b>
12931   * <p>
12932   * Description: <b>The creation date for the EOB</b><br>
12933   * Type: <b>date</b><br>
12934   * Path: <b>ExplanationOfBenefit.created</b><br>
12935   * </p>
12936   */
12937  @SearchParamDefinition(name="created", path="ExplanationOfBenefit.created", description="The creation date for the EOB", type="date" )
12938  public static final String SP_CREATED = "created";
12939 /**
12940   * <b>Fluent Client</b> search parameter constant for <b>created</b>
12941   * <p>
12942   * Description: <b>The creation date for the EOB</b><br>
12943   * Type: <b>date</b><br>
12944   * Path: <b>ExplanationOfBenefit.created</b><br>
12945   * </p>
12946   */
12947  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
12948
12949 /**
12950   * Search parameter: <b>encounter</b>
12951   * <p>
12952   * Description: <b>Encounters associated with a billed line item</b><br>
12953   * Type: <b>reference</b><br>
12954   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
12955   * </p>
12956   */
12957  @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 } )
12958  public static final String SP_ENCOUNTER = "encounter";
12959 /**
12960   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
12961   * <p>
12962   * Description: <b>Encounters associated with a billed line item</b><br>
12963   * Type: <b>reference</b><br>
12964   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
12965   * </p>
12966   */
12967  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
12968
12969/**
12970   * Constant for fluent queries to be used to add include statements. Specifies
12971   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
12972   */
12973  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:encounter").toLocked();
12974
12975 /**
12976   * Search parameter: <b>payee</b>
12977   * <p>
12978   * Description: <b>The party receiving any payment for the Claim</b><br>
12979   * Type: <b>reference</b><br>
12980   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
12981   * </p>
12982   */
12983  @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 } )
12984  public static final String SP_PAYEE = "payee";
12985 /**
12986   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
12987   * <p>
12988   * Description: <b>The party receiving any payment for the Claim</b><br>
12989   * Type: <b>reference</b><br>
12990   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
12991   * </p>
12992   */
12993  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PAYEE);
12994
12995/**
12996   * Constant for fluent queries to be used to add include statements. Specifies
12997   * the path value of "<b>ExplanationOfBenefit:payee</b>".
12998   */
12999  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:payee").toLocked();
13000
13001 /**
13002   * Search parameter: <b>disposition</b>
13003   * <p>
13004   * Description: <b>The contents of the disposition message</b><br>
13005   * Type: <b>string</b><br>
13006   * Path: <b>ExplanationOfBenefit.disposition</b><br>
13007   * </p>
13008   */
13009  @SearchParamDefinition(name="disposition", path="ExplanationOfBenefit.disposition", description="The contents of the disposition message", type="string" )
13010  public static final String SP_DISPOSITION = "disposition";
13011 /**
13012   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
13013   * <p>
13014   * Description: <b>The contents of the disposition message</b><br>
13015   * Type: <b>string</b><br>
13016   * Path: <b>ExplanationOfBenefit.disposition</b><br>
13017   * </p>
13018   */
13019  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
13020
13021 /**
13022   * Search parameter: <b>provider</b>
13023   * <p>
13024   * Description: <b>The reference to the provider</b><br>
13025   * Type: <b>reference</b><br>
13026   * Path: <b>ExplanationOfBenefit.provider</b><br>
13027   * </p>
13028   */
13029  @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 } )
13030  public static final String SP_PROVIDER = "provider";
13031 /**
13032   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
13033   * <p>
13034   * Description: <b>The reference to the provider</b><br>
13035   * Type: <b>reference</b><br>
13036   * Path: <b>ExplanationOfBenefit.provider</b><br>
13037   * </p>
13038   */
13039  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
13040
13041/**
13042   * Constant for fluent queries to be used to add include statements. Specifies
13043   * the path value of "<b>ExplanationOfBenefit:provider</b>".
13044   */
13045  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:provider").toLocked();
13046
13047 /**
13048   * Search parameter: <b>patient</b>
13049   * <p>
13050   * Description: <b>The reference to the patient</b><br>
13051   * Type: <b>reference</b><br>
13052   * Path: <b>ExplanationOfBenefit.patient</b><br>
13053   * </p>
13054   */
13055  @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 } )
13056  public static final String SP_PATIENT = "patient";
13057 /**
13058   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
13059   * <p>
13060   * Description: <b>The reference to the patient</b><br>
13061   * Type: <b>reference</b><br>
13062   * Path: <b>ExplanationOfBenefit.patient</b><br>
13063   * </p>
13064   */
13065  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
13066
13067/**
13068   * Constant for fluent queries to be used to add include statements. Specifies
13069   * the path value of "<b>ExplanationOfBenefit:patient</b>".
13070   */
13071  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:patient").toLocked();
13072
13073 /**
13074   * Search parameter: <b>organization</b>
13075   * <p>
13076   * Description: <b>The reference to the providing organization</b><br>
13077   * Type: <b>reference</b><br>
13078   * Path: <b>ExplanationOfBenefit.organization</b><br>
13079   * </p>
13080   */
13081  @SearchParamDefinition(name="organization", path="ExplanationOfBenefit.organization", description="The reference to the providing organization", type="reference", target={Organization.class } )
13082  public static final String SP_ORGANIZATION = "organization";
13083 /**
13084   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
13085   * <p>
13086   * Description: <b>The reference to the providing organization</b><br>
13087   * Type: <b>reference</b><br>
13088   * Path: <b>ExplanationOfBenefit.organization</b><br>
13089   * </p>
13090   */
13091  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
13092
13093/**
13094   * Constant for fluent queries to be used to add include statements. Specifies
13095   * the path value of "<b>ExplanationOfBenefit:organization</b>".
13096   */
13097  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:organization").toLocked();
13098
13099 /**
13100   * Search parameter: <b>claim</b>
13101   * <p>
13102   * Description: <b>The reference to the claim</b><br>
13103   * Type: <b>reference</b><br>
13104   * Path: <b>ExplanationOfBenefit.claim</b><br>
13105   * </p>
13106   */
13107  @SearchParamDefinition(name="claim", path="ExplanationOfBenefit.claim", description="The reference to the claim", type="reference", target={Claim.class } )
13108  public static final String SP_CLAIM = "claim";
13109 /**
13110   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
13111   * <p>
13112   * Description: <b>The reference to the claim</b><br>
13113   * Type: <b>reference</b><br>
13114   * Path: <b>ExplanationOfBenefit.claim</b><br>
13115   * </p>
13116   */
13117  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CLAIM);
13118
13119/**
13120   * Constant for fluent queries to be used to add include statements. Specifies
13121   * the path value of "<b>ExplanationOfBenefit:claim</b>".
13122   */
13123  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:claim").toLocked();
13124
13125 /**
13126   * Search parameter: <b>enterer</b>
13127   * <p>
13128   * Description: <b>The party responsible for the entry of the Claim</b><br>
13129   * Type: <b>reference</b><br>
13130   * Path: <b>ExplanationOfBenefit.enterer</b><br>
13131   * </p>
13132   */
13133  @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 } )
13134  public static final String SP_ENTERER = "enterer";
13135 /**
13136   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
13137   * <p>
13138   * Description: <b>The party responsible for the entry of the Claim</b><br>
13139   * Type: <b>reference</b><br>
13140   * Path: <b>ExplanationOfBenefit.enterer</b><br>
13141   * </p>
13142   */
13143  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
13144
13145/**
13146   * Constant for fluent queries to be used to add include statements. Specifies
13147   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
13148   */
13149  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:enterer").toLocked();
13150
13151 /**
13152   * Search parameter: <b>facility</b>
13153   * <p>
13154   * Description: <b>Facility responsible for the goods and services</b><br>
13155   * Type: <b>reference</b><br>
13156   * Path: <b>ExplanationOfBenefit.facility</b><br>
13157   * </p>
13158   */
13159  @SearchParamDefinition(name="facility", path="ExplanationOfBenefit.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class } )
13160  public static final String SP_FACILITY = "facility";
13161 /**
13162   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
13163   * <p>
13164   * Description: <b>Facility responsible for the goods and services</b><br>
13165   * Type: <b>reference</b><br>
13166   * Path: <b>ExplanationOfBenefit.facility</b><br>
13167   * </p>
13168   */
13169  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
13170
13171/**
13172   * Constant for fluent queries to be used to add include statements. Specifies
13173   * the path value of "<b>ExplanationOfBenefit:facility</b>".
13174   */
13175  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:facility").toLocked();
13176
13177
13178}
13179