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 Mon, Apr 17, 2017 17:38-0400 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;
047/**
048 * 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.
049 */
050@ResourceDef(name="ExplanationOfBenefit", profile="http://hl7.org/fhir/Profile/ExplanationOfBenefit")
051public class ExplanationOfBenefit extends DomainResource {
052
053    public enum ExplanationOfBenefitStatus {
054        /**
055         * The resource instance is currently in-force.
056         */
057        ACTIVE, 
058        /**
059         * The resource instance is withdrawn, rescinded or reversed.
060         */
061        CANCELLED, 
062        /**
063         * A new resource instance the contents of which is not complete.
064         */
065        DRAFT, 
066        /**
067         * The resource instance was entered in error.
068         */
069        ENTEREDINERROR, 
070        /**
071         * added to help the parsers with the generic types
072         */
073        NULL;
074        public static ExplanationOfBenefitStatus fromCode(String codeString) throws FHIRException {
075            if (codeString == null || "".equals(codeString))
076                return null;
077        if ("active".equals(codeString))
078          return ACTIVE;
079        if ("cancelled".equals(codeString))
080          return CANCELLED;
081        if ("draft".equals(codeString))
082          return DRAFT;
083        if ("entered-in-error".equals(codeString))
084          return ENTEREDINERROR;
085        if (Configuration.isAcceptInvalidEnums())
086          return null;
087        else
088          throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
089        }
090        public String toCode() {
091          switch (this) {
092            case ACTIVE: return "active";
093            case CANCELLED: return "cancelled";
094            case DRAFT: return "draft";
095            case ENTEREDINERROR: return "entered-in-error";
096            default: return "?";
097          }
098        }
099        public String getSystem() {
100          switch (this) {
101            case ACTIVE: return "http://hl7.org/fhir/explanationofbenefit-status";
102            case CANCELLED: return "http://hl7.org/fhir/explanationofbenefit-status";
103            case DRAFT: return "http://hl7.org/fhir/explanationofbenefit-status";
104            case ENTEREDINERROR: return "http://hl7.org/fhir/explanationofbenefit-status";
105            default: return "?";
106          }
107        }
108        public String getDefinition() {
109          switch (this) {
110            case ACTIVE: return "The resource instance is currently in-force.";
111            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
112            case DRAFT: return "A new resource instance the contents of which is not complete.";
113            case ENTEREDINERROR: return "The resource instance was entered in error.";
114            default: return "?";
115          }
116        }
117        public String getDisplay() {
118          switch (this) {
119            case ACTIVE: return "Active";
120            case CANCELLED: return "Cancelled";
121            case DRAFT: return "Draft";
122            case ENTEREDINERROR: return "Entered In Error";
123            default: return "?";
124          }
125        }
126    }
127
128  public static class ExplanationOfBenefitStatusEnumFactory implements EnumFactory<ExplanationOfBenefitStatus> {
129    public ExplanationOfBenefitStatus fromCode(String codeString) throws IllegalArgumentException {
130      if (codeString == null || "".equals(codeString))
131            if (codeString == null || "".equals(codeString))
132                return null;
133        if ("active".equals(codeString))
134          return ExplanationOfBenefitStatus.ACTIVE;
135        if ("cancelled".equals(codeString))
136          return ExplanationOfBenefitStatus.CANCELLED;
137        if ("draft".equals(codeString))
138          return ExplanationOfBenefitStatus.DRAFT;
139        if ("entered-in-error".equals(codeString))
140          return ExplanationOfBenefitStatus.ENTEREDINERROR;
141        throw new IllegalArgumentException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
142        }
143        public Enumeration<ExplanationOfBenefitStatus> fromType(Base code) throws FHIRException {
144          if (code == null)
145            return null;
146          if (code.isEmpty())
147            return new Enumeration<ExplanationOfBenefitStatus>(this);
148          String codeString = ((PrimitiveType) code).asStringValue();
149          if (codeString == null || "".equals(codeString))
150            return null;
151        if ("active".equals(codeString))
152          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ACTIVE);
153        if ("cancelled".equals(codeString))
154          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.CANCELLED);
155        if ("draft".equals(codeString))
156          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.DRAFT);
157        if ("entered-in-error".equals(codeString))
158          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ENTEREDINERROR);
159        throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
160        }
161    public String toCode(ExplanationOfBenefitStatus code) {
162      if (code == ExplanationOfBenefitStatus.ACTIVE)
163        return "active";
164      if (code == ExplanationOfBenefitStatus.CANCELLED)
165        return "cancelled";
166      if (code == ExplanationOfBenefitStatus.DRAFT)
167        return "draft";
168      if (code == ExplanationOfBenefitStatus.ENTEREDINERROR)
169        return "entered-in-error";
170      return "?";
171      }
172    public String toSystem(ExplanationOfBenefitStatus code) {
173      return code.getSystem();
174      }
175    }
176
177    @Block()
178    public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
179        /**
180         * Other claims which are related to this claim such as prior claim versions or for related services.
181         */
182        @Child(name = "claim", type = {Claim.class}, order=1, min=0, max=1, modifier=false, summary=false)
183        @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." )
184        protected Reference claim;
185
186        /**
187         * 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.)
188         */
189        protected Claim claimTarget;
190
191        /**
192         * For example prior or umbrella.
193         */
194        @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
195        @Description(shortDefinition="How the reference claim is related", formalDefinition="For example prior or umbrella." )
196        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-claim-relationship")
197        protected CodeableConcept relationship;
198
199        /**
200         * An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .
201         */
202        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=false)
203        @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 # ." )
204        protected Identifier reference;
205
206        private static final long serialVersionUID = -379338905L;
207
208    /**
209     * Constructor
210     */
211      public RelatedClaimComponent() {
212        super();
213      }
214
215        /**
216         * @return {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
217         */
218        public Reference getClaim() { 
219          if (this.claim == null)
220            if (Configuration.errorOnAutoCreate())
221              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
222            else if (Configuration.doAutoCreate())
223              this.claim = new Reference(); // cc
224          return this.claim;
225        }
226
227        public boolean hasClaim() { 
228          return this.claim != null && !this.claim.isEmpty();
229        }
230
231        /**
232         * @param value {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
233         */
234        public RelatedClaimComponent setClaim(Reference value) { 
235          this.claim = value;
236          return this;
237        }
238
239        /**
240         * @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.)
241         */
242        public Claim getClaimTarget() { 
243          if (this.claimTarget == null)
244            if (Configuration.errorOnAutoCreate())
245              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
246            else if (Configuration.doAutoCreate())
247              this.claimTarget = new Claim(); // aa
248          return this.claimTarget;
249        }
250
251        /**
252         * @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.)
253         */
254        public RelatedClaimComponent setClaimTarget(Claim value) { 
255          this.claimTarget = value;
256          return this;
257        }
258
259        /**
260         * @return {@link #relationship} (For example prior or umbrella.)
261         */
262        public CodeableConcept getRelationship() { 
263          if (this.relationship == null)
264            if (Configuration.errorOnAutoCreate())
265              throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
266            else if (Configuration.doAutoCreate())
267              this.relationship = new CodeableConcept(); // cc
268          return this.relationship;
269        }
270
271        public boolean hasRelationship() { 
272          return this.relationship != null && !this.relationship.isEmpty();
273        }
274
275        /**
276         * @param value {@link #relationship} (For example prior or umbrella.)
277         */
278        public RelatedClaimComponent setRelationship(CodeableConcept value) { 
279          this.relationship = value;
280          return this;
281        }
282
283        /**
284         * @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 # .)
285         */
286        public Identifier getReference() { 
287          if (this.reference == null)
288            if (Configuration.errorOnAutoCreate())
289              throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
290            else if (Configuration.doAutoCreate())
291              this.reference = new Identifier(); // cc
292          return this.reference;
293        }
294
295        public boolean hasReference() { 
296          return this.reference != null && !this.reference.isEmpty();
297        }
298
299        /**
300         * @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 # .)
301         */
302        public RelatedClaimComponent setReference(Identifier value) { 
303          this.reference = value;
304          return this;
305        }
306
307        protected void listChildren(List<Property> childrenList) {
308          super.listChildren(childrenList);
309          childrenList.add(new Property("claim", "Reference(Claim)", "Other claims which are related to this claim such as prior claim versions or for related services.", 0, java.lang.Integer.MAX_VALUE, claim));
310          childrenList.add(new Property("relationship", "CodeableConcept", "For example prior or umbrella.", 0, java.lang.Integer.MAX_VALUE, relationship));
311          childrenList.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, java.lang.Integer.MAX_VALUE, reference));
312        }
313
314      @Override
315      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
316        switch (hash) {
317        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
318        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
319        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
320        default: return super.getProperty(hash, name, checkValid);
321        }
322
323      }
324
325      @Override
326      public Base setProperty(int hash, String name, Base value) throws FHIRException {
327        switch (hash) {
328        case 94742588: // claim
329          this.claim = castToReference(value); // Reference
330          return value;
331        case -261851592: // relationship
332          this.relationship = castToCodeableConcept(value); // CodeableConcept
333          return value;
334        case -925155509: // reference
335          this.reference = castToIdentifier(value); // Identifier
336          return value;
337        default: return super.setProperty(hash, name, value);
338        }
339
340      }
341
342      @Override
343      public Base setProperty(String name, Base value) throws FHIRException {
344        if (name.equals("claim")) {
345          this.claim = castToReference(value); // Reference
346        } else if (name.equals("relationship")) {
347          this.relationship = castToCodeableConcept(value); // CodeableConcept
348        } else if (name.equals("reference")) {
349          this.reference = castToIdentifier(value); // Identifier
350        } else
351          return super.setProperty(name, value);
352        return value;
353      }
354
355      @Override
356      public Base makeProperty(int hash, String name) throws FHIRException {
357        switch (hash) {
358        case 94742588:  return getClaim(); 
359        case -261851592:  return getRelationship(); 
360        case -925155509:  return getReference(); 
361        default: return super.makeProperty(hash, name);
362        }
363
364      }
365
366      @Override
367      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
368        switch (hash) {
369        case 94742588: /*claim*/ return new String[] {"Reference"};
370        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
371        case -925155509: /*reference*/ return new String[] {"Identifier"};
372        default: return super.getTypesForProperty(hash, name);
373        }
374
375      }
376
377      @Override
378      public Base addChild(String name) throws FHIRException {
379        if (name.equals("claim")) {
380          this.claim = new Reference();
381          return this.claim;
382        }
383        else if (name.equals("relationship")) {
384          this.relationship = new CodeableConcept();
385          return this.relationship;
386        }
387        else if (name.equals("reference")) {
388          this.reference = new Identifier();
389          return this.reference;
390        }
391        else
392          return super.addChild(name);
393      }
394
395      public RelatedClaimComponent copy() {
396        RelatedClaimComponent dst = new RelatedClaimComponent();
397        copyValues(dst);
398        dst.claim = claim == null ? null : claim.copy();
399        dst.relationship = relationship == null ? null : relationship.copy();
400        dst.reference = reference == null ? null : reference.copy();
401        return dst;
402      }
403
404      @Override
405      public boolean equalsDeep(Base other) {
406        if (!super.equalsDeep(other))
407          return false;
408        if (!(other instanceof RelatedClaimComponent))
409          return false;
410        RelatedClaimComponent o = (RelatedClaimComponent) other;
411        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
412          ;
413      }
414
415      @Override
416      public boolean equalsShallow(Base other) {
417        if (!super.equalsShallow(other))
418          return false;
419        if (!(other instanceof RelatedClaimComponent))
420          return false;
421        RelatedClaimComponent o = (RelatedClaimComponent) other;
422        return true;
423      }
424
425      public boolean isEmpty() {
426        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference
427          );
428      }
429
430  public String fhirType() {
431    return "ExplanationOfBenefit.related";
432
433  }
434
435  }
436
437    @Block()
438    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
439        /**
440         * Type of Party to be reimbursed: Subscriber, provider, other.
441         */
442        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
443        @Description(shortDefinition="Type of party: Subscriber, Provider, other", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
444        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payeetype")
445        protected CodeableConcept type;
446
447        /**
448         * organization | patient | practitioner | relatedperson.
449         */
450        @Child(name = "resourceType", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
451        @Description(shortDefinition="organization | patient | practitioner | relatedperson", formalDefinition="organization | patient | practitioner | relatedperson." )
452        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-type-link")
453        protected CodeableConcept resourceType;
454
455        /**
456         * Party to be reimbursed: Subscriber, provider, other.
457         */
458        @Child(name = "party", type = {Practitioner.class, Organization.class, Patient.class, RelatedPerson.class}, order=3, min=0, max=1, modifier=false, summary=false)
459        @Description(shortDefinition="Party to receive the payable", formalDefinition="Party to be reimbursed: Subscriber, provider, other." )
460        protected Reference party;
461
462        /**
463         * The actual object that is the target of the reference (Party to be reimbursed: Subscriber, provider, other.)
464         */
465        protected Resource partyTarget;
466
467        private static final long serialVersionUID = 1146157718L;
468
469    /**
470     * Constructor
471     */
472      public PayeeComponent() {
473        super();
474      }
475
476        /**
477         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
478         */
479        public CodeableConcept getType() { 
480          if (this.type == null)
481            if (Configuration.errorOnAutoCreate())
482              throw new Error("Attempt to auto-create PayeeComponent.type");
483            else if (Configuration.doAutoCreate())
484              this.type = new CodeableConcept(); // cc
485          return this.type;
486        }
487
488        public boolean hasType() { 
489          return this.type != null && !this.type.isEmpty();
490        }
491
492        /**
493         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
494         */
495        public PayeeComponent setType(CodeableConcept value) { 
496          this.type = value;
497          return this;
498        }
499
500        /**
501         * @return {@link #resourceType} (organization | patient | practitioner | relatedperson.)
502         */
503        public CodeableConcept getResourceType() { 
504          if (this.resourceType == null)
505            if (Configuration.errorOnAutoCreate())
506              throw new Error("Attempt to auto-create PayeeComponent.resourceType");
507            else if (Configuration.doAutoCreate())
508              this.resourceType = new CodeableConcept(); // cc
509          return this.resourceType;
510        }
511
512        public boolean hasResourceType() { 
513          return this.resourceType != null && !this.resourceType.isEmpty();
514        }
515
516        /**
517         * @param value {@link #resourceType} (organization | patient | practitioner | relatedperson.)
518         */
519        public PayeeComponent setResourceType(CodeableConcept value) { 
520          this.resourceType = value;
521          return this;
522        }
523
524        /**
525         * @return {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
526         */
527        public Reference getParty() { 
528          if (this.party == null)
529            if (Configuration.errorOnAutoCreate())
530              throw new Error("Attempt to auto-create PayeeComponent.party");
531            else if (Configuration.doAutoCreate())
532              this.party = new Reference(); // cc
533          return this.party;
534        }
535
536        public boolean hasParty() { 
537          return this.party != null && !this.party.isEmpty();
538        }
539
540        /**
541         * @param value {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
542         */
543        public PayeeComponent setParty(Reference value) { 
544          this.party = value;
545          return this;
546        }
547
548        /**
549         * @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.)
550         */
551        public Resource getPartyTarget() { 
552          return this.partyTarget;
553        }
554
555        /**
556         * @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.)
557         */
558        public PayeeComponent setPartyTarget(Resource value) { 
559          this.partyTarget = value;
560          return this;
561        }
562
563        protected void listChildren(List<Property> childrenList) {
564          super.listChildren(childrenList);
565          childrenList.add(new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, java.lang.Integer.MAX_VALUE, type));
566          childrenList.add(new Property("resourceType", "CodeableConcept", "organization | patient | practitioner | relatedperson.", 0, java.lang.Integer.MAX_VALUE, resourceType));
567          childrenList.add(new Property("party", "Reference(Practitioner|Organization|Patient|RelatedPerson)", "Party to be reimbursed: Subscriber, provider, other.", 0, java.lang.Integer.MAX_VALUE, party));
568        }
569
570      @Override
571      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
572        switch (hash) {
573        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
574        case -384364440: /*resourceType*/ return this.resourceType == null ? new Base[0] : new Base[] {this.resourceType}; // CodeableConcept
575        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
576        default: return super.getProperty(hash, name, checkValid);
577        }
578
579      }
580
581      @Override
582      public Base setProperty(int hash, String name, Base value) throws FHIRException {
583        switch (hash) {
584        case 3575610: // type
585          this.type = castToCodeableConcept(value); // CodeableConcept
586          return value;
587        case -384364440: // resourceType
588          this.resourceType = castToCodeableConcept(value); // CodeableConcept
589          return value;
590        case 106437350: // party
591          this.party = castToReference(value); // Reference
592          return value;
593        default: return super.setProperty(hash, name, value);
594        }
595
596      }
597
598      @Override
599      public Base setProperty(String name, Base value) throws FHIRException {
600        if (name.equals("type")) {
601          this.type = castToCodeableConcept(value); // CodeableConcept
602        } else if (name.equals("resourceType")) {
603          this.resourceType = castToCodeableConcept(value); // CodeableConcept
604        } else if (name.equals("party")) {
605          this.party = castToReference(value); // Reference
606        } else
607          return super.setProperty(name, value);
608        return value;
609      }
610
611      @Override
612      public Base makeProperty(int hash, String name) throws FHIRException {
613        switch (hash) {
614        case 3575610:  return getType(); 
615        case -384364440:  return getResourceType(); 
616        case 106437350:  return getParty(); 
617        default: return super.makeProperty(hash, name);
618        }
619
620      }
621
622      @Override
623      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
624        switch (hash) {
625        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
626        case -384364440: /*resourceType*/ return new String[] {"CodeableConcept"};
627        case 106437350: /*party*/ return new String[] {"Reference"};
628        default: return super.getTypesForProperty(hash, name);
629        }
630
631      }
632
633      @Override
634      public Base addChild(String name) throws FHIRException {
635        if (name.equals("type")) {
636          this.type = new CodeableConcept();
637          return this.type;
638        }
639        else if (name.equals("resourceType")) {
640          this.resourceType = new CodeableConcept();
641          return this.resourceType;
642        }
643        else if (name.equals("party")) {
644          this.party = new Reference();
645          return this.party;
646        }
647        else
648          return super.addChild(name);
649      }
650
651      public PayeeComponent copy() {
652        PayeeComponent dst = new PayeeComponent();
653        copyValues(dst);
654        dst.type = type == null ? null : type.copy();
655        dst.resourceType = resourceType == null ? null : resourceType.copy();
656        dst.party = party == null ? null : party.copy();
657        return dst;
658      }
659
660      @Override
661      public boolean equalsDeep(Base other) {
662        if (!super.equalsDeep(other))
663          return false;
664        if (!(other instanceof PayeeComponent))
665          return false;
666        PayeeComponent o = (PayeeComponent) other;
667        return compareDeep(type, o.type, true) && compareDeep(resourceType, o.resourceType, true) && compareDeep(party, o.party, true)
668          ;
669      }
670
671      @Override
672      public boolean equalsShallow(Base other) {
673        if (!super.equalsShallow(other))
674          return false;
675        if (!(other instanceof PayeeComponent))
676          return false;
677        PayeeComponent o = (PayeeComponent) other;
678        return true;
679      }
680
681      public boolean isEmpty() {
682        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, resourceType, party
683          );
684      }
685
686  public String fhirType() {
687    return "ExplanationOfBenefit.payee";
688
689  }
690
691  }
692
693    @Block()
694    public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
695        /**
696         * Sequence of the information element which serves to provide a link.
697         */
698        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
699        @Description(shortDefinition="Information instance identifier", formalDefinition="Sequence of the information element which serves to provide a link." )
700        protected PositiveIntType sequence;
701
702        /**
703         * The general class of the information supplied: information; exception; accident, employment; onset, etc.
704         */
705        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
706        @Description(shortDefinition="General class of information", formalDefinition="The general class of the information supplied: information; exception; accident, employment; onset, etc." )
707        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-informationcategory")
708        protected CodeableConcept category;
709
710        /**
711         * 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.
712         */
713        @Child(name = "code", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
714        @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." )
715        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-exception")
716        protected CodeableConcept code;
717
718        /**
719         * The date when or period to which this information refers.
720         */
721        @Child(name = "timing", type = {DateType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
722        @Description(shortDefinition="When it occurred", formalDefinition="The date when or period to which this information refers." )
723        protected Type timing;
724
725        /**
726         * Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.
727         */
728        @Child(name = "value", type = {StringType.class, Quantity.class, Attachment.class, Reference.class}, order=5, min=0, max=1, modifier=false, summary=false)
729        @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." )
730        protected Type value;
731
732        /**
733         * 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.
734         */
735        @Child(name = "reason", type = {Coding.class}, order=6, min=0, max=1, modifier=false, summary=false)
736        @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." )
737        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/missing-tooth-reason")
738        protected Coding reason;
739
740        private static final long serialVersionUID = -410136661L;
741
742    /**
743     * Constructor
744     */
745      public SupportingInformationComponent() {
746        super();
747      }
748
749    /**
750     * Constructor
751     */
752      public SupportingInformationComponent(PositiveIntType sequence, CodeableConcept category) {
753        super();
754        this.sequence = sequence;
755        this.category = category;
756      }
757
758        /**
759         * @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
760         */
761        public PositiveIntType getSequenceElement() { 
762          if (this.sequence == null)
763            if (Configuration.errorOnAutoCreate())
764              throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
765            else if (Configuration.doAutoCreate())
766              this.sequence = new PositiveIntType(); // bb
767          return this.sequence;
768        }
769
770        public boolean hasSequenceElement() { 
771          return this.sequence != null && !this.sequence.isEmpty();
772        }
773
774        public boolean hasSequence() { 
775          return this.sequence != null && !this.sequence.isEmpty();
776        }
777
778        /**
779         * @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
780         */
781        public SupportingInformationComponent setSequenceElement(PositiveIntType value) { 
782          this.sequence = value;
783          return this;
784        }
785
786        /**
787         * @return Sequence of the information element which serves to provide a link.
788         */
789        public int getSequence() { 
790          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
791        }
792
793        /**
794         * @param value Sequence of the information element which serves to provide a link.
795         */
796        public SupportingInformationComponent setSequence(int value) { 
797            if (this.sequence == null)
798              this.sequence = new PositiveIntType();
799            this.sequence.setValue(value);
800          return this;
801        }
802
803        /**
804         * @return {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
805         */
806        public CodeableConcept getCategory() { 
807          if (this.category == null)
808            if (Configuration.errorOnAutoCreate())
809              throw new Error("Attempt to auto-create SupportingInformationComponent.category");
810            else if (Configuration.doAutoCreate())
811              this.category = new CodeableConcept(); // cc
812          return this.category;
813        }
814
815        public boolean hasCategory() { 
816          return this.category != null && !this.category.isEmpty();
817        }
818
819        /**
820         * @param value {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
821         */
822        public SupportingInformationComponent setCategory(CodeableConcept value) { 
823          this.category = value;
824          return this;
825        }
826
827        /**
828         * @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.)
829         */
830        public CodeableConcept getCode() { 
831          if (this.code == null)
832            if (Configuration.errorOnAutoCreate())
833              throw new Error("Attempt to auto-create SupportingInformationComponent.code");
834            else if (Configuration.doAutoCreate())
835              this.code = new CodeableConcept(); // cc
836          return this.code;
837        }
838
839        public boolean hasCode() { 
840          return this.code != null && !this.code.isEmpty();
841        }
842
843        /**
844         * @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.)
845         */
846        public SupportingInformationComponent setCode(CodeableConcept value) { 
847          this.code = value;
848          return this;
849        }
850
851        /**
852         * @return {@link #timing} (The date when or period to which this information refers.)
853         */
854        public Type getTiming() { 
855          return this.timing;
856        }
857
858        /**
859         * @return {@link #timing} (The date when or period to which this information refers.)
860         */
861        public DateType getTimingDateType() throws FHIRException { 
862          if (!(this.timing instanceof DateType))
863            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.timing.getClass().getName()+" was encountered");
864          return (DateType) this.timing;
865        }
866
867        public boolean hasTimingDateType() { 
868          return this.timing instanceof DateType;
869        }
870
871        /**
872         * @return {@link #timing} (The date when or period to which this information refers.)
873         */
874        public Period getTimingPeriod() throws FHIRException { 
875          if (!(this.timing instanceof Period))
876            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
877          return (Period) this.timing;
878        }
879
880        public boolean hasTimingPeriod() { 
881          return this.timing instanceof Period;
882        }
883
884        public boolean hasTiming() { 
885          return this.timing != null && !this.timing.isEmpty();
886        }
887
888        /**
889         * @param value {@link #timing} (The date when or period to which this information refers.)
890         */
891        public SupportingInformationComponent setTiming(Type value) { 
892          this.timing = value;
893          return this;
894        }
895
896        /**
897         * @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.)
898         */
899        public Type getValue() { 
900          return this.value;
901        }
902
903        /**
904         * @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.)
905         */
906        public StringType getValueStringType() throws FHIRException { 
907          if (!(this.value instanceof StringType))
908            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
909          return (StringType) this.value;
910        }
911
912        public boolean hasValueStringType() { 
913          return this.value instanceof StringType;
914        }
915
916        /**
917         * @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.)
918         */
919        public Quantity getValueQuantity() throws FHIRException { 
920          if (!(this.value instanceof Quantity))
921            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
922          return (Quantity) this.value;
923        }
924
925        public boolean hasValueQuantity() { 
926          return this.value instanceof Quantity;
927        }
928
929        /**
930         * @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.)
931         */
932        public Attachment getValueAttachment() throws FHIRException { 
933          if (!(this.value instanceof Attachment))
934            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
935          return (Attachment) this.value;
936        }
937
938        public boolean hasValueAttachment() { 
939          return this.value instanceof Attachment;
940        }
941
942        /**
943         * @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.)
944         */
945        public Reference getValueReference() throws FHIRException { 
946          if (!(this.value instanceof Reference))
947            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
948          return (Reference) this.value;
949        }
950
951        public boolean hasValueReference() { 
952          return this.value instanceof Reference;
953        }
954
955        public boolean hasValue() { 
956          return this.value != null && !this.value.isEmpty();
957        }
958
959        /**
960         * @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.)
961         */
962        public SupportingInformationComponent setValue(Type value) { 
963          this.value = value;
964          return this;
965        }
966
967        /**
968         * @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.)
969         */
970        public Coding getReason() { 
971          if (this.reason == null)
972            if (Configuration.errorOnAutoCreate())
973              throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
974            else if (Configuration.doAutoCreate())
975              this.reason = new Coding(); // cc
976          return this.reason;
977        }
978
979        public boolean hasReason() { 
980          return this.reason != null && !this.reason.isEmpty();
981        }
982
983        /**
984         * @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.)
985         */
986        public SupportingInformationComponent setReason(Coding value) { 
987          this.reason = value;
988          return this;
989        }
990
991        protected void listChildren(List<Property> childrenList) {
992          super.listChildren(childrenList);
993          childrenList.add(new Property("sequence", "positiveInt", "Sequence of the information element which serves to provide a link.", 0, java.lang.Integer.MAX_VALUE, sequence));
994          childrenList.add(new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, java.lang.Integer.MAX_VALUE, category));
995          childrenList.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, java.lang.Integer.MAX_VALUE, code));
996          childrenList.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, java.lang.Integer.MAX_VALUE, timing));
997          childrenList.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, java.lang.Integer.MAX_VALUE, value));
998          childrenList.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, java.lang.Integer.MAX_VALUE, reason));
999        }
1000
1001      @Override
1002      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1003        switch (hash) {
1004        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1005        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1006        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1007        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type
1008        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
1009        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
1010        default: return super.getProperty(hash, name, checkValid);
1011        }
1012
1013      }
1014
1015      @Override
1016      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1017        switch (hash) {
1018        case 1349547969: // sequence
1019          this.sequence = castToPositiveInt(value); // PositiveIntType
1020          return value;
1021        case 50511102: // category
1022          this.category = castToCodeableConcept(value); // CodeableConcept
1023          return value;
1024        case 3059181: // code
1025          this.code = castToCodeableConcept(value); // CodeableConcept
1026          return value;
1027        case -873664438: // timing
1028          this.timing = castToType(value); // Type
1029          return value;
1030        case 111972721: // value
1031          this.value = castToType(value); // Type
1032          return value;
1033        case -934964668: // reason
1034          this.reason = castToCoding(value); // Coding
1035          return value;
1036        default: return super.setProperty(hash, name, value);
1037        }
1038
1039      }
1040
1041      @Override
1042      public Base setProperty(String name, Base value) throws FHIRException {
1043        if (name.equals("sequence")) {
1044          this.sequence = castToPositiveInt(value); // PositiveIntType
1045        } else if (name.equals("category")) {
1046          this.category = castToCodeableConcept(value); // CodeableConcept
1047        } else if (name.equals("code")) {
1048          this.code = castToCodeableConcept(value); // CodeableConcept
1049        } else if (name.equals("timing[x]")) {
1050          this.timing = castToType(value); // Type
1051        } else if (name.equals("value[x]")) {
1052          this.value = castToType(value); // Type
1053        } else if (name.equals("reason")) {
1054          this.reason = castToCoding(value); // Coding
1055        } else
1056          return super.setProperty(name, value);
1057        return value;
1058      }
1059
1060      @Override
1061      public Base makeProperty(int hash, String name) throws FHIRException {
1062        switch (hash) {
1063        case 1349547969:  return getSequenceElement();
1064        case 50511102:  return getCategory(); 
1065        case 3059181:  return getCode(); 
1066        case 164632566:  return getTiming(); 
1067        case -873664438:  return getTiming(); 
1068        case -1410166417:  return getValue(); 
1069        case 111972721:  return getValue(); 
1070        case -934964668:  return getReason(); 
1071        default: return super.makeProperty(hash, name);
1072        }
1073
1074      }
1075
1076      @Override
1077      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1078        switch (hash) {
1079        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1080        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1081        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1082        case -873664438: /*timing*/ return new String[] {"date", "Period"};
1083        case 111972721: /*value*/ return new String[] {"string", "Quantity", "Attachment", "Reference"};
1084        case -934964668: /*reason*/ return new String[] {"Coding"};
1085        default: return super.getTypesForProperty(hash, name);
1086        }
1087
1088      }
1089
1090      @Override
1091      public Base addChild(String name) throws FHIRException {
1092        if (name.equals("sequence")) {
1093          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1094        }
1095        else if (name.equals("category")) {
1096          this.category = new CodeableConcept();
1097          return this.category;
1098        }
1099        else if (name.equals("code")) {
1100          this.code = new CodeableConcept();
1101          return this.code;
1102        }
1103        else if (name.equals("timingDate")) {
1104          this.timing = new DateType();
1105          return this.timing;
1106        }
1107        else if (name.equals("timingPeriod")) {
1108          this.timing = new Period();
1109          return this.timing;
1110        }
1111        else if (name.equals("valueString")) {
1112          this.value = new StringType();
1113          return this.value;
1114        }
1115        else if (name.equals("valueQuantity")) {
1116          this.value = new Quantity();
1117          return this.value;
1118        }
1119        else if (name.equals("valueAttachment")) {
1120          this.value = new Attachment();
1121          return this.value;
1122        }
1123        else if (name.equals("valueReference")) {
1124          this.value = new Reference();
1125          return this.value;
1126        }
1127        else if (name.equals("reason")) {
1128          this.reason = new Coding();
1129          return this.reason;
1130        }
1131        else
1132          return super.addChild(name);
1133      }
1134
1135      public SupportingInformationComponent copy() {
1136        SupportingInformationComponent dst = new SupportingInformationComponent();
1137        copyValues(dst);
1138        dst.sequence = sequence == null ? null : sequence.copy();
1139        dst.category = category == null ? null : category.copy();
1140        dst.code = code == null ? null : code.copy();
1141        dst.timing = timing == null ? null : timing.copy();
1142        dst.value = value == null ? null : value.copy();
1143        dst.reason = reason == null ? null : reason.copy();
1144        return dst;
1145      }
1146
1147      @Override
1148      public boolean equalsDeep(Base other) {
1149        if (!super.equalsDeep(other))
1150          return false;
1151        if (!(other instanceof SupportingInformationComponent))
1152          return false;
1153        SupportingInformationComponent o = (SupportingInformationComponent) other;
1154        return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true) && compareDeep(code, o.code, true)
1155           && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true) && compareDeep(reason, o.reason, true)
1156          ;
1157      }
1158
1159      @Override
1160      public boolean equalsShallow(Base other) {
1161        if (!super.equalsShallow(other))
1162          return false;
1163        if (!(other instanceof SupportingInformationComponent))
1164          return false;
1165        SupportingInformationComponent o = (SupportingInformationComponent) other;
1166        return compareValues(sequence, o.sequence, true);
1167      }
1168
1169      public boolean isEmpty() {
1170        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code
1171          , timing, value, reason);
1172      }
1173
1174  public String fhirType() {
1175    return "ExplanationOfBenefit.information";
1176
1177  }
1178
1179  }
1180
1181    @Block()
1182    public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
1183        /**
1184         * Sequence of careteam which serves to order and provide a link.
1185         */
1186        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1187        @Description(shortDefinition="Number to covey order of careteam", formalDefinition="Sequence of careteam which serves to order and provide a link." )
1188        protected PositiveIntType sequence;
1189
1190        /**
1191         * The members of the team who provided the overall service.
1192         */
1193        @Child(name = "provider", type = {Practitioner.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=false)
1194        @Description(shortDefinition="Member of the Care Team", formalDefinition="The members of the team who provided the overall service." )
1195        protected Reference provider;
1196
1197        /**
1198         * The actual object that is the target of the reference (The members of the team who provided the overall service.)
1199         */
1200        protected Resource providerTarget;
1201
1202        /**
1203         * The practitioner who is billing and responsible for the claimed services rendered to the patient.
1204         */
1205        @Child(name = "responsible", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
1206        @Description(shortDefinition="Billing practitioner", formalDefinition="The practitioner who is billing and responsible for the claimed services rendered to the patient." )
1207        protected BooleanType responsible;
1208
1209        /**
1210         * The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.
1211         */
1212        @Child(name = "role", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1213        @Description(shortDefinition="Role on the team", formalDefinition="The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team." )
1214        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-careteamrole")
1215        protected CodeableConcept role;
1216
1217        /**
1218         * The qualification which is applicable for this service.
1219         */
1220        @Child(name = "qualification", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1221        @Description(shortDefinition="Type, classification or Specialization", formalDefinition="The qualification which is applicable for this service." )
1222        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provider-qualification")
1223        protected CodeableConcept qualification;
1224
1225        private static final long serialVersionUID = 1758966968L;
1226
1227    /**
1228     * Constructor
1229     */
1230      public CareTeamComponent() {
1231        super();
1232      }
1233
1234    /**
1235     * Constructor
1236     */
1237      public CareTeamComponent(PositiveIntType sequence, Reference provider) {
1238        super();
1239        this.sequence = sequence;
1240        this.provider = provider;
1241      }
1242
1243        /**
1244         * @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
1245         */
1246        public PositiveIntType getSequenceElement() { 
1247          if (this.sequence == null)
1248            if (Configuration.errorOnAutoCreate())
1249              throw new Error("Attempt to auto-create CareTeamComponent.sequence");
1250            else if (Configuration.doAutoCreate())
1251              this.sequence = new PositiveIntType(); // bb
1252          return this.sequence;
1253        }
1254
1255        public boolean hasSequenceElement() { 
1256          return this.sequence != null && !this.sequence.isEmpty();
1257        }
1258
1259        public boolean hasSequence() { 
1260          return this.sequence != null && !this.sequence.isEmpty();
1261        }
1262
1263        /**
1264         * @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
1265         */
1266        public CareTeamComponent setSequenceElement(PositiveIntType value) { 
1267          this.sequence = value;
1268          return this;
1269        }
1270
1271        /**
1272         * @return Sequence of careteam which serves to order and provide a link.
1273         */
1274        public int getSequence() { 
1275          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1276        }
1277
1278        /**
1279         * @param value Sequence of careteam which serves to order and provide a link.
1280         */
1281        public CareTeamComponent setSequence(int value) { 
1282            if (this.sequence == null)
1283              this.sequence = new PositiveIntType();
1284            this.sequence.setValue(value);
1285          return this;
1286        }
1287
1288        /**
1289         * @return {@link #provider} (The members of the team who provided the overall service.)
1290         */
1291        public Reference getProvider() { 
1292          if (this.provider == null)
1293            if (Configuration.errorOnAutoCreate())
1294              throw new Error("Attempt to auto-create CareTeamComponent.provider");
1295            else if (Configuration.doAutoCreate())
1296              this.provider = new Reference(); // cc
1297          return this.provider;
1298        }
1299
1300        public boolean hasProvider() { 
1301          return this.provider != null && !this.provider.isEmpty();
1302        }
1303
1304        /**
1305         * @param value {@link #provider} (The members of the team who provided the overall service.)
1306         */
1307        public CareTeamComponent setProvider(Reference value) { 
1308          this.provider = value;
1309          return this;
1310        }
1311
1312        /**
1313         * @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.)
1314         */
1315        public Resource getProviderTarget() { 
1316          return this.providerTarget;
1317        }
1318
1319        /**
1320         * @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.)
1321         */
1322        public CareTeamComponent setProviderTarget(Resource value) { 
1323          this.providerTarget = value;
1324          return this;
1325        }
1326
1327        /**
1328         * @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
1329         */
1330        public BooleanType getResponsibleElement() { 
1331          if (this.responsible == null)
1332            if (Configuration.errorOnAutoCreate())
1333              throw new Error("Attempt to auto-create CareTeamComponent.responsible");
1334            else if (Configuration.doAutoCreate())
1335              this.responsible = new BooleanType(); // bb
1336          return this.responsible;
1337        }
1338
1339        public boolean hasResponsibleElement() { 
1340          return this.responsible != null && !this.responsible.isEmpty();
1341        }
1342
1343        public boolean hasResponsible() { 
1344          return this.responsible != null && !this.responsible.isEmpty();
1345        }
1346
1347        /**
1348         * @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
1349         */
1350        public CareTeamComponent setResponsibleElement(BooleanType value) { 
1351          this.responsible = value;
1352          return this;
1353        }
1354
1355        /**
1356         * @return The practitioner who is billing and responsible for the claimed services rendered to the patient.
1357         */
1358        public boolean getResponsible() { 
1359          return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
1360        }
1361
1362        /**
1363         * @param value The practitioner who is billing and responsible for the claimed services rendered to the patient.
1364         */
1365        public CareTeamComponent setResponsible(boolean value) { 
1366            if (this.responsible == null)
1367              this.responsible = new BooleanType();
1368            this.responsible.setValue(value);
1369          return this;
1370        }
1371
1372        /**
1373         * @return {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.)
1374         */
1375        public CodeableConcept getRole() { 
1376          if (this.role == null)
1377            if (Configuration.errorOnAutoCreate())
1378              throw new Error("Attempt to auto-create CareTeamComponent.role");
1379            else if (Configuration.doAutoCreate())
1380              this.role = new CodeableConcept(); // cc
1381          return this.role;
1382        }
1383
1384        public boolean hasRole() { 
1385          return this.role != null && !this.role.isEmpty();
1386        }
1387
1388        /**
1389         * @param value {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.)
1390         */
1391        public CareTeamComponent setRole(CodeableConcept value) { 
1392          this.role = value;
1393          return this;
1394        }
1395
1396        /**
1397         * @return {@link #qualification} (The qualification which is applicable for this service.)
1398         */
1399        public CodeableConcept getQualification() { 
1400          if (this.qualification == null)
1401            if (Configuration.errorOnAutoCreate())
1402              throw new Error("Attempt to auto-create CareTeamComponent.qualification");
1403            else if (Configuration.doAutoCreate())
1404              this.qualification = new CodeableConcept(); // cc
1405          return this.qualification;
1406        }
1407
1408        public boolean hasQualification() { 
1409          return this.qualification != null && !this.qualification.isEmpty();
1410        }
1411
1412        /**
1413         * @param value {@link #qualification} (The qualification which is applicable for this service.)
1414         */
1415        public CareTeamComponent setQualification(CodeableConcept value) { 
1416          this.qualification = value;
1417          return this;
1418        }
1419
1420        protected void listChildren(List<Property> childrenList) {
1421          super.listChildren(childrenList);
1422          childrenList.add(new Property("sequence", "positiveInt", "Sequence of careteam which serves to order and provide a link.", 0, java.lang.Integer.MAX_VALUE, sequence));
1423          childrenList.add(new Property("provider", "Reference(Practitioner|Organization)", "The members of the team who provided the overall service.", 0, java.lang.Integer.MAX_VALUE, provider));
1424          childrenList.add(new Property("responsible", "boolean", "The practitioner who is billing and responsible for the claimed services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, responsible));
1425          childrenList.add(new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.", 0, java.lang.Integer.MAX_VALUE, role));
1426          childrenList.add(new Property("qualification", "CodeableConcept", "The qualification which is applicable for this service.", 0, java.lang.Integer.MAX_VALUE, qualification));
1427        }
1428
1429      @Override
1430      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1431        switch (hash) {
1432        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1433        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
1434        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // BooleanType
1435        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
1436        case -631333393: /*qualification*/ return this.qualification == null ? new Base[0] : new Base[] {this.qualification}; // CodeableConcept
1437        default: return super.getProperty(hash, name, checkValid);
1438        }
1439
1440      }
1441
1442      @Override
1443      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1444        switch (hash) {
1445        case 1349547969: // sequence
1446          this.sequence = castToPositiveInt(value); // PositiveIntType
1447          return value;
1448        case -987494927: // provider
1449          this.provider = castToReference(value); // Reference
1450          return value;
1451        case 1847674614: // responsible
1452          this.responsible = castToBoolean(value); // BooleanType
1453          return value;
1454        case 3506294: // role
1455          this.role = castToCodeableConcept(value); // CodeableConcept
1456          return value;
1457        case -631333393: // qualification
1458          this.qualification = castToCodeableConcept(value); // CodeableConcept
1459          return value;
1460        default: return super.setProperty(hash, name, value);
1461        }
1462
1463      }
1464
1465      @Override
1466      public Base setProperty(String name, Base value) throws FHIRException {
1467        if (name.equals("sequence")) {
1468          this.sequence = castToPositiveInt(value); // PositiveIntType
1469        } else if (name.equals("provider")) {
1470          this.provider = castToReference(value); // Reference
1471        } else if (name.equals("responsible")) {
1472          this.responsible = castToBoolean(value); // BooleanType
1473        } else if (name.equals("role")) {
1474          this.role = castToCodeableConcept(value); // CodeableConcept
1475        } else if (name.equals("qualification")) {
1476          this.qualification = castToCodeableConcept(value); // CodeableConcept
1477        } else
1478          return super.setProperty(name, value);
1479        return value;
1480      }
1481
1482      @Override
1483      public Base makeProperty(int hash, String name) throws FHIRException {
1484        switch (hash) {
1485        case 1349547969:  return getSequenceElement();
1486        case -987494927:  return getProvider(); 
1487        case 1847674614:  return getResponsibleElement();
1488        case 3506294:  return getRole(); 
1489        case -631333393:  return getQualification(); 
1490        default: return super.makeProperty(hash, name);
1491        }
1492
1493      }
1494
1495      @Override
1496      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1497        switch (hash) {
1498        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1499        case -987494927: /*provider*/ return new String[] {"Reference"};
1500        case 1847674614: /*responsible*/ return new String[] {"boolean"};
1501        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
1502        case -631333393: /*qualification*/ return new String[] {"CodeableConcept"};
1503        default: return super.getTypesForProperty(hash, name);
1504        }
1505
1506      }
1507
1508      @Override
1509      public Base addChild(String name) throws FHIRException {
1510        if (name.equals("sequence")) {
1511          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1512        }
1513        else if (name.equals("provider")) {
1514          this.provider = new Reference();
1515          return this.provider;
1516        }
1517        else if (name.equals("responsible")) {
1518          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.responsible");
1519        }
1520        else if (name.equals("role")) {
1521          this.role = new CodeableConcept();
1522          return this.role;
1523        }
1524        else if (name.equals("qualification")) {
1525          this.qualification = new CodeableConcept();
1526          return this.qualification;
1527        }
1528        else
1529          return super.addChild(name);
1530      }
1531
1532      public CareTeamComponent copy() {
1533        CareTeamComponent dst = new CareTeamComponent();
1534        copyValues(dst);
1535        dst.sequence = sequence == null ? null : sequence.copy();
1536        dst.provider = provider == null ? null : provider.copy();
1537        dst.responsible = responsible == null ? null : responsible.copy();
1538        dst.role = role == null ? null : role.copy();
1539        dst.qualification = qualification == null ? null : qualification.copy();
1540        return dst;
1541      }
1542
1543      @Override
1544      public boolean equalsDeep(Base other) {
1545        if (!super.equalsDeep(other))
1546          return false;
1547        if (!(other instanceof CareTeamComponent))
1548          return false;
1549        CareTeamComponent o = (CareTeamComponent) other;
1550        return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true) && compareDeep(responsible, o.responsible, true)
1551           && compareDeep(role, o.role, true) && compareDeep(qualification, o.qualification, true);
1552      }
1553
1554      @Override
1555      public boolean equalsShallow(Base other) {
1556        if (!super.equalsShallow(other))
1557          return false;
1558        if (!(other instanceof CareTeamComponent))
1559          return false;
1560        CareTeamComponent o = (CareTeamComponent) other;
1561        return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true)
1562          ;
1563      }
1564
1565      public boolean isEmpty() {
1566        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible
1567          , role, qualification);
1568      }
1569
1570  public String fhirType() {
1571    return "ExplanationOfBenefit.careTeam";
1572
1573  }
1574
1575  }
1576
1577    @Block()
1578    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1579        /**
1580         * Sequence of diagnosis which serves to provide a link.
1581         */
1582        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1583        @Description(shortDefinition="Number to covey order of diagnosis", formalDefinition="Sequence of diagnosis which serves to provide a link." )
1584        protected PositiveIntType sequence;
1585
1586        /**
1587         * The diagnosis.
1588         */
1589        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=2, min=1, max=1, modifier=false, summary=false)
1590        @Description(shortDefinition="Patient's diagnosis", formalDefinition="The diagnosis." )
1591        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
1592        protected Type diagnosis;
1593
1594        /**
1595         * The type of the Diagnosis, for example: admitting, primary, secondary, discharge.
1596         */
1597        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1598        @Description(shortDefinition="Timing or nature of the diagnosis", formalDefinition="The type of the Diagnosis, for example: admitting, primary, secondary, discharge." )
1599        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosistype")
1600        protected List<CodeableConcept> type;
1601
1602        /**
1603         * The package billing code, for example DRG, based on the assigned grouping code system.
1604         */
1605        @Child(name = "packageCode", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1606        @Description(shortDefinition="Package billing code", formalDefinition="The package billing code, for example DRG, based on the assigned grouping code system." )
1607        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
1608        protected CodeableConcept packageCode;
1609
1610        private static final long serialVersionUID = -350960873L;
1611
1612    /**
1613     * Constructor
1614     */
1615      public DiagnosisComponent() {
1616        super();
1617      }
1618
1619    /**
1620     * Constructor
1621     */
1622      public DiagnosisComponent(PositiveIntType sequence, Type diagnosis) {
1623        super();
1624        this.sequence = sequence;
1625        this.diagnosis = diagnosis;
1626      }
1627
1628        /**
1629         * @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
1630         */
1631        public PositiveIntType getSequenceElement() { 
1632          if (this.sequence == null)
1633            if (Configuration.errorOnAutoCreate())
1634              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
1635            else if (Configuration.doAutoCreate())
1636              this.sequence = new PositiveIntType(); // bb
1637          return this.sequence;
1638        }
1639
1640        public boolean hasSequenceElement() { 
1641          return this.sequence != null && !this.sequence.isEmpty();
1642        }
1643
1644        public boolean hasSequence() { 
1645          return this.sequence != null && !this.sequence.isEmpty();
1646        }
1647
1648        /**
1649         * @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
1650         */
1651        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
1652          this.sequence = value;
1653          return this;
1654        }
1655
1656        /**
1657         * @return Sequence of diagnosis which serves to provide a link.
1658         */
1659        public int getSequence() { 
1660          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1661        }
1662
1663        /**
1664         * @param value Sequence of diagnosis which serves to provide a link.
1665         */
1666        public DiagnosisComponent setSequence(int value) { 
1667            if (this.sequence == null)
1668              this.sequence = new PositiveIntType();
1669            this.sequence.setValue(value);
1670          return this;
1671        }
1672
1673        /**
1674         * @return {@link #diagnosis} (The diagnosis.)
1675         */
1676        public Type getDiagnosis() { 
1677          return this.diagnosis;
1678        }
1679
1680        /**
1681         * @return {@link #diagnosis} (The diagnosis.)
1682         */
1683        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
1684          if (!(this.diagnosis instanceof CodeableConcept))
1685            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1686          return (CodeableConcept) this.diagnosis;
1687        }
1688
1689        public boolean hasDiagnosisCodeableConcept() { 
1690          return this.diagnosis instanceof CodeableConcept;
1691        }
1692
1693        /**
1694         * @return {@link #diagnosis} (The diagnosis.)
1695         */
1696        public Reference getDiagnosisReference() throws FHIRException { 
1697          if (!(this.diagnosis instanceof Reference))
1698            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1699          return (Reference) this.diagnosis;
1700        }
1701
1702        public boolean hasDiagnosisReference() { 
1703          return this.diagnosis instanceof Reference;
1704        }
1705
1706        public boolean hasDiagnosis() { 
1707          return this.diagnosis != null && !this.diagnosis.isEmpty();
1708        }
1709
1710        /**
1711         * @param value {@link #diagnosis} (The diagnosis.)
1712         */
1713        public DiagnosisComponent setDiagnosis(Type value) { 
1714          this.diagnosis = value;
1715          return this;
1716        }
1717
1718        /**
1719         * @return {@link #type} (The type of the Diagnosis, for example: admitting, primary, secondary, discharge.)
1720         */
1721        public List<CodeableConcept> getType() { 
1722          if (this.type == null)
1723            this.type = new ArrayList<CodeableConcept>();
1724          return this.type;
1725        }
1726
1727        /**
1728         * @return Returns a reference to <code>this</code> for easy method chaining
1729         */
1730        public DiagnosisComponent setType(List<CodeableConcept> theType) { 
1731          this.type = theType;
1732          return this;
1733        }
1734
1735        public boolean hasType() { 
1736          if (this.type == null)
1737            return false;
1738          for (CodeableConcept item : this.type)
1739            if (!item.isEmpty())
1740              return true;
1741          return false;
1742        }
1743
1744        public CodeableConcept addType() { //3
1745          CodeableConcept t = new CodeableConcept();
1746          if (this.type == null)
1747            this.type = new ArrayList<CodeableConcept>();
1748          this.type.add(t);
1749          return t;
1750        }
1751
1752        public DiagnosisComponent addType(CodeableConcept t) { //3
1753          if (t == null)
1754            return this;
1755          if (this.type == null)
1756            this.type = new ArrayList<CodeableConcept>();
1757          this.type.add(t);
1758          return this;
1759        }
1760
1761        /**
1762         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
1763         */
1764        public CodeableConcept getTypeFirstRep() { 
1765          if (getType().isEmpty()) {
1766            addType();
1767          }
1768          return getType().get(0);
1769        }
1770
1771        /**
1772         * @return {@link #packageCode} (The package billing code, for example DRG, based on the assigned grouping code system.)
1773         */
1774        public CodeableConcept getPackageCode() { 
1775          if (this.packageCode == null)
1776            if (Configuration.errorOnAutoCreate())
1777              throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
1778            else if (Configuration.doAutoCreate())
1779              this.packageCode = new CodeableConcept(); // cc
1780          return this.packageCode;
1781        }
1782
1783        public boolean hasPackageCode() { 
1784          return this.packageCode != null && !this.packageCode.isEmpty();
1785        }
1786
1787        /**
1788         * @param value {@link #packageCode} (The package billing code, for example DRG, based on the assigned grouping code system.)
1789         */
1790        public DiagnosisComponent setPackageCode(CodeableConcept value) { 
1791          this.packageCode = value;
1792          return this;
1793        }
1794
1795        protected void listChildren(List<Property> childrenList) {
1796          super.listChildren(childrenList);
1797          childrenList.add(new Property("sequence", "positiveInt", "Sequence of diagnosis which serves to provide a link.", 0, java.lang.Integer.MAX_VALUE, sequence));
1798          childrenList.add(new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
1799          childrenList.add(new Property("type", "CodeableConcept", "The type of the Diagnosis, for example: admitting, primary, secondary, discharge.", 0, java.lang.Integer.MAX_VALUE, type));
1800          childrenList.add(new Property("packageCode", "CodeableConcept", "The package billing code, for example DRG, based on the assigned grouping code system.", 0, java.lang.Integer.MAX_VALUE, packageCode));
1801        }
1802
1803      @Override
1804      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1805        switch (hash) {
1806        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1807        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // Type
1808        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
1809        case 908444499: /*packageCode*/ return this.packageCode == null ? new Base[0] : new Base[] {this.packageCode}; // CodeableConcept
1810        default: return super.getProperty(hash, name, checkValid);
1811        }
1812
1813      }
1814
1815      @Override
1816      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1817        switch (hash) {
1818        case 1349547969: // sequence
1819          this.sequence = castToPositiveInt(value); // PositiveIntType
1820          return value;
1821        case 1196993265: // diagnosis
1822          this.diagnosis = castToType(value); // Type
1823          return value;
1824        case 3575610: // type
1825          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
1826          return value;
1827        case 908444499: // packageCode
1828          this.packageCode = castToCodeableConcept(value); // CodeableConcept
1829          return value;
1830        default: return super.setProperty(hash, name, value);
1831        }
1832
1833      }
1834
1835      @Override
1836      public Base setProperty(String name, Base value) throws FHIRException {
1837        if (name.equals("sequence")) {
1838          this.sequence = castToPositiveInt(value); // PositiveIntType
1839        } else if (name.equals("diagnosis[x]")) {
1840          this.diagnosis = castToType(value); // Type
1841        } else if (name.equals("type")) {
1842          this.getType().add(castToCodeableConcept(value));
1843        } else if (name.equals("packageCode")) {
1844          this.packageCode = castToCodeableConcept(value); // CodeableConcept
1845        } else
1846          return super.setProperty(name, value);
1847        return value;
1848      }
1849
1850      @Override
1851      public Base makeProperty(int hash, String name) throws FHIRException {
1852        switch (hash) {
1853        case 1349547969:  return getSequenceElement();
1854        case -1487009809:  return getDiagnosis(); 
1855        case 1196993265:  return getDiagnosis(); 
1856        case 3575610:  return addType(); 
1857        case 908444499:  return getPackageCode(); 
1858        default: return super.makeProperty(hash, name);
1859        }
1860
1861      }
1862
1863      @Override
1864      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1865        switch (hash) {
1866        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1867        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
1868        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1869        case 908444499: /*packageCode*/ return new String[] {"CodeableConcept"};
1870        default: return super.getTypesForProperty(hash, name);
1871        }
1872
1873      }
1874
1875      @Override
1876      public Base addChild(String name) throws FHIRException {
1877        if (name.equals("sequence")) {
1878          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1879        }
1880        else if (name.equals("diagnosisCodeableConcept")) {
1881          this.diagnosis = new CodeableConcept();
1882          return this.diagnosis;
1883        }
1884        else if (name.equals("diagnosisReference")) {
1885          this.diagnosis = new Reference();
1886          return this.diagnosis;
1887        }
1888        else if (name.equals("type")) {
1889          return addType();
1890        }
1891        else if (name.equals("packageCode")) {
1892          this.packageCode = new CodeableConcept();
1893          return this.packageCode;
1894        }
1895        else
1896          return super.addChild(name);
1897      }
1898
1899      public DiagnosisComponent copy() {
1900        DiagnosisComponent dst = new DiagnosisComponent();
1901        copyValues(dst);
1902        dst.sequence = sequence == null ? null : sequence.copy();
1903        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
1904        if (type != null) {
1905          dst.type = new ArrayList<CodeableConcept>();
1906          for (CodeableConcept i : type)
1907            dst.type.add(i.copy());
1908        };
1909        dst.packageCode = packageCode == null ? null : packageCode.copy();
1910        return dst;
1911      }
1912
1913      @Override
1914      public boolean equalsDeep(Base other) {
1915        if (!super.equalsDeep(other))
1916          return false;
1917        if (!(other instanceof DiagnosisComponent))
1918          return false;
1919        DiagnosisComponent o = (DiagnosisComponent) other;
1920        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(type, o.type, true)
1921           && compareDeep(packageCode, o.packageCode, true);
1922      }
1923
1924      @Override
1925      public boolean equalsShallow(Base other) {
1926        if (!super.equalsShallow(other))
1927          return false;
1928        if (!(other instanceof DiagnosisComponent))
1929          return false;
1930        DiagnosisComponent o = (DiagnosisComponent) other;
1931        return compareValues(sequence, o.sequence, true);
1932      }
1933
1934      public boolean isEmpty() {
1935        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type
1936          , packageCode);
1937      }
1938
1939  public String fhirType() {
1940    return "ExplanationOfBenefit.diagnosis";
1941
1942  }
1943
1944  }
1945
1946    @Block()
1947    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
1948        /**
1949         * Sequence of procedures which serves to order and provide a link.
1950         */
1951        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1952        @Description(shortDefinition="Procedure sequence for reference", formalDefinition="Sequence of procedures which serves to order and provide a link." )
1953        protected PositiveIntType sequence;
1954
1955        /**
1956         * Date and optionally time the procedure was performed .
1957         */
1958        @Child(name = "date", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1959        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed ." )
1960        protected DateTimeType date;
1961
1962        /**
1963         * The procedure code.
1964         */
1965        @Child(name = "procedure", type = {CodeableConcept.class, Procedure.class}, order=3, min=1, max=1, modifier=false, summary=false)
1966        @Description(shortDefinition="Patient's list of procedures performed", formalDefinition="The procedure code." )
1967        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10-procedures")
1968        protected Type procedure;
1969
1970        private static final long serialVersionUID = 864307347L;
1971
1972    /**
1973     * Constructor
1974     */
1975      public ProcedureComponent() {
1976        super();
1977      }
1978
1979    /**
1980     * Constructor
1981     */
1982      public ProcedureComponent(PositiveIntType sequence, Type procedure) {
1983        super();
1984        this.sequence = sequence;
1985        this.procedure = procedure;
1986      }
1987
1988        /**
1989         * @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
1990         */
1991        public PositiveIntType getSequenceElement() { 
1992          if (this.sequence == null)
1993            if (Configuration.errorOnAutoCreate())
1994              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
1995            else if (Configuration.doAutoCreate())
1996              this.sequence = new PositiveIntType(); // bb
1997          return this.sequence;
1998        }
1999
2000        public boolean hasSequenceElement() { 
2001          return this.sequence != null && !this.sequence.isEmpty();
2002        }
2003
2004        public boolean hasSequence() { 
2005          return this.sequence != null && !this.sequence.isEmpty();
2006        }
2007
2008        /**
2009         * @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
2010         */
2011        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
2012          this.sequence = value;
2013          return this;
2014        }
2015
2016        /**
2017         * @return Sequence of procedures which serves to order and provide a link.
2018         */
2019        public int getSequence() { 
2020          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2021        }
2022
2023        /**
2024         * @param value Sequence of procedures which serves to order and provide a link.
2025         */
2026        public ProcedureComponent setSequence(int value) { 
2027            if (this.sequence == null)
2028              this.sequence = new PositiveIntType();
2029            this.sequence.setValue(value);
2030          return this;
2031        }
2032
2033        /**
2034         * @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
2035         */
2036        public DateTimeType getDateElement() { 
2037          if (this.date == null)
2038            if (Configuration.errorOnAutoCreate())
2039              throw new Error("Attempt to auto-create ProcedureComponent.date");
2040            else if (Configuration.doAutoCreate())
2041              this.date = new DateTimeType(); // bb
2042          return this.date;
2043        }
2044
2045        public boolean hasDateElement() { 
2046          return this.date != null && !this.date.isEmpty();
2047        }
2048
2049        public boolean hasDate() { 
2050          return this.date != null && !this.date.isEmpty();
2051        }
2052
2053        /**
2054         * @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
2055         */
2056        public ProcedureComponent setDateElement(DateTimeType value) { 
2057          this.date = value;
2058          return this;
2059        }
2060
2061        /**
2062         * @return Date and optionally time the procedure was performed .
2063         */
2064        public Date getDate() { 
2065          return this.date == null ? null : this.date.getValue();
2066        }
2067
2068        /**
2069         * @param value Date and optionally time the procedure was performed .
2070         */
2071        public ProcedureComponent setDate(Date value) { 
2072          if (value == null)
2073            this.date = null;
2074          else {
2075            if (this.date == null)
2076              this.date = new DateTimeType();
2077            this.date.setValue(value);
2078          }
2079          return this;
2080        }
2081
2082        /**
2083         * @return {@link #procedure} (The procedure code.)
2084         */
2085        public Type getProcedure() { 
2086          return this.procedure;
2087        }
2088
2089        /**
2090         * @return {@link #procedure} (The procedure code.)
2091         */
2092        public CodeableConcept getProcedureCodeableConcept() throws FHIRException { 
2093          if (!(this.procedure instanceof CodeableConcept))
2094            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.procedure.getClass().getName()+" was encountered");
2095          return (CodeableConcept) this.procedure;
2096        }
2097
2098        public boolean hasProcedureCodeableConcept() { 
2099          return this.procedure instanceof CodeableConcept;
2100        }
2101
2102        /**
2103         * @return {@link #procedure} (The procedure code.)
2104         */
2105        public Reference getProcedureReference() throws FHIRException { 
2106          if (!(this.procedure instanceof Reference))
2107            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
2108          return (Reference) this.procedure;
2109        }
2110
2111        public boolean hasProcedureReference() { 
2112          return this.procedure instanceof Reference;
2113        }
2114
2115        public boolean hasProcedure() { 
2116          return this.procedure != null && !this.procedure.isEmpty();
2117        }
2118
2119        /**
2120         * @param value {@link #procedure} (The procedure code.)
2121         */
2122        public ProcedureComponent setProcedure(Type value) { 
2123          this.procedure = value;
2124          return this;
2125        }
2126
2127        protected void listChildren(List<Property> childrenList) {
2128          super.listChildren(childrenList);
2129          childrenList.add(new Property("sequence", "positiveInt", "Sequence of procedures which serves to order and provide a link.", 0, java.lang.Integer.MAX_VALUE, sequence));
2130          childrenList.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed .", 0, java.lang.Integer.MAX_VALUE, date));
2131          childrenList.add(new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, java.lang.Integer.MAX_VALUE, procedure));
2132        }
2133
2134      @Override
2135      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2136        switch (hash) {
2137        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2138        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2139        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // Type
2140        default: return super.getProperty(hash, name, checkValid);
2141        }
2142
2143      }
2144
2145      @Override
2146      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2147        switch (hash) {
2148        case 1349547969: // sequence
2149          this.sequence = castToPositiveInt(value); // PositiveIntType
2150          return value;
2151        case 3076014: // date
2152          this.date = castToDateTime(value); // DateTimeType
2153          return value;
2154        case -1095204141: // procedure
2155          this.procedure = castToType(value); // Type
2156          return value;
2157        default: return super.setProperty(hash, name, value);
2158        }
2159
2160      }
2161
2162      @Override
2163      public Base setProperty(String name, Base value) throws FHIRException {
2164        if (name.equals("sequence")) {
2165          this.sequence = castToPositiveInt(value); // PositiveIntType
2166        } else if (name.equals("date")) {
2167          this.date = castToDateTime(value); // DateTimeType
2168        } else if (name.equals("procedure[x]")) {
2169          this.procedure = castToType(value); // Type
2170        } else
2171          return super.setProperty(name, value);
2172        return value;
2173      }
2174
2175      @Override
2176      public Base makeProperty(int hash, String name) throws FHIRException {
2177        switch (hash) {
2178        case 1349547969:  return getSequenceElement();
2179        case 3076014:  return getDateElement();
2180        case 1640074445:  return getProcedure(); 
2181        case -1095204141:  return getProcedure(); 
2182        default: return super.makeProperty(hash, name);
2183        }
2184
2185      }
2186
2187      @Override
2188      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2189        switch (hash) {
2190        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2191        case 3076014: /*date*/ return new String[] {"dateTime"};
2192        case -1095204141: /*procedure*/ return new String[] {"CodeableConcept", "Reference"};
2193        default: return super.getTypesForProperty(hash, name);
2194        }
2195
2196      }
2197
2198      @Override
2199      public Base addChild(String name) throws FHIRException {
2200        if (name.equals("sequence")) {
2201          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2202        }
2203        else if (name.equals("date")) {
2204          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
2205        }
2206        else if (name.equals("procedureCodeableConcept")) {
2207          this.procedure = new CodeableConcept();
2208          return this.procedure;
2209        }
2210        else if (name.equals("procedureReference")) {
2211          this.procedure = new Reference();
2212          return this.procedure;
2213        }
2214        else
2215          return super.addChild(name);
2216      }
2217
2218      public ProcedureComponent copy() {
2219        ProcedureComponent dst = new ProcedureComponent();
2220        copyValues(dst);
2221        dst.sequence = sequence == null ? null : sequence.copy();
2222        dst.date = date == null ? null : date.copy();
2223        dst.procedure = procedure == null ? null : procedure.copy();
2224        return dst;
2225      }
2226
2227      @Override
2228      public boolean equalsDeep(Base other) {
2229        if (!super.equalsDeep(other))
2230          return false;
2231        if (!(other instanceof ProcedureComponent))
2232          return false;
2233        ProcedureComponent o = (ProcedureComponent) other;
2234        return compareDeep(sequence, o.sequence, true) && compareDeep(date, o.date, true) && compareDeep(procedure, o.procedure, true)
2235          ;
2236      }
2237
2238      @Override
2239      public boolean equalsShallow(Base other) {
2240        if (!super.equalsShallow(other))
2241          return false;
2242        if (!(other instanceof ProcedureComponent))
2243          return false;
2244        ProcedureComponent o = (ProcedureComponent) other;
2245        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
2246      }
2247
2248      public boolean isEmpty() {
2249        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, date, procedure
2250          );
2251      }
2252
2253  public String fhirType() {
2254    return "ExplanationOfBenefit.procedure";
2255
2256  }
2257
2258  }
2259
2260    @Block()
2261    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
2262        /**
2263         * Reference to the program or plan identification, underwriter or payor.
2264         */
2265        @Child(name = "coverage", type = {Coverage.class}, order=1, min=0, max=1, modifier=false, summary=false)
2266        @Description(shortDefinition="Insurance information", formalDefinition="Reference to the program or plan identification, underwriter or payor." )
2267        protected Reference coverage;
2268
2269        /**
2270         * The actual object that is the target of the reference (Reference to the program or plan identification, underwriter or payor.)
2271         */
2272        protected Coverage coverageTarget;
2273
2274        /**
2275         * A list of references from the Insurer to which these services pertain.
2276         */
2277        @Child(name = "preAuthRef", type = {StringType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2278        @Description(shortDefinition="Pre-Authorization/Determination Reference", formalDefinition="A list of references from the Insurer to which these services pertain." )
2279        protected List<StringType> preAuthRef;
2280
2281        private static final long serialVersionUID = -870298727L;
2282
2283    /**
2284     * Constructor
2285     */
2286      public InsuranceComponent() {
2287        super();
2288      }
2289
2290        /**
2291         * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
2292         */
2293        public Reference getCoverage() { 
2294          if (this.coverage == null)
2295            if (Configuration.errorOnAutoCreate())
2296              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2297            else if (Configuration.doAutoCreate())
2298              this.coverage = new Reference(); // cc
2299          return this.coverage;
2300        }
2301
2302        public boolean hasCoverage() { 
2303          return this.coverage != null && !this.coverage.isEmpty();
2304        }
2305
2306        /**
2307         * @param value {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
2308         */
2309        public InsuranceComponent setCoverage(Reference value) { 
2310          this.coverage = value;
2311          return this;
2312        }
2313
2314        /**
2315         * @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.)
2316         */
2317        public Coverage getCoverageTarget() { 
2318          if (this.coverageTarget == null)
2319            if (Configuration.errorOnAutoCreate())
2320              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2321            else if (Configuration.doAutoCreate())
2322              this.coverageTarget = new Coverage(); // aa
2323          return this.coverageTarget;
2324        }
2325
2326        /**
2327         * @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.)
2328         */
2329        public InsuranceComponent setCoverageTarget(Coverage value) { 
2330          this.coverageTarget = value;
2331          return this;
2332        }
2333
2334        /**
2335         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2336         */
2337        public List<StringType> getPreAuthRef() { 
2338          if (this.preAuthRef == null)
2339            this.preAuthRef = new ArrayList<StringType>();
2340          return this.preAuthRef;
2341        }
2342
2343        /**
2344         * @return Returns a reference to <code>this</code> for easy method chaining
2345         */
2346        public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) { 
2347          this.preAuthRef = thePreAuthRef;
2348          return this;
2349        }
2350
2351        public boolean hasPreAuthRef() { 
2352          if (this.preAuthRef == null)
2353            return false;
2354          for (StringType item : this.preAuthRef)
2355            if (!item.isEmpty())
2356              return true;
2357          return false;
2358        }
2359
2360        /**
2361         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2362         */
2363        public StringType addPreAuthRefElement() {//2 
2364          StringType t = new StringType();
2365          if (this.preAuthRef == null)
2366            this.preAuthRef = new ArrayList<StringType>();
2367          this.preAuthRef.add(t);
2368          return t;
2369        }
2370
2371        /**
2372         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2373         */
2374        public InsuranceComponent addPreAuthRef(String value) { //1
2375          StringType t = new StringType();
2376          t.setValue(value);
2377          if (this.preAuthRef == null)
2378            this.preAuthRef = new ArrayList<StringType>();
2379          this.preAuthRef.add(t);
2380          return this;
2381        }
2382
2383        /**
2384         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2385         */
2386        public boolean hasPreAuthRef(String value) { 
2387          if (this.preAuthRef == null)
2388            return false;
2389          for (StringType v : this.preAuthRef)
2390            if (v.equals(value)) // string
2391              return true;
2392          return false;
2393        }
2394
2395        protected void listChildren(List<Property> childrenList) {
2396          super.listChildren(childrenList);
2397          childrenList.add(new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, java.lang.Integer.MAX_VALUE, coverage));
2398          childrenList.add(new Property("preAuthRef", "string", "A list of references from the Insurer to which these services pertain.", 0, java.lang.Integer.MAX_VALUE, preAuthRef));
2399        }
2400
2401      @Override
2402      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2403        switch (hash) {
2404        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
2405        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
2406        default: return super.getProperty(hash, name, checkValid);
2407        }
2408
2409      }
2410
2411      @Override
2412      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2413        switch (hash) {
2414        case -351767064: // coverage
2415          this.coverage = castToReference(value); // Reference
2416          return value;
2417        case 522246568: // preAuthRef
2418          this.getPreAuthRef().add(castToString(value)); // StringType
2419          return value;
2420        default: return super.setProperty(hash, name, value);
2421        }
2422
2423      }
2424
2425      @Override
2426      public Base setProperty(String name, Base value) throws FHIRException {
2427        if (name.equals("coverage")) {
2428          this.coverage = castToReference(value); // Reference
2429        } else if (name.equals("preAuthRef")) {
2430          this.getPreAuthRef().add(castToString(value));
2431        } else
2432          return super.setProperty(name, value);
2433        return value;
2434      }
2435
2436      @Override
2437      public Base makeProperty(int hash, String name) throws FHIRException {
2438        switch (hash) {
2439        case -351767064:  return getCoverage(); 
2440        case 522246568:  return addPreAuthRefElement();
2441        default: return super.makeProperty(hash, name);
2442        }
2443
2444      }
2445
2446      @Override
2447      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2448        switch (hash) {
2449        case -351767064: /*coverage*/ return new String[] {"Reference"};
2450        case 522246568: /*preAuthRef*/ return new String[] {"string"};
2451        default: return super.getTypesForProperty(hash, name);
2452        }
2453
2454      }
2455
2456      @Override
2457      public Base addChild(String name) throws FHIRException {
2458        if (name.equals("coverage")) {
2459          this.coverage = new Reference();
2460          return this.coverage;
2461        }
2462        else if (name.equals("preAuthRef")) {
2463          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
2464        }
2465        else
2466          return super.addChild(name);
2467      }
2468
2469      public InsuranceComponent copy() {
2470        InsuranceComponent dst = new InsuranceComponent();
2471        copyValues(dst);
2472        dst.coverage = coverage == null ? null : coverage.copy();
2473        if (preAuthRef != null) {
2474          dst.preAuthRef = new ArrayList<StringType>();
2475          for (StringType i : preAuthRef)
2476            dst.preAuthRef.add(i.copy());
2477        };
2478        return dst;
2479      }
2480
2481      @Override
2482      public boolean equalsDeep(Base other) {
2483        if (!super.equalsDeep(other))
2484          return false;
2485        if (!(other instanceof InsuranceComponent))
2486          return false;
2487        InsuranceComponent o = (InsuranceComponent) other;
2488        return compareDeep(coverage, o.coverage, true) && compareDeep(preAuthRef, o.preAuthRef, true);
2489      }
2490
2491      @Override
2492      public boolean equalsShallow(Base other) {
2493        if (!super.equalsShallow(other))
2494          return false;
2495        if (!(other instanceof InsuranceComponent))
2496          return false;
2497        InsuranceComponent o = (InsuranceComponent) other;
2498        return compareValues(preAuthRef, o.preAuthRef, true);
2499      }
2500
2501      public boolean isEmpty() {
2502        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(coverage, preAuthRef);
2503      }
2504
2505  public String fhirType() {
2506    return "ExplanationOfBenefit.insurance";
2507
2508  }
2509
2510  }
2511
2512    @Block()
2513    public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
2514        /**
2515         * Date of an accident which these services are addressing.
2516         */
2517        @Child(name = "date", type = {DateType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2518        @Description(shortDefinition="When the accident occurred", formalDefinition="Date of an accident which these services are addressing." )
2519        protected DateType date;
2520
2521        /**
2522         * Type of accident: work, auto, etc.
2523         */
2524        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
2525        @Description(shortDefinition="The nature of the accident", formalDefinition="Type of accident: work, auto, etc." )
2526        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActIncidentCode")
2527        protected CodeableConcept type;
2528
2529        /**
2530         * Where the accident occurred.
2531         */
2532        @Child(name = "location", type = {Address.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=false)
2533        @Description(shortDefinition="Accident Place", formalDefinition="Where the accident occurred." )
2534        protected Type location;
2535
2536        private static final long serialVersionUID = 622904984L;
2537
2538    /**
2539     * Constructor
2540     */
2541      public AccidentComponent() {
2542        super();
2543      }
2544
2545        /**
2546         * @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
2547         */
2548        public DateType getDateElement() { 
2549          if (this.date == null)
2550            if (Configuration.errorOnAutoCreate())
2551              throw new Error("Attempt to auto-create AccidentComponent.date");
2552            else if (Configuration.doAutoCreate())
2553              this.date = new DateType(); // bb
2554          return this.date;
2555        }
2556
2557        public boolean hasDateElement() { 
2558          return this.date != null && !this.date.isEmpty();
2559        }
2560
2561        public boolean hasDate() { 
2562          return this.date != null && !this.date.isEmpty();
2563        }
2564
2565        /**
2566         * @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
2567         */
2568        public AccidentComponent setDateElement(DateType value) { 
2569          this.date = value;
2570          return this;
2571        }
2572
2573        /**
2574         * @return Date of an accident which these services are addressing.
2575         */
2576        public Date getDate() { 
2577          return this.date == null ? null : this.date.getValue();
2578        }
2579
2580        /**
2581         * @param value Date of an accident which these services are addressing.
2582         */
2583        public AccidentComponent setDate(Date value) { 
2584          if (value == null)
2585            this.date = null;
2586          else {
2587            if (this.date == null)
2588              this.date = new DateType();
2589            this.date.setValue(value);
2590          }
2591          return this;
2592        }
2593
2594        /**
2595         * @return {@link #type} (Type of accident: work, auto, etc.)
2596         */
2597        public CodeableConcept getType() { 
2598          if (this.type == null)
2599            if (Configuration.errorOnAutoCreate())
2600              throw new Error("Attempt to auto-create AccidentComponent.type");
2601            else if (Configuration.doAutoCreate())
2602              this.type = new CodeableConcept(); // cc
2603          return this.type;
2604        }
2605
2606        public boolean hasType() { 
2607          return this.type != null && !this.type.isEmpty();
2608        }
2609
2610        /**
2611         * @param value {@link #type} (Type of accident: work, auto, etc.)
2612         */
2613        public AccidentComponent setType(CodeableConcept value) { 
2614          this.type = value;
2615          return this;
2616        }
2617
2618        /**
2619         * @return {@link #location} (Where the accident occurred.)
2620         */
2621        public Type getLocation() { 
2622          return this.location;
2623        }
2624
2625        /**
2626         * @return {@link #location} (Where the accident occurred.)
2627         */
2628        public Address getLocationAddress() throws FHIRException { 
2629          if (!(this.location instanceof Address))
2630            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
2631          return (Address) this.location;
2632        }
2633
2634        public boolean hasLocationAddress() { 
2635          return this.location instanceof Address;
2636        }
2637
2638        /**
2639         * @return {@link #location} (Where the accident occurred.)
2640         */
2641        public Reference getLocationReference() throws FHIRException { 
2642          if (!(this.location instanceof Reference))
2643            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
2644          return (Reference) this.location;
2645        }
2646
2647        public boolean hasLocationReference() { 
2648          return this.location instanceof Reference;
2649        }
2650
2651        public boolean hasLocation() { 
2652          return this.location != null && !this.location.isEmpty();
2653        }
2654
2655        /**
2656         * @param value {@link #location} (Where the accident occurred.)
2657         */
2658        public AccidentComponent setLocation(Type value) { 
2659          this.location = value;
2660          return this;
2661        }
2662
2663        protected void listChildren(List<Property> childrenList) {
2664          super.listChildren(childrenList);
2665          childrenList.add(new Property("date", "date", "Date of an accident which these services are addressing.", 0, java.lang.Integer.MAX_VALUE, date));
2666          childrenList.add(new Property("type", "CodeableConcept", "Type of accident: work, auto, etc.", 0, java.lang.Integer.MAX_VALUE, type));
2667          childrenList.add(new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, java.lang.Integer.MAX_VALUE, location));
2668        }
2669
2670      @Override
2671      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2672        switch (hash) {
2673        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
2674        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2675        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
2676        default: return super.getProperty(hash, name, checkValid);
2677        }
2678
2679      }
2680
2681      @Override
2682      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2683        switch (hash) {
2684        case 3076014: // date
2685          this.date = castToDate(value); // DateType
2686          return value;
2687        case 3575610: // type
2688          this.type = castToCodeableConcept(value); // CodeableConcept
2689          return value;
2690        case 1901043637: // location
2691          this.location = castToType(value); // Type
2692          return value;
2693        default: return super.setProperty(hash, name, value);
2694        }
2695
2696      }
2697
2698      @Override
2699      public Base setProperty(String name, Base value) throws FHIRException {
2700        if (name.equals("date")) {
2701          this.date = castToDate(value); // DateType
2702        } else if (name.equals("type")) {
2703          this.type = castToCodeableConcept(value); // CodeableConcept
2704        } else if (name.equals("location[x]")) {
2705          this.location = castToType(value); // Type
2706        } else
2707          return super.setProperty(name, value);
2708        return value;
2709      }
2710
2711      @Override
2712      public Base makeProperty(int hash, String name) throws FHIRException {
2713        switch (hash) {
2714        case 3076014:  return getDateElement();
2715        case 3575610:  return getType(); 
2716        case 552316075:  return getLocation(); 
2717        case 1901043637:  return getLocation(); 
2718        default: return super.makeProperty(hash, name);
2719        }
2720
2721      }
2722
2723      @Override
2724      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2725        switch (hash) {
2726        case 3076014: /*date*/ return new String[] {"date"};
2727        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2728        case 1901043637: /*location*/ return new String[] {"Address", "Reference"};
2729        default: return super.getTypesForProperty(hash, name);
2730        }
2731
2732      }
2733
2734      @Override
2735      public Base addChild(String name) throws FHIRException {
2736        if (name.equals("date")) {
2737          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
2738        }
2739        else if (name.equals("type")) {
2740          this.type = new CodeableConcept();
2741          return this.type;
2742        }
2743        else if (name.equals("locationAddress")) {
2744          this.location = new Address();
2745          return this.location;
2746        }
2747        else if (name.equals("locationReference")) {
2748          this.location = new Reference();
2749          return this.location;
2750        }
2751        else
2752          return super.addChild(name);
2753      }
2754
2755      public AccidentComponent copy() {
2756        AccidentComponent dst = new AccidentComponent();
2757        copyValues(dst);
2758        dst.date = date == null ? null : date.copy();
2759        dst.type = type == null ? null : type.copy();
2760        dst.location = location == null ? null : location.copy();
2761        return dst;
2762      }
2763
2764      @Override
2765      public boolean equalsDeep(Base other) {
2766        if (!super.equalsDeep(other))
2767          return false;
2768        if (!(other instanceof AccidentComponent))
2769          return false;
2770        AccidentComponent o = (AccidentComponent) other;
2771        return compareDeep(date, o.date, true) && compareDeep(type, o.type, true) && compareDeep(location, o.location, true)
2772          ;
2773      }
2774
2775      @Override
2776      public boolean equalsShallow(Base other) {
2777        if (!super.equalsShallow(other))
2778          return false;
2779        if (!(other instanceof AccidentComponent))
2780          return false;
2781        AccidentComponent o = (AccidentComponent) other;
2782        return compareValues(date, o.date, true);
2783      }
2784
2785      public boolean isEmpty() {
2786        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
2787      }
2788
2789  public String fhirType() {
2790    return "ExplanationOfBenefit.accident";
2791
2792  }
2793
2794  }
2795
2796    @Block()
2797    public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
2798        /**
2799         * A service line number.
2800         */
2801        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2802        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
2803        protected PositiveIntType sequence;
2804
2805        /**
2806         * Careteam applicable for this service or product line.
2807         */
2808        @Child(name = "careTeamLinkId", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2809        @Description(shortDefinition="Applicable careteam members", formalDefinition="Careteam applicable for this service or product line." )
2810        protected List<PositiveIntType> careTeamLinkId;
2811
2812        /**
2813         * Diagnosis applicable for this service or product line.
2814         */
2815        @Child(name = "diagnosisLinkId", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2816        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnosis applicable for this service or product line." )
2817        protected List<PositiveIntType> diagnosisLinkId;
2818
2819        /**
2820         * Procedures applicable for this service or product line.
2821         */
2822        @Child(name = "procedureLinkId", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2823        @Description(shortDefinition="Applicable procedures", formalDefinition="Procedures applicable for this service or product line." )
2824        protected List<PositiveIntType> procedureLinkId;
2825
2826        /**
2827         * Exceptions, special conditions and supporting information pplicable for this service or product line.
2828         */
2829        @Child(name = "informationLinkId", type = {PositiveIntType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2830        @Description(shortDefinition="Applicable exception and supporting information", formalDefinition="Exceptions, special conditions and supporting information pplicable for this service or product line." )
2831        protected List<PositiveIntType> informationLinkId;
2832
2833        /**
2834         * The type of reveneu or cost center providing the product and/or service.
2835         */
2836        @Child(name = "revenue", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
2837        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
2838        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
2839        protected CodeableConcept revenue;
2840
2841        /**
2842         * Health Care Service Type Codes  to identify the classification of service or benefits.
2843         */
2844        @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
2845        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
2846        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
2847        protected CodeableConcept category;
2848
2849        /**
2850         * 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'.
2851         */
2852        @Child(name = "service", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
2853        @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'." )
2854        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
2855        protected CodeableConcept service;
2856
2857        /**
2858         * 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.
2859         */
2860        @Child(name = "modifier", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2861        @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." )
2862        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
2863        protected List<CodeableConcept> modifier;
2864
2865        /**
2866         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
2867         */
2868        @Child(name = "programCode", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2869        @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." )
2870        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
2871        protected List<CodeableConcept> programCode;
2872
2873        /**
2874         * The date or dates when the enclosed suite of services were performed or completed.
2875         */
2876        @Child(name = "serviced", type = {DateType.class, Period.class}, order=11, min=0, max=1, modifier=false, summary=false)
2877        @Description(shortDefinition="Date or dates of Service", formalDefinition="The date or dates when the enclosed suite of services were performed or completed." )
2878        protected Type serviced;
2879
2880        /**
2881         * Where the service was provided.
2882         */
2883        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
2884        @Description(shortDefinition="Place of service", formalDefinition="Where the service was provided." )
2885        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
2886        protected Type location;
2887
2888        /**
2889         * The number of repetitions of a service or product.
2890         */
2891        @Child(name = "quantity", type = {SimpleQuantity.class}, order=13, min=0, max=1, modifier=false, summary=false)
2892        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
2893        protected SimpleQuantity quantity;
2894
2895        /**
2896         * 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.
2897         */
2898        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
2899        @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." )
2900        protected Money unitPrice;
2901
2902        /**
2903         * 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.
2904         */
2905        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=false)
2906        @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." )
2907        protected DecimalType factor;
2908
2909        /**
2910         * 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.
2911         */
2912        @Child(name = "net", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
2913        @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." )
2914        protected Money net;
2915
2916        /**
2917         * List of Unique Device Identifiers associated with this line item.
2918         */
2919        @Child(name = "udi", type = {Device.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2920        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
2921        protected List<Reference> udi;
2922        /**
2923         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
2924         */
2925        protected List<Device> udiTarget;
2926
2927
2928        /**
2929         * Physical service site on the patient (limb, tooth, etc).
2930         */
2931        @Child(name = "bodySite", type = {CodeableConcept.class}, order=18, min=0, max=1, modifier=false, summary=false)
2932        @Description(shortDefinition="Service Location", formalDefinition="Physical service site on the patient (limb, tooth, etc)." )
2933        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
2934        protected CodeableConcept bodySite;
2935
2936        /**
2937         * A region or surface of the site, eg. limb region or tooth surface(s).
2938         */
2939        @Child(name = "subSite", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2940        @Description(shortDefinition="Service Sub-location", formalDefinition="A region or surface of the site, eg. limb region or tooth surface(s)." )
2941        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
2942        protected List<CodeableConcept> subSite;
2943
2944        /**
2945         * A billed item may include goods or services provided in multiple encounters.
2946         */
2947        @Child(name = "encounter", type = {Encounter.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2948        @Description(shortDefinition="Encounters related to this billed item", formalDefinition="A billed item may include goods or services provided in multiple encounters." )
2949        protected List<Reference> encounter;
2950        /**
2951         * The actual objects that are the target of the reference (A billed item may include goods or services provided in multiple encounters.)
2952         */
2953        protected List<Encounter> encounterTarget;
2954
2955
2956        /**
2957         * A list of note references to the notes provided below.
2958         */
2959        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2960        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
2961        protected List<PositiveIntType> noteNumber;
2962
2963        /**
2964         * The adjudications results.
2965         */
2966        @Child(name = "adjudication", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2967        @Description(shortDefinition="Adjudication details", formalDefinition="The adjudications results." )
2968        protected List<AdjudicationComponent> adjudication;
2969
2970        /**
2971         * Second tier of goods and services.
2972         */
2973        @Child(name = "detail", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2974        @Description(shortDefinition="Additional items", formalDefinition="Second tier of goods and services." )
2975        protected List<DetailComponent> detail;
2976
2977        private static final long serialVersionUID = -1567825229L;
2978
2979    /**
2980     * Constructor
2981     */
2982      public ItemComponent() {
2983        super();
2984      }
2985
2986    /**
2987     * Constructor
2988     */
2989      public ItemComponent(PositiveIntType sequence) {
2990        super();
2991        this.sequence = sequence;
2992      }
2993
2994        /**
2995         * @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
2996         */
2997        public PositiveIntType getSequenceElement() { 
2998          if (this.sequence == null)
2999            if (Configuration.errorOnAutoCreate())
3000              throw new Error("Attempt to auto-create ItemComponent.sequence");
3001            else if (Configuration.doAutoCreate())
3002              this.sequence = new PositiveIntType(); // bb
3003          return this.sequence;
3004        }
3005
3006        public boolean hasSequenceElement() { 
3007          return this.sequence != null && !this.sequence.isEmpty();
3008        }
3009
3010        public boolean hasSequence() { 
3011          return this.sequence != null && !this.sequence.isEmpty();
3012        }
3013
3014        /**
3015         * @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
3016         */
3017        public ItemComponent setSequenceElement(PositiveIntType value) { 
3018          this.sequence = value;
3019          return this;
3020        }
3021
3022        /**
3023         * @return A service line number.
3024         */
3025        public int getSequence() { 
3026          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3027        }
3028
3029        /**
3030         * @param value A service line number.
3031         */
3032        public ItemComponent setSequence(int value) { 
3033            if (this.sequence == null)
3034              this.sequence = new PositiveIntType();
3035            this.sequence.setValue(value);
3036          return this;
3037        }
3038
3039        /**
3040         * @return {@link #careTeamLinkId} (Careteam applicable for this service or product line.)
3041         */
3042        public List<PositiveIntType> getCareTeamLinkId() { 
3043          if (this.careTeamLinkId == null)
3044            this.careTeamLinkId = new ArrayList<PositiveIntType>();
3045          return this.careTeamLinkId;
3046        }
3047
3048        /**
3049         * @return Returns a reference to <code>this</code> for easy method chaining
3050         */
3051        public ItemComponent setCareTeamLinkId(List<PositiveIntType> theCareTeamLinkId) { 
3052          this.careTeamLinkId = theCareTeamLinkId;
3053          return this;
3054        }
3055
3056        public boolean hasCareTeamLinkId() { 
3057          if (this.careTeamLinkId == null)
3058            return false;
3059          for (PositiveIntType item : this.careTeamLinkId)
3060            if (!item.isEmpty())
3061              return true;
3062          return false;
3063        }
3064
3065        /**
3066         * @return {@link #careTeamLinkId} (Careteam applicable for this service or product line.)
3067         */
3068        public PositiveIntType addCareTeamLinkIdElement() {//2 
3069          PositiveIntType t = new PositiveIntType();
3070          if (this.careTeamLinkId == null)
3071            this.careTeamLinkId = new ArrayList<PositiveIntType>();
3072          this.careTeamLinkId.add(t);
3073          return t;
3074        }
3075
3076        /**
3077         * @param value {@link #careTeamLinkId} (Careteam applicable for this service or product line.)
3078         */
3079        public ItemComponent addCareTeamLinkId(int value) { //1
3080          PositiveIntType t = new PositiveIntType();
3081          t.setValue(value);
3082          if (this.careTeamLinkId == null)
3083            this.careTeamLinkId = new ArrayList<PositiveIntType>();
3084          this.careTeamLinkId.add(t);
3085          return this;
3086        }
3087
3088        /**
3089         * @param value {@link #careTeamLinkId} (Careteam applicable for this service or product line.)
3090         */
3091        public boolean hasCareTeamLinkId(int value) { 
3092          if (this.careTeamLinkId == null)
3093            return false;
3094          for (PositiveIntType v : this.careTeamLinkId)
3095            if (v.equals(value)) // positiveInt
3096              return true;
3097          return false;
3098        }
3099
3100        /**
3101         * @return {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
3102         */
3103        public List<PositiveIntType> getDiagnosisLinkId() { 
3104          if (this.diagnosisLinkId == null)
3105            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
3106          return this.diagnosisLinkId;
3107        }
3108
3109        /**
3110         * @return Returns a reference to <code>this</code> for easy method chaining
3111         */
3112        public ItemComponent setDiagnosisLinkId(List<PositiveIntType> theDiagnosisLinkId) { 
3113          this.diagnosisLinkId = theDiagnosisLinkId;
3114          return this;
3115        }
3116
3117        public boolean hasDiagnosisLinkId() { 
3118          if (this.diagnosisLinkId == null)
3119            return false;
3120          for (PositiveIntType item : this.diagnosisLinkId)
3121            if (!item.isEmpty())
3122              return true;
3123          return false;
3124        }
3125
3126        /**
3127         * @return {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
3128         */
3129        public PositiveIntType addDiagnosisLinkIdElement() {//2 
3130          PositiveIntType t = new PositiveIntType();
3131          if (this.diagnosisLinkId == null)
3132            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
3133          this.diagnosisLinkId.add(t);
3134          return t;
3135        }
3136
3137        /**
3138         * @param value {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
3139         */
3140        public ItemComponent addDiagnosisLinkId(int value) { //1
3141          PositiveIntType t = new PositiveIntType();
3142          t.setValue(value);
3143          if (this.diagnosisLinkId == null)
3144            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
3145          this.diagnosisLinkId.add(t);
3146          return this;
3147        }
3148
3149        /**
3150         * @param value {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
3151         */
3152        public boolean hasDiagnosisLinkId(int value) { 
3153          if (this.diagnosisLinkId == null)
3154            return false;
3155          for (PositiveIntType v : this.diagnosisLinkId)
3156            if (v.equals(value)) // positiveInt
3157              return true;
3158          return false;
3159        }
3160
3161        /**
3162         * @return {@link #procedureLinkId} (Procedures applicable for this service or product line.)
3163         */
3164        public List<PositiveIntType> getProcedureLinkId() { 
3165          if (this.procedureLinkId == null)
3166            this.procedureLinkId = new ArrayList<PositiveIntType>();
3167          return this.procedureLinkId;
3168        }
3169
3170        /**
3171         * @return Returns a reference to <code>this</code> for easy method chaining
3172         */
3173        public ItemComponent setProcedureLinkId(List<PositiveIntType> theProcedureLinkId) { 
3174          this.procedureLinkId = theProcedureLinkId;
3175          return this;
3176        }
3177
3178        public boolean hasProcedureLinkId() { 
3179          if (this.procedureLinkId == null)
3180            return false;
3181          for (PositiveIntType item : this.procedureLinkId)
3182            if (!item.isEmpty())
3183              return true;
3184          return false;
3185        }
3186
3187        /**
3188         * @return {@link #procedureLinkId} (Procedures applicable for this service or product line.)
3189         */
3190        public PositiveIntType addProcedureLinkIdElement() {//2 
3191          PositiveIntType t = new PositiveIntType();
3192          if (this.procedureLinkId == null)
3193            this.procedureLinkId = new ArrayList<PositiveIntType>();
3194          this.procedureLinkId.add(t);
3195          return t;
3196        }
3197
3198        /**
3199         * @param value {@link #procedureLinkId} (Procedures applicable for this service or product line.)
3200         */
3201        public ItemComponent addProcedureLinkId(int value) { //1
3202          PositiveIntType t = new PositiveIntType();
3203          t.setValue(value);
3204          if (this.procedureLinkId == null)
3205            this.procedureLinkId = new ArrayList<PositiveIntType>();
3206          this.procedureLinkId.add(t);
3207          return this;
3208        }
3209
3210        /**
3211         * @param value {@link #procedureLinkId} (Procedures applicable for this service or product line.)
3212         */
3213        public boolean hasProcedureLinkId(int value) { 
3214          if (this.procedureLinkId == null)
3215            return false;
3216          for (PositiveIntType v : this.procedureLinkId)
3217            if (v.equals(value)) // positiveInt
3218              return true;
3219          return false;
3220        }
3221
3222        /**
3223         * @return {@link #informationLinkId} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3224         */
3225        public List<PositiveIntType> getInformationLinkId() { 
3226          if (this.informationLinkId == null)
3227            this.informationLinkId = new ArrayList<PositiveIntType>();
3228          return this.informationLinkId;
3229        }
3230
3231        /**
3232         * @return Returns a reference to <code>this</code> for easy method chaining
3233         */
3234        public ItemComponent setInformationLinkId(List<PositiveIntType> theInformationLinkId) { 
3235          this.informationLinkId = theInformationLinkId;
3236          return this;
3237        }
3238
3239        public boolean hasInformationLinkId() { 
3240          if (this.informationLinkId == null)
3241            return false;
3242          for (PositiveIntType item : this.informationLinkId)
3243            if (!item.isEmpty())
3244              return true;
3245          return false;
3246        }
3247
3248        /**
3249         * @return {@link #informationLinkId} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3250         */
3251        public PositiveIntType addInformationLinkIdElement() {//2 
3252          PositiveIntType t = new PositiveIntType();
3253          if (this.informationLinkId == null)
3254            this.informationLinkId = new ArrayList<PositiveIntType>();
3255          this.informationLinkId.add(t);
3256          return t;
3257        }
3258
3259        /**
3260         * @param value {@link #informationLinkId} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3261         */
3262        public ItemComponent addInformationLinkId(int value) { //1
3263          PositiveIntType t = new PositiveIntType();
3264          t.setValue(value);
3265          if (this.informationLinkId == null)
3266            this.informationLinkId = new ArrayList<PositiveIntType>();
3267          this.informationLinkId.add(t);
3268          return this;
3269        }
3270
3271        /**
3272         * @param value {@link #informationLinkId} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3273         */
3274        public boolean hasInformationLinkId(int value) { 
3275          if (this.informationLinkId == null)
3276            return false;
3277          for (PositiveIntType v : this.informationLinkId)
3278            if (v.equals(value)) // positiveInt
3279              return true;
3280          return false;
3281        }
3282
3283        /**
3284         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
3285         */
3286        public CodeableConcept getRevenue() { 
3287          if (this.revenue == null)
3288            if (Configuration.errorOnAutoCreate())
3289              throw new Error("Attempt to auto-create ItemComponent.revenue");
3290            else if (Configuration.doAutoCreate())
3291              this.revenue = new CodeableConcept(); // cc
3292          return this.revenue;
3293        }
3294
3295        public boolean hasRevenue() { 
3296          return this.revenue != null && !this.revenue.isEmpty();
3297        }
3298
3299        /**
3300         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
3301         */
3302        public ItemComponent setRevenue(CodeableConcept value) { 
3303          this.revenue = value;
3304          return this;
3305        }
3306
3307        /**
3308         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
3309         */
3310        public CodeableConcept getCategory() { 
3311          if (this.category == null)
3312            if (Configuration.errorOnAutoCreate())
3313              throw new Error("Attempt to auto-create ItemComponent.category");
3314            else if (Configuration.doAutoCreate())
3315              this.category = new CodeableConcept(); // cc
3316          return this.category;
3317        }
3318
3319        public boolean hasCategory() { 
3320          return this.category != null && !this.category.isEmpty();
3321        }
3322
3323        /**
3324         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
3325         */
3326        public ItemComponent setCategory(CodeableConcept value) { 
3327          this.category = value;
3328          return this;
3329        }
3330
3331        /**
3332         * @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'.)
3333         */
3334        public CodeableConcept getService() { 
3335          if (this.service == null)
3336            if (Configuration.errorOnAutoCreate())
3337              throw new Error("Attempt to auto-create ItemComponent.service");
3338            else if (Configuration.doAutoCreate())
3339              this.service = new CodeableConcept(); // cc
3340          return this.service;
3341        }
3342
3343        public boolean hasService() { 
3344          return this.service != null && !this.service.isEmpty();
3345        }
3346
3347        /**
3348         * @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'.)
3349         */
3350        public ItemComponent setService(CodeableConcept value) { 
3351          this.service = value;
3352          return this;
3353        }
3354
3355        /**
3356         * @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.)
3357         */
3358        public List<CodeableConcept> getModifier() { 
3359          if (this.modifier == null)
3360            this.modifier = new ArrayList<CodeableConcept>();
3361          return this.modifier;
3362        }
3363
3364        /**
3365         * @return Returns a reference to <code>this</code> for easy method chaining
3366         */
3367        public ItemComponent setModifier(List<CodeableConcept> theModifier) { 
3368          this.modifier = theModifier;
3369          return this;
3370        }
3371
3372        public boolean hasModifier() { 
3373          if (this.modifier == null)
3374            return false;
3375          for (CodeableConcept item : this.modifier)
3376            if (!item.isEmpty())
3377              return true;
3378          return false;
3379        }
3380
3381        public CodeableConcept addModifier() { //3
3382          CodeableConcept t = new CodeableConcept();
3383          if (this.modifier == null)
3384            this.modifier = new ArrayList<CodeableConcept>();
3385          this.modifier.add(t);
3386          return t;
3387        }
3388
3389        public ItemComponent addModifier(CodeableConcept t) { //3
3390          if (t == null)
3391            return this;
3392          if (this.modifier == null)
3393            this.modifier = new ArrayList<CodeableConcept>();
3394          this.modifier.add(t);
3395          return this;
3396        }
3397
3398        /**
3399         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
3400         */
3401        public CodeableConcept getModifierFirstRep() { 
3402          if (getModifier().isEmpty()) {
3403            addModifier();
3404          }
3405          return getModifier().get(0);
3406        }
3407
3408        /**
3409         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
3410         */
3411        public List<CodeableConcept> getProgramCode() { 
3412          if (this.programCode == null)
3413            this.programCode = new ArrayList<CodeableConcept>();
3414          return this.programCode;
3415        }
3416
3417        /**
3418         * @return Returns a reference to <code>this</code> for easy method chaining
3419         */
3420        public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
3421          this.programCode = theProgramCode;
3422          return this;
3423        }
3424
3425        public boolean hasProgramCode() { 
3426          if (this.programCode == null)
3427            return false;
3428          for (CodeableConcept item : this.programCode)
3429            if (!item.isEmpty())
3430              return true;
3431          return false;
3432        }
3433
3434        public CodeableConcept addProgramCode() { //3
3435          CodeableConcept t = new CodeableConcept();
3436          if (this.programCode == null)
3437            this.programCode = new ArrayList<CodeableConcept>();
3438          this.programCode.add(t);
3439          return t;
3440        }
3441
3442        public ItemComponent addProgramCode(CodeableConcept t) { //3
3443          if (t == null)
3444            return this;
3445          if (this.programCode == null)
3446            this.programCode = new ArrayList<CodeableConcept>();
3447          this.programCode.add(t);
3448          return this;
3449        }
3450
3451        /**
3452         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
3453         */
3454        public CodeableConcept getProgramCodeFirstRep() { 
3455          if (getProgramCode().isEmpty()) {
3456            addProgramCode();
3457          }
3458          return getProgramCode().get(0);
3459        }
3460
3461        /**
3462         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3463         */
3464        public Type getServiced() { 
3465          return this.serviced;
3466        }
3467
3468        /**
3469         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3470         */
3471        public DateType getServicedDateType() throws FHIRException { 
3472          if (!(this.serviced instanceof DateType))
3473            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
3474          return (DateType) this.serviced;
3475        }
3476
3477        public boolean hasServicedDateType() { 
3478          return this.serviced instanceof DateType;
3479        }
3480
3481        /**
3482         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3483         */
3484        public Period getServicedPeriod() throws FHIRException { 
3485          if (!(this.serviced instanceof Period))
3486            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
3487          return (Period) this.serviced;
3488        }
3489
3490        public boolean hasServicedPeriod() { 
3491          return this.serviced instanceof Period;
3492        }
3493
3494        public boolean hasServiced() { 
3495          return this.serviced != null && !this.serviced.isEmpty();
3496        }
3497
3498        /**
3499         * @param value {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3500         */
3501        public ItemComponent setServiced(Type value) { 
3502          this.serviced = value;
3503          return this;
3504        }
3505
3506        /**
3507         * @return {@link #location} (Where the service was provided.)
3508         */
3509        public Type getLocation() { 
3510          return this.location;
3511        }
3512
3513        /**
3514         * @return {@link #location} (Where the service was provided.)
3515         */
3516        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
3517          if (!(this.location instanceof CodeableConcept))
3518            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
3519          return (CodeableConcept) this.location;
3520        }
3521
3522        public boolean hasLocationCodeableConcept() { 
3523          return this.location instanceof CodeableConcept;
3524        }
3525
3526        /**
3527         * @return {@link #location} (Where the service was provided.)
3528         */
3529        public Address getLocationAddress() throws FHIRException { 
3530          if (!(this.location instanceof Address))
3531            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3532          return (Address) this.location;
3533        }
3534
3535        public boolean hasLocationAddress() { 
3536          return this.location instanceof Address;
3537        }
3538
3539        /**
3540         * @return {@link #location} (Where the service was provided.)
3541         */
3542        public Reference getLocationReference() throws FHIRException { 
3543          if (!(this.location instanceof Reference))
3544            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3545          return (Reference) this.location;
3546        }
3547
3548        public boolean hasLocationReference() { 
3549          return this.location instanceof Reference;
3550        }
3551
3552        public boolean hasLocation() { 
3553          return this.location != null && !this.location.isEmpty();
3554        }
3555
3556        /**
3557         * @param value {@link #location} (Where the service was provided.)
3558         */
3559        public ItemComponent setLocation(Type value) { 
3560          this.location = value;
3561          return this;
3562        }
3563
3564        /**
3565         * @return {@link #quantity} (The number of repetitions of a service or product.)
3566         */
3567        public SimpleQuantity getQuantity() { 
3568          if (this.quantity == null)
3569            if (Configuration.errorOnAutoCreate())
3570              throw new Error("Attempt to auto-create ItemComponent.quantity");
3571            else if (Configuration.doAutoCreate())
3572              this.quantity = new SimpleQuantity(); // cc
3573          return this.quantity;
3574        }
3575
3576        public boolean hasQuantity() { 
3577          return this.quantity != null && !this.quantity.isEmpty();
3578        }
3579
3580        /**
3581         * @param value {@link #quantity} (The number of repetitions of a service or product.)
3582         */
3583        public ItemComponent setQuantity(SimpleQuantity value) { 
3584          this.quantity = value;
3585          return this;
3586        }
3587
3588        /**
3589         * @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.)
3590         */
3591        public Money getUnitPrice() { 
3592          if (this.unitPrice == null)
3593            if (Configuration.errorOnAutoCreate())
3594              throw new Error("Attempt to auto-create ItemComponent.unitPrice");
3595            else if (Configuration.doAutoCreate())
3596              this.unitPrice = new Money(); // cc
3597          return this.unitPrice;
3598        }
3599
3600        public boolean hasUnitPrice() { 
3601          return this.unitPrice != null && !this.unitPrice.isEmpty();
3602        }
3603
3604        /**
3605         * @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.)
3606         */
3607        public ItemComponent setUnitPrice(Money value) { 
3608          this.unitPrice = value;
3609          return this;
3610        }
3611
3612        /**
3613         * @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
3614         */
3615        public DecimalType getFactorElement() { 
3616          if (this.factor == null)
3617            if (Configuration.errorOnAutoCreate())
3618              throw new Error("Attempt to auto-create ItemComponent.factor");
3619            else if (Configuration.doAutoCreate())
3620              this.factor = new DecimalType(); // bb
3621          return this.factor;
3622        }
3623
3624        public boolean hasFactorElement() { 
3625          return this.factor != null && !this.factor.isEmpty();
3626        }
3627
3628        public boolean hasFactor() { 
3629          return this.factor != null && !this.factor.isEmpty();
3630        }
3631
3632        /**
3633         * @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
3634         */
3635        public ItemComponent setFactorElement(DecimalType value) { 
3636          this.factor = value;
3637          return this;
3638        }
3639
3640        /**
3641         * @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.
3642         */
3643        public BigDecimal getFactor() { 
3644          return this.factor == null ? null : this.factor.getValue();
3645        }
3646
3647        /**
3648         * @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.
3649         */
3650        public ItemComponent setFactor(BigDecimal value) { 
3651          if (value == null)
3652            this.factor = null;
3653          else {
3654            if (this.factor == null)
3655              this.factor = new DecimalType();
3656            this.factor.setValue(value);
3657          }
3658          return this;
3659        }
3660
3661        /**
3662         * @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.
3663         */
3664        public ItemComponent setFactor(long value) { 
3665              this.factor = new DecimalType();
3666            this.factor.setValue(value);
3667          return this;
3668        }
3669
3670        /**
3671         * @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.
3672         */
3673        public ItemComponent setFactor(double value) { 
3674              this.factor = new DecimalType();
3675            this.factor.setValue(value);
3676          return this;
3677        }
3678
3679        /**
3680         * @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.)
3681         */
3682        public Money getNet() { 
3683          if (this.net == null)
3684            if (Configuration.errorOnAutoCreate())
3685              throw new Error("Attempt to auto-create ItemComponent.net");
3686            else if (Configuration.doAutoCreate())
3687              this.net = new Money(); // cc
3688          return this.net;
3689        }
3690
3691        public boolean hasNet() { 
3692          return this.net != null && !this.net.isEmpty();
3693        }
3694
3695        /**
3696         * @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.)
3697         */
3698        public ItemComponent setNet(Money value) { 
3699          this.net = value;
3700          return this;
3701        }
3702
3703        /**
3704         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
3705         */
3706        public List<Reference> getUdi() { 
3707          if (this.udi == null)
3708            this.udi = new ArrayList<Reference>();
3709          return this.udi;
3710        }
3711
3712        /**
3713         * @return Returns a reference to <code>this</code> for easy method chaining
3714         */
3715        public ItemComponent setUdi(List<Reference> theUdi) { 
3716          this.udi = theUdi;
3717          return this;
3718        }
3719
3720        public boolean hasUdi() { 
3721          if (this.udi == null)
3722            return false;
3723          for (Reference item : this.udi)
3724            if (!item.isEmpty())
3725              return true;
3726          return false;
3727        }
3728
3729        public Reference addUdi() { //3
3730          Reference t = new Reference();
3731          if (this.udi == null)
3732            this.udi = new ArrayList<Reference>();
3733          this.udi.add(t);
3734          return t;
3735        }
3736
3737        public ItemComponent addUdi(Reference t) { //3
3738          if (t == null)
3739            return this;
3740          if (this.udi == null)
3741            this.udi = new ArrayList<Reference>();
3742          this.udi.add(t);
3743          return this;
3744        }
3745
3746        /**
3747         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
3748         */
3749        public Reference getUdiFirstRep() { 
3750          if (getUdi().isEmpty()) {
3751            addUdi();
3752          }
3753          return getUdi().get(0);
3754        }
3755
3756        /**
3757         * @deprecated Use Reference#setResource(IBaseResource) instead
3758         */
3759        @Deprecated
3760        public List<Device> getUdiTarget() { 
3761          if (this.udiTarget == null)
3762            this.udiTarget = new ArrayList<Device>();
3763          return this.udiTarget;
3764        }
3765
3766        /**
3767         * @deprecated Use Reference#setResource(IBaseResource) instead
3768         */
3769        @Deprecated
3770        public Device addUdiTarget() { 
3771          Device r = new Device();
3772          if (this.udiTarget == null)
3773            this.udiTarget = new ArrayList<Device>();
3774          this.udiTarget.add(r);
3775          return r;
3776        }
3777
3778        /**
3779         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc).)
3780         */
3781        public CodeableConcept getBodySite() { 
3782          if (this.bodySite == null)
3783            if (Configuration.errorOnAutoCreate())
3784              throw new Error("Attempt to auto-create ItemComponent.bodySite");
3785            else if (Configuration.doAutoCreate())
3786              this.bodySite = new CodeableConcept(); // cc
3787          return this.bodySite;
3788        }
3789
3790        public boolean hasBodySite() { 
3791          return this.bodySite != null && !this.bodySite.isEmpty();
3792        }
3793
3794        /**
3795         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc).)
3796         */
3797        public ItemComponent setBodySite(CodeableConcept value) { 
3798          this.bodySite = value;
3799          return this;
3800        }
3801
3802        /**
3803         * @return {@link #subSite} (A region or surface of the site, eg. limb region or tooth surface(s).)
3804         */
3805        public List<CodeableConcept> getSubSite() { 
3806          if (this.subSite == null)
3807            this.subSite = new ArrayList<CodeableConcept>();
3808          return this.subSite;
3809        }
3810
3811        /**
3812         * @return Returns a reference to <code>this</code> for easy method chaining
3813         */
3814        public ItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
3815          this.subSite = theSubSite;
3816          return this;
3817        }
3818
3819        public boolean hasSubSite() { 
3820          if (this.subSite == null)
3821            return false;
3822          for (CodeableConcept item : this.subSite)
3823            if (!item.isEmpty())
3824              return true;
3825          return false;
3826        }
3827
3828        public CodeableConcept addSubSite() { //3
3829          CodeableConcept t = new CodeableConcept();
3830          if (this.subSite == null)
3831            this.subSite = new ArrayList<CodeableConcept>();
3832          this.subSite.add(t);
3833          return t;
3834        }
3835
3836        public ItemComponent addSubSite(CodeableConcept t) { //3
3837          if (t == null)
3838            return this;
3839          if (this.subSite == null)
3840            this.subSite = new ArrayList<CodeableConcept>();
3841          this.subSite.add(t);
3842          return this;
3843        }
3844
3845        /**
3846         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist
3847         */
3848        public CodeableConcept getSubSiteFirstRep() { 
3849          if (getSubSite().isEmpty()) {
3850            addSubSite();
3851          }
3852          return getSubSite().get(0);
3853        }
3854
3855        /**
3856         * @return {@link #encounter} (A billed item may include goods or services provided in multiple encounters.)
3857         */
3858        public List<Reference> getEncounter() { 
3859          if (this.encounter == null)
3860            this.encounter = new ArrayList<Reference>();
3861          return this.encounter;
3862        }
3863
3864        /**
3865         * @return Returns a reference to <code>this</code> for easy method chaining
3866         */
3867        public ItemComponent setEncounter(List<Reference> theEncounter) { 
3868          this.encounter = theEncounter;
3869          return this;
3870        }
3871
3872        public boolean hasEncounter() { 
3873          if (this.encounter == null)
3874            return false;
3875          for (Reference item : this.encounter)
3876            if (!item.isEmpty())
3877              return true;
3878          return false;
3879        }
3880
3881        public Reference addEncounter() { //3
3882          Reference t = new Reference();
3883          if (this.encounter == null)
3884            this.encounter = new ArrayList<Reference>();
3885          this.encounter.add(t);
3886          return t;
3887        }
3888
3889        public ItemComponent addEncounter(Reference t) { //3
3890          if (t == null)
3891            return this;
3892          if (this.encounter == null)
3893            this.encounter = new ArrayList<Reference>();
3894          this.encounter.add(t);
3895          return this;
3896        }
3897
3898        /**
3899         * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist
3900         */
3901        public Reference getEncounterFirstRep() { 
3902          if (getEncounter().isEmpty()) {
3903            addEncounter();
3904          }
3905          return getEncounter().get(0);
3906        }
3907
3908        /**
3909         * @deprecated Use Reference#setResource(IBaseResource) instead
3910         */
3911        @Deprecated
3912        public List<Encounter> getEncounterTarget() { 
3913          if (this.encounterTarget == null)
3914            this.encounterTarget = new ArrayList<Encounter>();
3915          return this.encounterTarget;
3916        }
3917
3918        /**
3919         * @deprecated Use Reference#setResource(IBaseResource) instead
3920         */
3921        @Deprecated
3922        public Encounter addEncounterTarget() { 
3923          Encounter r = new Encounter();
3924          if (this.encounterTarget == null)
3925            this.encounterTarget = new ArrayList<Encounter>();
3926          this.encounterTarget.add(r);
3927          return r;
3928        }
3929
3930        /**
3931         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
3932         */
3933        public List<PositiveIntType> getNoteNumber() { 
3934          if (this.noteNumber == null)
3935            this.noteNumber = new ArrayList<PositiveIntType>();
3936          return this.noteNumber;
3937        }
3938
3939        /**
3940         * @return Returns a reference to <code>this</code> for easy method chaining
3941         */
3942        public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
3943          this.noteNumber = theNoteNumber;
3944          return this;
3945        }
3946
3947        public boolean hasNoteNumber() { 
3948          if (this.noteNumber == null)
3949            return false;
3950          for (PositiveIntType item : this.noteNumber)
3951            if (!item.isEmpty())
3952              return true;
3953          return false;
3954        }
3955
3956        /**
3957         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
3958         */
3959        public PositiveIntType addNoteNumberElement() {//2 
3960          PositiveIntType t = new PositiveIntType();
3961          if (this.noteNumber == null)
3962            this.noteNumber = new ArrayList<PositiveIntType>();
3963          this.noteNumber.add(t);
3964          return t;
3965        }
3966
3967        /**
3968         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
3969         */
3970        public ItemComponent addNoteNumber(int value) { //1
3971          PositiveIntType t = new PositiveIntType();
3972          t.setValue(value);
3973          if (this.noteNumber == null)
3974            this.noteNumber = new ArrayList<PositiveIntType>();
3975          this.noteNumber.add(t);
3976          return this;
3977        }
3978
3979        /**
3980         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
3981         */
3982        public boolean hasNoteNumber(int value) { 
3983          if (this.noteNumber == null)
3984            return false;
3985          for (PositiveIntType v : this.noteNumber)
3986            if (v.equals(value)) // positiveInt
3987              return true;
3988          return false;
3989        }
3990
3991        /**
3992         * @return {@link #adjudication} (The adjudications results.)
3993         */
3994        public List<AdjudicationComponent> getAdjudication() { 
3995          if (this.adjudication == null)
3996            this.adjudication = new ArrayList<AdjudicationComponent>();
3997          return this.adjudication;
3998        }
3999
4000        /**
4001         * @return Returns a reference to <code>this</code> for easy method chaining
4002         */
4003        public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
4004          this.adjudication = theAdjudication;
4005          return this;
4006        }
4007
4008        public boolean hasAdjudication() { 
4009          if (this.adjudication == null)
4010            return false;
4011          for (AdjudicationComponent item : this.adjudication)
4012            if (!item.isEmpty())
4013              return true;
4014          return false;
4015        }
4016
4017        public AdjudicationComponent addAdjudication() { //3
4018          AdjudicationComponent t = new AdjudicationComponent();
4019          if (this.adjudication == null)
4020            this.adjudication = new ArrayList<AdjudicationComponent>();
4021          this.adjudication.add(t);
4022          return t;
4023        }
4024
4025        public ItemComponent addAdjudication(AdjudicationComponent t) { //3
4026          if (t == null)
4027            return this;
4028          if (this.adjudication == null)
4029            this.adjudication = new ArrayList<AdjudicationComponent>();
4030          this.adjudication.add(t);
4031          return this;
4032        }
4033
4034        /**
4035         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
4036         */
4037        public AdjudicationComponent getAdjudicationFirstRep() { 
4038          if (getAdjudication().isEmpty()) {
4039            addAdjudication();
4040          }
4041          return getAdjudication().get(0);
4042        }
4043
4044        /**
4045         * @return {@link #detail} (Second tier of goods and services.)
4046         */
4047        public List<DetailComponent> getDetail() { 
4048          if (this.detail == null)
4049            this.detail = new ArrayList<DetailComponent>();
4050          return this.detail;
4051        }
4052
4053        /**
4054         * @return Returns a reference to <code>this</code> for easy method chaining
4055         */
4056        public ItemComponent setDetail(List<DetailComponent> theDetail) { 
4057          this.detail = theDetail;
4058          return this;
4059        }
4060
4061        public boolean hasDetail() { 
4062          if (this.detail == null)
4063            return false;
4064          for (DetailComponent item : this.detail)
4065            if (!item.isEmpty())
4066              return true;
4067          return false;
4068        }
4069
4070        public DetailComponent addDetail() { //3
4071          DetailComponent t = new DetailComponent();
4072          if (this.detail == null)
4073            this.detail = new ArrayList<DetailComponent>();
4074          this.detail.add(t);
4075          return t;
4076        }
4077
4078        public ItemComponent addDetail(DetailComponent t) { //3
4079          if (t == null)
4080            return this;
4081          if (this.detail == null)
4082            this.detail = new ArrayList<DetailComponent>();
4083          this.detail.add(t);
4084          return this;
4085        }
4086
4087        /**
4088         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
4089         */
4090        public DetailComponent getDetailFirstRep() { 
4091          if (getDetail().isEmpty()) {
4092            addDetail();
4093          }
4094          return getDetail().get(0);
4095        }
4096
4097        protected void listChildren(List<Property> childrenList) {
4098          super.listChildren(childrenList);
4099          childrenList.add(new Property("sequence", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequence));
4100          childrenList.add(new Property("careTeamLinkId", "positiveInt", "Careteam applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, careTeamLinkId));
4101          childrenList.add(new Property("diagnosisLinkId", "positiveInt", "Diagnosis applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, diagnosisLinkId));
4102          childrenList.add(new Property("procedureLinkId", "positiveInt", "Procedures applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, procedureLinkId));
4103          childrenList.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));
4104          childrenList.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, java.lang.Integer.MAX_VALUE, revenue));
4105          childrenList.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, java.lang.Integer.MAX_VALUE, category));
4106          childrenList.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, java.lang.Integer.MAX_VALUE, service));
4107          childrenList.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));
4108          childrenList.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));
4109          childrenList.add(new Property("serviced[x]", "date|Period", "The date or dates when the enclosed suite of services were performed or completed.", 0, java.lang.Integer.MAX_VALUE, serviced));
4110          childrenList.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, java.lang.Integer.MAX_VALUE, location));
4111          childrenList.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, java.lang.Integer.MAX_VALUE, quantity));
4112          childrenList.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, java.lang.Integer.MAX_VALUE, unitPrice));
4113          childrenList.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, java.lang.Integer.MAX_VALUE, factor));
4114          childrenList.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, java.lang.Integer.MAX_VALUE, net));
4115          childrenList.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
4116          childrenList.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc).", 0, java.lang.Integer.MAX_VALUE, bodySite));
4117          childrenList.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));
4118          childrenList.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));
4119          childrenList.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
4120          childrenList.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
4121          childrenList.add(new Property("detail", "", "Second tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
4122        }
4123
4124      @Override
4125      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4126        switch (hash) {
4127        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
4128        case -186757789: /*careTeamLinkId*/ return this.careTeamLinkId == null ? new Base[0] : this.careTeamLinkId.toArray(new Base[this.careTeamLinkId.size()]); // PositiveIntType
4129        case -1659207418: /*diagnosisLinkId*/ return this.diagnosisLinkId == null ? new Base[0] : this.diagnosisLinkId.toArray(new Base[this.diagnosisLinkId.size()]); // PositiveIntType
4130        case -532846744: /*procedureLinkId*/ return this.procedureLinkId == null ? new Base[0] : this.procedureLinkId.toArray(new Base[this.procedureLinkId.size()]); // PositiveIntType
4131        case 1965585153: /*informationLinkId*/ return this.informationLinkId == null ? new Base[0] : this.informationLinkId.toArray(new Base[this.informationLinkId.size()]); // PositiveIntType
4132        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
4133        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4134        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
4135        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
4136        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
4137        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
4138        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
4139        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
4140        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
4141        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
4142        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
4143        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
4144        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
4145        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
4146        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
4147        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
4148        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
4149        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
4150        default: return super.getProperty(hash, name, checkValid);
4151        }
4152
4153      }
4154
4155      @Override
4156      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4157        switch (hash) {
4158        case 1349547969: // sequence
4159          this.sequence = castToPositiveInt(value); // PositiveIntType
4160          return value;
4161        case -186757789: // careTeamLinkId
4162          this.getCareTeamLinkId().add(castToPositiveInt(value)); // PositiveIntType
4163          return value;
4164        case -1659207418: // diagnosisLinkId
4165          this.getDiagnosisLinkId().add(castToPositiveInt(value)); // PositiveIntType
4166          return value;
4167        case -532846744: // procedureLinkId
4168          this.getProcedureLinkId().add(castToPositiveInt(value)); // PositiveIntType
4169          return value;
4170        case 1965585153: // informationLinkId
4171          this.getInformationLinkId().add(castToPositiveInt(value)); // PositiveIntType
4172          return value;
4173        case 1099842588: // revenue
4174          this.revenue = castToCodeableConcept(value); // CodeableConcept
4175          return value;
4176        case 50511102: // category
4177          this.category = castToCodeableConcept(value); // CodeableConcept
4178          return value;
4179        case 1984153269: // service
4180          this.service = castToCodeableConcept(value); // CodeableConcept
4181          return value;
4182        case -615513385: // modifier
4183          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
4184          return value;
4185        case 1010065041: // programCode
4186          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
4187          return value;
4188        case 1379209295: // serviced
4189          this.serviced = castToType(value); // Type
4190          return value;
4191        case 1901043637: // location
4192          this.location = castToType(value); // Type
4193          return value;
4194        case -1285004149: // quantity
4195          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
4196          return value;
4197        case -486196699: // unitPrice
4198          this.unitPrice = castToMoney(value); // Money
4199          return value;
4200        case -1282148017: // factor
4201          this.factor = castToDecimal(value); // DecimalType
4202          return value;
4203        case 108957: // net
4204          this.net = castToMoney(value); // Money
4205          return value;
4206        case 115642: // udi
4207          this.getUdi().add(castToReference(value)); // Reference
4208          return value;
4209        case 1702620169: // bodySite
4210          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4211          return value;
4212        case -1868566105: // subSite
4213          this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
4214          return value;
4215        case 1524132147: // encounter
4216          this.getEncounter().add(castToReference(value)); // Reference
4217          return value;
4218        case -1110033957: // noteNumber
4219          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
4220          return value;
4221        case -231349275: // adjudication
4222          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
4223          return value;
4224        case -1335224239: // detail
4225          this.getDetail().add((DetailComponent) value); // DetailComponent
4226          return value;
4227        default: return super.setProperty(hash, name, value);
4228        }
4229
4230      }
4231
4232      @Override
4233      public Base setProperty(String name, Base value) throws FHIRException {
4234        if (name.equals("sequence")) {
4235          this.sequence = castToPositiveInt(value); // PositiveIntType
4236        } else if (name.equals("careTeamLinkId")) {
4237          this.getCareTeamLinkId().add(castToPositiveInt(value));
4238        } else if (name.equals("diagnosisLinkId")) {
4239          this.getDiagnosisLinkId().add(castToPositiveInt(value));
4240        } else if (name.equals("procedureLinkId")) {
4241          this.getProcedureLinkId().add(castToPositiveInt(value));
4242        } else if (name.equals("informationLinkId")) {
4243          this.getInformationLinkId().add(castToPositiveInt(value));
4244        } else if (name.equals("revenue")) {
4245          this.revenue = castToCodeableConcept(value); // CodeableConcept
4246        } else if (name.equals("category")) {
4247          this.category = castToCodeableConcept(value); // CodeableConcept
4248        } else if (name.equals("service")) {
4249          this.service = castToCodeableConcept(value); // CodeableConcept
4250        } else if (name.equals("modifier")) {
4251          this.getModifier().add(castToCodeableConcept(value));
4252        } else if (name.equals("programCode")) {
4253          this.getProgramCode().add(castToCodeableConcept(value));
4254        } else if (name.equals("serviced[x]")) {
4255          this.serviced = castToType(value); // Type
4256        } else if (name.equals("location[x]")) {
4257          this.location = castToType(value); // Type
4258        } else if (name.equals("quantity")) {
4259          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
4260        } else if (name.equals("unitPrice")) {
4261          this.unitPrice = castToMoney(value); // Money
4262        } else if (name.equals("factor")) {
4263          this.factor = castToDecimal(value); // DecimalType
4264        } else if (name.equals("net")) {
4265          this.net = castToMoney(value); // Money
4266        } else if (name.equals("udi")) {
4267          this.getUdi().add(castToReference(value));
4268        } else if (name.equals("bodySite")) {
4269          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4270        } else if (name.equals("subSite")) {
4271          this.getSubSite().add(castToCodeableConcept(value));
4272        } else if (name.equals("encounter")) {
4273          this.getEncounter().add(castToReference(value));
4274        } else if (name.equals("noteNumber")) {
4275          this.getNoteNumber().add(castToPositiveInt(value));
4276        } else if (name.equals("adjudication")) {
4277          this.getAdjudication().add((AdjudicationComponent) value);
4278        } else if (name.equals("detail")) {
4279          this.getDetail().add((DetailComponent) value);
4280        } else
4281          return super.setProperty(name, value);
4282        return value;
4283      }
4284
4285      @Override
4286      public Base makeProperty(int hash, String name) throws FHIRException {
4287        switch (hash) {
4288        case 1349547969:  return getSequenceElement();
4289        case -186757789:  return addCareTeamLinkIdElement();
4290        case -1659207418:  return addDiagnosisLinkIdElement();
4291        case -532846744:  return addProcedureLinkIdElement();
4292        case 1965585153:  return addInformationLinkIdElement();
4293        case 1099842588:  return getRevenue(); 
4294        case 50511102:  return getCategory(); 
4295        case 1984153269:  return getService(); 
4296        case -615513385:  return addModifier(); 
4297        case 1010065041:  return addProgramCode(); 
4298        case -1927922223:  return getServiced(); 
4299        case 1379209295:  return getServiced(); 
4300        case 552316075:  return getLocation(); 
4301        case 1901043637:  return getLocation(); 
4302        case -1285004149:  return getQuantity(); 
4303        case -486196699:  return getUnitPrice(); 
4304        case -1282148017:  return getFactorElement();
4305        case 108957:  return getNet(); 
4306        case 115642:  return addUdi(); 
4307        case 1702620169:  return getBodySite(); 
4308        case -1868566105:  return addSubSite(); 
4309        case 1524132147:  return addEncounter(); 
4310        case -1110033957:  return addNoteNumberElement();
4311        case -231349275:  return addAdjudication(); 
4312        case -1335224239:  return addDetail(); 
4313        default: return super.makeProperty(hash, name);
4314        }
4315
4316      }
4317
4318      @Override
4319      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4320        switch (hash) {
4321        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
4322        case -186757789: /*careTeamLinkId*/ return new String[] {"positiveInt"};
4323        case -1659207418: /*diagnosisLinkId*/ return new String[] {"positiveInt"};
4324        case -532846744: /*procedureLinkId*/ return new String[] {"positiveInt"};
4325        case 1965585153: /*informationLinkId*/ return new String[] {"positiveInt"};
4326        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
4327        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4328        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
4329        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
4330        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
4331        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
4332        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
4333        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
4334        case -486196699: /*unitPrice*/ return new String[] {"Money"};
4335        case -1282148017: /*factor*/ return new String[] {"decimal"};
4336        case 108957: /*net*/ return new String[] {"Money"};
4337        case 115642: /*udi*/ return new String[] {"Reference"};
4338        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
4339        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
4340        case 1524132147: /*encounter*/ return new String[] {"Reference"};
4341        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
4342        case -231349275: /*adjudication*/ return new String[] {};
4343        case -1335224239: /*detail*/ return new String[] {};
4344        default: return super.getTypesForProperty(hash, name);
4345        }
4346
4347      }
4348
4349      @Override
4350      public Base addChild(String name) throws FHIRException {
4351        if (name.equals("sequence")) {
4352          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
4353        }
4354        else if (name.equals("careTeamLinkId")) {
4355          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeamLinkId");
4356        }
4357        else if (name.equals("diagnosisLinkId")) {
4358          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.diagnosisLinkId");
4359        }
4360        else if (name.equals("procedureLinkId")) {
4361          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedureLinkId");
4362        }
4363        else if (name.equals("informationLinkId")) {
4364          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.informationLinkId");
4365        }
4366        else if (name.equals("revenue")) {
4367          this.revenue = new CodeableConcept();
4368          return this.revenue;
4369        }
4370        else if (name.equals("category")) {
4371          this.category = new CodeableConcept();
4372          return this.category;
4373        }
4374        else if (name.equals("service")) {
4375          this.service = new CodeableConcept();
4376          return this.service;
4377        }
4378        else if (name.equals("modifier")) {
4379          return addModifier();
4380        }
4381        else if (name.equals("programCode")) {
4382          return addProgramCode();
4383        }
4384        else if (name.equals("servicedDate")) {
4385          this.serviced = new DateType();
4386          return this.serviced;
4387        }
4388        else if (name.equals("servicedPeriod")) {
4389          this.serviced = new Period();
4390          return this.serviced;
4391        }
4392        else if (name.equals("locationCodeableConcept")) {
4393          this.location = new CodeableConcept();
4394          return this.location;
4395        }
4396        else if (name.equals("locationAddress")) {
4397          this.location = new Address();
4398          return this.location;
4399        }
4400        else if (name.equals("locationReference")) {
4401          this.location = new Reference();
4402          return this.location;
4403        }
4404        else if (name.equals("quantity")) {
4405          this.quantity = new SimpleQuantity();
4406          return this.quantity;
4407        }
4408        else if (name.equals("unitPrice")) {
4409          this.unitPrice = new Money();
4410          return this.unitPrice;
4411        }
4412        else if (name.equals("factor")) {
4413          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
4414        }
4415        else if (name.equals("net")) {
4416          this.net = new Money();
4417          return this.net;
4418        }
4419        else if (name.equals("udi")) {
4420          return addUdi();
4421        }
4422        else if (name.equals("bodySite")) {
4423          this.bodySite = new CodeableConcept();
4424          return this.bodySite;
4425        }
4426        else if (name.equals("subSite")) {
4427          return addSubSite();
4428        }
4429        else if (name.equals("encounter")) {
4430          return addEncounter();
4431        }
4432        else if (name.equals("noteNumber")) {
4433          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
4434        }
4435        else if (name.equals("adjudication")) {
4436          return addAdjudication();
4437        }
4438        else if (name.equals("detail")) {
4439          return addDetail();
4440        }
4441        else
4442          return super.addChild(name);
4443      }
4444
4445      public ItemComponent copy() {
4446        ItemComponent dst = new ItemComponent();
4447        copyValues(dst);
4448        dst.sequence = sequence == null ? null : sequence.copy();
4449        if (careTeamLinkId != null) {
4450          dst.careTeamLinkId = new ArrayList<PositiveIntType>();
4451          for (PositiveIntType i : careTeamLinkId)
4452            dst.careTeamLinkId.add(i.copy());
4453        };
4454        if (diagnosisLinkId != null) {
4455          dst.diagnosisLinkId = new ArrayList<PositiveIntType>();
4456          for (PositiveIntType i : diagnosisLinkId)
4457            dst.diagnosisLinkId.add(i.copy());
4458        };
4459        if (procedureLinkId != null) {
4460          dst.procedureLinkId = new ArrayList<PositiveIntType>();
4461          for (PositiveIntType i : procedureLinkId)
4462            dst.procedureLinkId.add(i.copy());
4463        };
4464        if (informationLinkId != null) {
4465          dst.informationLinkId = new ArrayList<PositiveIntType>();
4466          for (PositiveIntType i : informationLinkId)
4467            dst.informationLinkId.add(i.copy());
4468        };
4469        dst.revenue = revenue == null ? null : revenue.copy();
4470        dst.category = category == null ? null : category.copy();
4471        dst.service = service == null ? null : service.copy();
4472        if (modifier != null) {
4473          dst.modifier = new ArrayList<CodeableConcept>();
4474          for (CodeableConcept i : modifier)
4475            dst.modifier.add(i.copy());
4476        };
4477        if (programCode != null) {
4478          dst.programCode = new ArrayList<CodeableConcept>();
4479          for (CodeableConcept i : programCode)
4480            dst.programCode.add(i.copy());
4481        };
4482        dst.serviced = serviced == null ? null : serviced.copy();
4483        dst.location = location == null ? null : location.copy();
4484        dst.quantity = quantity == null ? null : quantity.copy();
4485        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
4486        dst.factor = factor == null ? null : factor.copy();
4487        dst.net = net == null ? null : net.copy();
4488        if (udi != null) {
4489          dst.udi = new ArrayList<Reference>();
4490          for (Reference i : udi)
4491            dst.udi.add(i.copy());
4492        };
4493        dst.bodySite = bodySite == null ? null : bodySite.copy();
4494        if (subSite != null) {
4495          dst.subSite = new ArrayList<CodeableConcept>();
4496          for (CodeableConcept i : subSite)
4497            dst.subSite.add(i.copy());
4498        };
4499        if (encounter != null) {
4500          dst.encounter = new ArrayList<Reference>();
4501          for (Reference i : encounter)
4502            dst.encounter.add(i.copy());
4503        };
4504        if (noteNumber != null) {
4505          dst.noteNumber = new ArrayList<PositiveIntType>();
4506          for (PositiveIntType i : noteNumber)
4507            dst.noteNumber.add(i.copy());
4508        };
4509        if (adjudication != null) {
4510          dst.adjudication = new ArrayList<AdjudicationComponent>();
4511          for (AdjudicationComponent i : adjudication)
4512            dst.adjudication.add(i.copy());
4513        };
4514        if (detail != null) {
4515          dst.detail = new ArrayList<DetailComponent>();
4516          for (DetailComponent i : detail)
4517            dst.detail.add(i.copy());
4518        };
4519        return dst;
4520      }
4521
4522      @Override
4523      public boolean equalsDeep(Base other) {
4524        if (!super.equalsDeep(other))
4525          return false;
4526        if (!(other instanceof ItemComponent))
4527          return false;
4528        ItemComponent o = (ItemComponent) other;
4529        return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamLinkId, o.careTeamLinkId, true)
4530           && compareDeep(diagnosisLinkId, o.diagnosisLinkId, true) && compareDeep(procedureLinkId, o.procedureLinkId, true)
4531           && compareDeep(informationLinkId, o.informationLinkId, true) && compareDeep(revenue, o.revenue, true)
4532           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
4533           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
4534           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
4535           && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true) && compareDeep(bodySite, o.bodySite, true)
4536           && compareDeep(subSite, o.subSite, true) && compareDeep(encounter, o.encounter, true) && compareDeep(noteNumber, o.noteNumber, true)
4537           && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
4538      }
4539
4540      @Override
4541      public boolean equalsShallow(Base other) {
4542        if (!super.equalsShallow(other))
4543          return false;
4544        if (!(other instanceof ItemComponent))
4545          return false;
4546        ItemComponent o = (ItemComponent) other;
4547        return compareValues(sequence, o.sequence, true) && compareValues(careTeamLinkId, o.careTeamLinkId, true)
4548           && compareValues(diagnosisLinkId, o.diagnosisLinkId, true) && compareValues(procedureLinkId, o.procedureLinkId, true)
4549           && compareValues(informationLinkId, o.informationLinkId, true) && compareValues(factor, o.factor, true)
4550           && compareValues(noteNumber, o.noteNumber, true);
4551      }
4552
4553      public boolean isEmpty() {
4554        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamLinkId, diagnosisLinkId
4555          , procedureLinkId, informationLinkId, revenue, category, service, modifier, programCode
4556          , serviced, location, quantity, unitPrice, factor, net, udi, bodySite, subSite
4557          , encounter, noteNumber, adjudication, detail);
4558      }
4559
4560  public String fhirType() {
4561    return "ExplanationOfBenefit.item";
4562
4563  }
4564
4565  }
4566
4567    @Block()
4568    public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
4569        /**
4570         * Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.
4571         */
4572        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
4573        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc." )
4574        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
4575        protected CodeableConcept category;
4576
4577        /**
4578         * Adjudication reason such as limit reached.
4579         */
4580        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
4581        @Description(shortDefinition="Explanation of Adjudication outcome", formalDefinition="Adjudication reason such as limit reached." )
4582        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-reason")
4583        protected CodeableConcept reason;
4584
4585        /**
4586         * Monitory amount associated with the code.
4587         */
4588        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
4589        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
4590        protected Money amount;
4591
4592        /**
4593         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4594         */
4595        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
4596        @Description(shortDefinition="Non-monitory value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
4597        protected DecimalType value;
4598
4599        private static final long serialVersionUID = 1559898786L;
4600
4601    /**
4602     * Constructor
4603     */
4604      public AdjudicationComponent() {
4605        super();
4606      }
4607
4608    /**
4609     * Constructor
4610     */
4611      public AdjudicationComponent(CodeableConcept category) {
4612        super();
4613        this.category = category;
4614      }
4615
4616        /**
4617         * @return {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
4618         */
4619        public CodeableConcept getCategory() { 
4620          if (this.category == null)
4621            if (Configuration.errorOnAutoCreate())
4622              throw new Error("Attempt to auto-create AdjudicationComponent.category");
4623            else if (Configuration.doAutoCreate())
4624              this.category = new CodeableConcept(); // cc
4625          return this.category;
4626        }
4627
4628        public boolean hasCategory() { 
4629          return this.category != null && !this.category.isEmpty();
4630        }
4631
4632        /**
4633         * @param value {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
4634         */
4635        public AdjudicationComponent setCategory(CodeableConcept value) { 
4636          this.category = value;
4637          return this;
4638        }
4639
4640        /**
4641         * @return {@link #reason} (Adjudication reason such as limit reached.)
4642         */
4643        public CodeableConcept getReason() { 
4644          if (this.reason == null)
4645            if (Configuration.errorOnAutoCreate())
4646              throw new Error("Attempt to auto-create AdjudicationComponent.reason");
4647            else if (Configuration.doAutoCreate())
4648              this.reason = new CodeableConcept(); // cc
4649          return this.reason;
4650        }
4651
4652        public boolean hasReason() { 
4653          return this.reason != null && !this.reason.isEmpty();
4654        }
4655
4656        /**
4657         * @param value {@link #reason} (Adjudication reason such as limit reached.)
4658         */
4659        public AdjudicationComponent setReason(CodeableConcept value) { 
4660          this.reason = value;
4661          return this;
4662        }
4663
4664        /**
4665         * @return {@link #amount} (Monitory amount associated with the code.)
4666         */
4667        public Money getAmount() { 
4668          if (this.amount == null)
4669            if (Configuration.errorOnAutoCreate())
4670              throw new Error("Attempt to auto-create AdjudicationComponent.amount");
4671            else if (Configuration.doAutoCreate())
4672              this.amount = new Money(); // cc
4673          return this.amount;
4674        }
4675
4676        public boolean hasAmount() { 
4677          return this.amount != null && !this.amount.isEmpty();
4678        }
4679
4680        /**
4681         * @param value {@link #amount} (Monitory amount associated with the code.)
4682         */
4683        public AdjudicationComponent setAmount(Money value) { 
4684          this.amount = value;
4685          return this;
4686        }
4687
4688        /**
4689         * @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
4690         */
4691        public DecimalType getValueElement() { 
4692          if (this.value == null)
4693            if (Configuration.errorOnAutoCreate())
4694              throw new Error("Attempt to auto-create AdjudicationComponent.value");
4695            else if (Configuration.doAutoCreate())
4696              this.value = new DecimalType(); // bb
4697          return this.value;
4698        }
4699
4700        public boolean hasValueElement() { 
4701          return this.value != null && !this.value.isEmpty();
4702        }
4703
4704        public boolean hasValue() { 
4705          return this.value != null && !this.value.isEmpty();
4706        }
4707
4708        /**
4709         * @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
4710         */
4711        public AdjudicationComponent setValueElement(DecimalType value) { 
4712          this.value = value;
4713          return this;
4714        }
4715
4716        /**
4717         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4718         */
4719        public BigDecimal getValue() { 
4720          return this.value == null ? null : this.value.getValue();
4721        }
4722
4723        /**
4724         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4725         */
4726        public AdjudicationComponent setValue(BigDecimal value) { 
4727          if (value == null)
4728            this.value = null;
4729          else {
4730            if (this.value == null)
4731              this.value = new DecimalType();
4732            this.value.setValue(value);
4733          }
4734          return this;
4735        }
4736
4737        /**
4738         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4739         */
4740        public AdjudicationComponent setValue(long value) { 
4741              this.value = new DecimalType();
4742            this.value.setValue(value);
4743          return this;
4744        }
4745
4746        /**
4747         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4748         */
4749        public AdjudicationComponent setValue(double value) { 
4750              this.value = new DecimalType();
4751            this.value.setValue(value);
4752          return this;
4753        }
4754
4755        protected void listChildren(List<Property> childrenList) {
4756          super.listChildren(childrenList);
4757          childrenList.add(new Property("category", "CodeableConcept", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, java.lang.Integer.MAX_VALUE, category));
4758          childrenList.add(new Property("reason", "CodeableConcept", "Adjudication reason such as limit reached.", 0, java.lang.Integer.MAX_VALUE, reason));
4759          childrenList.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, java.lang.Integer.MAX_VALUE, amount));
4760          childrenList.add(new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, java.lang.Integer.MAX_VALUE, value));
4761        }
4762
4763      @Override
4764      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4765        switch (hash) {
4766        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4767        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
4768        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
4769        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
4770        default: return super.getProperty(hash, name, checkValid);
4771        }
4772
4773      }
4774
4775      @Override
4776      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4777        switch (hash) {
4778        case 50511102: // category
4779          this.category = castToCodeableConcept(value); // CodeableConcept
4780          return value;
4781        case -934964668: // reason
4782          this.reason = castToCodeableConcept(value); // CodeableConcept
4783          return value;
4784        case -1413853096: // amount
4785          this.amount = castToMoney(value); // Money
4786          return value;
4787        case 111972721: // value
4788          this.value = castToDecimal(value); // DecimalType
4789          return value;
4790        default: return super.setProperty(hash, name, value);
4791        }
4792
4793      }
4794
4795      @Override
4796      public Base setProperty(String name, Base value) throws FHIRException {
4797        if (name.equals("category")) {
4798          this.category = castToCodeableConcept(value); // CodeableConcept
4799        } else if (name.equals("reason")) {
4800          this.reason = castToCodeableConcept(value); // CodeableConcept
4801        } else if (name.equals("amount")) {
4802          this.amount = castToMoney(value); // Money
4803        } else if (name.equals("value")) {
4804          this.value = castToDecimal(value); // DecimalType
4805        } else
4806          return super.setProperty(name, value);
4807        return value;
4808      }
4809
4810      @Override
4811      public Base makeProperty(int hash, String name) throws FHIRException {
4812        switch (hash) {
4813        case 50511102:  return getCategory(); 
4814        case -934964668:  return getReason(); 
4815        case -1413853096:  return getAmount(); 
4816        case 111972721:  return getValueElement();
4817        default: return super.makeProperty(hash, name);
4818        }
4819
4820      }
4821
4822      @Override
4823      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4824        switch (hash) {
4825        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4826        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
4827        case -1413853096: /*amount*/ return new String[] {"Money"};
4828        case 111972721: /*value*/ return new String[] {"decimal"};
4829        default: return super.getTypesForProperty(hash, name);
4830        }
4831
4832      }
4833
4834      @Override
4835      public Base addChild(String name) throws FHIRException {
4836        if (name.equals("category")) {
4837          this.category = new CodeableConcept();
4838          return this.category;
4839        }
4840        else if (name.equals("reason")) {
4841          this.reason = new CodeableConcept();
4842          return this.reason;
4843        }
4844        else if (name.equals("amount")) {
4845          this.amount = new Money();
4846          return this.amount;
4847        }
4848        else if (name.equals("value")) {
4849          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
4850        }
4851        else
4852          return super.addChild(name);
4853      }
4854
4855      public AdjudicationComponent copy() {
4856        AdjudicationComponent dst = new AdjudicationComponent();
4857        copyValues(dst);
4858        dst.category = category == null ? null : category.copy();
4859        dst.reason = reason == null ? null : reason.copy();
4860        dst.amount = amount == null ? null : amount.copy();
4861        dst.value = value == null ? null : value.copy();
4862        return dst;
4863      }
4864
4865      @Override
4866      public boolean equalsDeep(Base other) {
4867        if (!super.equalsDeep(other))
4868          return false;
4869        if (!(other instanceof AdjudicationComponent))
4870          return false;
4871        AdjudicationComponent o = (AdjudicationComponent) other;
4872        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
4873           && compareDeep(value, o.value, true);
4874      }
4875
4876      @Override
4877      public boolean equalsShallow(Base other) {
4878        if (!super.equalsShallow(other))
4879          return false;
4880        if (!(other instanceof AdjudicationComponent))
4881          return false;
4882        AdjudicationComponent o = (AdjudicationComponent) other;
4883        return compareValues(value, o.value, true);
4884      }
4885
4886      public boolean isEmpty() {
4887        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount
4888          , value);
4889      }
4890
4891  public String fhirType() {
4892    return "ExplanationOfBenefit.item.adjudication";
4893
4894  }
4895
4896  }
4897
4898    @Block()
4899    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
4900        /**
4901         * A service line number.
4902         */
4903        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
4904        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
4905        protected PositiveIntType sequence;
4906
4907        /**
4908         * The type of product or service.
4909         */
4910        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
4911        @Description(shortDefinition="Group or type of product or service", formalDefinition="The type of product or service." )
4912        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActInvoiceGroupCode")
4913        protected CodeableConcept type;
4914
4915        /**
4916         * The type of reveneu or cost center providing the product and/or service.
4917         */
4918        @Child(name = "revenue", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
4919        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
4920        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
4921        protected CodeableConcept revenue;
4922
4923        /**
4924         * Health Care Service Type Codes  to identify the classification of service or benefits.
4925         */
4926        @Child(name = "category", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
4927        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
4928        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
4929        protected CodeableConcept category;
4930
4931        /**
4932         * 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'.
4933         */
4934        @Child(name = "service", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
4935        @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'." )
4936        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
4937        protected CodeableConcept service;
4938
4939        /**
4940         * 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.
4941         */
4942        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4943        @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." )
4944        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
4945        protected List<CodeableConcept> modifier;
4946
4947        /**
4948         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
4949         */
4950        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4951        @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." )
4952        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
4953        protected List<CodeableConcept> programCode;
4954
4955        /**
4956         * The number of repetitions of a service or product.
4957         */
4958        @Child(name = "quantity", type = {SimpleQuantity.class}, order=8, min=0, max=1, modifier=false, summary=false)
4959        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
4960        protected SimpleQuantity quantity;
4961
4962        /**
4963         * 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.
4964         */
4965        @Child(name = "unitPrice", type = {Money.class}, order=9, min=0, max=1, modifier=false, summary=false)
4966        @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." )
4967        protected Money unitPrice;
4968
4969        /**
4970         * 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.
4971         */
4972        @Child(name = "factor", type = {DecimalType.class}, order=10, min=0, max=1, modifier=false, summary=false)
4973        @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." )
4974        protected DecimalType factor;
4975
4976        /**
4977         * 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.
4978         */
4979        @Child(name = "net", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=false)
4980        @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." )
4981        protected Money net;
4982
4983        /**
4984         * List of Unique Device Identifiers associated with this line item.
4985         */
4986        @Child(name = "udi", type = {Device.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4987        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
4988        protected List<Reference> udi;
4989        /**
4990         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
4991         */
4992        protected List<Device> udiTarget;
4993
4994
4995        /**
4996         * A list of note references to the notes provided below.
4997         */
4998        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4999        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
5000        protected List<PositiveIntType> noteNumber;
5001
5002        /**
5003         * The adjudications results.
5004         */
5005        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5006        @Description(shortDefinition="Detail level adjudication details", formalDefinition="The adjudications results." )
5007        protected List<AdjudicationComponent> adjudication;
5008
5009        /**
5010         * Third tier of goods and services.
5011         */
5012        @Child(name = "subDetail", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5013        @Description(shortDefinition="Additional items", formalDefinition="Third tier of goods and services." )
5014        protected List<SubDetailComponent> subDetail;
5015
5016        private static final long serialVersionUID = -276371489L;
5017
5018    /**
5019     * Constructor
5020     */
5021      public DetailComponent() {
5022        super();
5023      }
5024
5025    /**
5026     * Constructor
5027     */
5028      public DetailComponent(PositiveIntType sequence, CodeableConcept type) {
5029        super();
5030        this.sequence = sequence;
5031        this.type = type;
5032      }
5033
5034        /**
5035         * @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
5036         */
5037        public PositiveIntType getSequenceElement() { 
5038          if (this.sequence == null)
5039            if (Configuration.errorOnAutoCreate())
5040              throw new Error("Attempt to auto-create DetailComponent.sequence");
5041            else if (Configuration.doAutoCreate())
5042              this.sequence = new PositiveIntType(); // bb
5043          return this.sequence;
5044        }
5045
5046        public boolean hasSequenceElement() { 
5047          return this.sequence != null && !this.sequence.isEmpty();
5048        }
5049
5050        public boolean hasSequence() { 
5051          return this.sequence != null && !this.sequence.isEmpty();
5052        }
5053
5054        /**
5055         * @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
5056         */
5057        public DetailComponent setSequenceElement(PositiveIntType value) { 
5058          this.sequence = value;
5059          return this;
5060        }
5061
5062        /**
5063         * @return A service line number.
5064         */
5065        public int getSequence() { 
5066          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
5067        }
5068
5069        /**
5070         * @param value A service line number.
5071         */
5072        public DetailComponent setSequence(int value) { 
5073            if (this.sequence == null)
5074              this.sequence = new PositiveIntType();
5075            this.sequence.setValue(value);
5076          return this;
5077        }
5078
5079        /**
5080         * @return {@link #type} (The type of product or service.)
5081         */
5082        public CodeableConcept getType() { 
5083          if (this.type == null)
5084            if (Configuration.errorOnAutoCreate())
5085              throw new Error("Attempt to auto-create DetailComponent.type");
5086            else if (Configuration.doAutoCreate())
5087              this.type = new CodeableConcept(); // cc
5088          return this.type;
5089        }
5090
5091        public boolean hasType() { 
5092          return this.type != null && !this.type.isEmpty();
5093        }
5094
5095        /**
5096         * @param value {@link #type} (The type of product or service.)
5097         */
5098        public DetailComponent setType(CodeableConcept value) { 
5099          this.type = value;
5100          return this;
5101        }
5102
5103        /**
5104         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
5105         */
5106        public CodeableConcept getRevenue() { 
5107          if (this.revenue == null)
5108            if (Configuration.errorOnAutoCreate())
5109              throw new Error("Attempt to auto-create DetailComponent.revenue");
5110            else if (Configuration.doAutoCreate())
5111              this.revenue = new CodeableConcept(); // cc
5112          return this.revenue;
5113        }
5114
5115        public boolean hasRevenue() { 
5116          return this.revenue != null && !this.revenue.isEmpty();
5117        }
5118
5119        /**
5120         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
5121         */
5122        public DetailComponent setRevenue(CodeableConcept value) { 
5123          this.revenue = value;
5124          return this;
5125        }
5126
5127        /**
5128         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
5129         */
5130        public CodeableConcept getCategory() { 
5131          if (this.category == null)
5132            if (Configuration.errorOnAutoCreate())
5133              throw new Error("Attempt to auto-create DetailComponent.category");
5134            else if (Configuration.doAutoCreate())
5135              this.category = new CodeableConcept(); // cc
5136          return this.category;
5137        }
5138
5139        public boolean hasCategory() { 
5140          return this.category != null && !this.category.isEmpty();
5141        }
5142
5143        /**
5144         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
5145         */
5146        public DetailComponent setCategory(CodeableConcept value) { 
5147          this.category = value;
5148          return this;
5149        }
5150
5151        /**
5152         * @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'.)
5153         */
5154        public CodeableConcept getService() { 
5155          if (this.service == null)
5156            if (Configuration.errorOnAutoCreate())
5157              throw new Error("Attempt to auto-create DetailComponent.service");
5158            else if (Configuration.doAutoCreate())
5159              this.service = new CodeableConcept(); // cc
5160          return this.service;
5161        }
5162
5163        public boolean hasService() { 
5164          return this.service != null && !this.service.isEmpty();
5165        }
5166
5167        /**
5168         * @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'.)
5169         */
5170        public DetailComponent setService(CodeableConcept value) { 
5171          this.service = value;
5172          return this;
5173        }
5174
5175        /**
5176         * @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.)
5177         */
5178        public List<CodeableConcept> getModifier() { 
5179          if (this.modifier == null)
5180            this.modifier = new ArrayList<CodeableConcept>();
5181          return this.modifier;
5182        }
5183
5184        /**
5185         * @return Returns a reference to <code>this</code> for easy method chaining
5186         */
5187        public DetailComponent setModifier(List<CodeableConcept> theModifier) { 
5188          this.modifier = theModifier;
5189          return this;
5190        }
5191
5192        public boolean hasModifier() { 
5193          if (this.modifier == null)
5194            return false;
5195          for (CodeableConcept item : this.modifier)
5196            if (!item.isEmpty())
5197              return true;
5198          return false;
5199        }
5200
5201        public CodeableConcept addModifier() { //3
5202          CodeableConcept t = new CodeableConcept();
5203          if (this.modifier == null)
5204            this.modifier = new ArrayList<CodeableConcept>();
5205          this.modifier.add(t);
5206          return t;
5207        }
5208
5209        public DetailComponent addModifier(CodeableConcept t) { //3
5210          if (t == null)
5211            return this;
5212          if (this.modifier == null)
5213            this.modifier = new ArrayList<CodeableConcept>();
5214          this.modifier.add(t);
5215          return this;
5216        }
5217
5218        /**
5219         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
5220         */
5221        public CodeableConcept getModifierFirstRep() { 
5222          if (getModifier().isEmpty()) {
5223            addModifier();
5224          }
5225          return getModifier().get(0);
5226        }
5227
5228        /**
5229         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
5230         */
5231        public List<CodeableConcept> getProgramCode() { 
5232          if (this.programCode == null)
5233            this.programCode = new ArrayList<CodeableConcept>();
5234          return this.programCode;
5235        }
5236
5237        /**
5238         * @return Returns a reference to <code>this</code> for easy method chaining
5239         */
5240        public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
5241          this.programCode = theProgramCode;
5242          return this;
5243        }
5244
5245        public boolean hasProgramCode() { 
5246          if (this.programCode == null)
5247            return false;
5248          for (CodeableConcept item : this.programCode)
5249            if (!item.isEmpty())
5250              return true;
5251          return false;
5252        }
5253
5254        public CodeableConcept addProgramCode() { //3
5255          CodeableConcept t = new CodeableConcept();
5256          if (this.programCode == null)
5257            this.programCode = new ArrayList<CodeableConcept>();
5258          this.programCode.add(t);
5259          return t;
5260        }
5261
5262        public DetailComponent addProgramCode(CodeableConcept t) { //3
5263          if (t == null)
5264            return this;
5265          if (this.programCode == null)
5266            this.programCode = new ArrayList<CodeableConcept>();
5267          this.programCode.add(t);
5268          return this;
5269        }
5270
5271        /**
5272         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
5273         */
5274        public CodeableConcept getProgramCodeFirstRep() { 
5275          if (getProgramCode().isEmpty()) {
5276            addProgramCode();
5277          }
5278          return getProgramCode().get(0);
5279        }
5280
5281        /**
5282         * @return {@link #quantity} (The number of repetitions of a service or product.)
5283         */
5284        public SimpleQuantity getQuantity() { 
5285          if (this.quantity == null)
5286            if (Configuration.errorOnAutoCreate())
5287              throw new Error("Attempt to auto-create DetailComponent.quantity");
5288            else if (Configuration.doAutoCreate())
5289              this.quantity = new SimpleQuantity(); // cc
5290          return this.quantity;
5291        }
5292
5293        public boolean hasQuantity() { 
5294          return this.quantity != null && !this.quantity.isEmpty();
5295        }
5296
5297        /**
5298         * @param value {@link #quantity} (The number of repetitions of a service or product.)
5299         */
5300        public DetailComponent setQuantity(SimpleQuantity value) { 
5301          this.quantity = value;
5302          return this;
5303        }
5304
5305        /**
5306         * @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.)
5307         */
5308        public Money getUnitPrice() { 
5309          if (this.unitPrice == null)
5310            if (Configuration.errorOnAutoCreate())
5311              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
5312            else if (Configuration.doAutoCreate())
5313              this.unitPrice = new Money(); // cc
5314          return this.unitPrice;
5315        }
5316
5317        public boolean hasUnitPrice() { 
5318          return this.unitPrice != null && !this.unitPrice.isEmpty();
5319        }
5320
5321        /**
5322         * @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.)
5323         */
5324        public DetailComponent setUnitPrice(Money value) { 
5325          this.unitPrice = value;
5326          return this;
5327        }
5328
5329        /**
5330         * @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
5331         */
5332        public DecimalType getFactorElement() { 
5333          if (this.factor == null)
5334            if (Configuration.errorOnAutoCreate())
5335              throw new Error("Attempt to auto-create DetailComponent.factor");
5336            else if (Configuration.doAutoCreate())
5337              this.factor = new DecimalType(); // bb
5338          return this.factor;
5339        }
5340
5341        public boolean hasFactorElement() { 
5342          return this.factor != null && !this.factor.isEmpty();
5343        }
5344
5345        public boolean hasFactor() { 
5346          return this.factor != null && !this.factor.isEmpty();
5347        }
5348
5349        /**
5350         * @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
5351         */
5352        public DetailComponent setFactorElement(DecimalType value) { 
5353          this.factor = value;
5354          return this;
5355        }
5356
5357        /**
5358         * @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.
5359         */
5360        public BigDecimal getFactor() { 
5361          return this.factor == null ? null : this.factor.getValue();
5362        }
5363
5364        /**
5365         * @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.
5366         */
5367        public DetailComponent setFactor(BigDecimal value) { 
5368          if (value == null)
5369            this.factor = null;
5370          else {
5371            if (this.factor == null)
5372              this.factor = new DecimalType();
5373            this.factor.setValue(value);
5374          }
5375          return this;
5376        }
5377
5378        /**
5379         * @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.
5380         */
5381        public DetailComponent setFactor(long value) { 
5382              this.factor = new DecimalType();
5383            this.factor.setValue(value);
5384          return this;
5385        }
5386
5387        /**
5388         * @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.
5389         */
5390        public DetailComponent setFactor(double value) { 
5391              this.factor = new DecimalType();
5392            this.factor.setValue(value);
5393          return this;
5394        }
5395
5396        /**
5397         * @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.)
5398         */
5399        public Money getNet() { 
5400          if (this.net == null)
5401            if (Configuration.errorOnAutoCreate())
5402              throw new Error("Attempt to auto-create DetailComponent.net");
5403            else if (Configuration.doAutoCreate())
5404              this.net = new Money(); // cc
5405          return this.net;
5406        }
5407
5408        public boolean hasNet() { 
5409          return this.net != null && !this.net.isEmpty();
5410        }
5411
5412        /**
5413         * @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.)
5414         */
5415        public DetailComponent setNet(Money value) { 
5416          this.net = value;
5417          return this;
5418        }
5419
5420        /**
5421         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
5422         */
5423        public List<Reference> getUdi() { 
5424          if (this.udi == null)
5425            this.udi = new ArrayList<Reference>();
5426          return this.udi;
5427        }
5428
5429        /**
5430         * @return Returns a reference to <code>this</code> for easy method chaining
5431         */
5432        public DetailComponent setUdi(List<Reference> theUdi) { 
5433          this.udi = theUdi;
5434          return this;
5435        }
5436
5437        public boolean hasUdi() { 
5438          if (this.udi == null)
5439            return false;
5440          for (Reference item : this.udi)
5441            if (!item.isEmpty())
5442              return true;
5443          return false;
5444        }
5445
5446        public Reference addUdi() { //3
5447          Reference t = new Reference();
5448          if (this.udi == null)
5449            this.udi = new ArrayList<Reference>();
5450          this.udi.add(t);
5451          return t;
5452        }
5453
5454        public DetailComponent addUdi(Reference t) { //3
5455          if (t == null)
5456            return this;
5457          if (this.udi == null)
5458            this.udi = new ArrayList<Reference>();
5459          this.udi.add(t);
5460          return this;
5461        }
5462
5463        /**
5464         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
5465         */
5466        public Reference getUdiFirstRep() { 
5467          if (getUdi().isEmpty()) {
5468            addUdi();
5469          }
5470          return getUdi().get(0);
5471        }
5472
5473        /**
5474         * @deprecated Use Reference#setResource(IBaseResource) instead
5475         */
5476        @Deprecated
5477        public List<Device> getUdiTarget() { 
5478          if (this.udiTarget == null)
5479            this.udiTarget = new ArrayList<Device>();
5480          return this.udiTarget;
5481        }
5482
5483        /**
5484         * @deprecated Use Reference#setResource(IBaseResource) instead
5485         */
5486        @Deprecated
5487        public Device addUdiTarget() { 
5488          Device r = new Device();
5489          if (this.udiTarget == null)
5490            this.udiTarget = new ArrayList<Device>();
5491          this.udiTarget.add(r);
5492          return r;
5493        }
5494
5495        /**
5496         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
5497         */
5498        public List<PositiveIntType> getNoteNumber() { 
5499          if (this.noteNumber == null)
5500            this.noteNumber = new ArrayList<PositiveIntType>();
5501          return this.noteNumber;
5502        }
5503
5504        /**
5505         * @return Returns a reference to <code>this</code> for easy method chaining
5506         */
5507        public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
5508          this.noteNumber = theNoteNumber;
5509          return this;
5510        }
5511
5512        public boolean hasNoteNumber() { 
5513          if (this.noteNumber == null)
5514            return false;
5515          for (PositiveIntType item : this.noteNumber)
5516            if (!item.isEmpty())
5517              return true;
5518          return false;
5519        }
5520
5521        /**
5522         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
5523         */
5524        public PositiveIntType addNoteNumberElement() {//2 
5525          PositiveIntType t = new PositiveIntType();
5526          if (this.noteNumber == null)
5527            this.noteNumber = new ArrayList<PositiveIntType>();
5528          this.noteNumber.add(t);
5529          return t;
5530        }
5531
5532        /**
5533         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
5534         */
5535        public DetailComponent addNoteNumber(int value) { //1
5536          PositiveIntType t = new PositiveIntType();
5537          t.setValue(value);
5538          if (this.noteNumber == null)
5539            this.noteNumber = new ArrayList<PositiveIntType>();
5540          this.noteNumber.add(t);
5541          return this;
5542        }
5543
5544        /**
5545         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
5546         */
5547        public boolean hasNoteNumber(int value) { 
5548          if (this.noteNumber == null)
5549            return false;
5550          for (PositiveIntType v : this.noteNumber)
5551            if (v.equals(value)) // positiveInt
5552              return true;
5553          return false;
5554        }
5555
5556        /**
5557         * @return {@link #adjudication} (The adjudications results.)
5558         */
5559        public List<AdjudicationComponent> getAdjudication() { 
5560          if (this.adjudication == null)
5561            this.adjudication = new ArrayList<AdjudicationComponent>();
5562          return this.adjudication;
5563        }
5564
5565        /**
5566         * @return Returns a reference to <code>this</code> for easy method chaining
5567         */
5568        public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
5569          this.adjudication = theAdjudication;
5570          return this;
5571        }
5572
5573        public boolean hasAdjudication() { 
5574          if (this.adjudication == null)
5575            return false;
5576          for (AdjudicationComponent item : this.adjudication)
5577            if (!item.isEmpty())
5578              return true;
5579          return false;
5580        }
5581
5582        public AdjudicationComponent addAdjudication() { //3
5583          AdjudicationComponent t = new AdjudicationComponent();
5584          if (this.adjudication == null)
5585            this.adjudication = new ArrayList<AdjudicationComponent>();
5586          this.adjudication.add(t);
5587          return t;
5588        }
5589
5590        public DetailComponent addAdjudication(AdjudicationComponent t) { //3
5591          if (t == null)
5592            return this;
5593          if (this.adjudication == null)
5594            this.adjudication = new ArrayList<AdjudicationComponent>();
5595          this.adjudication.add(t);
5596          return this;
5597        }
5598
5599        /**
5600         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
5601         */
5602        public AdjudicationComponent getAdjudicationFirstRep() { 
5603          if (getAdjudication().isEmpty()) {
5604            addAdjudication();
5605          }
5606          return getAdjudication().get(0);
5607        }
5608
5609        /**
5610         * @return {@link #subDetail} (Third tier of goods and services.)
5611         */
5612        public List<SubDetailComponent> getSubDetail() { 
5613          if (this.subDetail == null)
5614            this.subDetail = new ArrayList<SubDetailComponent>();
5615          return this.subDetail;
5616        }
5617
5618        /**
5619         * @return Returns a reference to <code>this</code> for easy method chaining
5620         */
5621        public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) { 
5622          this.subDetail = theSubDetail;
5623          return this;
5624        }
5625
5626        public boolean hasSubDetail() { 
5627          if (this.subDetail == null)
5628            return false;
5629          for (SubDetailComponent item : this.subDetail)
5630            if (!item.isEmpty())
5631              return true;
5632          return false;
5633        }
5634
5635        public SubDetailComponent addSubDetail() { //3
5636          SubDetailComponent t = new SubDetailComponent();
5637          if (this.subDetail == null)
5638            this.subDetail = new ArrayList<SubDetailComponent>();
5639          this.subDetail.add(t);
5640          return t;
5641        }
5642
5643        public DetailComponent addSubDetail(SubDetailComponent t) { //3
5644          if (t == null)
5645            return this;
5646          if (this.subDetail == null)
5647            this.subDetail = new ArrayList<SubDetailComponent>();
5648          this.subDetail.add(t);
5649          return this;
5650        }
5651
5652        /**
5653         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
5654         */
5655        public SubDetailComponent getSubDetailFirstRep() { 
5656          if (getSubDetail().isEmpty()) {
5657            addSubDetail();
5658          }
5659          return getSubDetail().get(0);
5660        }
5661
5662        protected void listChildren(List<Property> childrenList) {
5663          super.listChildren(childrenList);
5664          childrenList.add(new Property("sequence", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequence));
5665          childrenList.add(new Property("type", "CodeableConcept", "The type of product or service.", 0, java.lang.Integer.MAX_VALUE, type));
5666          childrenList.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, java.lang.Integer.MAX_VALUE, revenue));
5667          childrenList.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, java.lang.Integer.MAX_VALUE, category));
5668          childrenList.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, java.lang.Integer.MAX_VALUE, service));
5669          childrenList.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));
5670          childrenList.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));
5671          childrenList.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, java.lang.Integer.MAX_VALUE, quantity));
5672          childrenList.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, java.lang.Integer.MAX_VALUE, unitPrice));
5673          childrenList.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, java.lang.Integer.MAX_VALUE, factor));
5674          childrenList.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, java.lang.Integer.MAX_VALUE, net));
5675          childrenList.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
5676          childrenList.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
5677          childrenList.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
5678          childrenList.add(new Property("subDetail", "", "Third tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
5679        }
5680
5681      @Override
5682      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5683        switch (hash) {
5684        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
5685        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
5686        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
5687        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
5688        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
5689        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
5690        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
5691        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
5692        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
5693        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
5694        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
5695        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
5696        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
5697        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
5698        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
5699        default: return super.getProperty(hash, name, checkValid);
5700        }
5701
5702      }
5703
5704      @Override
5705      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5706        switch (hash) {
5707        case 1349547969: // sequence
5708          this.sequence = castToPositiveInt(value); // PositiveIntType
5709          return value;
5710        case 3575610: // type
5711          this.type = castToCodeableConcept(value); // CodeableConcept
5712          return value;
5713        case 1099842588: // revenue
5714          this.revenue = castToCodeableConcept(value); // CodeableConcept
5715          return value;
5716        case 50511102: // category
5717          this.category = castToCodeableConcept(value); // CodeableConcept
5718          return value;
5719        case 1984153269: // service
5720          this.service = castToCodeableConcept(value); // CodeableConcept
5721          return value;
5722        case -615513385: // modifier
5723          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
5724          return value;
5725        case 1010065041: // programCode
5726          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
5727          return value;
5728        case -1285004149: // quantity
5729          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
5730          return value;
5731        case -486196699: // unitPrice
5732          this.unitPrice = castToMoney(value); // Money
5733          return value;
5734        case -1282148017: // factor
5735          this.factor = castToDecimal(value); // DecimalType
5736          return value;
5737        case 108957: // net
5738          this.net = castToMoney(value); // Money
5739          return value;
5740        case 115642: // udi
5741          this.getUdi().add(castToReference(value)); // Reference
5742          return value;
5743        case -1110033957: // noteNumber
5744          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
5745          return value;
5746        case -231349275: // adjudication
5747          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
5748          return value;
5749        case -828829007: // subDetail
5750          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
5751          return value;
5752        default: return super.setProperty(hash, name, value);
5753        }
5754
5755      }
5756
5757      @Override
5758      public Base setProperty(String name, Base value) throws FHIRException {
5759        if (name.equals("sequence")) {
5760          this.sequence = castToPositiveInt(value); // PositiveIntType
5761        } else if (name.equals("type")) {
5762          this.type = castToCodeableConcept(value); // CodeableConcept
5763        } else if (name.equals("revenue")) {
5764          this.revenue = castToCodeableConcept(value); // CodeableConcept
5765        } else if (name.equals("category")) {
5766          this.category = castToCodeableConcept(value); // CodeableConcept
5767        } else if (name.equals("service")) {
5768          this.service = castToCodeableConcept(value); // CodeableConcept
5769        } else if (name.equals("modifier")) {
5770          this.getModifier().add(castToCodeableConcept(value));
5771        } else if (name.equals("programCode")) {
5772          this.getProgramCode().add(castToCodeableConcept(value));
5773        } else if (name.equals("quantity")) {
5774          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
5775        } else if (name.equals("unitPrice")) {
5776          this.unitPrice = castToMoney(value); // Money
5777        } else if (name.equals("factor")) {
5778          this.factor = castToDecimal(value); // DecimalType
5779        } else if (name.equals("net")) {
5780          this.net = castToMoney(value); // Money
5781        } else if (name.equals("udi")) {
5782          this.getUdi().add(castToReference(value));
5783        } else if (name.equals("noteNumber")) {
5784          this.getNoteNumber().add(castToPositiveInt(value));
5785        } else if (name.equals("adjudication")) {
5786          this.getAdjudication().add((AdjudicationComponent) value);
5787        } else if (name.equals("subDetail")) {
5788          this.getSubDetail().add((SubDetailComponent) value);
5789        } else
5790          return super.setProperty(name, value);
5791        return value;
5792      }
5793
5794      @Override
5795      public Base makeProperty(int hash, String name) throws FHIRException {
5796        switch (hash) {
5797        case 1349547969:  return getSequenceElement();
5798        case 3575610:  return getType(); 
5799        case 1099842588:  return getRevenue(); 
5800        case 50511102:  return getCategory(); 
5801        case 1984153269:  return getService(); 
5802        case -615513385:  return addModifier(); 
5803        case 1010065041:  return addProgramCode(); 
5804        case -1285004149:  return getQuantity(); 
5805        case -486196699:  return getUnitPrice(); 
5806        case -1282148017:  return getFactorElement();
5807        case 108957:  return getNet(); 
5808        case 115642:  return addUdi(); 
5809        case -1110033957:  return addNoteNumberElement();
5810        case -231349275:  return addAdjudication(); 
5811        case -828829007:  return addSubDetail(); 
5812        default: return super.makeProperty(hash, name);
5813        }
5814
5815      }
5816
5817      @Override
5818      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5819        switch (hash) {
5820        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
5821        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
5822        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
5823        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5824        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
5825        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
5826        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
5827        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
5828        case -486196699: /*unitPrice*/ return new String[] {"Money"};
5829        case -1282148017: /*factor*/ return new String[] {"decimal"};
5830        case 108957: /*net*/ return new String[] {"Money"};
5831        case 115642: /*udi*/ return new String[] {"Reference"};
5832        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
5833        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
5834        case -828829007: /*subDetail*/ return new String[] {};
5835        default: return super.getTypesForProperty(hash, name);
5836        }
5837
5838      }
5839
5840      @Override
5841      public Base addChild(String name) throws FHIRException {
5842        if (name.equals("sequence")) {
5843          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
5844        }
5845        else if (name.equals("type")) {
5846          this.type = new CodeableConcept();
5847          return this.type;
5848        }
5849        else if (name.equals("revenue")) {
5850          this.revenue = new CodeableConcept();
5851          return this.revenue;
5852        }
5853        else if (name.equals("category")) {
5854          this.category = new CodeableConcept();
5855          return this.category;
5856        }
5857        else if (name.equals("service")) {
5858          this.service = new CodeableConcept();
5859          return this.service;
5860        }
5861        else if (name.equals("modifier")) {
5862          return addModifier();
5863        }
5864        else if (name.equals("programCode")) {
5865          return addProgramCode();
5866        }
5867        else if (name.equals("quantity")) {
5868          this.quantity = new SimpleQuantity();
5869          return this.quantity;
5870        }
5871        else if (name.equals("unitPrice")) {
5872          this.unitPrice = new Money();
5873          return this.unitPrice;
5874        }
5875        else if (name.equals("factor")) {
5876          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
5877        }
5878        else if (name.equals("net")) {
5879          this.net = new Money();
5880          return this.net;
5881        }
5882        else if (name.equals("udi")) {
5883          return addUdi();
5884        }
5885        else if (name.equals("noteNumber")) {
5886          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
5887        }
5888        else if (name.equals("adjudication")) {
5889          return addAdjudication();
5890        }
5891        else if (name.equals("subDetail")) {
5892          return addSubDetail();
5893        }
5894        else
5895          return super.addChild(name);
5896      }
5897
5898      public DetailComponent copy() {
5899        DetailComponent dst = new DetailComponent();
5900        copyValues(dst);
5901        dst.sequence = sequence == null ? null : sequence.copy();
5902        dst.type = type == null ? null : type.copy();
5903        dst.revenue = revenue == null ? null : revenue.copy();
5904        dst.category = category == null ? null : category.copy();
5905        dst.service = service == null ? null : service.copy();
5906        if (modifier != null) {
5907          dst.modifier = new ArrayList<CodeableConcept>();
5908          for (CodeableConcept i : modifier)
5909            dst.modifier.add(i.copy());
5910        };
5911        if (programCode != null) {
5912          dst.programCode = new ArrayList<CodeableConcept>();
5913          for (CodeableConcept i : programCode)
5914            dst.programCode.add(i.copy());
5915        };
5916        dst.quantity = quantity == null ? null : quantity.copy();
5917        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
5918        dst.factor = factor == null ? null : factor.copy();
5919        dst.net = net == null ? null : net.copy();
5920        if (udi != null) {
5921          dst.udi = new ArrayList<Reference>();
5922          for (Reference i : udi)
5923            dst.udi.add(i.copy());
5924        };
5925        if (noteNumber != null) {
5926          dst.noteNumber = new ArrayList<PositiveIntType>();
5927          for (PositiveIntType i : noteNumber)
5928            dst.noteNumber.add(i.copy());
5929        };
5930        if (adjudication != null) {
5931          dst.adjudication = new ArrayList<AdjudicationComponent>();
5932          for (AdjudicationComponent i : adjudication)
5933            dst.adjudication.add(i.copy());
5934        };
5935        if (subDetail != null) {
5936          dst.subDetail = new ArrayList<SubDetailComponent>();
5937          for (SubDetailComponent i : subDetail)
5938            dst.subDetail.add(i.copy());
5939        };
5940        return dst;
5941      }
5942
5943      @Override
5944      public boolean equalsDeep(Base other) {
5945        if (!super.equalsDeep(other))
5946          return false;
5947        if (!(other instanceof DetailComponent))
5948          return false;
5949        DetailComponent o = (DetailComponent) other;
5950        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(revenue, o.revenue, true)
5951           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
5952           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
5953           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
5954           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
5955           && compareDeep(subDetail, o.subDetail, true);
5956      }
5957
5958      @Override
5959      public boolean equalsShallow(Base other) {
5960        if (!super.equalsShallow(other))
5961          return false;
5962        if (!(other instanceof DetailComponent))
5963          return false;
5964        DetailComponent o = (DetailComponent) other;
5965        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
5966          ;
5967      }
5968
5969      public boolean isEmpty() {
5970        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, revenue
5971          , category, service, modifier, programCode, quantity, unitPrice, factor, net
5972          , udi, noteNumber, adjudication, subDetail);
5973      }
5974
5975  public String fhirType() {
5976    return "ExplanationOfBenefit.item.detail";
5977
5978  }
5979
5980  }
5981
5982    @Block()
5983    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
5984        /**
5985         * A service line number.
5986         */
5987        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
5988        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
5989        protected PositiveIntType sequence;
5990
5991        /**
5992         * The type of product or service.
5993         */
5994        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
5995        @Description(shortDefinition="Type of product or service", formalDefinition="The type of product or service." )
5996        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActInvoiceGroupCode")
5997        protected CodeableConcept type;
5998
5999        /**
6000         * The type of reveneu or cost center providing the product and/or service.
6001         */
6002        @Child(name = "revenue", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
6003        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
6004        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
6005        protected CodeableConcept revenue;
6006
6007        /**
6008         * Health Care Service Type Codes  to identify the classification of service or benefits.
6009         */
6010        @Child(name = "category", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
6011        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
6012        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
6013        protected CodeableConcept category;
6014
6015        /**
6016         * A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).
6017         */
6018        @Child(name = "service", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
6019        @Description(shortDefinition="Billing Code", formalDefinition="A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI)." )
6020        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6021        protected CodeableConcept service;
6022
6023        /**
6024         * 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.
6025         */
6026        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6027        @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." )
6028        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
6029        protected List<CodeableConcept> modifier;
6030
6031        /**
6032         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
6033         */
6034        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6035        @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." )
6036        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
6037        protected List<CodeableConcept> programCode;
6038
6039        /**
6040         * The number of repetitions of a service or product.
6041         */
6042        @Child(name = "quantity", type = {SimpleQuantity.class}, order=8, min=0, max=1, modifier=false, summary=false)
6043        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
6044        protected SimpleQuantity quantity;
6045
6046        /**
6047         * The fee for an addittional service or product or charge.
6048         */
6049        @Child(name = "unitPrice", type = {Money.class}, order=9, min=0, max=1, modifier=false, summary=false)
6050        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="The fee for an addittional service or product or charge." )
6051        protected Money unitPrice;
6052
6053        /**
6054         * 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.
6055         */
6056        @Child(name = "factor", type = {DecimalType.class}, order=10, min=0, max=1, modifier=false, summary=false)
6057        @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." )
6058        protected DecimalType factor;
6059
6060        /**
6061         * 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.
6062         */
6063        @Child(name = "net", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=false)
6064        @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." )
6065        protected Money net;
6066
6067        /**
6068         * List of Unique Device Identifiers associated with this line item.
6069         */
6070        @Child(name = "udi", type = {Device.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6071        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
6072        protected List<Reference> udi;
6073        /**
6074         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
6075         */
6076        protected List<Device> udiTarget;
6077
6078
6079        /**
6080         * A list of note references to the notes provided below.
6081         */
6082        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6083        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
6084        protected List<PositiveIntType> noteNumber;
6085
6086        /**
6087         * The adjudications results.
6088         */
6089        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6090        @Description(shortDefinition="Language if different from the resource", formalDefinition="The adjudications results." )
6091        protected List<AdjudicationComponent> adjudication;
6092
6093        private static final long serialVersionUID = 1621872130L;
6094
6095    /**
6096     * Constructor
6097     */
6098      public SubDetailComponent() {
6099        super();
6100      }
6101
6102    /**
6103     * Constructor
6104     */
6105      public SubDetailComponent(PositiveIntType sequence, CodeableConcept type) {
6106        super();
6107        this.sequence = sequence;
6108        this.type = type;
6109      }
6110
6111        /**
6112         * @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
6113         */
6114        public PositiveIntType getSequenceElement() { 
6115          if (this.sequence == null)
6116            if (Configuration.errorOnAutoCreate())
6117              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
6118            else if (Configuration.doAutoCreate())
6119              this.sequence = new PositiveIntType(); // bb
6120          return this.sequence;
6121        }
6122
6123        public boolean hasSequenceElement() { 
6124          return this.sequence != null && !this.sequence.isEmpty();
6125        }
6126
6127        public boolean hasSequence() { 
6128          return this.sequence != null && !this.sequence.isEmpty();
6129        }
6130
6131        /**
6132         * @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
6133         */
6134        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
6135          this.sequence = value;
6136          return this;
6137        }
6138
6139        /**
6140         * @return A service line number.
6141         */
6142        public int getSequence() { 
6143          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6144        }
6145
6146        /**
6147         * @param value A service line number.
6148         */
6149        public SubDetailComponent setSequence(int value) { 
6150            if (this.sequence == null)
6151              this.sequence = new PositiveIntType();
6152            this.sequence.setValue(value);
6153          return this;
6154        }
6155
6156        /**
6157         * @return {@link #type} (The type of product or service.)
6158         */
6159        public CodeableConcept getType() { 
6160          if (this.type == null)
6161            if (Configuration.errorOnAutoCreate())
6162              throw new Error("Attempt to auto-create SubDetailComponent.type");
6163            else if (Configuration.doAutoCreate())
6164              this.type = new CodeableConcept(); // cc
6165          return this.type;
6166        }
6167
6168        public boolean hasType() { 
6169          return this.type != null && !this.type.isEmpty();
6170        }
6171
6172        /**
6173         * @param value {@link #type} (The type of product or service.)
6174         */
6175        public SubDetailComponent setType(CodeableConcept value) { 
6176          this.type = value;
6177          return this;
6178        }
6179
6180        /**
6181         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
6182         */
6183        public CodeableConcept getRevenue() { 
6184          if (this.revenue == null)
6185            if (Configuration.errorOnAutoCreate())
6186              throw new Error("Attempt to auto-create SubDetailComponent.revenue");
6187            else if (Configuration.doAutoCreate())
6188              this.revenue = new CodeableConcept(); // cc
6189          return this.revenue;
6190        }
6191
6192        public boolean hasRevenue() { 
6193          return this.revenue != null && !this.revenue.isEmpty();
6194        }
6195
6196        /**
6197         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
6198         */
6199        public SubDetailComponent setRevenue(CodeableConcept value) { 
6200          this.revenue = value;
6201          return this;
6202        }
6203
6204        /**
6205         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
6206         */
6207        public CodeableConcept getCategory() { 
6208          if (this.category == null)
6209            if (Configuration.errorOnAutoCreate())
6210              throw new Error("Attempt to auto-create SubDetailComponent.category");
6211            else if (Configuration.doAutoCreate())
6212              this.category = new CodeableConcept(); // cc
6213          return this.category;
6214        }
6215
6216        public boolean hasCategory() { 
6217          return this.category != null && !this.category.isEmpty();
6218        }
6219
6220        /**
6221         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
6222         */
6223        public SubDetailComponent setCategory(CodeableConcept value) { 
6224          this.category = value;
6225          return this;
6226        }
6227
6228        /**
6229         * @return {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
6230         */
6231        public CodeableConcept getService() { 
6232          if (this.service == null)
6233            if (Configuration.errorOnAutoCreate())
6234              throw new Error("Attempt to auto-create SubDetailComponent.service");
6235            else if (Configuration.doAutoCreate())
6236              this.service = new CodeableConcept(); // cc
6237          return this.service;
6238        }
6239
6240        public boolean hasService() { 
6241          return this.service != null && !this.service.isEmpty();
6242        }
6243
6244        /**
6245         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
6246         */
6247        public SubDetailComponent setService(CodeableConcept value) { 
6248          this.service = value;
6249          return this;
6250        }
6251
6252        /**
6253         * @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.)
6254         */
6255        public List<CodeableConcept> getModifier() { 
6256          if (this.modifier == null)
6257            this.modifier = new ArrayList<CodeableConcept>();
6258          return this.modifier;
6259        }
6260
6261        /**
6262         * @return Returns a reference to <code>this</code> for easy method chaining
6263         */
6264        public SubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
6265          this.modifier = theModifier;
6266          return this;
6267        }
6268
6269        public boolean hasModifier() { 
6270          if (this.modifier == null)
6271            return false;
6272          for (CodeableConcept item : this.modifier)
6273            if (!item.isEmpty())
6274              return true;
6275          return false;
6276        }
6277
6278        public CodeableConcept addModifier() { //3
6279          CodeableConcept t = new CodeableConcept();
6280          if (this.modifier == null)
6281            this.modifier = new ArrayList<CodeableConcept>();
6282          this.modifier.add(t);
6283          return t;
6284        }
6285
6286        public SubDetailComponent addModifier(CodeableConcept t) { //3
6287          if (t == null)
6288            return this;
6289          if (this.modifier == null)
6290            this.modifier = new ArrayList<CodeableConcept>();
6291          this.modifier.add(t);
6292          return this;
6293        }
6294
6295        /**
6296         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
6297         */
6298        public CodeableConcept getModifierFirstRep() { 
6299          if (getModifier().isEmpty()) {
6300            addModifier();
6301          }
6302          return getModifier().get(0);
6303        }
6304
6305        /**
6306         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
6307         */
6308        public List<CodeableConcept> getProgramCode() { 
6309          if (this.programCode == null)
6310            this.programCode = new ArrayList<CodeableConcept>();
6311          return this.programCode;
6312        }
6313
6314        /**
6315         * @return Returns a reference to <code>this</code> for easy method chaining
6316         */
6317        public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
6318          this.programCode = theProgramCode;
6319          return this;
6320        }
6321
6322        public boolean hasProgramCode() { 
6323          if (this.programCode == null)
6324            return false;
6325          for (CodeableConcept item : this.programCode)
6326            if (!item.isEmpty())
6327              return true;
6328          return false;
6329        }
6330
6331        public CodeableConcept addProgramCode() { //3
6332          CodeableConcept t = new CodeableConcept();
6333          if (this.programCode == null)
6334            this.programCode = new ArrayList<CodeableConcept>();
6335          this.programCode.add(t);
6336          return t;
6337        }
6338
6339        public SubDetailComponent addProgramCode(CodeableConcept t) { //3
6340          if (t == null)
6341            return this;
6342          if (this.programCode == null)
6343            this.programCode = new ArrayList<CodeableConcept>();
6344          this.programCode.add(t);
6345          return this;
6346        }
6347
6348        /**
6349         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
6350         */
6351        public CodeableConcept getProgramCodeFirstRep() { 
6352          if (getProgramCode().isEmpty()) {
6353            addProgramCode();
6354          }
6355          return getProgramCode().get(0);
6356        }
6357
6358        /**
6359         * @return {@link #quantity} (The number of repetitions of a service or product.)
6360         */
6361        public SimpleQuantity getQuantity() { 
6362          if (this.quantity == null)
6363            if (Configuration.errorOnAutoCreate())
6364              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
6365            else if (Configuration.doAutoCreate())
6366              this.quantity = new SimpleQuantity(); // cc
6367          return this.quantity;
6368        }
6369
6370        public boolean hasQuantity() { 
6371          return this.quantity != null && !this.quantity.isEmpty();
6372        }
6373
6374        /**
6375         * @param value {@link #quantity} (The number of repetitions of a service or product.)
6376         */
6377        public SubDetailComponent setQuantity(SimpleQuantity value) { 
6378          this.quantity = value;
6379          return this;
6380        }
6381
6382        /**
6383         * @return {@link #unitPrice} (The fee for an addittional service or product or charge.)
6384         */
6385        public Money getUnitPrice() { 
6386          if (this.unitPrice == null)
6387            if (Configuration.errorOnAutoCreate())
6388              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
6389            else if (Configuration.doAutoCreate())
6390              this.unitPrice = new Money(); // cc
6391          return this.unitPrice;
6392        }
6393
6394        public boolean hasUnitPrice() { 
6395          return this.unitPrice != null && !this.unitPrice.isEmpty();
6396        }
6397
6398        /**
6399         * @param value {@link #unitPrice} (The fee for an addittional service or product or charge.)
6400         */
6401        public SubDetailComponent setUnitPrice(Money value) { 
6402          this.unitPrice = value;
6403          return this;
6404        }
6405
6406        /**
6407         * @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
6408         */
6409        public DecimalType getFactorElement() { 
6410          if (this.factor == null)
6411            if (Configuration.errorOnAutoCreate())
6412              throw new Error("Attempt to auto-create SubDetailComponent.factor");
6413            else if (Configuration.doAutoCreate())
6414              this.factor = new DecimalType(); // bb
6415          return this.factor;
6416        }
6417
6418        public boolean hasFactorElement() { 
6419          return this.factor != null && !this.factor.isEmpty();
6420        }
6421
6422        public boolean hasFactor() { 
6423          return this.factor != null && !this.factor.isEmpty();
6424        }
6425
6426        /**
6427         * @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
6428         */
6429        public SubDetailComponent setFactorElement(DecimalType value) { 
6430          this.factor = value;
6431          return this;
6432        }
6433
6434        /**
6435         * @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.
6436         */
6437        public BigDecimal getFactor() { 
6438          return this.factor == null ? null : this.factor.getValue();
6439        }
6440
6441        /**
6442         * @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.
6443         */
6444        public SubDetailComponent setFactor(BigDecimal value) { 
6445          if (value == null)
6446            this.factor = null;
6447          else {
6448            if (this.factor == null)
6449              this.factor = new DecimalType();
6450            this.factor.setValue(value);
6451          }
6452          return this;
6453        }
6454
6455        /**
6456         * @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.
6457         */
6458        public SubDetailComponent setFactor(long value) { 
6459              this.factor = new DecimalType();
6460            this.factor.setValue(value);
6461          return this;
6462        }
6463
6464        /**
6465         * @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.
6466         */
6467        public SubDetailComponent setFactor(double value) { 
6468              this.factor = new DecimalType();
6469            this.factor.setValue(value);
6470          return this;
6471        }
6472
6473        /**
6474         * @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.)
6475         */
6476        public Money getNet() { 
6477          if (this.net == null)
6478            if (Configuration.errorOnAutoCreate())
6479              throw new Error("Attempt to auto-create SubDetailComponent.net");
6480            else if (Configuration.doAutoCreate())
6481              this.net = new Money(); // cc
6482          return this.net;
6483        }
6484
6485        public boolean hasNet() { 
6486          return this.net != null && !this.net.isEmpty();
6487        }
6488
6489        /**
6490         * @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.)
6491         */
6492        public SubDetailComponent setNet(Money value) { 
6493          this.net = value;
6494          return this;
6495        }
6496
6497        /**
6498         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
6499         */
6500        public List<Reference> getUdi() { 
6501          if (this.udi == null)
6502            this.udi = new ArrayList<Reference>();
6503          return this.udi;
6504        }
6505
6506        /**
6507         * @return Returns a reference to <code>this</code> for easy method chaining
6508         */
6509        public SubDetailComponent setUdi(List<Reference> theUdi) { 
6510          this.udi = theUdi;
6511          return this;
6512        }
6513
6514        public boolean hasUdi() { 
6515          if (this.udi == null)
6516            return false;
6517          for (Reference item : this.udi)
6518            if (!item.isEmpty())
6519              return true;
6520          return false;
6521        }
6522
6523        public Reference addUdi() { //3
6524          Reference t = new Reference();
6525          if (this.udi == null)
6526            this.udi = new ArrayList<Reference>();
6527          this.udi.add(t);
6528          return t;
6529        }
6530
6531        public SubDetailComponent addUdi(Reference t) { //3
6532          if (t == null)
6533            return this;
6534          if (this.udi == null)
6535            this.udi = new ArrayList<Reference>();
6536          this.udi.add(t);
6537          return this;
6538        }
6539
6540        /**
6541         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
6542         */
6543        public Reference getUdiFirstRep() { 
6544          if (getUdi().isEmpty()) {
6545            addUdi();
6546          }
6547          return getUdi().get(0);
6548        }
6549
6550        /**
6551         * @deprecated Use Reference#setResource(IBaseResource) instead
6552         */
6553        @Deprecated
6554        public List<Device> getUdiTarget() { 
6555          if (this.udiTarget == null)
6556            this.udiTarget = new ArrayList<Device>();
6557          return this.udiTarget;
6558        }
6559
6560        /**
6561         * @deprecated Use Reference#setResource(IBaseResource) instead
6562         */
6563        @Deprecated
6564        public Device addUdiTarget() { 
6565          Device r = new Device();
6566          if (this.udiTarget == null)
6567            this.udiTarget = new ArrayList<Device>();
6568          this.udiTarget.add(r);
6569          return r;
6570        }
6571
6572        /**
6573         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
6574         */
6575        public List<PositiveIntType> getNoteNumber() { 
6576          if (this.noteNumber == null)
6577            this.noteNumber = new ArrayList<PositiveIntType>();
6578          return this.noteNumber;
6579        }
6580
6581        /**
6582         * @return Returns a reference to <code>this</code> for easy method chaining
6583         */
6584        public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
6585          this.noteNumber = theNoteNumber;
6586          return this;
6587        }
6588
6589        public boolean hasNoteNumber() { 
6590          if (this.noteNumber == null)
6591            return false;
6592          for (PositiveIntType item : this.noteNumber)
6593            if (!item.isEmpty())
6594              return true;
6595          return false;
6596        }
6597
6598        /**
6599         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
6600         */
6601        public PositiveIntType addNoteNumberElement() {//2 
6602          PositiveIntType t = new PositiveIntType();
6603          if (this.noteNumber == null)
6604            this.noteNumber = new ArrayList<PositiveIntType>();
6605          this.noteNumber.add(t);
6606          return t;
6607        }
6608
6609        /**
6610         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
6611         */
6612        public SubDetailComponent addNoteNumber(int value) { //1
6613          PositiveIntType t = new PositiveIntType();
6614          t.setValue(value);
6615          if (this.noteNumber == null)
6616            this.noteNumber = new ArrayList<PositiveIntType>();
6617          this.noteNumber.add(t);
6618          return this;
6619        }
6620
6621        /**
6622         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
6623         */
6624        public boolean hasNoteNumber(int value) { 
6625          if (this.noteNumber == null)
6626            return false;
6627          for (PositiveIntType v : this.noteNumber)
6628            if (v.equals(value)) // positiveInt
6629              return true;
6630          return false;
6631        }
6632
6633        /**
6634         * @return {@link #adjudication} (The adjudications results.)
6635         */
6636        public List<AdjudicationComponent> getAdjudication() { 
6637          if (this.adjudication == null)
6638            this.adjudication = new ArrayList<AdjudicationComponent>();
6639          return this.adjudication;
6640        }
6641
6642        /**
6643         * @return Returns a reference to <code>this</code> for easy method chaining
6644         */
6645        public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
6646          this.adjudication = theAdjudication;
6647          return this;
6648        }
6649
6650        public boolean hasAdjudication() { 
6651          if (this.adjudication == null)
6652            return false;
6653          for (AdjudicationComponent item : this.adjudication)
6654            if (!item.isEmpty())
6655              return true;
6656          return false;
6657        }
6658
6659        public AdjudicationComponent addAdjudication() { //3
6660          AdjudicationComponent t = new AdjudicationComponent();
6661          if (this.adjudication == null)
6662            this.adjudication = new ArrayList<AdjudicationComponent>();
6663          this.adjudication.add(t);
6664          return t;
6665        }
6666
6667        public SubDetailComponent addAdjudication(AdjudicationComponent t) { //3
6668          if (t == null)
6669            return this;
6670          if (this.adjudication == null)
6671            this.adjudication = new ArrayList<AdjudicationComponent>();
6672          this.adjudication.add(t);
6673          return this;
6674        }
6675
6676        /**
6677         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
6678         */
6679        public AdjudicationComponent getAdjudicationFirstRep() { 
6680          if (getAdjudication().isEmpty()) {
6681            addAdjudication();
6682          }
6683          return getAdjudication().get(0);
6684        }
6685
6686        protected void listChildren(List<Property> childrenList) {
6687          super.listChildren(childrenList);
6688          childrenList.add(new Property("sequence", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequence));
6689          childrenList.add(new Property("type", "CodeableConcept", "The type of product or service.", 0, java.lang.Integer.MAX_VALUE, type));
6690          childrenList.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, java.lang.Integer.MAX_VALUE, revenue));
6691          childrenList.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, java.lang.Integer.MAX_VALUE, category));
6692          childrenList.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, java.lang.Integer.MAX_VALUE, service));
6693          childrenList.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));
6694          childrenList.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));
6695          childrenList.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, java.lang.Integer.MAX_VALUE, quantity));
6696          childrenList.add(new Property("unitPrice", "Money", "The fee for an addittional service or product or charge.", 0, java.lang.Integer.MAX_VALUE, unitPrice));
6697          childrenList.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, java.lang.Integer.MAX_VALUE, factor));
6698          childrenList.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, java.lang.Integer.MAX_VALUE, net));
6699          childrenList.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
6700          childrenList.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
6701          childrenList.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6702        }
6703
6704      @Override
6705      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6706        switch (hash) {
6707        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6708        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
6709        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6710        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6711        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
6712        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6713        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6714        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
6715        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6716        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6717        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6718        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6719        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
6720        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
6721        default: return super.getProperty(hash, name, checkValid);
6722        }
6723
6724      }
6725
6726      @Override
6727      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6728        switch (hash) {
6729        case 1349547969: // sequence
6730          this.sequence = castToPositiveInt(value); // PositiveIntType
6731          return value;
6732        case 3575610: // type
6733          this.type = castToCodeableConcept(value); // CodeableConcept
6734          return value;
6735        case 1099842588: // revenue
6736          this.revenue = castToCodeableConcept(value); // CodeableConcept
6737          return value;
6738        case 50511102: // category
6739          this.category = castToCodeableConcept(value); // CodeableConcept
6740          return value;
6741        case 1984153269: // service
6742          this.service = castToCodeableConcept(value); // CodeableConcept
6743          return value;
6744        case -615513385: // modifier
6745          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
6746          return value;
6747        case 1010065041: // programCode
6748          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
6749          return value;
6750        case -1285004149: // quantity
6751          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
6752          return value;
6753        case -486196699: // unitPrice
6754          this.unitPrice = castToMoney(value); // Money
6755          return value;
6756        case -1282148017: // factor
6757          this.factor = castToDecimal(value); // DecimalType
6758          return value;
6759        case 108957: // net
6760          this.net = castToMoney(value); // Money
6761          return value;
6762        case 115642: // udi
6763          this.getUdi().add(castToReference(value)); // Reference
6764          return value;
6765        case -1110033957: // noteNumber
6766          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
6767          return value;
6768        case -231349275: // adjudication
6769          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
6770          return value;
6771        default: return super.setProperty(hash, name, value);
6772        }
6773
6774      }
6775
6776      @Override
6777      public Base setProperty(String name, Base value) throws FHIRException {
6778        if (name.equals("sequence")) {
6779          this.sequence = castToPositiveInt(value); // PositiveIntType
6780        } else if (name.equals("type")) {
6781          this.type = castToCodeableConcept(value); // CodeableConcept
6782        } else if (name.equals("revenue")) {
6783          this.revenue = castToCodeableConcept(value); // CodeableConcept
6784        } else if (name.equals("category")) {
6785          this.category = castToCodeableConcept(value); // CodeableConcept
6786        } else if (name.equals("service")) {
6787          this.service = castToCodeableConcept(value); // CodeableConcept
6788        } else if (name.equals("modifier")) {
6789          this.getModifier().add(castToCodeableConcept(value));
6790        } else if (name.equals("programCode")) {
6791          this.getProgramCode().add(castToCodeableConcept(value));
6792        } else if (name.equals("quantity")) {
6793          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
6794        } else if (name.equals("unitPrice")) {
6795          this.unitPrice = castToMoney(value); // Money
6796        } else if (name.equals("factor")) {
6797          this.factor = castToDecimal(value); // DecimalType
6798        } else if (name.equals("net")) {
6799          this.net = castToMoney(value); // Money
6800        } else if (name.equals("udi")) {
6801          this.getUdi().add(castToReference(value));
6802        } else if (name.equals("noteNumber")) {
6803          this.getNoteNumber().add(castToPositiveInt(value));
6804        } else if (name.equals("adjudication")) {
6805          this.getAdjudication().add((AdjudicationComponent) value);
6806        } else
6807          return super.setProperty(name, value);
6808        return value;
6809      }
6810
6811      @Override
6812      public Base makeProperty(int hash, String name) throws FHIRException {
6813        switch (hash) {
6814        case 1349547969:  return getSequenceElement();
6815        case 3575610:  return getType(); 
6816        case 1099842588:  return getRevenue(); 
6817        case 50511102:  return getCategory(); 
6818        case 1984153269:  return getService(); 
6819        case -615513385:  return addModifier(); 
6820        case 1010065041:  return addProgramCode(); 
6821        case -1285004149:  return getQuantity(); 
6822        case -486196699:  return getUnitPrice(); 
6823        case -1282148017:  return getFactorElement();
6824        case 108957:  return getNet(); 
6825        case 115642:  return addUdi(); 
6826        case -1110033957:  return addNoteNumberElement();
6827        case -231349275:  return addAdjudication(); 
6828        default: return super.makeProperty(hash, name);
6829        }
6830
6831      }
6832
6833      @Override
6834      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6835        switch (hash) {
6836        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
6837        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
6838        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
6839        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
6840        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
6841        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
6842        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
6843        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
6844        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6845        case -1282148017: /*factor*/ return new String[] {"decimal"};
6846        case 108957: /*net*/ return new String[] {"Money"};
6847        case 115642: /*udi*/ return new String[] {"Reference"};
6848        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
6849        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
6850        default: return super.getTypesForProperty(hash, name);
6851        }
6852
6853      }
6854
6855      @Override
6856      public Base addChild(String name) throws FHIRException {
6857        if (name.equals("sequence")) {
6858          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
6859        }
6860        else if (name.equals("type")) {
6861          this.type = new CodeableConcept();
6862          return this.type;
6863        }
6864        else if (name.equals("revenue")) {
6865          this.revenue = new CodeableConcept();
6866          return this.revenue;
6867        }
6868        else if (name.equals("category")) {
6869          this.category = new CodeableConcept();
6870          return this.category;
6871        }
6872        else if (name.equals("service")) {
6873          this.service = new CodeableConcept();
6874          return this.service;
6875        }
6876        else if (name.equals("modifier")) {
6877          return addModifier();
6878        }
6879        else if (name.equals("programCode")) {
6880          return addProgramCode();
6881        }
6882        else if (name.equals("quantity")) {
6883          this.quantity = new SimpleQuantity();
6884          return this.quantity;
6885        }
6886        else if (name.equals("unitPrice")) {
6887          this.unitPrice = new Money();
6888          return this.unitPrice;
6889        }
6890        else if (name.equals("factor")) {
6891          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
6892        }
6893        else if (name.equals("net")) {
6894          this.net = new Money();
6895          return this.net;
6896        }
6897        else if (name.equals("udi")) {
6898          return addUdi();
6899        }
6900        else if (name.equals("noteNumber")) {
6901          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
6902        }
6903        else if (name.equals("adjudication")) {
6904          return addAdjudication();
6905        }
6906        else
6907          return super.addChild(name);
6908      }
6909
6910      public SubDetailComponent copy() {
6911        SubDetailComponent dst = new SubDetailComponent();
6912        copyValues(dst);
6913        dst.sequence = sequence == null ? null : sequence.copy();
6914        dst.type = type == null ? null : type.copy();
6915        dst.revenue = revenue == null ? null : revenue.copy();
6916        dst.category = category == null ? null : category.copy();
6917        dst.service = service == null ? null : service.copy();
6918        if (modifier != null) {
6919          dst.modifier = new ArrayList<CodeableConcept>();
6920          for (CodeableConcept i : modifier)
6921            dst.modifier.add(i.copy());
6922        };
6923        if (programCode != null) {
6924          dst.programCode = new ArrayList<CodeableConcept>();
6925          for (CodeableConcept i : programCode)
6926            dst.programCode.add(i.copy());
6927        };
6928        dst.quantity = quantity == null ? null : quantity.copy();
6929        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6930        dst.factor = factor == null ? null : factor.copy();
6931        dst.net = net == null ? null : net.copy();
6932        if (udi != null) {
6933          dst.udi = new ArrayList<Reference>();
6934          for (Reference i : udi)
6935            dst.udi.add(i.copy());
6936        };
6937        if (noteNumber != null) {
6938          dst.noteNumber = new ArrayList<PositiveIntType>();
6939          for (PositiveIntType i : noteNumber)
6940            dst.noteNumber.add(i.copy());
6941        };
6942        if (adjudication != null) {
6943          dst.adjudication = new ArrayList<AdjudicationComponent>();
6944          for (AdjudicationComponent i : adjudication)
6945            dst.adjudication.add(i.copy());
6946        };
6947        return dst;
6948      }
6949
6950      @Override
6951      public boolean equalsDeep(Base other) {
6952        if (!super.equalsDeep(other))
6953          return false;
6954        if (!(other instanceof SubDetailComponent))
6955          return false;
6956        SubDetailComponent o = (SubDetailComponent) other;
6957        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(revenue, o.revenue, true)
6958           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
6959           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
6960           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6961           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
6962          ;
6963      }
6964
6965      @Override
6966      public boolean equalsShallow(Base other) {
6967        if (!super.equalsShallow(other))
6968          return false;
6969        if (!(other instanceof SubDetailComponent))
6970          return false;
6971        SubDetailComponent o = (SubDetailComponent) other;
6972        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
6973          ;
6974      }
6975
6976      public boolean isEmpty() {
6977        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, revenue
6978          , category, service, modifier, programCode, quantity, unitPrice, factor, net
6979          , udi, noteNumber, adjudication);
6980      }
6981
6982  public String fhirType() {
6983    return "ExplanationOfBenefit.item.detail.subDetail";
6984
6985  }
6986
6987  }
6988
6989    @Block()
6990    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
6991        /**
6992         * List of input service items which this service line is intended to replace.
6993         */
6994        @Child(name = "sequenceLinkId", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6995        @Description(shortDefinition="Service instances", formalDefinition="List of input service items which this service line is intended to replace." )
6996        protected List<PositiveIntType> sequenceLinkId;
6997
6998        /**
6999         * The type of reveneu or cost center providing the product and/or service.
7000         */
7001        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
7002        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
7003        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
7004        protected CodeableConcept revenue;
7005
7006        /**
7007         * Health Care Service Type Codes  to identify the classification of service or benefits.
7008         */
7009        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
7010        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
7011        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
7012        protected CodeableConcept category;
7013
7014        /**
7015         * 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'.
7016         */
7017        @Child(name = "service", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
7018        @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'." )
7019        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7020        protected CodeableConcept service;
7021
7022        /**
7023         * 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.
7024         */
7025        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7026        @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." )
7027        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
7028        protected List<CodeableConcept> modifier;
7029
7030        /**
7031         * The fee charged for the professional service or product.
7032         */
7033        @Child(name = "fee", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
7034        @Description(shortDefinition="Professional fee or Product charge", formalDefinition="The fee charged for the professional service or product." )
7035        protected Money fee;
7036
7037        /**
7038         * A list of note references to the notes provided below.
7039         */
7040        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7041        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
7042        protected List<PositiveIntType> noteNumber;
7043
7044        /**
7045         * The adjudications results.
7046         */
7047        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7048        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudications results." )
7049        protected List<AdjudicationComponent> adjudication;
7050
7051        /**
7052         * The second tier service adjudications for payor added services.
7053         */
7054        @Child(name = "detail", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7055        @Description(shortDefinition="Added items details", formalDefinition="The second tier service adjudications for payor added services." )
7056        protected List<AddedItemsDetailComponent> detail;
7057
7058        private static final long serialVersionUID = 1969703165L;
7059
7060    /**
7061     * Constructor
7062     */
7063      public AddedItemComponent() {
7064        super();
7065      }
7066
7067        /**
7068         * @return {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
7069         */
7070        public List<PositiveIntType> getSequenceLinkId() { 
7071          if (this.sequenceLinkId == null)
7072            this.sequenceLinkId = new ArrayList<PositiveIntType>();
7073          return this.sequenceLinkId;
7074        }
7075
7076        /**
7077         * @return Returns a reference to <code>this</code> for easy method chaining
7078         */
7079        public AddedItemComponent setSequenceLinkId(List<PositiveIntType> theSequenceLinkId) { 
7080          this.sequenceLinkId = theSequenceLinkId;
7081          return this;
7082        }
7083
7084        public boolean hasSequenceLinkId() { 
7085          if (this.sequenceLinkId == null)
7086            return false;
7087          for (PositiveIntType item : this.sequenceLinkId)
7088            if (!item.isEmpty())
7089              return true;
7090          return false;
7091        }
7092
7093        /**
7094         * @return {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
7095         */
7096        public PositiveIntType addSequenceLinkIdElement() {//2 
7097          PositiveIntType t = new PositiveIntType();
7098          if (this.sequenceLinkId == null)
7099            this.sequenceLinkId = new ArrayList<PositiveIntType>();
7100          this.sequenceLinkId.add(t);
7101          return t;
7102        }
7103
7104        /**
7105         * @param value {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
7106         */
7107        public AddedItemComponent addSequenceLinkId(int value) { //1
7108          PositiveIntType t = new PositiveIntType();
7109          t.setValue(value);
7110          if (this.sequenceLinkId == null)
7111            this.sequenceLinkId = new ArrayList<PositiveIntType>();
7112          this.sequenceLinkId.add(t);
7113          return this;
7114        }
7115
7116        /**
7117         * @param value {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
7118         */
7119        public boolean hasSequenceLinkId(int value) { 
7120          if (this.sequenceLinkId == null)
7121            return false;
7122          for (PositiveIntType v : this.sequenceLinkId)
7123            if (v.equals(value)) // positiveInt
7124              return true;
7125          return false;
7126        }
7127
7128        /**
7129         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
7130         */
7131        public CodeableConcept getRevenue() { 
7132          if (this.revenue == null)
7133            if (Configuration.errorOnAutoCreate())
7134              throw new Error("Attempt to auto-create AddedItemComponent.revenue");
7135            else if (Configuration.doAutoCreate())
7136              this.revenue = new CodeableConcept(); // cc
7137          return this.revenue;
7138        }
7139
7140        public boolean hasRevenue() { 
7141          return this.revenue != null && !this.revenue.isEmpty();
7142        }
7143
7144        /**
7145         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
7146         */
7147        public AddedItemComponent setRevenue(CodeableConcept value) { 
7148          this.revenue = value;
7149          return this;
7150        }
7151
7152        /**
7153         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
7154         */
7155        public CodeableConcept getCategory() { 
7156          if (this.category == null)
7157            if (Configuration.errorOnAutoCreate())
7158              throw new Error("Attempt to auto-create AddedItemComponent.category");
7159            else if (Configuration.doAutoCreate())
7160              this.category = new CodeableConcept(); // cc
7161          return this.category;
7162        }
7163
7164        public boolean hasCategory() { 
7165          return this.category != null && !this.category.isEmpty();
7166        }
7167
7168        /**
7169         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
7170         */
7171        public AddedItemComponent setCategory(CodeableConcept value) { 
7172          this.category = value;
7173          return this;
7174        }
7175
7176        /**
7177         * @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'.)
7178         */
7179        public CodeableConcept getService() { 
7180          if (this.service == null)
7181            if (Configuration.errorOnAutoCreate())
7182              throw new Error("Attempt to auto-create AddedItemComponent.service");
7183            else if (Configuration.doAutoCreate())
7184              this.service = new CodeableConcept(); // cc
7185          return this.service;
7186        }
7187
7188        public boolean hasService() { 
7189          return this.service != null && !this.service.isEmpty();
7190        }
7191
7192        /**
7193         * @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'.)
7194         */
7195        public AddedItemComponent setService(CodeableConcept value) { 
7196          this.service = value;
7197          return this;
7198        }
7199
7200        /**
7201         * @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.)
7202         */
7203        public List<CodeableConcept> getModifier() { 
7204          if (this.modifier == null)
7205            this.modifier = new ArrayList<CodeableConcept>();
7206          return this.modifier;
7207        }
7208
7209        /**
7210         * @return Returns a reference to <code>this</code> for easy method chaining
7211         */
7212        public AddedItemComponent setModifier(List<CodeableConcept> theModifier) { 
7213          this.modifier = theModifier;
7214          return this;
7215        }
7216
7217        public boolean hasModifier() { 
7218          if (this.modifier == null)
7219            return false;
7220          for (CodeableConcept item : this.modifier)
7221            if (!item.isEmpty())
7222              return true;
7223          return false;
7224        }
7225
7226        public CodeableConcept addModifier() { //3
7227          CodeableConcept t = new CodeableConcept();
7228          if (this.modifier == null)
7229            this.modifier = new ArrayList<CodeableConcept>();
7230          this.modifier.add(t);
7231          return t;
7232        }
7233
7234        public AddedItemComponent addModifier(CodeableConcept t) { //3
7235          if (t == null)
7236            return this;
7237          if (this.modifier == null)
7238            this.modifier = new ArrayList<CodeableConcept>();
7239          this.modifier.add(t);
7240          return this;
7241        }
7242
7243        /**
7244         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
7245         */
7246        public CodeableConcept getModifierFirstRep() { 
7247          if (getModifier().isEmpty()) {
7248            addModifier();
7249          }
7250          return getModifier().get(0);
7251        }
7252
7253        /**
7254         * @return {@link #fee} (The fee charged for the professional service or product.)
7255         */
7256        public Money getFee() { 
7257          if (this.fee == null)
7258            if (Configuration.errorOnAutoCreate())
7259              throw new Error("Attempt to auto-create AddedItemComponent.fee");
7260            else if (Configuration.doAutoCreate())
7261              this.fee = new Money(); // cc
7262          return this.fee;
7263        }
7264
7265        public boolean hasFee() { 
7266          return this.fee != null && !this.fee.isEmpty();
7267        }
7268
7269        /**
7270         * @param value {@link #fee} (The fee charged for the professional service or product.)
7271         */
7272        public AddedItemComponent setFee(Money value) { 
7273          this.fee = value;
7274          return this;
7275        }
7276
7277        /**
7278         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
7279         */
7280        public List<PositiveIntType> getNoteNumber() { 
7281          if (this.noteNumber == null)
7282            this.noteNumber = new ArrayList<PositiveIntType>();
7283          return this.noteNumber;
7284        }
7285
7286        /**
7287         * @return Returns a reference to <code>this</code> for easy method chaining
7288         */
7289        public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
7290          this.noteNumber = theNoteNumber;
7291          return this;
7292        }
7293
7294        public boolean hasNoteNumber() { 
7295          if (this.noteNumber == null)
7296            return false;
7297          for (PositiveIntType item : this.noteNumber)
7298            if (!item.isEmpty())
7299              return true;
7300          return false;
7301        }
7302
7303        /**
7304         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
7305         */
7306        public PositiveIntType addNoteNumberElement() {//2 
7307          PositiveIntType t = new PositiveIntType();
7308          if (this.noteNumber == null)
7309            this.noteNumber = new ArrayList<PositiveIntType>();
7310          this.noteNumber.add(t);
7311          return t;
7312        }
7313
7314        /**
7315         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
7316         */
7317        public AddedItemComponent addNoteNumber(int value) { //1
7318          PositiveIntType t = new PositiveIntType();
7319          t.setValue(value);
7320          if (this.noteNumber == null)
7321            this.noteNumber = new ArrayList<PositiveIntType>();
7322          this.noteNumber.add(t);
7323          return this;
7324        }
7325
7326        /**
7327         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
7328         */
7329        public boolean hasNoteNumber(int value) { 
7330          if (this.noteNumber == null)
7331            return false;
7332          for (PositiveIntType v : this.noteNumber)
7333            if (v.equals(value)) // positiveInt
7334              return true;
7335          return false;
7336        }
7337
7338        /**
7339         * @return {@link #adjudication} (The adjudications results.)
7340         */
7341        public List<AdjudicationComponent> getAdjudication() { 
7342          if (this.adjudication == null)
7343            this.adjudication = new ArrayList<AdjudicationComponent>();
7344          return this.adjudication;
7345        }
7346
7347        /**
7348         * @return Returns a reference to <code>this</code> for easy method chaining
7349         */
7350        public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
7351          this.adjudication = theAdjudication;
7352          return this;
7353        }
7354
7355        public boolean hasAdjudication() { 
7356          if (this.adjudication == null)
7357            return false;
7358          for (AdjudicationComponent item : this.adjudication)
7359            if (!item.isEmpty())
7360              return true;
7361          return false;
7362        }
7363
7364        public AdjudicationComponent addAdjudication() { //3
7365          AdjudicationComponent t = new AdjudicationComponent();
7366          if (this.adjudication == null)
7367            this.adjudication = new ArrayList<AdjudicationComponent>();
7368          this.adjudication.add(t);
7369          return t;
7370        }
7371
7372        public AddedItemComponent addAdjudication(AdjudicationComponent t) { //3
7373          if (t == null)
7374            return this;
7375          if (this.adjudication == null)
7376            this.adjudication = new ArrayList<AdjudicationComponent>();
7377          this.adjudication.add(t);
7378          return this;
7379        }
7380
7381        /**
7382         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
7383         */
7384        public AdjudicationComponent getAdjudicationFirstRep() { 
7385          if (getAdjudication().isEmpty()) {
7386            addAdjudication();
7387          }
7388          return getAdjudication().get(0);
7389        }
7390
7391        /**
7392         * @return {@link #detail} (The second tier service adjudications for payor added services.)
7393         */
7394        public List<AddedItemsDetailComponent> getDetail() { 
7395          if (this.detail == null)
7396            this.detail = new ArrayList<AddedItemsDetailComponent>();
7397          return this.detail;
7398        }
7399
7400        /**
7401         * @return Returns a reference to <code>this</code> for easy method chaining
7402         */
7403        public AddedItemComponent setDetail(List<AddedItemsDetailComponent> theDetail) { 
7404          this.detail = theDetail;
7405          return this;
7406        }
7407
7408        public boolean hasDetail() { 
7409          if (this.detail == null)
7410            return false;
7411          for (AddedItemsDetailComponent item : this.detail)
7412            if (!item.isEmpty())
7413              return true;
7414          return false;
7415        }
7416
7417        public AddedItemsDetailComponent addDetail() { //3
7418          AddedItemsDetailComponent t = new AddedItemsDetailComponent();
7419          if (this.detail == null)
7420            this.detail = new ArrayList<AddedItemsDetailComponent>();
7421          this.detail.add(t);
7422          return t;
7423        }
7424
7425        public AddedItemComponent addDetail(AddedItemsDetailComponent t) { //3
7426          if (t == null)
7427            return this;
7428          if (this.detail == null)
7429            this.detail = new ArrayList<AddedItemsDetailComponent>();
7430          this.detail.add(t);
7431          return this;
7432        }
7433
7434        /**
7435         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
7436         */
7437        public AddedItemsDetailComponent getDetailFirstRep() { 
7438          if (getDetail().isEmpty()) {
7439            addDetail();
7440          }
7441          return getDetail().get(0);
7442        }
7443
7444        protected void listChildren(List<Property> childrenList) {
7445          super.listChildren(childrenList);
7446          childrenList.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));
7447          childrenList.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, java.lang.Integer.MAX_VALUE, revenue));
7448          childrenList.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, java.lang.Integer.MAX_VALUE, category));
7449          childrenList.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, java.lang.Integer.MAX_VALUE, service));
7450          childrenList.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));
7451          childrenList.add(new Property("fee", "Money", "The fee charged for the professional service or product.", 0, java.lang.Integer.MAX_VALUE, fee));
7452          childrenList.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
7453          childrenList.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
7454          childrenList.add(new Property("detail", "", "The second tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
7455        }
7456
7457      @Override
7458      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7459        switch (hash) {
7460        case -1422298666: /*sequenceLinkId*/ return this.sequenceLinkId == null ? new Base[0] : this.sequenceLinkId.toArray(new Base[this.sequenceLinkId.size()]); // PositiveIntType
7461        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
7462        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
7463        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
7464        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7465        case 101254: /*fee*/ return this.fee == null ? new Base[0] : new Base[] {this.fee}; // Money
7466        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7467        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7468        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemsDetailComponent
7469        default: return super.getProperty(hash, name, checkValid);
7470        }
7471
7472      }
7473
7474      @Override
7475      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7476        switch (hash) {
7477        case -1422298666: // sequenceLinkId
7478          this.getSequenceLinkId().add(castToPositiveInt(value)); // PositiveIntType
7479          return value;
7480        case 1099842588: // revenue
7481          this.revenue = castToCodeableConcept(value); // CodeableConcept
7482          return value;
7483        case 50511102: // category
7484          this.category = castToCodeableConcept(value); // CodeableConcept
7485          return value;
7486        case 1984153269: // service
7487          this.service = castToCodeableConcept(value); // CodeableConcept
7488          return value;
7489        case -615513385: // modifier
7490          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7491          return value;
7492        case 101254: // fee
7493          this.fee = castToMoney(value); // Money
7494          return value;
7495        case -1110033957: // noteNumber
7496          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
7497          return value;
7498        case -231349275: // adjudication
7499          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7500          return value;
7501        case -1335224239: // detail
7502          this.getDetail().add((AddedItemsDetailComponent) value); // AddedItemsDetailComponent
7503          return value;
7504        default: return super.setProperty(hash, name, value);
7505        }
7506
7507      }
7508
7509      @Override
7510      public Base setProperty(String name, Base value) throws FHIRException {
7511        if (name.equals("sequenceLinkId")) {
7512          this.getSequenceLinkId().add(castToPositiveInt(value));
7513        } else if (name.equals("revenue")) {
7514          this.revenue = castToCodeableConcept(value); // CodeableConcept
7515        } else if (name.equals("category")) {
7516          this.category = castToCodeableConcept(value); // CodeableConcept
7517        } else if (name.equals("service")) {
7518          this.service = castToCodeableConcept(value); // CodeableConcept
7519        } else if (name.equals("modifier")) {
7520          this.getModifier().add(castToCodeableConcept(value));
7521        } else if (name.equals("fee")) {
7522          this.fee = castToMoney(value); // Money
7523        } else if (name.equals("noteNumber")) {
7524          this.getNoteNumber().add(castToPositiveInt(value));
7525        } else if (name.equals("adjudication")) {
7526          this.getAdjudication().add((AdjudicationComponent) value);
7527        } else if (name.equals("detail")) {
7528          this.getDetail().add((AddedItemsDetailComponent) value);
7529        } else
7530          return super.setProperty(name, value);
7531        return value;
7532      }
7533
7534      @Override
7535      public Base makeProperty(int hash, String name) throws FHIRException {
7536        switch (hash) {
7537        case -1422298666:  return addSequenceLinkIdElement();
7538        case 1099842588:  return getRevenue(); 
7539        case 50511102:  return getCategory(); 
7540        case 1984153269:  return getService(); 
7541        case -615513385:  return addModifier(); 
7542        case 101254:  return getFee(); 
7543        case -1110033957:  return addNoteNumberElement();
7544        case -231349275:  return addAdjudication(); 
7545        case -1335224239:  return addDetail(); 
7546        default: return super.makeProperty(hash, name);
7547        }
7548
7549      }
7550
7551      @Override
7552      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7553        switch (hash) {
7554        case -1422298666: /*sequenceLinkId*/ return new String[] {"positiveInt"};
7555        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7556        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7557        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
7558        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7559        case 101254: /*fee*/ return new String[] {"Money"};
7560        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7561        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7562        case -1335224239: /*detail*/ return new String[] {};
7563        default: return super.getTypesForProperty(hash, name);
7564        }
7565
7566      }
7567
7568      @Override
7569      public Base addChild(String name) throws FHIRException {
7570        if (name.equals("sequenceLinkId")) {
7571          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequenceLinkId");
7572        }
7573        else if (name.equals("revenue")) {
7574          this.revenue = new CodeableConcept();
7575          return this.revenue;
7576        }
7577        else if (name.equals("category")) {
7578          this.category = new CodeableConcept();
7579          return this.category;
7580        }
7581        else if (name.equals("service")) {
7582          this.service = new CodeableConcept();
7583          return this.service;
7584        }
7585        else if (name.equals("modifier")) {
7586          return addModifier();
7587        }
7588        else if (name.equals("fee")) {
7589          this.fee = new Money();
7590          return this.fee;
7591        }
7592        else if (name.equals("noteNumber")) {
7593          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
7594        }
7595        else if (name.equals("adjudication")) {
7596          return addAdjudication();
7597        }
7598        else if (name.equals("detail")) {
7599          return addDetail();
7600        }
7601        else
7602          return super.addChild(name);
7603      }
7604
7605      public AddedItemComponent copy() {
7606        AddedItemComponent dst = new AddedItemComponent();
7607        copyValues(dst);
7608        if (sequenceLinkId != null) {
7609          dst.sequenceLinkId = new ArrayList<PositiveIntType>();
7610          for (PositiveIntType i : sequenceLinkId)
7611            dst.sequenceLinkId.add(i.copy());
7612        };
7613        dst.revenue = revenue == null ? null : revenue.copy();
7614        dst.category = category == null ? null : category.copy();
7615        dst.service = service == null ? null : service.copy();
7616        if (modifier != null) {
7617          dst.modifier = new ArrayList<CodeableConcept>();
7618          for (CodeableConcept i : modifier)
7619            dst.modifier.add(i.copy());
7620        };
7621        dst.fee = fee == null ? null : fee.copy();
7622        if (noteNumber != null) {
7623          dst.noteNumber = new ArrayList<PositiveIntType>();
7624          for (PositiveIntType i : noteNumber)
7625            dst.noteNumber.add(i.copy());
7626        };
7627        if (adjudication != null) {
7628          dst.adjudication = new ArrayList<AdjudicationComponent>();
7629          for (AdjudicationComponent i : adjudication)
7630            dst.adjudication.add(i.copy());
7631        };
7632        if (detail != null) {
7633          dst.detail = new ArrayList<AddedItemsDetailComponent>();
7634          for (AddedItemsDetailComponent i : detail)
7635            dst.detail.add(i.copy());
7636        };
7637        return dst;
7638      }
7639
7640      @Override
7641      public boolean equalsDeep(Base other) {
7642        if (!super.equalsDeep(other))
7643          return false;
7644        if (!(other instanceof AddedItemComponent))
7645          return false;
7646        AddedItemComponent o = (AddedItemComponent) other;
7647        return compareDeep(sequenceLinkId, o.sequenceLinkId, true) && compareDeep(revenue, o.revenue, true)
7648           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
7649           && compareDeep(fee, o.fee, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
7650           && compareDeep(detail, o.detail, true);
7651      }
7652
7653      @Override
7654      public boolean equalsShallow(Base other) {
7655        if (!super.equalsShallow(other))
7656          return false;
7657        if (!(other instanceof AddedItemComponent))
7658          return false;
7659        AddedItemComponent o = (AddedItemComponent) other;
7660        return compareValues(sequenceLinkId, o.sequenceLinkId, true) && compareValues(noteNumber, o.noteNumber, true)
7661          ;
7662      }
7663
7664      public boolean isEmpty() {
7665        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequenceLinkId, revenue, category
7666          , service, modifier, fee, noteNumber, adjudication, detail);
7667      }
7668
7669  public String fhirType() {
7670    return "ExplanationOfBenefit.addItem";
7671
7672  }
7673
7674  }
7675
7676    @Block()
7677    public static class AddedItemsDetailComponent extends BackboneElement implements IBaseBackboneElement {
7678        /**
7679         * The type of reveneu or cost center providing the product and/or service.
7680         */
7681        @Child(name = "revenue", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
7682        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
7683        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
7684        protected CodeableConcept revenue;
7685
7686        /**
7687         * Health Care Service Type Codes  to identify the classification of service or benefits.
7688         */
7689        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
7690        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
7691        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
7692        protected CodeableConcept category;
7693
7694        /**
7695         * A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).
7696         */
7697        @Child(name = "service", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
7698        @Description(shortDefinition="Billing Code", formalDefinition="A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI)." )
7699        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7700        protected CodeableConcept service;
7701
7702        /**
7703         * 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.
7704         */
7705        @Child(name = "modifier", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7706        @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." )
7707        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
7708        protected List<CodeableConcept> modifier;
7709
7710        /**
7711         * The fee charged for the professional service or product.
7712         */
7713        @Child(name = "fee", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
7714        @Description(shortDefinition="Professional fee or Product charge", formalDefinition="The fee charged for the professional service or product." )
7715        protected Money fee;
7716
7717        /**
7718         * A list of note references to the notes provided below.
7719         */
7720        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7721        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
7722        protected List<PositiveIntType> noteNumber;
7723
7724        /**
7725         * The adjudications results.
7726         */
7727        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7728        @Description(shortDefinition="Added items detail adjudication", formalDefinition="The adjudications results." )
7729        protected List<AdjudicationComponent> adjudication;
7730
7731        private static final long serialVersionUID = -311484980L;
7732
7733    /**
7734     * Constructor
7735     */
7736      public AddedItemsDetailComponent() {
7737        super();
7738      }
7739
7740        /**
7741         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
7742         */
7743        public CodeableConcept getRevenue() { 
7744          if (this.revenue == null)
7745            if (Configuration.errorOnAutoCreate())
7746              throw new Error("Attempt to auto-create AddedItemsDetailComponent.revenue");
7747            else if (Configuration.doAutoCreate())
7748              this.revenue = new CodeableConcept(); // cc
7749          return this.revenue;
7750        }
7751
7752        public boolean hasRevenue() { 
7753          return this.revenue != null && !this.revenue.isEmpty();
7754        }
7755
7756        /**
7757         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
7758         */
7759        public AddedItemsDetailComponent setRevenue(CodeableConcept value) { 
7760          this.revenue = value;
7761          return this;
7762        }
7763
7764        /**
7765         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
7766         */
7767        public CodeableConcept getCategory() { 
7768          if (this.category == null)
7769            if (Configuration.errorOnAutoCreate())
7770              throw new Error("Attempt to auto-create AddedItemsDetailComponent.category");
7771            else if (Configuration.doAutoCreate())
7772              this.category = new CodeableConcept(); // cc
7773          return this.category;
7774        }
7775
7776        public boolean hasCategory() { 
7777          return this.category != null && !this.category.isEmpty();
7778        }
7779
7780        /**
7781         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
7782         */
7783        public AddedItemsDetailComponent setCategory(CodeableConcept value) { 
7784          this.category = value;
7785          return this;
7786        }
7787
7788        /**
7789         * @return {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
7790         */
7791        public CodeableConcept getService() { 
7792          if (this.service == null)
7793            if (Configuration.errorOnAutoCreate())
7794              throw new Error("Attempt to auto-create AddedItemsDetailComponent.service");
7795            else if (Configuration.doAutoCreate())
7796              this.service = new CodeableConcept(); // cc
7797          return this.service;
7798        }
7799
7800        public boolean hasService() { 
7801          return this.service != null && !this.service.isEmpty();
7802        }
7803
7804        /**
7805         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
7806         */
7807        public AddedItemsDetailComponent setService(CodeableConcept value) { 
7808          this.service = value;
7809          return this;
7810        }
7811
7812        /**
7813         * @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.)
7814         */
7815        public List<CodeableConcept> getModifier() { 
7816          if (this.modifier == null)
7817            this.modifier = new ArrayList<CodeableConcept>();
7818          return this.modifier;
7819        }
7820
7821        /**
7822         * @return Returns a reference to <code>this</code> for easy method chaining
7823         */
7824        public AddedItemsDetailComponent setModifier(List<CodeableConcept> theModifier) { 
7825          this.modifier = theModifier;
7826          return this;
7827        }
7828
7829        public boolean hasModifier() { 
7830          if (this.modifier == null)
7831            return false;
7832          for (CodeableConcept item : this.modifier)
7833            if (!item.isEmpty())
7834              return true;
7835          return false;
7836        }
7837
7838        public CodeableConcept addModifier() { //3
7839          CodeableConcept t = new CodeableConcept();
7840          if (this.modifier == null)
7841            this.modifier = new ArrayList<CodeableConcept>();
7842          this.modifier.add(t);
7843          return t;
7844        }
7845
7846        public AddedItemsDetailComponent addModifier(CodeableConcept t) { //3
7847          if (t == null)
7848            return this;
7849          if (this.modifier == null)
7850            this.modifier = new ArrayList<CodeableConcept>();
7851          this.modifier.add(t);
7852          return this;
7853        }
7854
7855        /**
7856         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
7857         */
7858        public CodeableConcept getModifierFirstRep() { 
7859          if (getModifier().isEmpty()) {
7860            addModifier();
7861          }
7862          return getModifier().get(0);
7863        }
7864
7865        /**
7866         * @return {@link #fee} (The fee charged for the professional service or product.)
7867         */
7868        public Money getFee() { 
7869          if (this.fee == null)
7870            if (Configuration.errorOnAutoCreate())
7871              throw new Error("Attempt to auto-create AddedItemsDetailComponent.fee");
7872            else if (Configuration.doAutoCreate())
7873              this.fee = new Money(); // cc
7874          return this.fee;
7875        }
7876
7877        public boolean hasFee() { 
7878          return this.fee != null && !this.fee.isEmpty();
7879        }
7880
7881        /**
7882         * @param value {@link #fee} (The fee charged for the professional service or product.)
7883         */
7884        public AddedItemsDetailComponent setFee(Money value) { 
7885          this.fee = value;
7886          return this;
7887        }
7888
7889        /**
7890         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
7891         */
7892        public List<PositiveIntType> getNoteNumber() { 
7893          if (this.noteNumber == null)
7894            this.noteNumber = new ArrayList<PositiveIntType>();
7895          return this.noteNumber;
7896        }
7897
7898        /**
7899         * @return Returns a reference to <code>this</code> for easy method chaining
7900         */
7901        public AddedItemsDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
7902          this.noteNumber = theNoteNumber;
7903          return this;
7904        }
7905
7906        public boolean hasNoteNumber() { 
7907          if (this.noteNumber == null)
7908            return false;
7909          for (PositiveIntType item : this.noteNumber)
7910            if (!item.isEmpty())
7911              return true;
7912          return false;
7913        }
7914
7915        /**
7916         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
7917         */
7918        public PositiveIntType addNoteNumberElement() {//2 
7919          PositiveIntType t = new PositiveIntType();
7920          if (this.noteNumber == null)
7921            this.noteNumber = new ArrayList<PositiveIntType>();
7922          this.noteNumber.add(t);
7923          return t;
7924        }
7925
7926        /**
7927         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
7928         */
7929        public AddedItemsDetailComponent addNoteNumber(int value) { //1
7930          PositiveIntType t = new PositiveIntType();
7931          t.setValue(value);
7932          if (this.noteNumber == null)
7933            this.noteNumber = new ArrayList<PositiveIntType>();
7934          this.noteNumber.add(t);
7935          return this;
7936        }
7937
7938        /**
7939         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
7940         */
7941        public boolean hasNoteNumber(int value) { 
7942          if (this.noteNumber == null)
7943            return false;
7944          for (PositiveIntType v : this.noteNumber)
7945            if (v.equals(value)) // positiveInt
7946              return true;
7947          return false;
7948        }
7949
7950        /**
7951         * @return {@link #adjudication} (The adjudications results.)
7952         */
7953        public List<AdjudicationComponent> getAdjudication() { 
7954          if (this.adjudication == null)
7955            this.adjudication = new ArrayList<AdjudicationComponent>();
7956          return this.adjudication;
7957        }
7958
7959        /**
7960         * @return Returns a reference to <code>this</code> for easy method chaining
7961         */
7962        public AddedItemsDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
7963          this.adjudication = theAdjudication;
7964          return this;
7965        }
7966
7967        public boolean hasAdjudication() { 
7968          if (this.adjudication == null)
7969            return false;
7970          for (AdjudicationComponent item : this.adjudication)
7971            if (!item.isEmpty())
7972              return true;
7973          return false;
7974        }
7975
7976        public AdjudicationComponent addAdjudication() { //3
7977          AdjudicationComponent t = new AdjudicationComponent();
7978          if (this.adjudication == null)
7979            this.adjudication = new ArrayList<AdjudicationComponent>();
7980          this.adjudication.add(t);
7981          return t;
7982        }
7983
7984        public AddedItemsDetailComponent addAdjudication(AdjudicationComponent t) { //3
7985          if (t == null)
7986            return this;
7987          if (this.adjudication == null)
7988            this.adjudication = new ArrayList<AdjudicationComponent>();
7989          this.adjudication.add(t);
7990          return this;
7991        }
7992
7993        /**
7994         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
7995         */
7996        public AdjudicationComponent getAdjudicationFirstRep() { 
7997          if (getAdjudication().isEmpty()) {
7998            addAdjudication();
7999          }
8000          return getAdjudication().get(0);
8001        }
8002
8003        protected void listChildren(List<Property> childrenList) {
8004          super.listChildren(childrenList);
8005          childrenList.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, java.lang.Integer.MAX_VALUE, revenue));
8006          childrenList.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, java.lang.Integer.MAX_VALUE, category));
8007          childrenList.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, java.lang.Integer.MAX_VALUE, service));
8008          childrenList.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));
8009          childrenList.add(new Property("fee", "Money", "The fee charged for the professional service or product.", 0, java.lang.Integer.MAX_VALUE, fee));
8010          childrenList.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
8011          childrenList.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
8012        }
8013
8014      @Override
8015      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8016        switch (hash) {
8017        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
8018        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
8019        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
8020        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
8021        case 101254: /*fee*/ return this.fee == null ? new Base[0] : new Base[] {this.fee}; // Money
8022        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
8023        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
8024        default: return super.getProperty(hash, name, checkValid);
8025        }
8026
8027      }
8028
8029      @Override
8030      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8031        switch (hash) {
8032        case 1099842588: // revenue
8033          this.revenue = castToCodeableConcept(value); // CodeableConcept
8034          return value;
8035        case 50511102: // category
8036          this.category = castToCodeableConcept(value); // CodeableConcept
8037          return value;
8038        case 1984153269: // service
8039          this.service = castToCodeableConcept(value); // CodeableConcept
8040          return value;
8041        case -615513385: // modifier
8042          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
8043          return value;
8044        case 101254: // fee
8045          this.fee = castToMoney(value); // Money
8046          return value;
8047        case -1110033957: // noteNumber
8048          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
8049          return value;
8050        case -231349275: // adjudication
8051          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
8052          return value;
8053        default: return super.setProperty(hash, name, value);
8054        }
8055
8056      }
8057
8058      @Override
8059      public Base setProperty(String name, Base value) throws FHIRException {
8060        if (name.equals("revenue")) {
8061          this.revenue = castToCodeableConcept(value); // CodeableConcept
8062        } else if (name.equals("category")) {
8063          this.category = castToCodeableConcept(value); // CodeableConcept
8064        } else if (name.equals("service")) {
8065          this.service = castToCodeableConcept(value); // CodeableConcept
8066        } else if (name.equals("modifier")) {
8067          this.getModifier().add(castToCodeableConcept(value));
8068        } else if (name.equals("fee")) {
8069          this.fee = castToMoney(value); // Money
8070        } else if (name.equals("noteNumber")) {
8071          this.getNoteNumber().add(castToPositiveInt(value));
8072        } else if (name.equals("adjudication")) {
8073          this.getAdjudication().add((AdjudicationComponent) value);
8074        } else
8075          return super.setProperty(name, value);
8076        return value;
8077      }
8078
8079      @Override
8080      public Base makeProperty(int hash, String name) throws FHIRException {
8081        switch (hash) {
8082        case 1099842588:  return getRevenue(); 
8083        case 50511102:  return getCategory(); 
8084        case 1984153269:  return getService(); 
8085        case -615513385:  return addModifier(); 
8086        case 101254:  return getFee(); 
8087        case -1110033957:  return addNoteNumberElement();
8088        case -231349275:  return addAdjudication(); 
8089        default: return super.makeProperty(hash, name);
8090        }
8091
8092      }
8093
8094      @Override
8095      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8096        switch (hash) {
8097        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
8098        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
8099        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
8100        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
8101        case 101254: /*fee*/ return new String[] {"Money"};
8102        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
8103        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
8104        default: return super.getTypesForProperty(hash, name);
8105        }
8106
8107      }
8108
8109      @Override
8110      public Base addChild(String name) throws FHIRException {
8111        if (name.equals("revenue")) {
8112          this.revenue = new CodeableConcept();
8113          return this.revenue;
8114        }
8115        else if (name.equals("category")) {
8116          this.category = new CodeableConcept();
8117          return this.category;
8118        }
8119        else if (name.equals("service")) {
8120          this.service = new CodeableConcept();
8121          return this.service;
8122        }
8123        else if (name.equals("modifier")) {
8124          return addModifier();
8125        }
8126        else if (name.equals("fee")) {
8127          this.fee = new Money();
8128          return this.fee;
8129        }
8130        else if (name.equals("noteNumber")) {
8131          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
8132        }
8133        else if (name.equals("adjudication")) {
8134          return addAdjudication();
8135        }
8136        else
8137          return super.addChild(name);
8138      }
8139
8140      public AddedItemsDetailComponent copy() {
8141        AddedItemsDetailComponent dst = new AddedItemsDetailComponent();
8142        copyValues(dst);
8143        dst.revenue = revenue == null ? null : revenue.copy();
8144        dst.category = category == null ? null : category.copy();
8145        dst.service = service == null ? null : service.copy();
8146        if (modifier != null) {
8147          dst.modifier = new ArrayList<CodeableConcept>();
8148          for (CodeableConcept i : modifier)
8149            dst.modifier.add(i.copy());
8150        };
8151        dst.fee = fee == null ? null : fee.copy();
8152        if (noteNumber != null) {
8153          dst.noteNumber = new ArrayList<PositiveIntType>();
8154          for (PositiveIntType i : noteNumber)
8155            dst.noteNumber.add(i.copy());
8156        };
8157        if (adjudication != null) {
8158          dst.adjudication = new ArrayList<AdjudicationComponent>();
8159          for (AdjudicationComponent i : adjudication)
8160            dst.adjudication.add(i.copy());
8161        };
8162        return dst;
8163      }
8164
8165      @Override
8166      public boolean equalsDeep(Base other) {
8167        if (!super.equalsDeep(other))
8168          return false;
8169        if (!(other instanceof AddedItemsDetailComponent))
8170          return false;
8171        AddedItemsDetailComponent o = (AddedItemsDetailComponent) other;
8172        return compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true) && compareDeep(service, o.service, true)
8173           && compareDeep(modifier, o.modifier, true) && compareDeep(fee, o.fee, true) && compareDeep(noteNumber, o.noteNumber, true)
8174           && compareDeep(adjudication, o.adjudication, true);
8175      }
8176
8177      @Override
8178      public boolean equalsShallow(Base other) {
8179        if (!super.equalsShallow(other))
8180          return false;
8181        if (!(other instanceof AddedItemsDetailComponent))
8182          return false;
8183        AddedItemsDetailComponent o = (AddedItemsDetailComponent) other;
8184        return compareValues(noteNumber, o.noteNumber, true);
8185      }
8186
8187      public boolean isEmpty() {
8188        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(revenue, category, service
8189          , modifier, fee, noteNumber, adjudication);
8190      }
8191
8192  public String fhirType() {
8193    return "ExplanationOfBenefit.addItem.detail";
8194
8195  }
8196
8197  }
8198
8199    @Block()
8200    public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
8201        /**
8202         * Whether this represents partial or complete payment of the claim.
8203         */
8204        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
8205        @Description(shortDefinition="Partial or Complete", formalDefinition="Whether this represents partial or complete payment of the claim." )
8206        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-paymenttype")
8207        protected CodeableConcept type;
8208
8209        /**
8210         * Adjustment to the payment of this transaction which is not related to adjudication of this transaction.
8211         */
8212        @Child(name = "adjustment", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
8213        @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." )
8214        protected Money adjustment;
8215
8216        /**
8217         * Reason for the payment adjustment.
8218         */
8219        @Child(name = "adjustmentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
8220        @Description(shortDefinition="Explanation for the non-claim adjustment", formalDefinition="Reason for the payment adjustment." )
8221        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
8222        protected CodeableConcept adjustmentReason;
8223
8224        /**
8225         * Estimated payment date.
8226         */
8227        @Child(name = "date", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=false)
8228        @Description(shortDefinition="Expected date of Payment", formalDefinition="Estimated payment date." )
8229        protected DateType date;
8230
8231        /**
8232         * Payable less any payment adjustment.
8233         */
8234        @Child(name = "amount", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
8235        @Description(shortDefinition="Payable amount after adjustment", formalDefinition="Payable less any payment adjustment." )
8236        protected Money amount;
8237
8238        /**
8239         * Payment identifer.
8240         */
8241        @Child(name = "identifier", type = {Identifier.class}, order=6, min=0, max=1, modifier=false, summary=false)
8242        @Description(shortDefinition="Identifier of the payment instrument", formalDefinition="Payment identifer." )
8243        protected Identifier identifier;
8244
8245        private static final long serialVersionUID = 1539906026L;
8246
8247    /**
8248     * Constructor
8249     */
8250      public PaymentComponent() {
8251        super();
8252      }
8253
8254        /**
8255         * @return {@link #type} (Whether this represents partial or complete payment of the claim.)
8256         */
8257        public CodeableConcept getType() { 
8258          if (this.type == null)
8259            if (Configuration.errorOnAutoCreate())
8260              throw new Error("Attempt to auto-create PaymentComponent.type");
8261            else if (Configuration.doAutoCreate())
8262              this.type = new CodeableConcept(); // cc
8263          return this.type;
8264        }
8265
8266        public boolean hasType() { 
8267          return this.type != null && !this.type.isEmpty();
8268        }
8269
8270        /**
8271         * @param value {@link #type} (Whether this represents partial or complete payment of the claim.)
8272         */
8273        public PaymentComponent setType(CodeableConcept value) { 
8274          this.type = value;
8275          return this;
8276        }
8277
8278        /**
8279         * @return {@link #adjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
8280         */
8281        public Money getAdjustment() { 
8282          if (this.adjustment == null)
8283            if (Configuration.errorOnAutoCreate())
8284              throw new Error("Attempt to auto-create PaymentComponent.adjustment");
8285            else if (Configuration.doAutoCreate())
8286              this.adjustment = new Money(); // cc
8287          return this.adjustment;
8288        }
8289
8290        public boolean hasAdjustment() { 
8291          return this.adjustment != null && !this.adjustment.isEmpty();
8292        }
8293
8294        /**
8295         * @param value {@link #adjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
8296         */
8297        public PaymentComponent setAdjustment(Money value) { 
8298          this.adjustment = value;
8299          return this;
8300        }
8301
8302        /**
8303         * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
8304         */
8305        public CodeableConcept getAdjustmentReason() { 
8306          if (this.adjustmentReason == null)
8307            if (Configuration.errorOnAutoCreate())
8308              throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
8309            else if (Configuration.doAutoCreate())
8310              this.adjustmentReason = new CodeableConcept(); // cc
8311          return this.adjustmentReason;
8312        }
8313
8314        public boolean hasAdjustmentReason() { 
8315          return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
8316        }
8317
8318        /**
8319         * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
8320         */
8321        public PaymentComponent setAdjustmentReason(CodeableConcept value) { 
8322          this.adjustmentReason = value;
8323          return this;
8324        }
8325
8326        /**
8327         * @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
8328         */
8329        public DateType getDateElement() { 
8330          if (this.date == null)
8331            if (Configuration.errorOnAutoCreate())
8332              throw new Error("Attempt to auto-create PaymentComponent.date");
8333            else if (Configuration.doAutoCreate())
8334              this.date = new DateType(); // bb
8335          return this.date;
8336        }
8337
8338        public boolean hasDateElement() { 
8339          return this.date != null && !this.date.isEmpty();
8340        }
8341
8342        public boolean hasDate() { 
8343          return this.date != null && !this.date.isEmpty();
8344        }
8345
8346        /**
8347         * @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
8348         */
8349        public PaymentComponent setDateElement(DateType value) { 
8350          this.date = value;
8351          return this;
8352        }
8353
8354        /**
8355         * @return Estimated payment date.
8356         */
8357        public Date getDate() { 
8358          return this.date == null ? null : this.date.getValue();
8359        }
8360
8361        /**
8362         * @param value Estimated payment date.
8363         */
8364        public PaymentComponent setDate(Date value) { 
8365          if (value == null)
8366            this.date = null;
8367          else {
8368            if (this.date == null)
8369              this.date = new DateType();
8370            this.date.setValue(value);
8371          }
8372          return this;
8373        }
8374
8375        /**
8376         * @return {@link #amount} (Payable less any payment adjustment.)
8377         */
8378        public Money getAmount() { 
8379          if (this.amount == null)
8380            if (Configuration.errorOnAutoCreate())
8381              throw new Error("Attempt to auto-create PaymentComponent.amount");
8382            else if (Configuration.doAutoCreate())
8383              this.amount = new Money(); // cc
8384          return this.amount;
8385        }
8386
8387        public boolean hasAmount() { 
8388          return this.amount != null && !this.amount.isEmpty();
8389        }
8390
8391        /**
8392         * @param value {@link #amount} (Payable less any payment adjustment.)
8393         */
8394        public PaymentComponent setAmount(Money value) { 
8395          this.amount = value;
8396          return this;
8397        }
8398
8399        /**
8400         * @return {@link #identifier} (Payment identifer.)
8401         */
8402        public Identifier getIdentifier() { 
8403          if (this.identifier == null)
8404            if (Configuration.errorOnAutoCreate())
8405              throw new Error("Attempt to auto-create PaymentComponent.identifier");
8406            else if (Configuration.doAutoCreate())
8407              this.identifier = new Identifier(); // cc
8408          return this.identifier;
8409        }
8410
8411        public boolean hasIdentifier() { 
8412          return this.identifier != null && !this.identifier.isEmpty();
8413        }
8414
8415        /**
8416         * @param value {@link #identifier} (Payment identifer.)
8417         */
8418        public PaymentComponent setIdentifier(Identifier value) { 
8419          this.identifier = value;
8420          return this;
8421        }
8422
8423        protected void listChildren(List<Property> childrenList) {
8424          super.listChildren(childrenList);
8425          childrenList.add(new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the claim.", 0, java.lang.Integer.MAX_VALUE, type));
8426          childrenList.add(new Property("adjustment", "Money", "Adjustment to the payment of this transaction which is not related to adjudication of this transaction.", 0, java.lang.Integer.MAX_VALUE, adjustment));
8427          childrenList.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, java.lang.Integer.MAX_VALUE, adjustmentReason));
8428          childrenList.add(new Property("date", "date", "Estimated payment date.", 0, java.lang.Integer.MAX_VALUE, date));
8429          childrenList.add(new Property("amount", "Money", "Payable less any payment adjustment.", 0, java.lang.Integer.MAX_VALUE, amount));
8430          childrenList.add(new Property("identifier", "Identifier", "Payment identifer.", 0, java.lang.Integer.MAX_VALUE, identifier));
8431        }
8432
8433      @Override
8434      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8435        switch (hash) {
8436        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
8437        case 1977085293: /*adjustment*/ return this.adjustment == null ? new Base[0] : new Base[] {this.adjustment}; // Money
8438        case -1255938543: /*adjustmentReason*/ return this.adjustmentReason == null ? new Base[0] : new Base[] {this.adjustmentReason}; // CodeableConcept
8439        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
8440        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
8441        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
8442        default: return super.getProperty(hash, name, checkValid);
8443        }
8444
8445      }
8446
8447      @Override
8448      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8449        switch (hash) {
8450        case 3575610: // type
8451          this.type = castToCodeableConcept(value); // CodeableConcept
8452          return value;
8453        case 1977085293: // adjustment
8454          this.adjustment = castToMoney(value); // Money
8455          return value;
8456        case -1255938543: // adjustmentReason
8457          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
8458          return value;
8459        case 3076014: // date
8460          this.date = castToDate(value); // DateType
8461          return value;
8462        case -1413853096: // amount
8463          this.amount = castToMoney(value); // Money
8464          return value;
8465        case -1618432855: // identifier
8466          this.identifier = castToIdentifier(value); // Identifier
8467          return value;
8468        default: return super.setProperty(hash, name, value);
8469        }
8470
8471      }
8472
8473      @Override
8474      public Base setProperty(String name, Base value) throws FHIRException {
8475        if (name.equals("type")) {
8476          this.type = castToCodeableConcept(value); // CodeableConcept
8477        } else if (name.equals("adjustment")) {
8478          this.adjustment = castToMoney(value); // Money
8479        } else if (name.equals("adjustmentReason")) {
8480          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
8481        } else if (name.equals("date")) {
8482          this.date = castToDate(value); // DateType
8483        } else if (name.equals("amount")) {
8484          this.amount = castToMoney(value); // Money
8485        } else if (name.equals("identifier")) {
8486          this.identifier = castToIdentifier(value); // Identifier
8487        } else
8488          return super.setProperty(name, value);
8489        return value;
8490      }
8491
8492      @Override
8493      public Base makeProperty(int hash, String name) throws FHIRException {
8494        switch (hash) {
8495        case 3575610:  return getType(); 
8496        case 1977085293:  return getAdjustment(); 
8497        case -1255938543:  return getAdjustmentReason(); 
8498        case 3076014:  return getDateElement();
8499        case -1413853096:  return getAmount(); 
8500        case -1618432855:  return getIdentifier(); 
8501        default: return super.makeProperty(hash, name);
8502        }
8503
8504      }
8505
8506      @Override
8507      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8508        switch (hash) {
8509        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
8510        case 1977085293: /*adjustment*/ return new String[] {"Money"};
8511        case -1255938543: /*adjustmentReason*/ return new String[] {"CodeableConcept"};
8512        case 3076014: /*date*/ return new String[] {"date"};
8513        case -1413853096: /*amount*/ return new String[] {"Money"};
8514        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
8515        default: return super.getTypesForProperty(hash, name);
8516        }
8517
8518      }
8519
8520      @Override
8521      public Base addChild(String name) throws FHIRException {
8522        if (name.equals("type")) {
8523          this.type = new CodeableConcept();
8524          return this.type;
8525        }
8526        else if (name.equals("adjustment")) {
8527          this.adjustment = new Money();
8528          return this.adjustment;
8529        }
8530        else if (name.equals("adjustmentReason")) {
8531          this.adjustmentReason = new CodeableConcept();
8532          return this.adjustmentReason;
8533        }
8534        else if (name.equals("date")) {
8535          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
8536        }
8537        else if (name.equals("amount")) {
8538          this.amount = new Money();
8539          return this.amount;
8540        }
8541        else if (name.equals("identifier")) {
8542          this.identifier = new Identifier();
8543          return this.identifier;
8544        }
8545        else
8546          return super.addChild(name);
8547      }
8548
8549      public PaymentComponent copy() {
8550        PaymentComponent dst = new PaymentComponent();
8551        copyValues(dst);
8552        dst.type = type == null ? null : type.copy();
8553        dst.adjustment = adjustment == null ? null : adjustment.copy();
8554        dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
8555        dst.date = date == null ? null : date.copy();
8556        dst.amount = amount == null ? null : amount.copy();
8557        dst.identifier = identifier == null ? null : identifier.copy();
8558        return dst;
8559      }
8560
8561      @Override
8562      public boolean equalsDeep(Base other) {
8563        if (!super.equalsDeep(other))
8564          return false;
8565        if (!(other instanceof PaymentComponent))
8566          return false;
8567        PaymentComponent o = (PaymentComponent) other;
8568        return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true) && compareDeep(adjustmentReason, o.adjustmentReason, true)
8569           && compareDeep(date, o.date, true) && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true)
8570          ;
8571      }
8572
8573      @Override
8574      public boolean equalsShallow(Base other) {
8575        if (!super.equalsShallow(other))
8576          return false;
8577        if (!(other instanceof PaymentComponent))
8578          return false;
8579        PaymentComponent o = (PaymentComponent) other;
8580        return compareValues(date, o.date, true);
8581      }
8582
8583      public boolean isEmpty() {
8584        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason
8585          , date, amount, identifier);
8586      }
8587
8588  public String fhirType() {
8589    return "ExplanationOfBenefit.payment";
8590
8591  }
8592
8593  }
8594
8595    @Block()
8596    public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
8597        /**
8598         * An integer associated with each note which may be referred to from each service line item.
8599         */
8600        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
8601        @Description(shortDefinition="Sequence number for this note", formalDefinition="An integer associated with each note which may be referred to from each service line item." )
8602        protected PositiveIntType number;
8603
8604        /**
8605         * The note purpose: Print/Display.
8606         */
8607        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
8608        @Description(shortDefinition="display | print | printoper", formalDefinition="The note purpose: Print/Display." )
8609        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
8610        protected CodeableConcept type;
8611
8612        /**
8613         * The note text.
8614         */
8615        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
8616        @Description(shortDefinition="Note explanitory text", formalDefinition="The note text." )
8617        protected StringType text;
8618
8619        /**
8620         * 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.
8621         */
8622        @Child(name = "language", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
8623        @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." )
8624        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
8625        protected CodeableConcept language;
8626
8627        private static final long serialVersionUID = -944255449L;
8628
8629    /**
8630     * Constructor
8631     */
8632      public NoteComponent() {
8633        super();
8634      }
8635
8636        /**
8637         * @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
8638         */
8639        public PositiveIntType getNumberElement() { 
8640          if (this.number == null)
8641            if (Configuration.errorOnAutoCreate())
8642              throw new Error("Attempt to auto-create NoteComponent.number");
8643            else if (Configuration.doAutoCreate())
8644              this.number = new PositiveIntType(); // bb
8645          return this.number;
8646        }
8647
8648        public boolean hasNumberElement() { 
8649          return this.number != null && !this.number.isEmpty();
8650        }
8651
8652        public boolean hasNumber() { 
8653          return this.number != null && !this.number.isEmpty();
8654        }
8655
8656        /**
8657         * @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
8658         */
8659        public NoteComponent setNumberElement(PositiveIntType value) { 
8660          this.number = value;
8661          return this;
8662        }
8663
8664        /**
8665         * @return An integer associated with each note which may be referred to from each service line item.
8666         */
8667        public int getNumber() { 
8668          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
8669        }
8670
8671        /**
8672         * @param value An integer associated with each note which may be referred to from each service line item.
8673         */
8674        public NoteComponent setNumber(int value) { 
8675            if (this.number == null)
8676              this.number = new PositiveIntType();
8677            this.number.setValue(value);
8678          return this;
8679        }
8680
8681        /**
8682         * @return {@link #type} (The note purpose: Print/Display.)
8683         */
8684        public CodeableConcept getType() { 
8685          if (this.type == null)
8686            if (Configuration.errorOnAutoCreate())
8687              throw new Error("Attempt to auto-create NoteComponent.type");
8688            else if (Configuration.doAutoCreate())
8689              this.type = new CodeableConcept(); // cc
8690          return this.type;
8691        }
8692
8693        public boolean hasType() { 
8694          return this.type != null && !this.type.isEmpty();
8695        }
8696
8697        /**
8698         * @param value {@link #type} (The note purpose: Print/Display.)
8699         */
8700        public NoteComponent setType(CodeableConcept value) { 
8701          this.type = value;
8702          return this;
8703        }
8704
8705        /**
8706         * @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
8707         */
8708        public StringType getTextElement() { 
8709          if (this.text == null)
8710            if (Configuration.errorOnAutoCreate())
8711              throw new Error("Attempt to auto-create NoteComponent.text");
8712            else if (Configuration.doAutoCreate())
8713              this.text = new StringType(); // bb
8714          return this.text;
8715        }
8716
8717        public boolean hasTextElement() { 
8718          return this.text != null && !this.text.isEmpty();
8719        }
8720
8721        public boolean hasText() { 
8722          return this.text != null && !this.text.isEmpty();
8723        }
8724
8725        /**
8726         * @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
8727         */
8728        public NoteComponent setTextElement(StringType value) { 
8729          this.text = value;
8730          return this;
8731        }
8732
8733        /**
8734         * @return The note text.
8735         */
8736        public String getText() { 
8737          return this.text == null ? null : this.text.getValue();
8738        }
8739
8740        /**
8741         * @param value The note text.
8742         */
8743        public NoteComponent setText(String value) { 
8744          if (Utilities.noString(value))
8745            this.text = null;
8746          else {
8747            if (this.text == null)
8748              this.text = new StringType();
8749            this.text.setValue(value);
8750          }
8751          return this;
8752        }
8753
8754        /**
8755         * @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.)
8756         */
8757        public CodeableConcept getLanguage() { 
8758          if (this.language == null)
8759            if (Configuration.errorOnAutoCreate())
8760              throw new Error("Attempt to auto-create NoteComponent.language");
8761            else if (Configuration.doAutoCreate())
8762              this.language = new CodeableConcept(); // cc
8763          return this.language;
8764        }
8765
8766        public boolean hasLanguage() { 
8767          return this.language != null && !this.language.isEmpty();
8768        }
8769
8770        /**
8771         * @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.)
8772         */
8773        public NoteComponent setLanguage(CodeableConcept value) { 
8774          this.language = value;
8775          return this;
8776        }
8777
8778        protected void listChildren(List<Property> childrenList) {
8779          super.listChildren(childrenList);
8780          childrenList.add(new Property("number", "positiveInt", "An integer associated with each note which may be referred to from each service line item.", 0, java.lang.Integer.MAX_VALUE, number));
8781          childrenList.add(new Property("type", "CodeableConcept", "The note purpose: Print/Display.", 0, java.lang.Integer.MAX_VALUE, type));
8782          childrenList.add(new Property("text", "string", "The note text.", 0, java.lang.Integer.MAX_VALUE, text));
8783          childrenList.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, java.lang.Integer.MAX_VALUE, language));
8784        }
8785
8786      @Override
8787      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8788        switch (hash) {
8789        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
8790        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
8791        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
8792        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
8793        default: return super.getProperty(hash, name, checkValid);
8794        }
8795
8796      }
8797
8798      @Override
8799      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8800        switch (hash) {
8801        case -1034364087: // number
8802          this.number = castToPositiveInt(value); // PositiveIntType
8803          return value;
8804        case 3575610: // type
8805          this.type = castToCodeableConcept(value); // CodeableConcept
8806          return value;
8807        case 3556653: // text
8808          this.text = castToString(value); // StringType
8809          return value;
8810        case -1613589672: // language
8811          this.language = castToCodeableConcept(value); // CodeableConcept
8812          return value;
8813        default: return super.setProperty(hash, name, value);
8814        }
8815
8816      }
8817
8818      @Override
8819      public Base setProperty(String name, Base value) throws FHIRException {
8820        if (name.equals("number")) {
8821          this.number = castToPositiveInt(value); // PositiveIntType
8822        } else if (name.equals("type")) {
8823          this.type = castToCodeableConcept(value); // CodeableConcept
8824        } else if (name.equals("text")) {
8825          this.text = castToString(value); // StringType
8826        } else if (name.equals("language")) {
8827          this.language = castToCodeableConcept(value); // CodeableConcept
8828        } else
8829          return super.setProperty(name, value);
8830        return value;
8831      }
8832
8833      @Override
8834      public Base makeProperty(int hash, String name) throws FHIRException {
8835        switch (hash) {
8836        case -1034364087:  return getNumberElement();
8837        case 3575610:  return getType(); 
8838        case 3556653:  return getTextElement();
8839        case -1613589672:  return getLanguage(); 
8840        default: return super.makeProperty(hash, name);
8841        }
8842
8843      }
8844
8845      @Override
8846      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8847        switch (hash) {
8848        case -1034364087: /*number*/ return new String[] {"positiveInt"};
8849        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
8850        case 3556653: /*text*/ return new String[] {"string"};
8851        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
8852        default: return super.getTypesForProperty(hash, name);
8853        }
8854
8855      }
8856
8857      @Override
8858      public Base addChild(String name) throws FHIRException {
8859        if (name.equals("number")) {
8860          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.number");
8861        }
8862        else if (name.equals("type")) {
8863          this.type = new CodeableConcept();
8864          return this.type;
8865        }
8866        else if (name.equals("text")) {
8867          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.text");
8868        }
8869        else if (name.equals("language")) {
8870          this.language = new CodeableConcept();
8871          return this.language;
8872        }
8873        else
8874          return super.addChild(name);
8875      }
8876
8877      public NoteComponent copy() {
8878        NoteComponent dst = new NoteComponent();
8879        copyValues(dst);
8880        dst.number = number == null ? null : number.copy();
8881        dst.type = type == null ? null : type.copy();
8882        dst.text = text == null ? null : text.copy();
8883        dst.language = language == null ? null : language.copy();
8884        return dst;
8885      }
8886
8887      @Override
8888      public boolean equalsDeep(Base other) {
8889        if (!super.equalsDeep(other))
8890          return false;
8891        if (!(other instanceof NoteComponent))
8892          return false;
8893        NoteComponent o = (NoteComponent) other;
8894        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
8895           && compareDeep(language, o.language, true);
8896      }
8897
8898      @Override
8899      public boolean equalsShallow(Base other) {
8900        if (!super.equalsShallow(other))
8901          return false;
8902        if (!(other instanceof NoteComponent))
8903          return false;
8904        NoteComponent o = (NoteComponent) other;
8905        return compareValues(number, o.number, true) && compareValues(text, o.text, true);
8906      }
8907
8908      public boolean isEmpty() {
8909        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language
8910          );
8911      }
8912
8913  public String fhirType() {
8914    return "ExplanationOfBenefit.processNote";
8915
8916  }
8917
8918  }
8919
8920    @Block()
8921    public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
8922        /**
8923         * Dental, Vision, Medical, Pharmacy, Rehab etc.
8924         */
8925        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
8926        @Description(shortDefinition="Type of services covered", formalDefinition="Dental, Vision, Medical, Pharmacy, Rehab etc." )
8927        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-category")
8928        protected CodeableConcept category;
8929
8930        /**
8931         * Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.
8932         */
8933        @Child(name = "subCategory", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
8934        @Description(shortDefinition="Detailed services covered within the type", formalDefinition="Dental: basic, major, ortho; Vision exam, glasses, contacts; etc." )
8935        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
8936        protected CodeableConcept subCategory;
8937
8938        /**
8939         * True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.
8940         */
8941        @Child(name = "excluded", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
8942        @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." )
8943        protected BooleanType excluded;
8944
8945        /**
8946         * A short name or tag for the benefit, for example MED01, or DENT2.
8947         */
8948        @Child(name = "name", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
8949        @Description(shortDefinition="Short name for the benefit", formalDefinition="A short name or tag for the benefit, for example MED01, or DENT2." )
8950        protected StringType name;
8951
8952        /**
8953         * A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.
8954         */
8955        @Child(name = "description", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
8956        @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'." )
8957        protected StringType description;
8958
8959        /**
8960         * Network designation.
8961         */
8962        @Child(name = "network", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
8963        @Description(shortDefinition="In or out of network", formalDefinition="Network designation." )
8964        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-network")
8965        protected CodeableConcept network;
8966
8967        /**
8968         * Unit designation: individual or family.
8969         */
8970        @Child(name = "unit", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
8971        @Description(shortDefinition="Individual or family", formalDefinition="Unit designation: individual or family." )
8972        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-unit")
8973        protected CodeableConcept unit;
8974
8975        /**
8976         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.
8977         */
8978        @Child(name = "term", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
8979        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'." )
8980        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-term")
8981        protected CodeableConcept term;
8982
8983        /**
8984         * Benefits Used to date.
8985         */
8986        @Child(name = "financial", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8987        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
8988        protected List<BenefitComponent> financial;
8989
8990        private static final long serialVersionUID = 833826021L;
8991
8992    /**
8993     * Constructor
8994     */
8995      public BenefitBalanceComponent() {
8996        super();
8997      }
8998
8999    /**
9000     * Constructor
9001     */
9002      public BenefitBalanceComponent(CodeableConcept category) {
9003        super();
9004        this.category = category;
9005      }
9006
9007        /**
9008         * @return {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
9009         */
9010        public CodeableConcept getCategory() { 
9011          if (this.category == null)
9012            if (Configuration.errorOnAutoCreate())
9013              throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
9014            else if (Configuration.doAutoCreate())
9015              this.category = new CodeableConcept(); // cc
9016          return this.category;
9017        }
9018
9019        public boolean hasCategory() { 
9020          return this.category != null && !this.category.isEmpty();
9021        }
9022
9023        /**
9024         * @param value {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
9025         */
9026        public BenefitBalanceComponent setCategory(CodeableConcept value) { 
9027          this.category = value;
9028          return this;
9029        }
9030
9031        /**
9032         * @return {@link #subCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
9033         */
9034        public CodeableConcept getSubCategory() { 
9035          if (this.subCategory == null)
9036            if (Configuration.errorOnAutoCreate())
9037              throw new Error("Attempt to auto-create BenefitBalanceComponent.subCategory");
9038            else if (Configuration.doAutoCreate())
9039              this.subCategory = new CodeableConcept(); // cc
9040          return this.subCategory;
9041        }
9042
9043        public boolean hasSubCategory() { 
9044          return this.subCategory != null && !this.subCategory.isEmpty();
9045        }
9046
9047        /**
9048         * @param value {@link #subCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
9049         */
9050        public BenefitBalanceComponent setSubCategory(CodeableConcept value) { 
9051          this.subCategory = value;
9052          return this;
9053        }
9054
9055        /**
9056         * @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
9057         */
9058        public BooleanType getExcludedElement() { 
9059          if (this.excluded == null)
9060            if (Configuration.errorOnAutoCreate())
9061              throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
9062            else if (Configuration.doAutoCreate())
9063              this.excluded = new BooleanType(); // bb
9064          return this.excluded;
9065        }
9066
9067        public boolean hasExcludedElement() { 
9068          return this.excluded != null && !this.excluded.isEmpty();
9069        }
9070
9071        public boolean hasExcluded() { 
9072          return this.excluded != null && !this.excluded.isEmpty();
9073        }
9074
9075        /**
9076         * @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
9077         */
9078        public BenefitBalanceComponent setExcludedElement(BooleanType value) { 
9079          this.excluded = value;
9080          return this;
9081        }
9082
9083        /**
9084         * @return True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.
9085         */
9086        public boolean getExcluded() { 
9087          return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
9088        }
9089
9090        /**
9091         * @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.
9092         */
9093        public BenefitBalanceComponent setExcluded(boolean value) { 
9094            if (this.excluded == null)
9095              this.excluded = new BooleanType();
9096            this.excluded.setValue(value);
9097          return this;
9098        }
9099
9100        /**
9101         * @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
9102         */
9103        public StringType getNameElement() { 
9104          if (this.name == null)
9105            if (Configuration.errorOnAutoCreate())
9106              throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
9107            else if (Configuration.doAutoCreate())
9108              this.name = new StringType(); // bb
9109          return this.name;
9110        }
9111
9112        public boolean hasNameElement() { 
9113          return this.name != null && !this.name.isEmpty();
9114        }
9115
9116        public boolean hasName() { 
9117          return this.name != null && !this.name.isEmpty();
9118        }
9119
9120        /**
9121         * @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
9122         */
9123        public BenefitBalanceComponent setNameElement(StringType value) { 
9124          this.name = value;
9125          return this;
9126        }
9127
9128        /**
9129         * @return A short name or tag for the benefit, for example MED01, or DENT2.
9130         */
9131        public String getName() { 
9132          return this.name == null ? null : this.name.getValue();
9133        }
9134
9135        /**
9136         * @param value A short name or tag for the benefit, for example MED01, or DENT2.
9137         */
9138        public BenefitBalanceComponent setName(String value) { 
9139          if (Utilities.noString(value))
9140            this.name = null;
9141          else {
9142            if (this.name == null)
9143              this.name = new StringType();
9144            this.name.setValue(value);
9145          }
9146          return this;
9147        }
9148
9149        /**
9150         * @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
9151         */
9152        public StringType getDescriptionElement() { 
9153          if (this.description == null)
9154            if (Configuration.errorOnAutoCreate())
9155              throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
9156            else if (Configuration.doAutoCreate())
9157              this.description = new StringType(); // bb
9158          return this.description;
9159        }
9160
9161        public boolean hasDescriptionElement() { 
9162          return this.description != null && !this.description.isEmpty();
9163        }
9164
9165        public boolean hasDescription() { 
9166          return this.description != null && !this.description.isEmpty();
9167        }
9168
9169        /**
9170         * @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
9171         */
9172        public BenefitBalanceComponent setDescriptionElement(StringType value) { 
9173          this.description = value;
9174          return this;
9175        }
9176
9177        /**
9178         * @return A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.
9179         */
9180        public String getDescription() { 
9181          return this.description == null ? null : this.description.getValue();
9182        }
9183
9184        /**
9185         * @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'.
9186         */
9187        public BenefitBalanceComponent setDescription(String value) { 
9188          if (Utilities.noString(value))
9189            this.description = null;
9190          else {
9191            if (this.description == null)
9192              this.description = new StringType();
9193            this.description.setValue(value);
9194          }
9195          return this;
9196        }
9197
9198        /**
9199         * @return {@link #network} (Network designation.)
9200         */
9201        public CodeableConcept getNetwork() { 
9202          if (this.network == null)
9203            if (Configuration.errorOnAutoCreate())
9204              throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
9205            else if (Configuration.doAutoCreate())
9206              this.network = new CodeableConcept(); // cc
9207          return this.network;
9208        }
9209
9210        public boolean hasNetwork() { 
9211          return this.network != null && !this.network.isEmpty();
9212        }
9213
9214        /**
9215         * @param value {@link #network} (Network designation.)
9216         */
9217        public BenefitBalanceComponent setNetwork(CodeableConcept value) { 
9218          this.network = value;
9219          return this;
9220        }
9221
9222        /**
9223         * @return {@link #unit} (Unit designation: individual or family.)
9224         */
9225        public CodeableConcept getUnit() { 
9226          if (this.unit == null)
9227            if (Configuration.errorOnAutoCreate())
9228              throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
9229            else if (Configuration.doAutoCreate())
9230              this.unit = new CodeableConcept(); // cc
9231          return this.unit;
9232        }
9233
9234        public boolean hasUnit() { 
9235          return this.unit != null && !this.unit.isEmpty();
9236        }
9237
9238        /**
9239         * @param value {@link #unit} (Unit designation: individual or family.)
9240         */
9241        public BenefitBalanceComponent setUnit(CodeableConcept value) { 
9242          this.unit = value;
9243          return this;
9244        }
9245
9246        /**
9247         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
9248         */
9249        public CodeableConcept getTerm() { 
9250          if (this.term == null)
9251            if (Configuration.errorOnAutoCreate())
9252              throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
9253            else if (Configuration.doAutoCreate())
9254              this.term = new CodeableConcept(); // cc
9255          return this.term;
9256        }
9257
9258        public boolean hasTerm() { 
9259          return this.term != null && !this.term.isEmpty();
9260        }
9261
9262        /**
9263         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
9264         */
9265        public BenefitBalanceComponent setTerm(CodeableConcept value) { 
9266          this.term = value;
9267          return this;
9268        }
9269
9270        /**
9271         * @return {@link #financial} (Benefits Used to date.)
9272         */
9273        public List<BenefitComponent> getFinancial() { 
9274          if (this.financial == null)
9275            this.financial = new ArrayList<BenefitComponent>();
9276          return this.financial;
9277        }
9278
9279        /**
9280         * @return Returns a reference to <code>this</code> for easy method chaining
9281         */
9282        public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) { 
9283          this.financial = theFinancial;
9284          return this;
9285        }
9286
9287        public boolean hasFinancial() { 
9288          if (this.financial == null)
9289            return false;
9290          for (BenefitComponent item : this.financial)
9291            if (!item.isEmpty())
9292              return true;
9293          return false;
9294        }
9295
9296        public BenefitComponent addFinancial() { //3
9297          BenefitComponent t = new BenefitComponent();
9298          if (this.financial == null)
9299            this.financial = new ArrayList<BenefitComponent>();
9300          this.financial.add(t);
9301          return t;
9302        }
9303
9304        public BenefitBalanceComponent addFinancial(BenefitComponent t) { //3
9305          if (t == null)
9306            return this;
9307          if (this.financial == null)
9308            this.financial = new ArrayList<BenefitComponent>();
9309          this.financial.add(t);
9310          return this;
9311        }
9312
9313        /**
9314         * @return The first repetition of repeating field {@link #financial}, creating it if it does not already exist
9315         */
9316        public BenefitComponent getFinancialFirstRep() { 
9317          if (getFinancial().isEmpty()) {
9318            addFinancial();
9319          }
9320          return getFinancial().get(0);
9321        }
9322
9323        protected void listChildren(List<Property> childrenList) {
9324          super.listChildren(childrenList);
9325          childrenList.add(new Property("category", "CodeableConcept", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, java.lang.Integer.MAX_VALUE, category));
9326          childrenList.add(new Property("subCategory", "CodeableConcept", "Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.", 0, java.lang.Integer.MAX_VALUE, subCategory));
9327          childrenList.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, java.lang.Integer.MAX_VALUE, excluded));
9328          childrenList.add(new Property("name", "string", "A short name or tag for the benefit, for example MED01, or DENT2.", 0, java.lang.Integer.MAX_VALUE, name));
9329          childrenList.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, java.lang.Integer.MAX_VALUE, description));
9330          childrenList.add(new Property("network", "CodeableConcept", "Network designation.", 0, java.lang.Integer.MAX_VALUE, network));
9331          childrenList.add(new Property("unit", "CodeableConcept", "Unit designation: individual or family.", 0, java.lang.Integer.MAX_VALUE, unit));
9332          childrenList.add(new Property("term", "CodeableConcept", "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.", 0, java.lang.Integer.MAX_VALUE, term));
9333          childrenList.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
9334        }
9335
9336      @Override
9337      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9338        switch (hash) {
9339        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
9340        case 1365024606: /*subCategory*/ return this.subCategory == null ? new Base[0] : new Base[] {this.subCategory}; // CodeableConcept
9341        case 1994055114: /*excluded*/ return this.excluded == null ? new Base[0] : new Base[] {this.excluded}; // BooleanType
9342        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
9343        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
9344        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // CodeableConcept
9345        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
9346        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // CodeableConcept
9347        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
9348        default: return super.getProperty(hash, name, checkValid);
9349        }
9350
9351      }
9352
9353      @Override
9354      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9355        switch (hash) {
9356        case 50511102: // category
9357          this.category = castToCodeableConcept(value); // CodeableConcept
9358          return value;
9359        case 1365024606: // subCategory
9360          this.subCategory = castToCodeableConcept(value); // CodeableConcept
9361          return value;
9362        case 1994055114: // excluded
9363          this.excluded = castToBoolean(value); // BooleanType
9364          return value;
9365        case 3373707: // name
9366          this.name = castToString(value); // StringType
9367          return value;
9368        case -1724546052: // description
9369          this.description = castToString(value); // StringType
9370          return value;
9371        case 1843485230: // network
9372          this.network = castToCodeableConcept(value); // CodeableConcept
9373          return value;
9374        case 3594628: // unit
9375          this.unit = castToCodeableConcept(value); // CodeableConcept
9376          return value;
9377        case 3556460: // term
9378          this.term = castToCodeableConcept(value); // CodeableConcept
9379          return value;
9380        case 357555337: // financial
9381          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
9382          return value;
9383        default: return super.setProperty(hash, name, value);
9384        }
9385
9386      }
9387
9388      @Override
9389      public Base setProperty(String name, Base value) throws FHIRException {
9390        if (name.equals("category")) {
9391          this.category = castToCodeableConcept(value); // CodeableConcept
9392        } else if (name.equals("subCategory")) {
9393          this.subCategory = castToCodeableConcept(value); // CodeableConcept
9394        } else if (name.equals("excluded")) {
9395          this.excluded = castToBoolean(value); // BooleanType
9396        } else if (name.equals("name")) {
9397          this.name = castToString(value); // StringType
9398        } else if (name.equals("description")) {
9399          this.description = castToString(value); // StringType
9400        } else if (name.equals("network")) {
9401          this.network = castToCodeableConcept(value); // CodeableConcept
9402        } else if (name.equals("unit")) {
9403          this.unit = castToCodeableConcept(value); // CodeableConcept
9404        } else if (name.equals("term")) {
9405          this.term = castToCodeableConcept(value); // CodeableConcept
9406        } else if (name.equals("financial")) {
9407          this.getFinancial().add((BenefitComponent) value);
9408        } else
9409          return super.setProperty(name, value);
9410        return value;
9411      }
9412
9413      @Override
9414      public Base makeProperty(int hash, String name) throws FHIRException {
9415        switch (hash) {
9416        case 50511102:  return getCategory(); 
9417        case 1365024606:  return getSubCategory(); 
9418        case 1994055114:  return getExcludedElement();
9419        case 3373707:  return getNameElement();
9420        case -1724546052:  return getDescriptionElement();
9421        case 1843485230:  return getNetwork(); 
9422        case 3594628:  return getUnit(); 
9423        case 3556460:  return getTerm(); 
9424        case 357555337:  return addFinancial(); 
9425        default: return super.makeProperty(hash, name);
9426        }
9427
9428      }
9429
9430      @Override
9431      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9432        switch (hash) {
9433        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
9434        case 1365024606: /*subCategory*/ return new String[] {"CodeableConcept"};
9435        case 1994055114: /*excluded*/ return new String[] {"boolean"};
9436        case 3373707: /*name*/ return new String[] {"string"};
9437        case -1724546052: /*description*/ return new String[] {"string"};
9438        case 1843485230: /*network*/ return new String[] {"CodeableConcept"};
9439        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
9440        case 3556460: /*term*/ return new String[] {"CodeableConcept"};
9441        case 357555337: /*financial*/ return new String[] {};
9442        default: return super.getTypesForProperty(hash, name);
9443        }
9444
9445      }
9446
9447      @Override
9448      public Base addChild(String name) throws FHIRException {
9449        if (name.equals("category")) {
9450          this.category = new CodeableConcept();
9451          return this.category;
9452        }
9453        else if (name.equals("subCategory")) {
9454          this.subCategory = new CodeableConcept();
9455          return this.subCategory;
9456        }
9457        else if (name.equals("excluded")) {
9458          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.excluded");
9459        }
9460        else if (name.equals("name")) {
9461          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.name");
9462        }
9463        else if (name.equals("description")) {
9464          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.description");
9465        }
9466        else if (name.equals("network")) {
9467          this.network = new CodeableConcept();
9468          return this.network;
9469        }
9470        else if (name.equals("unit")) {
9471          this.unit = new CodeableConcept();
9472          return this.unit;
9473        }
9474        else if (name.equals("term")) {
9475          this.term = new CodeableConcept();
9476          return this.term;
9477        }
9478        else if (name.equals("financial")) {
9479          return addFinancial();
9480        }
9481        else
9482          return super.addChild(name);
9483      }
9484
9485      public BenefitBalanceComponent copy() {
9486        BenefitBalanceComponent dst = new BenefitBalanceComponent();
9487        copyValues(dst);
9488        dst.category = category == null ? null : category.copy();
9489        dst.subCategory = subCategory == null ? null : subCategory.copy();
9490        dst.excluded = excluded == null ? null : excluded.copy();
9491        dst.name = name == null ? null : name.copy();
9492        dst.description = description == null ? null : description.copy();
9493        dst.network = network == null ? null : network.copy();
9494        dst.unit = unit == null ? null : unit.copy();
9495        dst.term = term == null ? null : term.copy();
9496        if (financial != null) {
9497          dst.financial = new ArrayList<BenefitComponent>();
9498          for (BenefitComponent i : financial)
9499            dst.financial.add(i.copy());
9500        };
9501        return dst;
9502      }
9503
9504      @Override
9505      public boolean equalsDeep(Base other) {
9506        if (!super.equalsDeep(other))
9507          return false;
9508        if (!(other instanceof BenefitBalanceComponent))
9509          return false;
9510        BenefitBalanceComponent o = (BenefitBalanceComponent) other;
9511        return compareDeep(category, o.category, true) && compareDeep(subCategory, o.subCategory, true)
9512           && compareDeep(excluded, o.excluded, true) && compareDeep(name, o.name, true) && compareDeep(description, o.description, true)
9513           && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true) && compareDeep(term, o.term, true)
9514           && compareDeep(financial, o.financial, true);
9515      }
9516
9517      @Override
9518      public boolean equalsShallow(Base other) {
9519        if (!super.equalsShallow(other))
9520          return false;
9521        if (!(other instanceof BenefitBalanceComponent))
9522          return false;
9523        BenefitBalanceComponent o = (BenefitBalanceComponent) other;
9524        return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
9525          ;
9526      }
9527
9528      public boolean isEmpty() {
9529        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, subCategory, excluded
9530          , name, description, network, unit, term, financial);
9531      }
9532
9533  public String fhirType() {
9534    return "ExplanationOfBenefit.benefitBalance";
9535
9536  }
9537
9538  }
9539
9540    @Block()
9541    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
9542        /**
9543         * Deductable, visits, benefit amount.
9544         */
9545        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9546        @Description(shortDefinition="Deductable, visits, benefit amount", formalDefinition="Deductable, visits, benefit amount." )
9547        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-type")
9548        protected CodeableConcept type;
9549
9550        /**
9551         * Benefits allowed.
9552         */
9553        @Child(name = "allowed", type = {UnsignedIntType.class, StringType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
9554        @Description(shortDefinition="Benefits allowed", formalDefinition="Benefits allowed." )
9555        protected Type allowed;
9556
9557        /**
9558         * Benefits used.
9559         */
9560        @Child(name = "used", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
9561        @Description(shortDefinition="Benefits used", formalDefinition="Benefits used." )
9562        protected Type used;
9563
9564        private static final long serialVersionUID = -1506285314L;
9565
9566    /**
9567     * Constructor
9568     */
9569      public BenefitComponent() {
9570        super();
9571      }
9572
9573    /**
9574     * Constructor
9575     */
9576      public BenefitComponent(CodeableConcept type) {
9577        super();
9578        this.type = type;
9579      }
9580
9581        /**
9582         * @return {@link #type} (Deductable, visits, benefit amount.)
9583         */
9584        public CodeableConcept getType() { 
9585          if (this.type == null)
9586            if (Configuration.errorOnAutoCreate())
9587              throw new Error("Attempt to auto-create BenefitComponent.type");
9588            else if (Configuration.doAutoCreate())
9589              this.type = new CodeableConcept(); // cc
9590          return this.type;
9591        }
9592
9593        public boolean hasType() { 
9594          return this.type != null && !this.type.isEmpty();
9595        }
9596
9597        /**
9598         * @param value {@link #type} (Deductable, visits, benefit amount.)
9599         */
9600        public BenefitComponent setType(CodeableConcept value) { 
9601          this.type = value;
9602          return this;
9603        }
9604
9605        /**
9606         * @return {@link #allowed} (Benefits allowed.)
9607         */
9608        public Type getAllowed() { 
9609          return this.allowed;
9610        }
9611
9612        /**
9613         * @return {@link #allowed} (Benefits allowed.)
9614         */
9615        public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException { 
9616          if (!(this.allowed instanceof UnsignedIntType))
9617            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.allowed.getClass().getName()+" was encountered");
9618          return (UnsignedIntType) this.allowed;
9619        }
9620
9621        public boolean hasAllowedUnsignedIntType() { 
9622          return this.allowed instanceof UnsignedIntType;
9623        }
9624
9625        /**
9626         * @return {@link #allowed} (Benefits allowed.)
9627         */
9628        public StringType getAllowedStringType() throws FHIRException { 
9629          if (!(this.allowed instanceof StringType))
9630            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.allowed.getClass().getName()+" was encountered");
9631          return (StringType) this.allowed;
9632        }
9633
9634        public boolean hasAllowedStringType() { 
9635          return this.allowed instanceof StringType;
9636        }
9637
9638        /**
9639         * @return {@link #allowed} (Benefits allowed.)
9640         */
9641        public Money getAllowedMoney() throws FHIRException { 
9642          if (!(this.allowed instanceof Money))
9643            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.allowed.getClass().getName()+" was encountered");
9644          return (Money) this.allowed;
9645        }
9646
9647        public boolean hasAllowedMoney() { 
9648          return this.allowed instanceof Money;
9649        }
9650
9651        public boolean hasAllowed() { 
9652          return this.allowed != null && !this.allowed.isEmpty();
9653        }
9654
9655        /**
9656         * @param value {@link #allowed} (Benefits allowed.)
9657         */
9658        public BenefitComponent setAllowed(Type value) { 
9659          this.allowed = value;
9660          return this;
9661        }
9662
9663        /**
9664         * @return {@link #used} (Benefits used.)
9665         */
9666        public Type getUsed() { 
9667          return this.used;
9668        }
9669
9670        /**
9671         * @return {@link #used} (Benefits used.)
9672         */
9673        public UnsignedIntType getUsedUnsignedIntType() throws FHIRException { 
9674          if (!(this.used instanceof UnsignedIntType))
9675            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.used.getClass().getName()+" was encountered");
9676          return (UnsignedIntType) this.used;
9677        }
9678
9679        public boolean hasUsedUnsignedIntType() { 
9680          return this.used instanceof UnsignedIntType;
9681        }
9682
9683        /**
9684         * @return {@link #used} (Benefits used.)
9685         */
9686        public Money getUsedMoney() throws FHIRException { 
9687          if (!(this.used instanceof Money))
9688            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.used.getClass().getName()+" was encountered");
9689          return (Money) this.used;
9690        }
9691
9692        public boolean hasUsedMoney() { 
9693          return this.used instanceof Money;
9694        }
9695
9696        public boolean hasUsed() { 
9697          return this.used != null && !this.used.isEmpty();
9698        }
9699
9700        /**
9701         * @param value {@link #used} (Benefits used.)
9702         */
9703        public BenefitComponent setUsed(Type value) { 
9704          this.used = value;
9705          return this;
9706        }
9707
9708        protected void listChildren(List<Property> childrenList) {
9709          super.listChildren(childrenList);
9710          childrenList.add(new Property("type", "CodeableConcept", "Deductable, visits, benefit amount.", 0, java.lang.Integer.MAX_VALUE, type));
9711          childrenList.add(new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, java.lang.Integer.MAX_VALUE, allowed));
9712          childrenList.add(new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, java.lang.Integer.MAX_VALUE, used));
9713        }
9714
9715      @Override
9716      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9717        switch (hash) {
9718        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
9719        case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // Type
9720        case 3599293: /*used*/ return this.used == null ? new Base[0] : new Base[] {this.used}; // Type
9721        default: return super.getProperty(hash, name, checkValid);
9722        }
9723
9724      }
9725
9726      @Override
9727      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9728        switch (hash) {
9729        case 3575610: // type
9730          this.type = castToCodeableConcept(value); // CodeableConcept
9731          return value;
9732        case -911343192: // allowed
9733          this.allowed = castToType(value); // Type
9734          return value;
9735        case 3599293: // used
9736          this.used = castToType(value); // Type
9737          return value;
9738        default: return super.setProperty(hash, name, value);
9739        }
9740
9741      }
9742
9743      @Override
9744      public Base setProperty(String name, Base value) throws FHIRException {
9745        if (name.equals("type")) {
9746          this.type = castToCodeableConcept(value); // CodeableConcept
9747        } else if (name.equals("allowed[x]")) {
9748          this.allowed = castToType(value); // Type
9749        } else if (name.equals("used[x]")) {
9750          this.used = castToType(value); // Type
9751        } else
9752          return super.setProperty(name, value);
9753        return value;
9754      }
9755
9756      @Override
9757      public Base makeProperty(int hash, String name) throws FHIRException {
9758        switch (hash) {
9759        case 3575610:  return getType(); 
9760        case -1336663592:  return getAllowed(); 
9761        case -911343192:  return getAllowed(); 
9762        case -147553373:  return getUsed(); 
9763        case 3599293:  return getUsed(); 
9764        default: return super.makeProperty(hash, name);
9765        }
9766
9767      }
9768
9769      @Override
9770      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9771        switch (hash) {
9772        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
9773        case -911343192: /*allowed*/ return new String[] {"unsignedInt", "string", "Money"};
9774        case 3599293: /*used*/ return new String[] {"unsignedInt", "Money"};
9775        default: return super.getTypesForProperty(hash, name);
9776        }
9777
9778      }
9779
9780      @Override
9781      public Base addChild(String name) throws FHIRException {
9782        if (name.equals("type")) {
9783          this.type = new CodeableConcept();
9784          return this.type;
9785        }
9786        else if (name.equals("allowedUnsignedInt")) {
9787          this.allowed = new UnsignedIntType();
9788          return this.allowed;
9789        }
9790        else if (name.equals("allowedString")) {
9791          this.allowed = new StringType();
9792          return this.allowed;
9793        }
9794        else if (name.equals("allowedMoney")) {
9795          this.allowed = new Money();
9796          return this.allowed;
9797        }
9798        else if (name.equals("usedUnsignedInt")) {
9799          this.used = new UnsignedIntType();
9800          return this.used;
9801        }
9802        else if (name.equals("usedMoney")) {
9803          this.used = new Money();
9804          return this.used;
9805        }
9806        else
9807          return super.addChild(name);
9808      }
9809
9810      public BenefitComponent copy() {
9811        BenefitComponent dst = new BenefitComponent();
9812        copyValues(dst);
9813        dst.type = type == null ? null : type.copy();
9814        dst.allowed = allowed == null ? null : allowed.copy();
9815        dst.used = used == null ? null : used.copy();
9816        return dst;
9817      }
9818
9819      @Override
9820      public boolean equalsDeep(Base other) {
9821        if (!super.equalsDeep(other))
9822          return false;
9823        if (!(other instanceof BenefitComponent))
9824          return false;
9825        BenefitComponent o = (BenefitComponent) other;
9826        return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true) && compareDeep(used, o.used, true)
9827          ;
9828      }
9829
9830      @Override
9831      public boolean equalsShallow(Base other) {
9832        if (!super.equalsShallow(other))
9833          return false;
9834        if (!(other instanceof BenefitComponent))
9835          return false;
9836        BenefitComponent o = (BenefitComponent) other;
9837        return true;
9838      }
9839
9840      public boolean isEmpty() {
9841        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
9842      }
9843
9844  public String fhirType() {
9845    return "ExplanationOfBenefit.benefitBalance.financial";
9846
9847  }
9848
9849  }
9850
9851    /**
9852     * The EOB Business Identifier.
9853     */
9854    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9855    @Description(shortDefinition="Business Identifier", formalDefinition="The EOB Business Identifier." )
9856    protected List<Identifier> identifier;
9857
9858    /**
9859     * The status of the resource instance.
9860     */
9861    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
9862    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
9863    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
9864    protected Enumeration<ExplanationOfBenefitStatus> status;
9865
9866    /**
9867     * The category of claim, eg, oral, pharmacy, vision, insitutional, professional.
9868     */
9869    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
9870    @Description(shortDefinition="Type or discipline", formalDefinition="The category of claim, eg, oral, pharmacy, vision, insitutional, professional." )
9871    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-type")
9872    protected CodeableConcept type;
9873
9874    /**
9875     * A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType.
9876     */
9877    @Child(name = "subType", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9878    @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." )
9879    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-subtype")
9880    protected List<CodeableConcept> subType;
9881
9882    /**
9883     * Patient Resource.
9884     */
9885    @Child(name = "patient", type = {Patient.class}, order=4, min=0, max=1, modifier=false, summary=false)
9886    @Description(shortDefinition="The subject of the Products and Services", formalDefinition="Patient Resource." )
9887    protected Reference patient;
9888
9889    /**
9890     * The actual object that is the target of the reference (Patient Resource.)
9891     */
9892    protected Patient patientTarget;
9893
9894    /**
9895     * The billable period for which charges are being submitted.
9896     */
9897    @Child(name = "billablePeriod", type = {Period.class}, order=5, min=0, max=1, modifier=false, summary=false)
9898    @Description(shortDefinition="Period for charge submission", formalDefinition="The billable period for which charges are being submitted." )
9899    protected Period billablePeriod;
9900
9901    /**
9902     * The date when the EOB was created.
9903     */
9904    @Child(name = "created", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=false)
9905    @Description(shortDefinition="Creation date", formalDefinition="The date when the EOB was created." )
9906    protected DateTimeType created;
9907
9908    /**
9909     * The person who created the explanation of benefit.
9910     */
9911    @Child(name = "enterer", type = {Practitioner.class}, order=7, min=0, max=1, modifier=false, summary=false)
9912    @Description(shortDefinition="Author", formalDefinition="The person who created the explanation of benefit." )
9913    protected Reference enterer;
9914
9915    /**
9916     * The actual object that is the target of the reference (The person who created the explanation of benefit.)
9917     */
9918    protected Practitioner entererTarget;
9919
9920    /**
9921     * The insurer which is responsible for the explanation of benefit.
9922     */
9923    @Child(name = "insurer", type = {Organization.class}, order=8, min=0, max=1, modifier=false, summary=false)
9924    @Description(shortDefinition="Insurer responsible for the EOB", formalDefinition="The insurer which is responsible for the explanation of benefit." )
9925    protected Reference insurer;
9926
9927    /**
9928     * The actual object that is the target of the reference (The insurer which is responsible for the explanation of benefit.)
9929     */
9930    protected Organization insurerTarget;
9931
9932    /**
9933     * The provider which is responsible for the claim.
9934     */
9935    @Child(name = "provider", type = {Practitioner.class}, order=9, min=0, max=1, modifier=false, summary=false)
9936    @Description(shortDefinition="Responsible provider for the claim", formalDefinition="The provider which is responsible for the claim." )
9937    protected Reference provider;
9938
9939    /**
9940     * The actual object that is the target of the reference (The provider which is responsible for the claim.)
9941     */
9942    protected Practitioner providerTarget;
9943
9944    /**
9945     * The provider which is responsible for the claim.
9946     */
9947    @Child(name = "organization", type = {Organization.class}, order=10, min=0, max=1, modifier=false, summary=false)
9948    @Description(shortDefinition="Responsible organization for the claim", formalDefinition="The provider which is responsible for the claim." )
9949    protected Reference organization;
9950
9951    /**
9952     * The actual object that is the target of the reference (The provider which is responsible for the claim.)
9953     */
9954    protected Organization organizationTarget;
9955
9956    /**
9957     * The referral resource which lists the date, practitioner, reason and other supporting information.
9958     */
9959    @Child(name = "referral", type = {ReferralRequest.class}, order=11, min=0, max=1, modifier=false, summary=false)
9960    @Description(shortDefinition="Treatment Referral", formalDefinition="The referral resource which lists the date, practitioner, reason and other supporting information." )
9961    protected Reference referral;
9962
9963    /**
9964     * The actual object that is the target of the reference (The referral resource which lists the date, practitioner, reason and other supporting information.)
9965     */
9966    protected ReferralRequest referralTarget;
9967
9968    /**
9969     * Facility where the services were provided.
9970     */
9971    @Child(name = "facility", type = {Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
9972    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
9973    protected Reference facility;
9974
9975    /**
9976     * The actual object that is the target of the reference (Facility where the services were provided.)
9977     */
9978    protected Location facilityTarget;
9979
9980    /**
9981     * The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.
9982     */
9983    @Child(name = "claim", type = {Claim.class}, order=13, min=0, max=1, modifier=false, summary=false)
9984    @Description(shortDefinition="Claim reference", formalDefinition="The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number." )
9985    protected Reference claim;
9986
9987    /**
9988     * 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.)
9989     */
9990    protected Claim claimTarget;
9991
9992    /**
9993     * The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.
9994     */
9995    @Child(name = "claimResponse", type = {ClaimResponse.class}, order=14, min=0, max=1, modifier=false, summary=false)
9996    @Description(shortDefinition="Claim response reference", formalDefinition="The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number." )
9997    protected Reference claimResponse;
9998
9999    /**
10000     * 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.)
10001     */
10002    protected ClaimResponse claimResponseTarget;
10003
10004    /**
10005     * Processing outcome errror, partial or complete processing.
10006     */
10007    @Child(name = "outcome", type = {CodeableConcept.class}, order=15, min=0, max=1, modifier=false, summary=false)
10008    @Description(shortDefinition="complete | error | partial", formalDefinition="Processing outcome errror, partial or complete processing." )
10009    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
10010    protected CodeableConcept outcome;
10011
10012    /**
10013     * A description of the status of the adjudication.
10014     */
10015    @Child(name = "disposition", type = {StringType.class}, order=16, min=0, max=1, modifier=false, summary=false)
10016    @Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
10017    protected StringType disposition;
10018
10019    /**
10020     * Other claims which are related to this claim such as prior claim versions or for related services.
10021     */
10022    @Child(name = "related", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10023    @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." )
10024    protected List<RelatedClaimComponent> related;
10025
10026    /**
10027     * Prescription to support the dispensing of Pharmacy or Vision products.
10028     */
10029    @Child(name = "prescription", type = {MedicationRequest.class, VisionPrescription.class}, order=18, min=0, max=1, modifier=false, summary=false)
10030    @Description(shortDefinition="Prescription authorizing services or products", formalDefinition="Prescription to support the dispensing of Pharmacy or Vision products." )
10031    protected Reference prescription;
10032
10033    /**
10034     * The actual object that is the target of the reference (Prescription to support the dispensing of Pharmacy or Vision products.)
10035     */
10036    protected Resource prescriptionTarget;
10037
10038    /**
10039     * 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'.
10040     */
10041    @Child(name = "originalPrescription", type = {MedicationRequest.class}, order=19, min=0, max=1, modifier=false, summary=false)
10042    @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'." )
10043    protected Reference originalPrescription;
10044
10045    /**
10046     * 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'.)
10047     */
10048    protected MedicationRequest originalPrescriptionTarget;
10049
10050    /**
10051     * The party to be reimbursed for the services.
10052     */
10053    @Child(name = "payee", type = {}, order=20, min=0, max=1, modifier=false, summary=false)
10054    @Description(shortDefinition="Party to be paid any benefits payable", formalDefinition="The party to be reimbursed for the services." )
10055    protected PayeeComponent payee;
10056
10057    /**
10058     * Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required.
10059     */
10060    @Child(name = "information", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10061    @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." )
10062    protected List<SupportingInformationComponent> information;
10063
10064    /**
10065     * The members of the team who provided the overall service as well as their role and whether responsible and qualifications.
10066     */
10067    @Child(name = "careTeam", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10068    @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." )
10069    protected List<CareTeamComponent> careTeam;
10070
10071    /**
10072     * Ordered list of patient diagnosis for which care is sought.
10073     */
10074    @Child(name = "diagnosis", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10075    @Description(shortDefinition="List of Diagnosis", formalDefinition="Ordered list of patient diagnosis for which care is sought." )
10076    protected List<DiagnosisComponent> diagnosis;
10077
10078    /**
10079     * Ordered list of patient procedures performed to support the adjudication.
10080     */
10081    @Child(name = "procedure", type = {}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10082    @Description(shortDefinition="Procedures performed", formalDefinition="Ordered list of patient procedures performed to support the adjudication." )
10083    protected List<ProcedureComponent> procedure;
10084
10085    /**
10086     * Precedence (primary, secondary, etc.).
10087     */
10088    @Child(name = "precedence", type = {PositiveIntType.class}, order=25, min=0, max=1, modifier=false, summary=false)
10089    @Description(shortDefinition="Precedence (primary, secondary, etc.)", formalDefinition="Precedence (primary, secondary, etc.)." )
10090    protected PositiveIntType precedence;
10091
10092    /**
10093     * Financial instrument by which payment information for health care.
10094     */
10095    @Child(name = "insurance", type = {}, order=26, min=0, max=1, modifier=false, summary=false)
10096    @Description(shortDefinition="Insurance or medical plan", formalDefinition="Financial instrument by which payment information for health care." )
10097    protected InsuranceComponent insurance;
10098
10099    /**
10100     * An accident which resulted in the need for healthcare services.
10101     */
10102    @Child(name = "accident", type = {}, order=27, min=0, max=1, modifier=false, summary=false)
10103    @Description(shortDefinition="Details of an accident", formalDefinition="An accident which resulted in the need for healthcare services." )
10104    protected AccidentComponent accident;
10105
10106    /**
10107     * The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).
10108     */
10109    @Child(name = "employmentImpacted", type = {Period.class}, order=28, min=0, max=1, modifier=false, summary=false)
10110    @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)." )
10111    protected Period employmentImpacted;
10112
10113    /**
10114     * The start and optional end dates of when the patient was confined to a treatment center.
10115     */
10116    @Child(name = "hospitalization", type = {Period.class}, order=29, min=0, max=1, modifier=false, summary=false)
10117    @Description(shortDefinition="Period in hospital", formalDefinition="The start and optional end dates of when the patient was confined to a treatment center." )
10118    protected Period hospitalization;
10119
10120    /**
10121     * First tier of goods and services.
10122     */
10123    @Child(name = "item", type = {}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10124    @Description(shortDefinition="Goods and Services", formalDefinition="First tier of goods and services." )
10125    protected List<ItemComponent> item;
10126
10127    /**
10128     * The first tier service adjudications for payor added services.
10129     */
10130    @Child(name = "addItem", type = {}, order=31, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10131    @Description(shortDefinition="Insurer added line items", formalDefinition="The first tier service adjudications for payor added services." )
10132    protected List<AddedItemComponent> addItem;
10133
10134    /**
10135     * The total cost of the services reported.
10136     */
10137    @Child(name = "totalCost", type = {Money.class}, order=32, min=0, max=1, modifier=false, summary=false)
10138    @Description(shortDefinition="Total Cost of service from the Claim", formalDefinition="The total cost of the services reported." )
10139    protected Money totalCost;
10140
10141    /**
10142     * The amount of deductable applied which was not allocated to any particular service line.
10143     */
10144    @Child(name = "unallocDeductable", type = {Money.class}, order=33, min=0, max=1, modifier=false, summary=false)
10145    @Description(shortDefinition="Unallocated deductable", formalDefinition="The amount of deductable applied which was not allocated to any particular service line." )
10146    protected Money unallocDeductable;
10147
10148    /**
10149     * Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable).
10150     */
10151    @Child(name = "totalBenefit", type = {Money.class}, order=34, min=0, max=1, modifier=false, summary=false)
10152    @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)." )
10153    protected Money totalBenefit;
10154
10155    /**
10156     * Payment details for the claim if the claim has been paid.
10157     */
10158    @Child(name = "payment", type = {}, order=35, min=0, max=1, modifier=false, summary=false)
10159    @Description(shortDefinition="Payment (if paid)", formalDefinition="Payment details for the claim if the claim has been paid." )
10160    protected PaymentComponent payment;
10161
10162    /**
10163     * The form to be used for printing the content.
10164     */
10165    @Child(name = "form", type = {CodeableConcept.class}, order=36, min=0, max=1, modifier=false, summary=false)
10166    @Description(shortDefinition="Printed Form Identifier", formalDefinition="The form to be used for printing the content." )
10167    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
10168    protected CodeableConcept form;
10169
10170    /**
10171     * Note text.
10172     */
10173    @Child(name = "processNote", type = {}, order=37, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10174    @Description(shortDefinition="Processing notes", formalDefinition="Note text." )
10175    protected List<NoteComponent> processNote;
10176
10177    /**
10178     * Balance by Benefit Category.
10179     */
10180    @Child(name = "benefitBalance", type = {}, order=38, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10181    @Description(shortDefinition="Balance by Benefit Category", formalDefinition="Balance by Benefit Category." )
10182    protected List<BenefitBalanceComponent> benefitBalance;
10183
10184    private static final long serialVersionUID = -1301056913L;
10185
10186  /**
10187   * Constructor
10188   */
10189    public ExplanationOfBenefit() {
10190      super();
10191    }
10192
10193    /**
10194     * @return {@link #identifier} (The EOB Business Identifier.)
10195     */
10196    public List<Identifier> getIdentifier() { 
10197      if (this.identifier == null)
10198        this.identifier = new ArrayList<Identifier>();
10199      return this.identifier;
10200    }
10201
10202    /**
10203     * @return Returns a reference to <code>this</code> for easy method chaining
10204     */
10205    public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) { 
10206      this.identifier = theIdentifier;
10207      return this;
10208    }
10209
10210    public boolean hasIdentifier() { 
10211      if (this.identifier == null)
10212        return false;
10213      for (Identifier item : this.identifier)
10214        if (!item.isEmpty())
10215          return true;
10216      return false;
10217    }
10218
10219    public Identifier addIdentifier() { //3
10220      Identifier t = new Identifier();
10221      if (this.identifier == null)
10222        this.identifier = new ArrayList<Identifier>();
10223      this.identifier.add(t);
10224      return t;
10225    }
10226
10227    public ExplanationOfBenefit addIdentifier(Identifier t) { //3
10228      if (t == null)
10229        return this;
10230      if (this.identifier == null)
10231        this.identifier = new ArrayList<Identifier>();
10232      this.identifier.add(t);
10233      return this;
10234    }
10235
10236    /**
10237     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
10238     */
10239    public Identifier getIdentifierFirstRep() { 
10240      if (getIdentifier().isEmpty()) {
10241        addIdentifier();
10242      }
10243      return getIdentifier().get(0);
10244    }
10245
10246    /**
10247     * @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
10248     */
10249    public Enumeration<ExplanationOfBenefitStatus> getStatusElement() { 
10250      if (this.status == null)
10251        if (Configuration.errorOnAutoCreate())
10252          throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
10253        else if (Configuration.doAutoCreate())
10254          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
10255      return this.status;
10256    }
10257
10258    public boolean hasStatusElement() { 
10259      return this.status != null && !this.status.isEmpty();
10260    }
10261
10262    public boolean hasStatus() { 
10263      return this.status != null && !this.status.isEmpty();
10264    }
10265
10266    /**
10267     * @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
10268     */
10269    public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) { 
10270      this.status = value;
10271      return this;
10272    }
10273
10274    /**
10275     * @return The status of the resource instance.
10276     */
10277    public ExplanationOfBenefitStatus getStatus() { 
10278      return this.status == null ? null : this.status.getValue();
10279    }
10280
10281    /**
10282     * @param value The status of the resource instance.
10283     */
10284    public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) { 
10285      if (value == null)
10286        this.status = null;
10287      else {
10288        if (this.status == null)
10289          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
10290        this.status.setValue(value);
10291      }
10292      return this;
10293    }
10294
10295    /**
10296     * @return {@link #type} (The category of claim, eg, oral, pharmacy, vision, insitutional, professional.)
10297     */
10298    public CodeableConcept getType() { 
10299      if (this.type == null)
10300        if (Configuration.errorOnAutoCreate())
10301          throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
10302        else if (Configuration.doAutoCreate())
10303          this.type = new CodeableConcept(); // cc
10304      return this.type;
10305    }
10306
10307    public boolean hasType() { 
10308      return this.type != null && !this.type.isEmpty();
10309    }
10310
10311    /**
10312     * @param value {@link #type} (The category of claim, eg, oral, pharmacy, vision, insitutional, professional.)
10313     */
10314    public ExplanationOfBenefit setType(CodeableConcept value) { 
10315      this.type = value;
10316      return this;
10317    }
10318
10319    /**
10320     * @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.)
10321     */
10322    public List<CodeableConcept> getSubType() { 
10323      if (this.subType == null)
10324        this.subType = new ArrayList<CodeableConcept>();
10325      return this.subType;
10326    }
10327
10328    /**
10329     * @return Returns a reference to <code>this</code> for easy method chaining
10330     */
10331    public ExplanationOfBenefit setSubType(List<CodeableConcept> theSubType) { 
10332      this.subType = theSubType;
10333      return this;
10334    }
10335
10336    public boolean hasSubType() { 
10337      if (this.subType == null)
10338        return false;
10339      for (CodeableConcept item : this.subType)
10340        if (!item.isEmpty())
10341          return true;
10342      return false;
10343    }
10344
10345    public CodeableConcept addSubType() { //3
10346      CodeableConcept t = new CodeableConcept();
10347      if (this.subType == null)
10348        this.subType = new ArrayList<CodeableConcept>();
10349      this.subType.add(t);
10350      return t;
10351    }
10352
10353    public ExplanationOfBenefit addSubType(CodeableConcept t) { //3
10354      if (t == null)
10355        return this;
10356      if (this.subType == null)
10357        this.subType = new ArrayList<CodeableConcept>();
10358      this.subType.add(t);
10359      return this;
10360    }
10361
10362    /**
10363     * @return The first repetition of repeating field {@link #subType}, creating it if it does not already exist
10364     */
10365    public CodeableConcept getSubTypeFirstRep() { 
10366      if (getSubType().isEmpty()) {
10367        addSubType();
10368      }
10369      return getSubType().get(0);
10370    }
10371
10372    /**
10373     * @return {@link #patient} (Patient Resource.)
10374     */
10375    public Reference getPatient() { 
10376      if (this.patient == null)
10377        if (Configuration.errorOnAutoCreate())
10378          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
10379        else if (Configuration.doAutoCreate())
10380          this.patient = new Reference(); // cc
10381      return this.patient;
10382    }
10383
10384    public boolean hasPatient() { 
10385      return this.patient != null && !this.patient.isEmpty();
10386    }
10387
10388    /**
10389     * @param value {@link #patient} (Patient Resource.)
10390     */
10391    public ExplanationOfBenefit setPatient(Reference value) { 
10392      this.patient = value;
10393      return this;
10394    }
10395
10396    /**
10397     * @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.)
10398     */
10399    public Patient getPatientTarget() { 
10400      if (this.patientTarget == null)
10401        if (Configuration.errorOnAutoCreate())
10402          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
10403        else if (Configuration.doAutoCreate())
10404          this.patientTarget = new Patient(); // aa
10405      return this.patientTarget;
10406    }
10407
10408    /**
10409     * @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.)
10410     */
10411    public ExplanationOfBenefit setPatientTarget(Patient value) { 
10412      this.patientTarget = value;
10413      return this;
10414    }
10415
10416    /**
10417     * @return {@link #billablePeriod} (The billable period for which charges are being submitted.)
10418     */
10419    public Period getBillablePeriod() { 
10420      if (this.billablePeriod == null)
10421        if (Configuration.errorOnAutoCreate())
10422          throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
10423        else if (Configuration.doAutoCreate())
10424          this.billablePeriod = new Period(); // cc
10425      return this.billablePeriod;
10426    }
10427
10428    public boolean hasBillablePeriod() { 
10429      return this.billablePeriod != null && !this.billablePeriod.isEmpty();
10430    }
10431
10432    /**
10433     * @param value {@link #billablePeriod} (The billable period for which charges are being submitted.)
10434     */
10435    public ExplanationOfBenefit setBillablePeriod(Period value) { 
10436      this.billablePeriod = value;
10437      return this;
10438    }
10439
10440    /**
10441     * @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
10442     */
10443    public DateTimeType getCreatedElement() { 
10444      if (this.created == null)
10445        if (Configuration.errorOnAutoCreate())
10446          throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
10447        else if (Configuration.doAutoCreate())
10448          this.created = new DateTimeType(); // bb
10449      return this.created;
10450    }
10451
10452    public boolean hasCreatedElement() { 
10453      return this.created != null && !this.created.isEmpty();
10454    }
10455
10456    public boolean hasCreated() { 
10457      return this.created != null && !this.created.isEmpty();
10458    }
10459
10460    /**
10461     * @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
10462     */
10463    public ExplanationOfBenefit setCreatedElement(DateTimeType value) { 
10464      this.created = value;
10465      return this;
10466    }
10467
10468    /**
10469     * @return The date when the EOB was created.
10470     */
10471    public Date getCreated() { 
10472      return this.created == null ? null : this.created.getValue();
10473    }
10474
10475    /**
10476     * @param value The date when the EOB was created.
10477     */
10478    public ExplanationOfBenefit setCreated(Date value) { 
10479      if (value == null)
10480        this.created = null;
10481      else {
10482        if (this.created == null)
10483          this.created = new DateTimeType();
10484        this.created.setValue(value);
10485      }
10486      return this;
10487    }
10488
10489    /**
10490     * @return {@link #enterer} (The person who created the explanation of benefit.)
10491     */
10492    public Reference getEnterer() { 
10493      if (this.enterer == null)
10494        if (Configuration.errorOnAutoCreate())
10495          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
10496        else if (Configuration.doAutoCreate())
10497          this.enterer = new Reference(); // cc
10498      return this.enterer;
10499    }
10500
10501    public boolean hasEnterer() { 
10502      return this.enterer != null && !this.enterer.isEmpty();
10503    }
10504
10505    /**
10506     * @param value {@link #enterer} (The person who created the explanation of benefit.)
10507     */
10508    public ExplanationOfBenefit setEnterer(Reference value) { 
10509      this.enterer = value;
10510      return this;
10511    }
10512
10513    /**
10514     * @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.)
10515     */
10516    public Practitioner getEntererTarget() { 
10517      if (this.entererTarget == null)
10518        if (Configuration.errorOnAutoCreate())
10519          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
10520        else if (Configuration.doAutoCreate())
10521          this.entererTarget = new Practitioner(); // aa
10522      return this.entererTarget;
10523    }
10524
10525    /**
10526     * @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.)
10527     */
10528    public ExplanationOfBenefit setEntererTarget(Practitioner value) { 
10529      this.entererTarget = value;
10530      return this;
10531    }
10532
10533    /**
10534     * @return {@link #insurer} (The insurer which is responsible for the explanation of benefit.)
10535     */
10536    public Reference getInsurer() { 
10537      if (this.insurer == null)
10538        if (Configuration.errorOnAutoCreate())
10539          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
10540        else if (Configuration.doAutoCreate())
10541          this.insurer = new Reference(); // cc
10542      return this.insurer;
10543    }
10544
10545    public boolean hasInsurer() { 
10546      return this.insurer != null && !this.insurer.isEmpty();
10547    }
10548
10549    /**
10550     * @param value {@link #insurer} (The insurer which is responsible for the explanation of benefit.)
10551     */
10552    public ExplanationOfBenefit setInsurer(Reference value) { 
10553      this.insurer = value;
10554      return this;
10555    }
10556
10557    /**
10558     * @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.)
10559     */
10560    public Organization getInsurerTarget() { 
10561      if (this.insurerTarget == null)
10562        if (Configuration.errorOnAutoCreate())
10563          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
10564        else if (Configuration.doAutoCreate())
10565          this.insurerTarget = new Organization(); // aa
10566      return this.insurerTarget;
10567    }
10568
10569    /**
10570     * @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.)
10571     */
10572    public ExplanationOfBenefit setInsurerTarget(Organization value) { 
10573      this.insurerTarget = value;
10574      return this;
10575    }
10576
10577    /**
10578     * @return {@link #provider} (The provider which is responsible for the claim.)
10579     */
10580    public Reference getProvider() { 
10581      if (this.provider == null)
10582        if (Configuration.errorOnAutoCreate())
10583          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
10584        else if (Configuration.doAutoCreate())
10585          this.provider = new Reference(); // cc
10586      return this.provider;
10587    }
10588
10589    public boolean hasProvider() { 
10590      return this.provider != null && !this.provider.isEmpty();
10591    }
10592
10593    /**
10594     * @param value {@link #provider} (The provider which is responsible for the claim.)
10595     */
10596    public ExplanationOfBenefit setProvider(Reference value) { 
10597      this.provider = value;
10598      return this;
10599    }
10600
10601    /**
10602     * @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.)
10603     */
10604    public Practitioner getProviderTarget() { 
10605      if (this.providerTarget == null)
10606        if (Configuration.errorOnAutoCreate())
10607          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
10608        else if (Configuration.doAutoCreate())
10609          this.providerTarget = new Practitioner(); // aa
10610      return this.providerTarget;
10611    }
10612
10613    /**
10614     * @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.)
10615     */
10616    public ExplanationOfBenefit setProviderTarget(Practitioner value) { 
10617      this.providerTarget = value;
10618      return this;
10619    }
10620
10621    /**
10622     * @return {@link #organization} (The provider which is responsible for the claim.)
10623     */
10624    public Reference getOrganization() { 
10625      if (this.organization == null)
10626        if (Configuration.errorOnAutoCreate())
10627          throw new Error("Attempt to auto-create ExplanationOfBenefit.organization");
10628        else if (Configuration.doAutoCreate())
10629          this.organization = new Reference(); // cc
10630      return this.organization;
10631    }
10632
10633    public boolean hasOrganization() { 
10634      return this.organization != null && !this.organization.isEmpty();
10635    }
10636
10637    /**
10638     * @param value {@link #organization} (The provider which is responsible for the claim.)
10639     */
10640    public ExplanationOfBenefit setOrganization(Reference value) { 
10641      this.organization = value;
10642      return this;
10643    }
10644
10645    /**
10646     * @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.)
10647     */
10648    public Organization getOrganizationTarget() { 
10649      if (this.organizationTarget == null)
10650        if (Configuration.errorOnAutoCreate())
10651          throw new Error("Attempt to auto-create ExplanationOfBenefit.organization");
10652        else if (Configuration.doAutoCreate())
10653          this.organizationTarget = new Organization(); // aa
10654      return this.organizationTarget;
10655    }
10656
10657    /**
10658     * @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.)
10659     */
10660    public ExplanationOfBenefit setOrganizationTarget(Organization value) { 
10661      this.organizationTarget = value;
10662      return this;
10663    }
10664
10665    /**
10666     * @return {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
10667     */
10668    public Reference getReferral() { 
10669      if (this.referral == null)
10670        if (Configuration.errorOnAutoCreate())
10671          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
10672        else if (Configuration.doAutoCreate())
10673          this.referral = new Reference(); // cc
10674      return this.referral;
10675    }
10676
10677    public boolean hasReferral() { 
10678      return this.referral != null && !this.referral.isEmpty();
10679    }
10680
10681    /**
10682     * @param value {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
10683     */
10684    public ExplanationOfBenefit setReferral(Reference value) { 
10685      this.referral = value;
10686      return this;
10687    }
10688
10689    /**
10690     * @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.)
10691     */
10692    public ReferralRequest getReferralTarget() { 
10693      if (this.referralTarget == null)
10694        if (Configuration.errorOnAutoCreate())
10695          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
10696        else if (Configuration.doAutoCreate())
10697          this.referralTarget = new ReferralRequest(); // aa
10698      return this.referralTarget;
10699    }
10700
10701    /**
10702     * @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.)
10703     */
10704    public ExplanationOfBenefit setReferralTarget(ReferralRequest value) { 
10705      this.referralTarget = value;
10706      return this;
10707    }
10708
10709    /**
10710     * @return {@link #facility} (Facility where the services were provided.)
10711     */
10712    public Reference getFacility() { 
10713      if (this.facility == null)
10714        if (Configuration.errorOnAutoCreate())
10715          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
10716        else if (Configuration.doAutoCreate())
10717          this.facility = new Reference(); // cc
10718      return this.facility;
10719    }
10720
10721    public boolean hasFacility() { 
10722      return this.facility != null && !this.facility.isEmpty();
10723    }
10724
10725    /**
10726     * @param value {@link #facility} (Facility where the services were provided.)
10727     */
10728    public ExplanationOfBenefit setFacility(Reference value) { 
10729      this.facility = value;
10730      return this;
10731    }
10732
10733    /**
10734     * @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.)
10735     */
10736    public Location getFacilityTarget() { 
10737      if (this.facilityTarget == null)
10738        if (Configuration.errorOnAutoCreate())
10739          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
10740        else if (Configuration.doAutoCreate())
10741          this.facilityTarget = new Location(); // aa
10742      return this.facilityTarget;
10743    }
10744
10745    /**
10746     * @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.)
10747     */
10748    public ExplanationOfBenefit setFacilityTarget(Location value) { 
10749      this.facilityTarget = value;
10750      return this;
10751    }
10752
10753    /**
10754     * @return {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
10755     */
10756    public Reference getClaim() { 
10757      if (this.claim == null)
10758        if (Configuration.errorOnAutoCreate())
10759          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
10760        else if (Configuration.doAutoCreate())
10761          this.claim = new Reference(); // cc
10762      return this.claim;
10763    }
10764
10765    public boolean hasClaim() { 
10766      return this.claim != null && !this.claim.isEmpty();
10767    }
10768
10769    /**
10770     * @param value {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
10771     */
10772    public ExplanationOfBenefit setClaim(Reference value) { 
10773      this.claim = value;
10774      return this;
10775    }
10776
10777    /**
10778     * @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.)
10779     */
10780    public Claim getClaimTarget() { 
10781      if (this.claimTarget == null)
10782        if (Configuration.errorOnAutoCreate())
10783          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
10784        else if (Configuration.doAutoCreate())
10785          this.claimTarget = new Claim(); // aa
10786      return this.claimTarget;
10787    }
10788
10789    /**
10790     * @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.)
10791     */
10792    public ExplanationOfBenefit setClaimTarget(Claim value) { 
10793      this.claimTarget = value;
10794      return this;
10795    }
10796
10797    /**
10798     * @return {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
10799     */
10800    public Reference getClaimResponse() { 
10801      if (this.claimResponse == null)
10802        if (Configuration.errorOnAutoCreate())
10803          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
10804        else if (Configuration.doAutoCreate())
10805          this.claimResponse = new Reference(); // cc
10806      return this.claimResponse;
10807    }
10808
10809    public boolean hasClaimResponse() { 
10810      return this.claimResponse != null && !this.claimResponse.isEmpty();
10811    }
10812
10813    /**
10814     * @param value {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
10815     */
10816    public ExplanationOfBenefit setClaimResponse(Reference value) { 
10817      this.claimResponse = value;
10818      return this;
10819    }
10820
10821    /**
10822     * @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.)
10823     */
10824    public ClaimResponse getClaimResponseTarget() { 
10825      if (this.claimResponseTarget == null)
10826        if (Configuration.errorOnAutoCreate())
10827          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
10828        else if (Configuration.doAutoCreate())
10829          this.claimResponseTarget = new ClaimResponse(); // aa
10830      return this.claimResponseTarget;
10831    }
10832
10833    /**
10834     * @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.)
10835     */
10836    public ExplanationOfBenefit setClaimResponseTarget(ClaimResponse value) { 
10837      this.claimResponseTarget = value;
10838      return this;
10839    }
10840
10841    /**
10842     * @return {@link #outcome} (Processing outcome errror, partial or complete processing.)
10843     */
10844    public CodeableConcept getOutcome() { 
10845      if (this.outcome == null)
10846        if (Configuration.errorOnAutoCreate())
10847          throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
10848        else if (Configuration.doAutoCreate())
10849          this.outcome = new CodeableConcept(); // cc
10850      return this.outcome;
10851    }
10852
10853    public boolean hasOutcome() { 
10854      return this.outcome != null && !this.outcome.isEmpty();
10855    }
10856
10857    /**
10858     * @param value {@link #outcome} (Processing outcome errror, partial or complete processing.)
10859     */
10860    public ExplanationOfBenefit setOutcome(CodeableConcept value) { 
10861      this.outcome = value;
10862      return this;
10863    }
10864
10865    /**
10866     * @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
10867     */
10868    public StringType getDispositionElement() { 
10869      if (this.disposition == null)
10870        if (Configuration.errorOnAutoCreate())
10871          throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
10872        else if (Configuration.doAutoCreate())
10873          this.disposition = new StringType(); // bb
10874      return this.disposition;
10875    }
10876
10877    public boolean hasDispositionElement() { 
10878      return this.disposition != null && !this.disposition.isEmpty();
10879    }
10880
10881    public boolean hasDisposition() { 
10882      return this.disposition != null && !this.disposition.isEmpty();
10883    }
10884
10885    /**
10886     * @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
10887     */
10888    public ExplanationOfBenefit setDispositionElement(StringType value) { 
10889      this.disposition = value;
10890      return this;
10891    }
10892
10893    /**
10894     * @return A description of the status of the adjudication.
10895     */
10896    public String getDisposition() { 
10897      return this.disposition == null ? null : this.disposition.getValue();
10898    }
10899
10900    /**
10901     * @param value A description of the status of the adjudication.
10902     */
10903    public ExplanationOfBenefit setDisposition(String value) { 
10904      if (Utilities.noString(value))
10905        this.disposition = null;
10906      else {
10907        if (this.disposition == null)
10908          this.disposition = new StringType();
10909        this.disposition.setValue(value);
10910      }
10911      return this;
10912    }
10913
10914    /**
10915     * @return {@link #related} (Other claims which are related to this claim such as prior claim versions or for related services.)
10916     */
10917    public List<RelatedClaimComponent> getRelated() { 
10918      if (this.related == null)
10919        this.related = new ArrayList<RelatedClaimComponent>();
10920      return this.related;
10921    }
10922
10923    /**
10924     * @return Returns a reference to <code>this</code> for easy method chaining
10925     */
10926    public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) { 
10927      this.related = theRelated;
10928      return this;
10929    }
10930
10931    public boolean hasRelated() { 
10932      if (this.related == null)
10933        return false;
10934      for (RelatedClaimComponent item : this.related)
10935        if (!item.isEmpty())
10936          return true;
10937      return false;
10938    }
10939
10940    public RelatedClaimComponent addRelated() { //3
10941      RelatedClaimComponent t = new RelatedClaimComponent();
10942      if (this.related == null)
10943        this.related = new ArrayList<RelatedClaimComponent>();
10944      this.related.add(t);
10945      return t;
10946    }
10947
10948    public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { //3
10949      if (t == null)
10950        return this;
10951      if (this.related == null)
10952        this.related = new ArrayList<RelatedClaimComponent>();
10953      this.related.add(t);
10954      return this;
10955    }
10956
10957    /**
10958     * @return The first repetition of repeating field {@link #related}, creating it if it does not already exist
10959     */
10960    public RelatedClaimComponent getRelatedFirstRep() { 
10961      if (getRelated().isEmpty()) {
10962        addRelated();
10963      }
10964      return getRelated().get(0);
10965    }
10966
10967    /**
10968     * @return {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
10969     */
10970    public Reference getPrescription() { 
10971      if (this.prescription == null)
10972        if (Configuration.errorOnAutoCreate())
10973          throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
10974        else if (Configuration.doAutoCreate())
10975          this.prescription = new Reference(); // cc
10976      return this.prescription;
10977    }
10978
10979    public boolean hasPrescription() { 
10980      return this.prescription != null && !this.prescription.isEmpty();
10981    }
10982
10983    /**
10984     * @param value {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
10985     */
10986    public ExplanationOfBenefit setPrescription(Reference value) { 
10987      this.prescription = value;
10988      return this;
10989    }
10990
10991    /**
10992     * @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.)
10993     */
10994    public Resource getPrescriptionTarget() { 
10995      return this.prescriptionTarget;
10996    }
10997
10998    /**
10999     * @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.)
11000     */
11001    public ExplanationOfBenefit setPrescriptionTarget(Resource value) { 
11002      this.prescriptionTarget = value;
11003      return this;
11004    }
11005
11006    /**
11007     * @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'.)
11008     */
11009    public Reference getOriginalPrescription() { 
11010      if (this.originalPrescription == null)
11011        if (Configuration.errorOnAutoCreate())
11012          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
11013        else if (Configuration.doAutoCreate())
11014          this.originalPrescription = new Reference(); // cc
11015      return this.originalPrescription;
11016    }
11017
11018    public boolean hasOriginalPrescription() { 
11019      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
11020    }
11021
11022    /**
11023     * @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'.)
11024     */
11025    public ExplanationOfBenefit setOriginalPrescription(Reference value) { 
11026      this.originalPrescription = value;
11027      return this;
11028    }
11029
11030    /**
11031     * @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'.)
11032     */
11033    public MedicationRequest getOriginalPrescriptionTarget() { 
11034      if (this.originalPrescriptionTarget == null)
11035        if (Configuration.errorOnAutoCreate())
11036          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
11037        else if (Configuration.doAutoCreate())
11038          this.originalPrescriptionTarget = new MedicationRequest(); // aa
11039      return this.originalPrescriptionTarget;
11040    }
11041
11042    /**
11043     * @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'.)
11044     */
11045    public ExplanationOfBenefit setOriginalPrescriptionTarget(MedicationRequest value) { 
11046      this.originalPrescriptionTarget = value;
11047      return this;
11048    }
11049
11050    /**
11051     * @return {@link #payee} (The party to be reimbursed for the services.)
11052     */
11053    public PayeeComponent getPayee() { 
11054      if (this.payee == null)
11055        if (Configuration.errorOnAutoCreate())
11056          throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
11057        else if (Configuration.doAutoCreate())
11058          this.payee = new PayeeComponent(); // cc
11059      return this.payee;
11060    }
11061
11062    public boolean hasPayee() { 
11063      return this.payee != null && !this.payee.isEmpty();
11064    }
11065
11066    /**
11067     * @param value {@link #payee} (The party to be reimbursed for the services.)
11068     */
11069    public ExplanationOfBenefit setPayee(PayeeComponent value) { 
11070      this.payee = value;
11071      return this;
11072    }
11073
11074    /**
11075     * @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.)
11076     */
11077    public List<SupportingInformationComponent> getInformation() { 
11078      if (this.information == null)
11079        this.information = new ArrayList<SupportingInformationComponent>();
11080      return this.information;
11081    }
11082
11083    /**
11084     * @return Returns a reference to <code>this</code> for easy method chaining
11085     */
11086    public ExplanationOfBenefit setInformation(List<SupportingInformationComponent> theInformation) { 
11087      this.information = theInformation;
11088      return this;
11089    }
11090
11091    public boolean hasInformation() { 
11092      if (this.information == null)
11093        return false;
11094      for (SupportingInformationComponent item : this.information)
11095        if (!item.isEmpty())
11096          return true;
11097      return false;
11098    }
11099
11100    public SupportingInformationComponent addInformation() { //3
11101      SupportingInformationComponent t = new SupportingInformationComponent();
11102      if (this.information == null)
11103        this.information = new ArrayList<SupportingInformationComponent>();
11104      this.information.add(t);
11105      return t;
11106    }
11107
11108    public ExplanationOfBenefit addInformation(SupportingInformationComponent t) { //3
11109      if (t == null)
11110        return this;
11111      if (this.information == null)
11112        this.information = new ArrayList<SupportingInformationComponent>();
11113      this.information.add(t);
11114      return this;
11115    }
11116
11117    /**
11118     * @return The first repetition of repeating field {@link #information}, creating it if it does not already exist
11119     */
11120    public SupportingInformationComponent getInformationFirstRep() { 
11121      if (getInformation().isEmpty()) {
11122        addInformation();
11123      }
11124      return getInformation().get(0);
11125    }
11126
11127    /**
11128     * @return {@link #careTeam} (The members of the team who provided the overall service as well as their role and whether responsible and qualifications.)
11129     */
11130    public List<CareTeamComponent> getCareTeam() { 
11131      if (this.careTeam == null)
11132        this.careTeam = new ArrayList<CareTeamComponent>();
11133      return this.careTeam;
11134    }
11135
11136    /**
11137     * @return Returns a reference to <code>this</code> for easy method chaining
11138     */
11139    public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) { 
11140      this.careTeam = theCareTeam;
11141      return this;
11142    }
11143
11144    public boolean hasCareTeam() { 
11145      if (this.careTeam == null)
11146        return false;
11147      for (CareTeamComponent item : this.careTeam)
11148        if (!item.isEmpty())
11149          return true;
11150      return false;
11151    }
11152
11153    public CareTeamComponent addCareTeam() { //3
11154      CareTeamComponent t = new CareTeamComponent();
11155      if (this.careTeam == null)
11156        this.careTeam = new ArrayList<CareTeamComponent>();
11157      this.careTeam.add(t);
11158      return t;
11159    }
11160
11161    public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { //3
11162      if (t == null)
11163        return this;
11164      if (this.careTeam == null)
11165        this.careTeam = new ArrayList<CareTeamComponent>();
11166      this.careTeam.add(t);
11167      return this;
11168    }
11169
11170    /**
11171     * @return The first repetition of repeating field {@link #careTeam}, creating it if it does not already exist
11172     */
11173    public CareTeamComponent getCareTeamFirstRep() { 
11174      if (getCareTeam().isEmpty()) {
11175        addCareTeam();
11176      }
11177      return getCareTeam().get(0);
11178    }
11179
11180    /**
11181     * @return {@link #diagnosis} (Ordered list of patient diagnosis for which care is sought.)
11182     */
11183    public List<DiagnosisComponent> getDiagnosis() { 
11184      if (this.diagnosis == null)
11185        this.diagnosis = new ArrayList<DiagnosisComponent>();
11186      return this.diagnosis;
11187    }
11188
11189    /**
11190     * @return Returns a reference to <code>this</code> for easy method chaining
11191     */
11192    public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
11193      this.diagnosis = theDiagnosis;
11194      return this;
11195    }
11196
11197    public boolean hasDiagnosis() { 
11198      if (this.diagnosis == null)
11199        return false;
11200      for (DiagnosisComponent item : this.diagnosis)
11201        if (!item.isEmpty())
11202          return true;
11203      return false;
11204    }
11205
11206    public DiagnosisComponent addDiagnosis() { //3
11207      DiagnosisComponent t = new DiagnosisComponent();
11208      if (this.diagnosis == null)
11209        this.diagnosis = new ArrayList<DiagnosisComponent>();
11210      this.diagnosis.add(t);
11211      return t;
11212    }
11213
11214    public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { //3
11215      if (t == null)
11216        return this;
11217      if (this.diagnosis == null)
11218        this.diagnosis = new ArrayList<DiagnosisComponent>();
11219      this.diagnosis.add(t);
11220      return this;
11221    }
11222
11223    /**
11224     * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist
11225     */
11226    public DiagnosisComponent getDiagnosisFirstRep() { 
11227      if (getDiagnosis().isEmpty()) {
11228        addDiagnosis();
11229      }
11230      return getDiagnosis().get(0);
11231    }
11232
11233    /**
11234     * @return {@link #procedure} (Ordered list of patient procedures performed to support the adjudication.)
11235     */
11236    public List<ProcedureComponent> getProcedure() { 
11237      if (this.procedure == null)
11238        this.procedure = new ArrayList<ProcedureComponent>();
11239      return this.procedure;
11240    }
11241
11242    /**
11243     * @return Returns a reference to <code>this</code> for easy method chaining
11244     */
11245    public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) { 
11246      this.procedure = theProcedure;
11247      return this;
11248    }
11249
11250    public boolean hasProcedure() { 
11251      if (this.procedure == null)
11252        return false;
11253      for (ProcedureComponent item : this.procedure)
11254        if (!item.isEmpty())
11255          return true;
11256      return false;
11257    }
11258
11259    public ProcedureComponent addProcedure() { //3
11260      ProcedureComponent t = new ProcedureComponent();
11261      if (this.procedure == null)
11262        this.procedure = new ArrayList<ProcedureComponent>();
11263      this.procedure.add(t);
11264      return t;
11265    }
11266
11267    public ExplanationOfBenefit addProcedure(ProcedureComponent t) { //3
11268      if (t == null)
11269        return this;
11270      if (this.procedure == null)
11271        this.procedure = new ArrayList<ProcedureComponent>();
11272      this.procedure.add(t);
11273      return this;
11274    }
11275
11276    /**
11277     * @return The first repetition of repeating field {@link #procedure}, creating it if it does not already exist
11278     */
11279    public ProcedureComponent getProcedureFirstRep() { 
11280      if (getProcedure().isEmpty()) {
11281        addProcedure();
11282      }
11283      return getProcedure().get(0);
11284    }
11285
11286    /**
11287     * @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
11288     */
11289    public PositiveIntType getPrecedenceElement() { 
11290      if (this.precedence == null)
11291        if (Configuration.errorOnAutoCreate())
11292          throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
11293        else if (Configuration.doAutoCreate())
11294          this.precedence = new PositiveIntType(); // bb
11295      return this.precedence;
11296    }
11297
11298    public boolean hasPrecedenceElement() { 
11299      return this.precedence != null && !this.precedence.isEmpty();
11300    }
11301
11302    public boolean hasPrecedence() { 
11303      return this.precedence != null && !this.precedence.isEmpty();
11304    }
11305
11306    /**
11307     * @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
11308     */
11309    public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) { 
11310      this.precedence = value;
11311      return this;
11312    }
11313
11314    /**
11315     * @return Precedence (primary, secondary, etc.).
11316     */
11317    public int getPrecedence() { 
11318      return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
11319    }
11320
11321    /**
11322     * @param value Precedence (primary, secondary, etc.).
11323     */
11324    public ExplanationOfBenefit setPrecedence(int value) { 
11325        if (this.precedence == null)
11326          this.precedence = new PositiveIntType();
11327        this.precedence.setValue(value);
11328      return this;
11329    }
11330
11331    /**
11332     * @return {@link #insurance} (Financial instrument by which payment information for health care.)
11333     */
11334    public InsuranceComponent getInsurance() { 
11335      if (this.insurance == null)
11336        if (Configuration.errorOnAutoCreate())
11337          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurance");
11338        else if (Configuration.doAutoCreate())
11339          this.insurance = new InsuranceComponent(); // cc
11340      return this.insurance;
11341    }
11342
11343    public boolean hasInsurance() { 
11344      return this.insurance != null && !this.insurance.isEmpty();
11345    }
11346
11347    /**
11348     * @param value {@link #insurance} (Financial instrument by which payment information for health care.)
11349     */
11350    public ExplanationOfBenefit setInsurance(InsuranceComponent value) { 
11351      this.insurance = value;
11352      return this;
11353    }
11354
11355    /**
11356     * @return {@link #accident} (An accident which resulted in the need for healthcare services.)
11357     */
11358    public AccidentComponent getAccident() { 
11359      if (this.accident == null)
11360        if (Configuration.errorOnAutoCreate())
11361          throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
11362        else if (Configuration.doAutoCreate())
11363          this.accident = new AccidentComponent(); // cc
11364      return this.accident;
11365    }
11366
11367    public boolean hasAccident() { 
11368      return this.accident != null && !this.accident.isEmpty();
11369    }
11370
11371    /**
11372     * @param value {@link #accident} (An accident which resulted in the need for healthcare services.)
11373     */
11374    public ExplanationOfBenefit setAccident(AccidentComponent value) { 
11375      this.accident = value;
11376      return this;
11377    }
11378
11379    /**
11380     * @return {@link #employmentImpacted} (The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).)
11381     */
11382    public Period getEmploymentImpacted() { 
11383      if (this.employmentImpacted == null)
11384        if (Configuration.errorOnAutoCreate())
11385          throw new Error("Attempt to auto-create ExplanationOfBenefit.employmentImpacted");
11386        else if (Configuration.doAutoCreate())
11387          this.employmentImpacted = new Period(); // cc
11388      return this.employmentImpacted;
11389    }
11390
11391    public boolean hasEmploymentImpacted() { 
11392      return this.employmentImpacted != null && !this.employmentImpacted.isEmpty();
11393    }
11394
11395    /**
11396     * @param value {@link #employmentImpacted} (The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).)
11397     */
11398    public ExplanationOfBenefit setEmploymentImpacted(Period value) { 
11399      this.employmentImpacted = value;
11400      return this;
11401    }
11402
11403    /**
11404     * @return {@link #hospitalization} (The start and optional end dates of when the patient was confined to a treatment center.)
11405     */
11406    public Period getHospitalization() { 
11407      if (this.hospitalization == null)
11408        if (Configuration.errorOnAutoCreate())
11409          throw new Error("Attempt to auto-create ExplanationOfBenefit.hospitalization");
11410        else if (Configuration.doAutoCreate())
11411          this.hospitalization = new Period(); // cc
11412      return this.hospitalization;
11413    }
11414
11415    public boolean hasHospitalization() { 
11416      return this.hospitalization != null && !this.hospitalization.isEmpty();
11417    }
11418
11419    /**
11420     * @param value {@link #hospitalization} (The start and optional end dates of when the patient was confined to a treatment center.)
11421     */
11422    public ExplanationOfBenefit setHospitalization(Period value) { 
11423      this.hospitalization = value;
11424      return this;
11425    }
11426
11427    /**
11428     * @return {@link #item} (First tier of goods and services.)
11429     */
11430    public List<ItemComponent> getItem() { 
11431      if (this.item == null)
11432        this.item = new ArrayList<ItemComponent>();
11433      return this.item;
11434    }
11435
11436    /**
11437     * @return Returns a reference to <code>this</code> for easy method chaining
11438     */
11439    public ExplanationOfBenefit setItem(List<ItemComponent> theItem) { 
11440      this.item = theItem;
11441      return this;
11442    }
11443
11444    public boolean hasItem() { 
11445      if (this.item == null)
11446        return false;
11447      for (ItemComponent item : this.item)
11448        if (!item.isEmpty())
11449          return true;
11450      return false;
11451    }
11452
11453    public ItemComponent addItem() { //3
11454      ItemComponent t = new ItemComponent();
11455      if (this.item == null)
11456        this.item = new ArrayList<ItemComponent>();
11457      this.item.add(t);
11458      return t;
11459    }
11460
11461    public ExplanationOfBenefit addItem(ItemComponent t) { //3
11462      if (t == null)
11463        return this;
11464      if (this.item == null)
11465        this.item = new ArrayList<ItemComponent>();
11466      this.item.add(t);
11467      return this;
11468    }
11469
11470    /**
11471     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
11472     */
11473    public ItemComponent getItemFirstRep() { 
11474      if (getItem().isEmpty()) {
11475        addItem();
11476      }
11477      return getItem().get(0);
11478    }
11479
11480    /**
11481     * @return {@link #addItem} (The first tier service adjudications for payor added services.)
11482     */
11483    public List<AddedItemComponent> getAddItem() { 
11484      if (this.addItem == null)
11485        this.addItem = new ArrayList<AddedItemComponent>();
11486      return this.addItem;
11487    }
11488
11489    /**
11490     * @return Returns a reference to <code>this</code> for easy method chaining
11491     */
11492    public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) { 
11493      this.addItem = theAddItem;
11494      return this;
11495    }
11496
11497    public boolean hasAddItem() { 
11498      if (this.addItem == null)
11499        return false;
11500      for (AddedItemComponent item : this.addItem)
11501        if (!item.isEmpty())
11502          return true;
11503      return false;
11504    }
11505
11506    public AddedItemComponent addAddItem() { //3
11507      AddedItemComponent t = new AddedItemComponent();
11508      if (this.addItem == null)
11509        this.addItem = new ArrayList<AddedItemComponent>();
11510      this.addItem.add(t);
11511      return t;
11512    }
11513
11514    public ExplanationOfBenefit addAddItem(AddedItemComponent t) { //3
11515      if (t == null)
11516        return this;
11517      if (this.addItem == null)
11518        this.addItem = new ArrayList<AddedItemComponent>();
11519      this.addItem.add(t);
11520      return this;
11521    }
11522
11523    /**
11524     * @return The first repetition of repeating field {@link #addItem}, creating it if it does not already exist
11525     */
11526    public AddedItemComponent getAddItemFirstRep() { 
11527      if (getAddItem().isEmpty()) {
11528        addAddItem();
11529      }
11530      return getAddItem().get(0);
11531    }
11532
11533    /**
11534     * @return {@link #totalCost} (The total cost of the services reported.)
11535     */
11536    public Money getTotalCost() { 
11537      if (this.totalCost == null)
11538        if (Configuration.errorOnAutoCreate())
11539          throw new Error("Attempt to auto-create ExplanationOfBenefit.totalCost");
11540        else if (Configuration.doAutoCreate())
11541          this.totalCost = new Money(); // cc
11542      return this.totalCost;
11543    }
11544
11545    public boolean hasTotalCost() { 
11546      return this.totalCost != null && !this.totalCost.isEmpty();
11547    }
11548
11549    /**
11550     * @param value {@link #totalCost} (The total cost of the services reported.)
11551     */
11552    public ExplanationOfBenefit setTotalCost(Money value) { 
11553      this.totalCost = value;
11554      return this;
11555    }
11556
11557    /**
11558     * @return {@link #unallocDeductable} (The amount of deductable applied which was not allocated to any particular service line.)
11559     */
11560    public Money getUnallocDeductable() { 
11561      if (this.unallocDeductable == null)
11562        if (Configuration.errorOnAutoCreate())
11563          throw new Error("Attempt to auto-create ExplanationOfBenefit.unallocDeductable");
11564        else if (Configuration.doAutoCreate())
11565          this.unallocDeductable = new Money(); // cc
11566      return this.unallocDeductable;
11567    }
11568
11569    public boolean hasUnallocDeductable() { 
11570      return this.unallocDeductable != null && !this.unallocDeductable.isEmpty();
11571    }
11572
11573    /**
11574     * @param value {@link #unallocDeductable} (The amount of deductable applied which was not allocated to any particular service line.)
11575     */
11576    public ExplanationOfBenefit setUnallocDeductable(Money value) { 
11577      this.unallocDeductable = value;
11578      return this;
11579    }
11580
11581    /**
11582     * @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).)
11583     */
11584    public Money getTotalBenefit() { 
11585      if (this.totalBenefit == null)
11586        if (Configuration.errorOnAutoCreate())
11587          throw new Error("Attempt to auto-create ExplanationOfBenefit.totalBenefit");
11588        else if (Configuration.doAutoCreate())
11589          this.totalBenefit = new Money(); // cc
11590      return this.totalBenefit;
11591    }
11592
11593    public boolean hasTotalBenefit() { 
11594      return this.totalBenefit != null && !this.totalBenefit.isEmpty();
11595    }
11596
11597    /**
11598     * @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).)
11599     */
11600    public ExplanationOfBenefit setTotalBenefit(Money value) { 
11601      this.totalBenefit = value;
11602      return this;
11603    }
11604
11605    /**
11606     * @return {@link #payment} (Payment details for the claim if the claim has been paid.)
11607     */
11608    public PaymentComponent getPayment() { 
11609      if (this.payment == null)
11610        if (Configuration.errorOnAutoCreate())
11611          throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
11612        else if (Configuration.doAutoCreate())
11613          this.payment = new PaymentComponent(); // cc
11614      return this.payment;
11615    }
11616
11617    public boolean hasPayment() { 
11618      return this.payment != null && !this.payment.isEmpty();
11619    }
11620
11621    /**
11622     * @param value {@link #payment} (Payment details for the claim if the claim has been paid.)
11623     */
11624    public ExplanationOfBenefit setPayment(PaymentComponent value) { 
11625      this.payment = value;
11626      return this;
11627    }
11628
11629    /**
11630     * @return {@link #form} (The form to be used for printing the content.)
11631     */
11632    public CodeableConcept getForm() { 
11633      if (this.form == null)
11634        if (Configuration.errorOnAutoCreate())
11635          throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
11636        else if (Configuration.doAutoCreate())
11637          this.form = new CodeableConcept(); // cc
11638      return this.form;
11639    }
11640
11641    public boolean hasForm() { 
11642      return this.form != null && !this.form.isEmpty();
11643    }
11644
11645    /**
11646     * @param value {@link #form} (The form to be used for printing the content.)
11647     */
11648    public ExplanationOfBenefit setForm(CodeableConcept value) { 
11649      this.form = value;
11650      return this;
11651    }
11652
11653    /**
11654     * @return {@link #processNote} (Note text.)
11655     */
11656    public List<NoteComponent> getProcessNote() { 
11657      if (this.processNote == null)
11658        this.processNote = new ArrayList<NoteComponent>();
11659      return this.processNote;
11660    }
11661
11662    /**
11663     * @return Returns a reference to <code>this</code> for easy method chaining
11664     */
11665    public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) { 
11666      this.processNote = theProcessNote;
11667      return this;
11668    }
11669
11670    public boolean hasProcessNote() { 
11671      if (this.processNote == null)
11672        return false;
11673      for (NoteComponent item : this.processNote)
11674        if (!item.isEmpty())
11675          return true;
11676      return false;
11677    }
11678
11679    public NoteComponent addProcessNote() { //3
11680      NoteComponent t = new NoteComponent();
11681      if (this.processNote == null)
11682        this.processNote = new ArrayList<NoteComponent>();
11683      this.processNote.add(t);
11684      return t;
11685    }
11686
11687    public ExplanationOfBenefit addProcessNote(NoteComponent t) { //3
11688      if (t == null)
11689        return this;
11690      if (this.processNote == null)
11691        this.processNote = new ArrayList<NoteComponent>();
11692      this.processNote.add(t);
11693      return this;
11694    }
11695
11696    /**
11697     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist
11698     */
11699    public NoteComponent getProcessNoteFirstRep() { 
11700      if (getProcessNote().isEmpty()) {
11701        addProcessNote();
11702      }
11703      return getProcessNote().get(0);
11704    }
11705
11706    /**
11707     * @return {@link #benefitBalance} (Balance by Benefit Category.)
11708     */
11709    public List<BenefitBalanceComponent> getBenefitBalance() { 
11710      if (this.benefitBalance == null)
11711        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
11712      return this.benefitBalance;
11713    }
11714
11715    /**
11716     * @return Returns a reference to <code>this</code> for easy method chaining
11717     */
11718    public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) { 
11719      this.benefitBalance = theBenefitBalance;
11720      return this;
11721    }
11722
11723    public boolean hasBenefitBalance() { 
11724      if (this.benefitBalance == null)
11725        return false;
11726      for (BenefitBalanceComponent item : this.benefitBalance)
11727        if (!item.isEmpty())
11728          return true;
11729      return false;
11730    }
11731
11732    public BenefitBalanceComponent addBenefitBalance() { //3
11733      BenefitBalanceComponent t = new BenefitBalanceComponent();
11734      if (this.benefitBalance == null)
11735        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
11736      this.benefitBalance.add(t);
11737      return t;
11738    }
11739
11740    public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { //3
11741      if (t == null)
11742        return this;
11743      if (this.benefitBalance == null)
11744        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
11745      this.benefitBalance.add(t);
11746      return this;
11747    }
11748
11749    /**
11750     * @return The first repetition of repeating field {@link #benefitBalance}, creating it if it does not already exist
11751     */
11752    public BenefitBalanceComponent getBenefitBalanceFirstRep() { 
11753      if (getBenefitBalance().isEmpty()) {
11754        addBenefitBalance();
11755      }
11756      return getBenefitBalance().get(0);
11757    }
11758
11759      protected void listChildren(List<Property> childrenList) {
11760        super.listChildren(childrenList);
11761        childrenList.add(new Property("identifier", "Identifier", "The EOB Business Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
11762        childrenList.add(new Property("status", "code", "The status of the resource instance.", 0, java.lang.Integer.MAX_VALUE, status));
11763        childrenList.add(new Property("type", "CodeableConcept", "The category of claim, eg, oral, pharmacy, vision, insitutional, professional.", 0, java.lang.Integer.MAX_VALUE, type));
11764        childrenList.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));
11765        childrenList.add(new Property("patient", "Reference(Patient)", "Patient Resource.", 0, java.lang.Integer.MAX_VALUE, patient));
11766        childrenList.add(new Property("billablePeriod", "Period", "The billable period for which charges are being submitted.", 0, java.lang.Integer.MAX_VALUE, billablePeriod));
11767        childrenList.add(new Property("created", "dateTime", "The date when the EOB was created.", 0, java.lang.Integer.MAX_VALUE, created));
11768        childrenList.add(new Property("enterer", "Reference(Practitioner)", "The person who created the explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, enterer));
11769        childrenList.add(new Property("insurer", "Reference(Organization)", "The insurer which is responsible for the explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, insurer));
11770        childrenList.add(new Property("provider", "Reference(Practitioner)", "The provider which is responsible for the claim.", 0, java.lang.Integer.MAX_VALUE, provider));
11771        childrenList.add(new Property("organization", "Reference(Organization)", "The provider which is responsible for the claim.", 0, java.lang.Integer.MAX_VALUE, organization));
11772        childrenList.add(new Property("referral", "Reference(ReferralRequest)", "The referral resource which lists the date, practitioner, reason and other supporting information.", 0, java.lang.Integer.MAX_VALUE, referral));
11773        childrenList.add(new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, java.lang.Integer.MAX_VALUE, facility));
11774        childrenList.add(new Property("claim", "Reference(Claim)", "The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.", 0, java.lang.Integer.MAX_VALUE, claim));
11775        childrenList.add(new Property("claimResponse", "Reference(ClaimResponse)", "The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.", 0, java.lang.Integer.MAX_VALUE, claimResponse));
11776        childrenList.add(new Property("outcome", "CodeableConcept", "Processing outcome errror, partial or complete processing.", 0, java.lang.Integer.MAX_VALUE, outcome));
11777        childrenList.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, java.lang.Integer.MAX_VALUE, disposition));
11778        childrenList.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));
11779        childrenList.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of Pharmacy or Vision products.", 0, java.lang.Integer.MAX_VALUE, prescription));
11780        childrenList.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, java.lang.Integer.MAX_VALUE, originalPrescription));
11781        childrenList.add(new Property("payee", "", "The party to be reimbursed for the services.", 0, java.lang.Integer.MAX_VALUE, payee));
11782        childrenList.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));
11783        childrenList.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));
11784        childrenList.add(new Property("diagnosis", "", "Ordered list of patient diagnosis for which care is sought.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
11785        childrenList.add(new Property("procedure", "", "Ordered list of patient procedures performed to support the adjudication.", 0, java.lang.Integer.MAX_VALUE, procedure));
11786        childrenList.add(new Property("precedence", "positiveInt", "Precedence (primary, secondary, etc.).", 0, java.lang.Integer.MAX_VALUE, precedence));
11787        childrenList.add(new Property("insurance", "", "Financial instrument by which payment information for health care.", 0, java.lang.Integer.MAX_VALUE, insurance));
11788        childrenList.add(new Property("accident", "", "An accident which resulted in the need for healthcare services.", 0, java.lang.Integer.MAX_VALUE, accident));
11789        childrenList.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, java.lang.Integer.MAX_VALUE, employmentImpacted));
11790        childrenList.add(new Property("hospitalization", "Period", "The start and optional end dates of when the patient was confined to a treatment center.", 0, java.lang.Integer.MAX_VALUE, hospitalization));
11791        childrenList.add(new Property("item", "", "First tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, item));
11792        childrenList.add(new Property("addItem", "", "The first tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, addItem));
11793        childrenList.add(new Property("totalCost", "Money", "The total cost of the services reported.", 0, java.lang.Integer.MAX_VALUE, totalCost));
11794        childrenList.add(new Property("unallocDeductable", "Money", "The amount of deductable applied which was not allocated to any particular service line.", 0, java.lang.Integer.MAX_VALUE, unallocDeductable));
11795        childrenList.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, java.lang.Integer.MAX_VALUE, totalBenefit));
11796        childrenList.add(new Property("payment", "", "Payment details for the claim if the claim has been paid.", 0, java.lang.Integer.MAX_VALUE, payment));
11797        childrenList.add(new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, java.lang.Integer.MAX_VALUE, form));
11798        childrenList.add(new Property("processNote", "", "Note text.", 0, java.lang.Integer.MAX_VALUE, processNote));
11799        childrenList.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
11800      }
11801
11802      @Override
11803      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11804        switch (hash) {
11805        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
11806        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ExplanationOfBenefitStatus>
11807        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
11808        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : this.subType.toArray(new Base[this.subType.size()]); // CodeableConcept
11809        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
11810        case -332066046: /*billablePeriod*/ return this.billablePeriod == null ? new Base[0] : new Base[] {this.billablePeriod}; // Period
11811        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
11812        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
11813        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
11814        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
11815        case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : new Base[] {this.organization}; // Reference
11816        case -722568291: /*referral*/ return this.referral == null ? new Base[0] : new Base[] {this.referral}; // Reference
11817        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
11818        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
11819        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Reference
11820        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // CodeableConcept
11821        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
11822        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
11823        case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Reference
11824        case -1814015861: /*originalPrescription*/ return this.originalPrescription == null ? new Base[0] : new Base[] {this.originalPrescription}; // Reference
11825        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // PayeeComponent
11826        case 1968600364: /*information*/ return this.information == null ? new Base[0] : this.information.toArray(new Base[this.information.size()]); // SupportingInformationComponent
11827        case -7323378: /*careTeam*/ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
11828        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
11829        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
11830        case 159695370: /*precedence*/ return this.precedence == null ? new Base[0] : new Base[] {this.precedence}; // PositiveIntType
11831        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : new Base[] {this.insurance}; // InsuranceComponent
11832        case -2143202801: /*accident*/ return this.accident == null ? new Base[0] : new Base[] {this.accident}; // AccidentComponent
11833        case 1051487345: /*employmentImpacted*/ return this.employmentImpacted == null ? new Base[0] : new Base[] {this.employmentImpacted}; // Period
11834        case 1057894634: /*hospitalization*/ return this.hospitalization == null ? new Base[0] : new Base[] {this.hospitalization}; // Period
11835        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
11836        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
11837        case -577782479: /*totalCost*/ return this.totalCost == null ? new Base[0] : new Base[] {this.totalCost}; // Money
11838        case 2096309753: /*unallocDeductable*/ return this.unallocDeductable == null ? new Base[0] : new Base[] {this.unallocDeductable}; // Money
11839        case 332332211: /*totalBenefit*/ return this.totalBenefit == null ? new Base[0] : new Base[] {this.totalBenefit}; // Money
11840        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // PaymentComponent
11841        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // CodeableConcept
11842        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
11843        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
11844        default: return super.getProperty(hash, name, checkValid);
11845        }
11846
11847      }
11848
11849      @Override
11850      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11851        switch (hash) {
11852        case -1618432855: // identifier
11853          this.getIdentifier().add(castToIdentifier(value)); // Identifier
11854          return value;
11855        case -892481550: // status
11856          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
11857          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
11858          return value;
11859        case 3575610: // type
11860          this.type = castToCodeableConcept(value); // CodeableConcept
11861          return value;
11862        case -1868521062: // subType
11863          this.getSubType().add(castToCodeableConcept(value)); // CodeableConcept
11864          return value;
11865        case -791418107: // patient
11866          this.patient = castToReference(value); // Reference
11867          return value;
11868        case -332066046: // billablePeriod
11869          this.billablePeriod = castToPeriod(value); // Period
11870          return value;
11871        case 1028554472: // created
11872          this.created = castToDateTime(value); // DateTimeType
11873          return value;
11874        case -1591951995: // enterer
11875          this.enterer = castToReference(value); // Reference
11876          return value;
11877        case 1957615864: // insurer
11878          this.insurer = castToReference(value); // Reference
11879          return value;
11880        case -987494927: // provider
11881          this.provider = castToReference(value); // Reference
11882          return value;
11883        case 1178922291: // organization
11884          this.organization = castToReference(value); // Reference
11885          return value;
11886        case -722568291: // referral
11887          this.referral = castToReference(value); // Reference
11888          return value;
11889        case 501116579: // facility
11890          this.facility = castToReference(value); // Reference
11891          return value;
11892        case 94742588: // claim
11893          this.claim = castToReference(value); // Reference
11894          return value;
11895        case 689513629: // claimResponse
11896          this.claimResponse = castToReference(value); // Reference
11897          return value;
11898        case -1106507950: // outcome
11899          this.outcome = castToCodeableConcept(value); // CodeableConcept
11900          return value;
11901        case 583380919: // disposition
11902          this.disposition = castToString(value); // StringType
11903          return value;
11904        case 1090493483: // related
11905          this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
11906          return value;
11907        case 460301338: // prescription
11908          this.prescription = castToReference(value); // Reference
11909          return value;
11910        case -1814015861: // originalPrescription
11911          this.originalPrescription = castToReference(value); // Reference
11912          return value;
11913        case 106443592: // payee
11914          this.payee = (PayeeComponent) value; // PayeeComponent
11915          return value;
11916        case 1968600364: // information
11917          this.getInformation().add((SupportingInformationComponent) value); // SupportingInformationComponent
11918          return value;
11919        case -7323378: // careTeam
11920          this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
11921          return value;
11922        case 1196993265: // diagnosis
11923          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
11924          return value;
11925        case -1095204141: // procedure
11926          this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
11927          return value;
11928        case 159695370: // precedence
11929          this.precedence = castToPositiveInt(value); // PositiveIntType
11930          return value;
11931        case 73049818: // insurance
11932          this.insurance = (InsuranceComponent) value; // InsuranceComponent
11933          return value;
11934        case -2143202801: // accident
11935          this.accident = (AccidentComponent) value; // AccidentComponent
11936          return value;
11937        case 1051487345: // employmentImpacted
11938          this.employmentImpacted = castToPeriod(value); // Period
11939          return value;
11940        case 1057894634: // hospitalization
11941          this.hospitalization = castToPeriod(value); // Period
11942          return value;
11943        case 3242771: // item
11944          this.getItem().add((ItemComponent) value); // ItemComponent
11945          return value;
11946        case -1148899500: // addItem
11947          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
11948          return value;
11949        case -577782479: // totalCost
11950          this.totalCost = castToMoney(value); // Money
11951          return value;
11952        case 2096309753: // unallocDeductable
11953          this.unallocDeductable = castToMoney(value); // Money
11954          return value;
11955        case 332332211: // totalBenefit
11956          this.totalBenefit = castToMoney(value); // Money
11957          return value;
11958        case -786681338: // payment
11959          this.payment = (PaymentComponent) value; // PaymentComponent
11960          return value;
11961        case 3148996: // form
11962          this.form = castToCodeableConcept(value); // CodeableConcept
11963          return value;
11964        case 202339073: // processNote
11965          this.getProcessNote().add((NoteComponent) value); // NoteComponent
11966          return value;
11967        case 596003397: // benefitBalance
11968          this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
11969          return value;
11970        default: return super.setProperty(hash, name, value);
11971        }
11972
11973      }
11974
11975      @Override
11976      public Base setProperty(String name, Base value) throws FHIRException {
11977        if (name.equals("identifier")) {
11978          this.getIdentifier().add(castToIdentifier(value));
11979        } else if (name.equals("status")) {
11980          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
11981          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
11982        } else if (name.equals("type")) {
11983          this.type = castToCodeableConcept(value); // CodeableConcept
11984        } else if (name.equals("subType")) {
11985          this.getSubType().add(castToCodeableConcept(value));
11986        } else if (name.equals("patient")) {
11987          this.patient = castToReference(value); // Reference
11988        } else if (name.equals("billablePeriod")) {
11989          this.billablePeriod = castToPeriod(value); // Period
11990        } else if (name.equals("created")) {
11991          this.created = castToDateTime(value); // DateTimeType
11992        } else if (name.equals("enterer")) {
11993          this.enterer = castToReference(value); // Reference
11994        } else if (name.equals("insurer")) {
11995          this.insurer = castToReference(value); // Reference
11996        } else if (name.equals("provider")) {
11997          this.provider = castToReference(value); // Reference
11998        } else if (name.equals("organization")) {
11999          this.organization = castToReference(value); // Reference
12000        } else if (name.equals("referral")) {
12001          this.referral = castToReference(value); // Reference
12002        } else if (name.equals("facility")) {
12003          this.facility = castToReference(value); // Reference
12004        } else if (name.equals("claim")) {
12005          this.claim = castToReference(value); // Reference
12006        } else if (name.equals("claimResponse")) {
12007          this.claimResponse = castToReference(value); // Reference
12008        } else if (name.equals("outcome")) {
12009          this.outcome = castToCodeableConcept(value); // CodeableConcept
12010        } else if (name.equals("disposition")) {
12011          this.disposition = castToString(value); // StringType
12012        } else if (name.equals("related")) {
12013          this.getRelated().add((RelatedClaimComponent) value);
12014        } else if (name.equals("prescription")) {
12015          this.prescription = castToReference(value); // Reference
12016        } else if (name.equals("originalPrescription")) {
12017          this.originalPrescription = castToReference(value); // Reference
12018        } else if (name.equals("payee")) {
12019          this.payee = (PayeeComponent) value; // PayeeComponent
12020        } else if (name.equals("information")) {
12021          this.getInformation().add((SupportingInformationComponent) value);
12022        } else if (name.equals("careTeam")) {
12023          this.getCareTeam().add((CareTeamComponent) value);
12024        } else if (name.equals("diagnosis")) {
12025          this.getDiagnosis().add((DiagnosisComponent) value);
12026        } else if (name.equals("procedure")) {
12027          this.getProcedure().add((ProcedureComponent) value);
12028        } else if (name.equals("precedence")) {
12029          this.precedence = castToPositiveInt(value); // PositiveIntType
12030        } else if (name.equals("insurance")) {
12031          this.insurance = (InsuranceComponent) value; // InsuranceComponent
12032        } else if (name.equals("accident")) {
12033          this.accident = (AccidentComponent) value; // AccidentComponent
12034        } else if (name.equals("employmentImpacted")) {
12035          this.employmentImpacted = castToPeriod(value); // Period
12036        } else if (name.equals("hospitalization")) {
12037          this.hospitalization = castToPeriod(value); // Period
12038        } else if (name.equals("item")) {
12039          this.getItem().add((ItemComponent) value);
12040        } else if (name.equals("addItem")) {
12041          this.getAddItem().add((AddedItemComponent) value);
12042        } else if (name.equals("totalCost")) {
12043          this.totalCost = castToMoney(value); // Money
12044        } else if (name.equals("unallocDeductable")) {
12045          this.unallocDeductable = castToMoney(value); // Money
12046        } else if (name.equals("totalBenefit")) {
12047          this.totalBenefit = castToMoney(value); // Money
12048        } else if (name.equals("payment")) {
12049          this.payment = (PaymentComponent) value; // PaymentComponent
12050        } else if (name.equals("form")) {
12051          this.form = castToCodeableConcept(value); // CodeableConcept
12052        } else if (name.equals("processNote")) {
12053          this.getProcessNote().add((NoteComponent) value);
12054        } else if (name.equals("benefitBalance")) {
12055          this.getBenefitBalance().add((BenefitBalanceComponent) value);
12056        } else
12057          return super.setProperty(name, value);
12058        return value;
12059      }
12060
12061      @Override
12062      public Base makeProperty(int hash, String name) throws FHIRException {
12063        switch (hash) {
12064        case -1618432855:  return addIdentifier(); 
12065        case -892481550:  return getStatusElement();
12066        case 3575610:  return getType(); 
12067        case -1868521062:  return addSubType(); 
12068        case -791418107:  return getPatient(); 
12069        case -332066046:  return getBillablePeriod(); 
12070        case 1028554472:  return getCreatedElement();
12071        case -1591951995:  return getEnterer(); 
12072        case 1957615864:  return getInsurer(); 
12073        case -987494927:  return getProvider(); 
12074        case 1178922291:  return getOrganization(); 
12075        case -722568291:  return getReferral(); 
12076        case 501116579:  return getFacility(); 
12077        case 94742588:  return getClaim(); 
12078        case 689513629:  return getClaimResponse(); 
12079        case -1106507950:  return getOutcome(); 
12080        case 583380919:  return getDispositionElement();
12081        case 1090493483:  return addRelated(); 
12082        case 460301338:  return getPrescription(); 
12083        case -1814015861:  return getOriginalPrescription(); 
12084        case 106443592:  return getPayee(); 
12085        case 1968600364:  return addInformation(); 
12086        case -7323378:  return addCareTeam(); 
12087        case 1196993265:  return addDiagnosis(); 
12088        case -1095204141:  return addProcedure(); 
12089        case 159695370:  return getPrecedenceElement();
12090        case 73049818:  return getInsurance(); 
12091        case -2143202801:  return getAccident(); 
12092        case 1051487345:  return getEmploymentImpacted(); 
12093        case 1057894634:  return getHospitalization(); 
12094        case 3242771:  return addItem(); 
12095        case -1148899500:  return addAddItem(); 
12096        case -577782479:  return getTotalCost(); 
12097        case 2096309753:  return getUnallocDeductable(); 
12098        case 332332211:  return getTotalBenefit(); 
12099        case -786681338:  return getPayment(); 
12100        case 3148996:  return getForm(); 
12101        case 202339073:  return addProcessNote(); 
12102        case 596003397:  return addBenefitBalance(); 
12103        default: return super.makeProperty(hash, name);
12104        }
12105
12106      }
12107
12108      @Override
12109      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12110        switch (hash) {
12111        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
12112        case -892481550: /*status*/ return new String[] {"code"};
12113        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
12114        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
12115        case -791418107: /*patient*/ return new String[] {"Reference"};
12116        case -332066046: /*billablePeriod*/ return new String[] {"Period"};
12117        case 1028554472: /*created*/ return new String[] {"dateTime"};
12118        case -1591951995: /*enterer*/ return new String[] {"Reference"};
12119        case 1957615864: /*insurer*/ return new String[] {"Reference"};
12120        case -987494927: /*provider*/ return new String[] {"Reference"};
12121        case 1178922291: /*organization*/ return new String[] {"Reference"};
12122        case -722568291: /*referral*/ return new String[] {"Reference"};
12123        case 501116579: /*facility*/ return new String[] {"Reference"};
12124        case 94742588: /*claim*/ return new String[] {"Reference"};
12125        case 689513629: /*claimResponse*/ return new String[] {"Reference"};
12126        case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
12127        case 583380919: /*disposition*/ return new String[] {"string"};
12128        case 1090493483: /*related*/ return new String[] {};
12129        case 460301338: /*prescription*/ return new String[] {"Reference"};
12130        case -1814015861: /*originalPrescription*/ return new String[] {"Reference"};
12131        case 106443592: /*payee*/ return new String[] {};
12132        case 1968600364: /*information*/ return new String[] {};
12133        case -7323378: /*careTeam*/ return new String[] {};
12134        case 1196993265: /*diagnosis*/ return new String[] {};
12135        case -1095204141: /*procedure*/ return new String[] {};
12136        case 159695370: /*precedence*/ return new String[] {"positiveInt"};
12137        case 73049818: /*insurance*/ return new String[] {};
12138        case -2143202801: /*accident*/ return new String[] {};
12139        case 1051487345: /*employmentImpacted*/ return new String[] {"Period"};
12140        case 1057894634: /*hospitalization*/ return new String[] {"Period"};
12141        case 3242771: /*item*/ return new String[] {};
12142        case -1148899500: /*addItem*/ return new String[] {};
12143        case -577782479: /*totalCost*/ return new String[] {"Money"};
12144        case 2096309753: /*unallocDeductable*/ return new String[] {"Money"};
12145        case 332332211: /*totalBenefit*/ return new String[] {"Money"};
12146        case -786681338: /*payment*/ return new String[] {};
12147        case 3148996: /*form*/ return new String[] {"CodeableConcept"};
12148        case 202339073: /*processNote*/ return new String[] {};
12149        case 596003397: /*benefitBalance*/ return new String[] {};
12150        default: return super.getTypesForProperty(hash, name);
12151        }
12152
12153      }
12154
12155      @Override
12156      public Base addChild(String name) throws FHIRException {
12157        if (name.equals("identifier")) {
12158          return addIdentifier();
12159        }
12160        else if (name.equals("status")) {
12161          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.status");
12162        }
12163        else if (name.equals("type")) {
12164          this.type = new CodeableConcept();
12165          return this.type;
12166        }
12167        else if (name.equals("subType")) {
12168          return addSubType();
12169        }
12170        else if (name.equals("patient")) {
12171          this.patient = new Reference();
12172          return this.patient;
12173        }
12174        else if (name.equals("billablePeriod")) {
12175          this.billablePeriod = new Period();
12176          return this.billablePeriod;
12177        }
12178        else if (name.equals("created")) {
12179          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.created");
12180        }
12181        else if (name.equals("enterer")) {
12182          this.enterer = new Reference();
12183          return this.enterer;
12184        }
12185        else if (name.equals("insurer")) {
12186          this.insurer = new Reference();
12187          return this.insurer;
12188        }
12189        else if (name.equals("provider")) {
12190          this.provider = new Reference();
12191          return this.provider;
12192        }
12193        else if (name.equals("organization")) {
12194          this.organization = new Reference();
12195          return this.organization;
12196        }
12197        else if (name.equals("referral")) {
12198          this.referral = new Reference();
12199          return this.referral;
12200        }
12201        else if (name.equals("facility")) {
12202          this.facility = new Reference();
12203          return this.facility;
12204        }
12205        else if (name.equals("claim")) {
12206          this.claim = new Reference();
12207          return this.claim;
12208        }
12209        else if (name.equals("claimResponse")) {
12210          this.claimResponse = new Reference();
12211          return this.claimResponse;
12212        }
12213        else if (name.equals("outcome")) {
12214          this.outcome = new CodeableConcept();
12215          return this.outcome;
12216        }
12217        else if (name.equals("disposition")) {
12218          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.disposition");
12219        }
12220        else if (name.equals("related")) {
12221          return addRelated();
12222        }
12223        else if (name.equals("prescription")) {
12224          this.prescription = new Reference();
12225          return this.prescription;
12226        }
12227        else if (name.equals("originalPrescription")) {
12228          this.originalPrescription = new Reference();
12229          return this.originalPrescription;
12230        }
12231        else if (name.equals("payee")) {
12232          this.payee = new PayeeComponent();
12233          return this.payee;
12234        }
12235        else if (name.equals("information")) {
12236          return addInformation();
12237        }
12238        else if (name.equals("careTeam")) {
12239          return addCareTeam();
12240        }
12241        else if (name.equals("diagnosis")) {
12242          return addDiagnosis();
12243        }
12244        else if (name.equals("procedure")) {
12245          return addProcedure();
12246        }
12247        else if (name.equals("precedence")) {
12248          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.precedence");
12249        }
12250        else if (name.equals("insurance")) {
12251          this.insurance = new InsuranceComponent();
12252          return this.insurance;
12253        }
12254        else if (name.equals("accident")) {
12255          this.accident = new AccidentComponent();
12256          return this.accident;
12257        }
12258        else if (name.equals("employmentImpacted")) {
12259          this.employmentImpacted = new Period();
12260          return this.employmentImpacted;
12261        }
12262        else if (name.equals("hospitalization")) {
12263          this.hospitalization = new Period();
12264          return this.hospitalization;
12265        }
12266        else if (name.equals("item")) {
12267          return addItem();
12268        }
12269        else if (name.equals("addItem")) {
12270          return addAddItem();
12271        }
12272        else if (name.equals("totalCost")) {
12273          this.totalCost = new Money();
12274          return this.totalCost;
12275        }
12276        else if (name.equals("unallocDeductable")) {
12277          this.unallocDeductable = new Money();
12278          return this.unallocDeductable;
12279        }
12280        else if (name.equals("totalBenefit")) {
12281          this.totalBenefit = new Money();
12282          return this.totalBenefit;
12283        }
12284        else if (name.equals("payment")) {
12285          this.payment = new PaymentComponent();
12286          return this.payment;
12287        }
12288        else if (name.equals("form")) {
12289          this.form = new CodeableConcept();
12290          return this.form;
12291        }
12292        else if (name.equals("processNote")) {
12293          return addProcessNote();
12294        }
12295        else if (name.equals("benefitBalance")) {
12296          return addBenefitBalance();
12297        }
12298        else
12299          return super.addChild(name);
12300      }
12301
12302  public String fhirType() {
12303    return "ExplanationOfBenefit";
12304
12305  }
12306
12307      public ExplanationOfBenefit copy() {
12308        ExplanationOfBenefit dst = new ExplanationOfBenefit();
12309        copyValues(dst);
12310        if (identifier != null) {
12311          dst.identifier = new ArrayList<Identifier>();
12312          for (Identifier i : identifier)
12313            dst.identifier.add(i.copy());
12314        };
12315        dst.status = status == null ? null : status.copy();
12316        dst.type = type == null ? null : type.copy();
12317        if (subType != null) {
12318          dst.subType = new ArrayList<CodeableConcept>();
12319          for (CodeableConcept i : subType)
12320            dst.subType.add(i.copy());
12321        };
12322        dst.patient = patient == null ? null : patient.copy();
12323        dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
12324        dst.created = created == null ? null : created.copy();
12325        dst.enterer = enterer == null ? null : enterer.copy();
12326        dst.insurer = insurer == null ? null : insurer.copy();
12327        dst.provider = provider == null ? null : provider.copy();
12328        dst.organization = organization == null ? null : organization.copy();
12329        dst.referral = referral == null ? null : referral.copy();
12330        dst.facility = facility == null ? null : facility.copy();
12331        dst.claim = claim == null ? null : claim.copy();
12332        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
12333        dst.outcome = outcome == null ? null : outcome.copy();
12334        dst.disposition = disposition == null ? null : disposition.copy();
12335        if (related != null) {
12336          dst.related = new ArrayList<RelatedClaimComponent>();
12337          for (RelatedClaimComponent i : related)
12338            dst.related.add(i.copy());
12339        };
12340        dst.prescription = prescription == null ? null : prescription.copy();
12341        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
12342        dst.payee = payee == null ? null : payee.copy();
12343        if (information != null) {
12344          dst.information = new ArrayList<SupportingInformationComponent>();
12345          for (SupportingInformationComponent i : information)
12346            dst.information.add(i.copy());
12347        };
12348        if (careTeam != null) {
12349          dst.careTeam = new ArrayList<CareTeamComponent>();
12350          for (CareTeamComponent i : careTeam)
12351            dst.careTeam.add(i.copy());
12352        };
12353        if (diagnosis != null) {
12354          dst.diagnosis = new ArrayList<DiagnosisComponent>();
12355          for (DiagnosisComponent i : diagnosis)
12356            dst.diagnosis.add(i.copy());
12357        };
12358        if (procedure != null) {
12359          dst.procedure = new ArrayList<ProcedureComponent>();
12360          for (ProcedureComponent i : procedure)
12361            dst.procedure.add(i.copy());
12362        };
12363        dst.precedence = precedence == null ? null : precedence.copy();
12364        dst.insurance = insurance == null ? null : insurance.copy();
12365        dst.accident = accident == null ? null : accident.copy();
12366        dst.employmentImpacted = employmentImpacted == null ? null : employmentImpacted.copy();
12367        dst.hospitalization = hospitalization == null ? null : hospitalization.copy();
12368        if (item != null) {
12369          dst.item = new ArrayList<ItemComponent>();
12370          for (ItemComponent i : item)
12371            dst.item.add(i.copy());
12372        };
12373        if (addItem != null) {
12374          dst.addItem = new ArrayList<AddedItemComponent>();
12375          for (AddedItemComponent i : addItem)
12376            dst.addItem.add(i.copy());
12377        };
12378        dst.totalCost = totalCost == null ? null : totalCost.copy();
12379        dst.unallocDeductable = unallocDeductable == null ? null : unallocDeductable.copy();
12380        dst.totalBenefit = totalBenefit == null ? null : totalBenefit.copy();
12381        dst.payment = payment == null ? null : payment.copy();
12382        dst.form = form == null ? null : form.copy();
12383        if (processNote != null) {
12384          dst.processNote = new ArrayList<NoteComponent>();
12385          for (NoteComponent i : processNote)
12386            dst.processNote.add(i.copy());
12387        };
12388        if (benefitBalance != null) {
12389          dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
12390          for (BenefitBalanceComponent i : benefitBalance)
12391            dst.benefitBalance.add(i.copy());
12392        };
12393        return dst;
12394      }
12395
12396      protected ExplanationOfBenefit typedCopy() {
12397        return copy();
12398      }
12399
12400      @Override
12401      public boolean equalsDeep(Base other) {
12402        if (!super.equalsDeep(other))
12403          return false;
12404        if (!(other instanceof ExplanationOfBenefit))
12405          return false;
12406        ExplanationOfBenefit o = (ExplanationOfBenefit) other;
12407        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
12408           && compareDeep(subType, o.subType, true) && compareDeep(patient, o.patient, true) && compareDeep(billablePeriod, o.billablePeriod, true)
12409           && compareDeep(created, o.created, true) && compareDeep(enterer, o.enterer, true) && compareDeep(insurer, o.insurer, true)
12410           && compareDeep(provider, o.provider, true) && compareDeep(organization, o.organization, true) && compareDeep(referral, o.referral, true)
12411           && compareDeep(facility, o.facility, true) && compareDeep(claim, o.claim, true) && compareDeep(claimResponse, o.claimResponse, true)
12412           && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true) && compareDeep(related, o.related, true)
12413           && compareDeep(prescription, o.prescription, true) && compareDeep(originalPrescription, o.originalPrescription, true)
12414           && compareDeep(payee, o.payee, true) && compareDeep(information, o.information, true) && compareDeep(careTeam, o.careTeam, true)
12415           && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true) && compareDeep(precedence, o.precedence, true)
12416           && compareDeep(insurance, o.insurance, true) && compareDeep(accident, o.accident, true) && compareDeep(employmentImpacted, o.employmentImpacted, true)
12417           && compareDeep(hospitalization, o.hospitalization, true) && compareDeep(item, o.item, true) && compareDeep(addItem, o.addItem, true)
12418           && compareDeep(totalCost, o.totalCost, true) && compareDeep(unallocDeductable, o.unallocDeductable, true)
12419           && compareDeep(totalBenefit, o.totalBenefit, true) && compareDeep(payment, o.payment, true) && compareDeep(form, o.form, true)
12420           && compareDeep(processNote, o.processNote, true) && compareDeep(benefitBalance, o.benefitBalance, true)
12421          ;
12422      }
12423
12424      @Override
12425      public boolean equalsShallow(Base other) {
12426        if (!super.equalsShallow(other))
12427          return false;
12428        if (!(other instanceof ExplanationOfBenefit))
12429          return false;
12430        ExplanationOfBenefit o = (ExplanationOfBenefit) other;
12431        return compareValues(status, o.status, true) && compareValues(created, o.created, true) && compareValues(disposition, o.disposition, true)
12432           && compareValues(precedence, o.precedence, true);
12433      }
12434
12435      public boolean isEmpty() {
12436        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
12437          , subType, patient, billablePeriod, created, enterer, insurer, provider, organization
12438          , referral, facility, claim, claimResponse, outcome, disposition, related, prescription
12439          , originalPrescription, payee, information, careTeam, diagnosis, procedure, precedence
12440          , insurance, accident, employmentImpacted, hospitalization, item, addItem, totalCost
12441          , unallocDeductable, totalBenefit, payment, form, processNote, benefitBalance);
12442      }
12443
12444  @Override
12445  public ResourceType getResourceType() {
12446    return ResourceType.ExplanationOfBenefit;
12447   }
12448
12449 /**
12450   * Search parameter: <b>coverage</b>
12451   * <p>
12452   * Description: <b>The plan under which the claim was adjudicated</b><br>
12453   * Type: <b>reference</b><br>
12454   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
12455   * </p>
12456   */
12457  @SearchParamDefinition(name="coverage", path="ExplanationOfBenefit.insurance.coverage", description="The plan under which the claim was adjudicated", type="reference", target={Coverage.class } )
12458  public static final String SP_COVERAGE = "coverage";
12459 /**
12460   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
12461   * <p>
12462   * Description: <b>The plan under which the claim was adjudicated</b><br>
12463   * Type: <b>reference</b><br>
12464   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
12465   * </p>
12466   */
12467  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COVERAGE);
12468
12469/**
12470   * Constant for fluent queries to be used to add include statements. Specifies
12471   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
12472   */
12473  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:coverage").toLocked();
12474
12475 /**
12476   * Search parameter: <b>care-team</b>
12477   * <p>
12478   * Description: <b>Member of the CareTeam</b><br>
12479   * Type: <b>reference</b><br>
12480   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
12481   * </p>
12482   */
12483  @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 } )
12484  public static final String SP_CARE_TEAM = "care-team";
12485 /**
12486   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
12487   * <p>
12488   * Description: <b>Member of the CareTeam</b><br>
12489   * Type: <b>reference</b><br>
12490   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
12491   * </p>
12492   */
12493  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_TEAM);
12494
12495/**
12496   * Constant for fluent queries to be used to add include statements. Specifies
12497   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
12498   */
12499  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:care-team").toLocked();
12500
12501 /**
12502   * Search parameter: <b>identifier</b>
12503   * <p>
12504   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
12505   * Type: <b>token</b><br>
12506   * Path: <b>ExplanationOfBenefit.identifier</b><br>
12507   * </p>
12508   */
12509  @SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
12510  public static final String SP_IDENTIFIER = "identifier";
12511 /**
12512   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
12513   * <p>
12514   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
12515   * Type: <b>token</b><br>
12516   * Path: <b>ExplanationOfBenefit.identifier</b><br>
12517   * </p>
12518   */
12519  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
12520
12521 /**
12522   * Search parameter: <b>created</b>
12523   * <p>
12524   * Description: <b>The creation date for the EOB</b><br>
12525   * Type: <b>date</b><br>
12526   * Path: <b>ExplanationOfBenefit.created</b><br>
12527   * </p>
12528   */
12529  @SearchParamDefinition(name="created", path="ExplanationOfBenefit.created", description="The creation date for the EOB", type="date" )
12530  public static final String SP_CREATED = "created";
12531 /**
12532   * <b>Fluent Client</b> search parameter constant for <b>created</b>
12533   * <p>
12534   * Description: <b>The creation date for the EOB</b><br>
12535   * Type: <b>date</b><br>
12536   * Path: <b>ExplanationOfBenefit.created</b><br>
12537   * </p>
12538   */
12539  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
12540
12541 /**
12542   * Search parameter: <b>encounter</b>
12543   * <p>
12544   * Description: <b>Encounters associated with a billed line item</b><br>
12545   * Type: <b>reference</b><br>
12546   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
12547   * </p>
12548   */
12549  @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 } )
12550  public static final String SP_ENCOUNTER = "encounter";
12551 /**
12552   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
12553   * <p>
12554   * Description: <b>Encounters associated with a billed line item</b><br>
12555   * Type: <b>reference</b><br>
12556   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
12557   * </p>
12558   */
12559  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
12560
12561/**
12562   * Constant for fluent queries to be used to add include statements. Specifies
12563   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
12564   */
12565  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:encounter").toLocked();
12566
12567 /**
12568   * Search parameter: <b>payee</b>
12569   * <p>
12570   * Description: <b>The party receiving any payment for the Claim</b><br>
12571   * Type: <b>reference</b><br>
12572   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
12573   * </p>
12574   */
12575  @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 } )
12576  public static final String SP_PAYEE = "payee";
12577 /**
12578   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
12579   * <p>
12580   * Description: <b>The party receiving any payment for the Claim</b><br>
12581   * Type: <b>reference</b><br>
12582   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
12583   * </p>
12584   */
12585  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PAYEE);
12586
12587/**
12588   * Constant for fluent queries to be used to add include statements. Specifies
12589   * the path value of "<b>ExplanationOfBenefit:payee</b>".
12590   */
12591  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:payee").toLocked();
12592
12593 /**
12594   * Search parameter: <b>disposition</b>
12595   * <p>
12596   * Description: <b>The contents of the disposition message</b><br>
12597   * Type: <b>string</b><br>
12598   * Path: <b>ExplanationOfBenefit.disposition</b><br>
12599   * </p>
12600   */
12601  @SearchParamDefinition(name="disposition", path="ExplanationOfBenefit.disposition", description="The contents of the disposition message", type="string" )
12602  public static final String SP_DISPOSITION = "disposition";
12603 /**
12604   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
12605   * <p>
12606   * Description: <b>The contents of the disposition message</b><br>
12607   * Type: <b>string</b><br>
12608   * Path: <b>ExplanationOfBenefit.disposition</b><br>
12609   * </p>
12610   */
12611  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
12612
12613 /**
12614   * Search parameter: <b>provider</b>
12615   * <p>
12616   * Description: <b>The reference to the provider</b><br>
12617   * Type: <b>reference</b><br>
12618   * Path: <b>ExplanationOfBenefit.provider</b><br>
12619   * </p>
12620   */
12621  @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 } )
12622  public static final String SP_PROVIDER = "provider";
12623 /**
12624   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
12625   * <p>
12626   * Description: <b>The reference to the provider</b><br>
12627   * Type: <b>reference</b><br>
12628   * Path: <b>ExplanationOfBenefit.provider</b><br>
12629   * </p>
12630   */
12631  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
12632
12633/**
12634   * Constant for fluent queries to be used to add include statements. Specifies
12635   * the path value of "<b>ExplanationOfBenefit:provider</b>".
12636   */
12637  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:provider").toLocked();
12638
12639 /**
12640   * Search parameter: <b>patient</b>
12641   * <p>
12642   * Description: <b>The reference to the patient</b><br>
12643   * Type: <b>reference</b><br>
12644   * Path: <b>ExplanationOfBenefit.patient</b><br>
12645   * </p>
12646   */
12647  @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 } )
12648  public static final String SP_PATIENT = "patient";
12649 /**
12650   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
12651   * <p>
12652   * Description: <b>The reference to the patient</b><br>
12653   * Type: <b>reference</b><br>
12654   * Path: <b>ExplanationOfBenefit.patient</b><br>
12655   * </p>
12656   */
12657  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
12658
12659/**
12660   * Constant for fluent queries to be used to add include statements. Specifies
12661   * the path value of "<b>ExplanationOfBenefit:patient</b>".
12662   */
12663  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:patient").toLocked();
12664
12665 /**
12666   * Search parameter: <b>organization</b>
12667   * <p>
12668   * Description: <b>The reference to the providing organization</b><br>
12669   * Type: <b>reference</b><br>
12670   * Path: <b>ExplanationOfBenefit.organization</b><br>
12671   * </p>
12672   */
12673  @SearchParamDefinition(name="organization", path="ExplanationOfBenefit.organization", description="The reference to the providing organization", type="reference", target={Organization.class } )
12674  public static final String SP_ORGANIZATION = "organization";
12675 /**
12676   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
12677   * <p>
12678   * Description: <b>The reference to the providing organization</b><br>
12679   * Type: <b>reference</b><br>
12680   * Path: <b>ExplanationOfBenefit.organization</b><br>
12681   * </p>
12682   */
12683  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
12684
12685/**
12686   * Constant for fluent queries to be used to add include statements. Specifies
12687   * the path value of "<b>ExplanationOfBenefit:organization</b>".
12688   */
12689  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:organization").toLocked();
12690
12691 /**
12692   * Search parameter: <b>claim</b>
12693   * <p>
12694   * Description: <b>The reference to the claim</b><br>
12695   * Type: <b>reference</b><br>
12696   * Path: <b>ExplanationOfBenefit.claim</b><br>
12697   * </p>
12698   */
12699  @SearchParamDefinition(name="claim", path="ExplanationOfBenefit.claim", description="The reference to the claim", type="reference", target={Claim.class } )
12700  public static final String SP_CLAIM = "claim";
12701 /**
12702   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
12703   * <p>
12704   * Description: <b>The reference to the claim</b><br>
12705   * Type: <b>reference</b><br>
12706   * Path: <b>ExplanationOfBenefit.claim</b><br>
12707   * </p>
12708   */
12709  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CLAIM);
12710
12711/**
12712   * Constant for fluent queries to be used to add include statements. Specifies
12713   * the path value of "<b>ExplanationOfBenefit:claim</b>".
12714   */
12715  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:claim").toLocked();
12716
12717 /**
12718   * Search parameter: <b>enterer</b>
12719   * <p>
12720   * Description: <b>The party responsible for the entry of the Claim</b><br>
12721   * Type: <b>reference</b><br>
12722   * Path: <b>ExplanationOfBenefit.enterer</b><br>
12723   * </p>
12724   */
12725  @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 } )
12726  public static final String SP_ENTERER = "enterer";
12727 /**
12728   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
12729   * <p>
12730   * Description: <b>The party responsible for the entry of the Claim</b><br>
12731   * Type: <b>reference</b><br>
12732   * Path: <b>ExplanationOfBenefit.enterer</b><br>
12733   * </p>
12734   */
12735  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
12736
12737/**
12738   * Constant for fluent queries to be used to add include statements. Specifies
12739   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
12740   */
12741  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:enterer").toLocked();
12742
12743 /**
12744   * Search parameter: <b>facility</b>
12745   * <p>
12746   * Description: <b>Facility responsible for the goods and services</b><br>
12747   * Type: <b>reference</b><br>
12748   * Path: <b>ExplanationOfBenefit.facility</b><br>
12749   * </p>
12750   */
12751  @SearchParamDefinition(name="facility", path="ExplanationOfBenefit.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class } )
12752  public static final String SP_FACILITY = "facility";
12753 /**
12754   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
12755   * <p>
12756   * Description: <b>Facility responsible for the goods and services</b><br>
12757   * Type: <b>reference</b><br>
12758   * Path: <b>ExplanationOfBenefit.facility</b><br>
12759   * </p>
12760   */
12761  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
12762
12763/**
12764   * Constant for fluent queries to be used to add include statements. Specifies
12765   * the path value of "<b>ExplanationOfBenefit:facility</b>".
12766   */
12767  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:facility").toLocked();
12768
12769
12770}
12771