001package org.hl7.fhir.dstu3.model;
002
003import java.math.BigDecimal;
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
035import java.util.ArrayList;
036import java.util.Date;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.exceptions.FHIRFormatError;
041import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
042import org.hl7.fhir.utilities.Utilities;
043
044import ca.uhn.fhir.model.api.annotation.Block;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.Description;
047import ca.uhn.fhir.model.api.annotation.ResourceDef;
048import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
049/**
050 * 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.
051 */
052@ResourceDef(name="ExplanationOfBenefit", profile="http://hl7.org/fhir/Profile/ExplanationOfBenefit")
053public class ExplanationOfBenefit extends DomainResource {
054
055    public enum ExplanationOfBenefitStatus {
056        /**
057         * The resource instance is currently in-force.
058         */
059        ACTIVE, 
060        /**
061         * The resource instance is withdrawn, rescinded or reversed.
062         */
063        CANCELLED, 
064        /**
065         * A new resource instance the contents of which is not complete.
066         */
067        DRAFT, 
068        /**
069         * The resource instance was entered in error.
070         */
071        ENTEREDINERROR, 
072        /**
073         * added to help the parsers with the generic types
074         */
075        NULL;
076        public static ExplanationOfBenefitStatus fromCode(String codeString) throws FHIRException {
077            if (codeString == null || "".equals(codeString))
078                return null;
079        if ("active".equals(codeString))
080          return ACTIVE;
081        if ("cancelled".equals(codeString))
082          return CANCELLED;
083        if ("draft".equals(codeString))
084          return DRAFT;
085        if ("entered-in-error".equals(codeString))
086          return ENTEREDINERROR;
087        if (Configuration.isAcceptInvalidEnums())
088          return null;
089        else
090          throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
091        }
092        public String toCode() {
093          switch (this) {
094            case ACTIVE: return "active";
095            case CANCELLED: return "cancelled";
096            case DRAFT: return "draft";
097            case ENTEREDINERROR: return "entered-in-error";
098            case NULL: return null;
099            default: return "?";
100          }
101        }
102        public String getSystem() {
103          switch (this) {
104            case ACTIVE: return "http://hl7.org/fhir/explanationofbenefit-status";
105            case CANCELLED: return "http://hl7.org/fhir/explanationofbenefit-status";
106            case DRAFT: return "http://hl7.org/fhir/explanationofbenefit-status";
107            case ENTEREDINERROR: return "http://hl7.org/fhir/explanationofbenefit-status";
108            case NULL: return null;
109            default: return "?";
110          }
111        }
112        public String getDefinition() {
113          switch (this) {
114            case ACTIVE: return "The resource instance is currently in-force.";
115            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
116            case DRAFT: return "A new resource instance the contents of which is not complete.";
117            case ENTEREDINERROR: return "The resource instance was entered in error.";
118            case NULL: return null;
119            default: return "?";
120          }
121        }
122        public String getDisplay() {
123          switch (this) {
124            case ACTIVE: return "Active";
125            case CANCELLED: return "Cancelled";
126            case DRAFT: return "Draft";
127            case ENTEREDINERROR: return "Entered In Error";
128            case NULL: return null;
129            default: return "?";
130          }
131        }
132    }
133
134  public static class ExplanationOfBenefitStatusEnumFactory implements EnumFactory<ExplanationOfBenefitStatus> {
135    public ExplanationOfBenefitStatus fromCode(String codeString) throws IllegalArgumentException {
136      if (codeString == null || "".equals(codeString))
137            if (codeString == null || "".equals(codeString))
138                return null;
139        if ("active".equals(codeString))
140          return ExplanationOfBenefitStatus.ACTIVE;
141        if ("cancelled".equals(codeString))
142          return ExplanationOfBenefitStatus.CANCELLED;
143        if ("draft".equals(codeString))
144          return ExplanationOfBenefitStatus.DRAFT;
145        if ("entered-in-error".equals(codeString))
146          return ExplanationOfBenefitStatus.ENTEREDINERROR;
147        throw new IllegalArgumentException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
148        }
149        public Enumeration<ExplanationOfBenefitStatus> fromType(PrimitiveType<?> code) throws FHIRException {
150          if (code == null)
151            return null;
152          if (code.isEmpty())
153            return new Enumeration<ExplanationOfBenefitStatus>(this);
154          String codeString = code.asStringValue();
155          if (codeString == null || "".equals(codeString))
156            return null;
157        if ("active".equals(codeString))
158          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ACTIVE);
159        if ("cancelled".equals(codeString))
160          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.CANCELLED);
161        if ("draft".equals(codeString))
162          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.DRAFT);
163        if ("entered-in-error".equals(codeString))
164          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ENTEREDINERROR);
165        throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
166        }
167    public String toCode(ExplanationOfBenefitStatus code) {
168       if (code == ExplanationOfBenefitStatus.NULL)
169           return null;
170       if (code == ExplanationOfBenefitStatus.ACTIVE)
171        return "active";
172      if (code == ExplanationOfBenefitStatus.CANCELLED)
173        return "cancelled";
174      if (code == ExplanationOfBenefitStatus.DRAFT)
175        return "draft";
176      if (code == ExplanationOfBenefitStatus.ENTEREDINERROR)
177        return "entered-in-error";
178      return "?";
179   }
180    public String toSystem(ExplanationOfBenefitStatus code) {
181      return code.getSystem();
182      }
183    }
184
185    @Block()
186    public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
187        /**
188         * Other claims which are related to this claim such as prior claim versions or for related services.
189         */
190        @Child(name = "claim", type = {Claim.class}, order=1, min=0, max=1, modifier=false, summary=false)
191        @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." )
192        protected Reference claim;
193
194        /**
195         * 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.)
196         */
197        protected Claim claimTarget;
198
199        /**
200         * For example prior or umbrella.
201         */
202        @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
203        @Description(shortDefinition="How the reference claim is related", formalDefinition="For example prior or umbrella." )
204        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-claim-relationship")
205        protected CodeableConcept relationship;
206
207        /**
208         * An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .
209         */
210        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=false)
211        @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 # ." )
212        protected Identifier reference;
213
214        private static final long serialVersionUID = -379338905L;
215
216    /**
217     * Constructor
218     */
219      public RelatedClaimComponent() {
220        super();
221      }
222
223        /**
224         * @return {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
225         */
226        public Reference getClaim() { 
227          if (this.claim == null)
228            if (Configuration.errorOnAutoCreate())
229              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
230            else if (Configuration.doAutoCreate())
231              this.claim = new Reference(); // cc
232          return this.claim;
233        }
234
235        public boolean hasClaim() { 
236          return this.claim != null && !this.claim.isEmpty();
237        }
238
239        /**
240         * @param value {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
241         */
242        public RelatedClaimComponent setClaim(Reference value)  { 
243          this.claim = value;
244          return this;
245        }
246
247        /**
248         * @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.)
249         */
250        public Claim getClaimTarget() { 
251          if (this.claimTarget == null)
252            if (Configuration.errorOnAutoCreate())
253              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
254            else if (Configuration.doAutoCreate())
255              this.claimTarget = new Claim(); // aa
256          return this.claimTarget;
257        }
258
259        /**
260         * @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.)
261         */
262        public RelatedClaimComponent setClaimTarget(Claim value) { 
263          this.claimTarget = value;
264          return this;
265        }
266
267        /**
268         * @return {@link #relationship} (For example prior or umbrella.)
269         */
270        public CodeableConcept getRelationship() { 
271          if (this.relationship == null)
272            if (Configuration.errorOnAutoCreate())
273              throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
274            else if (Configuration.doAutoCreate())
275              this.relationship = new CodeableConcept(); // cc
276          return this.relationship;
277        }
278
279        public boolean hasRelationship() { 
280          return this.relationship != null && !this.relationship.isEmpty();
281        }
282
283        /**
284         * @param value {@link #relationship} (For example prior or umbrella.)
285         */
286        public RelatedClaimComponent setRelationship(CodeableConcept value)  { 
287          this.relationship = value;
288          return this;
289        }
290
291        /**
292         * @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 # .)
293         */
294        public Identifier getReference() { 
295          if (this.reference == null)
296            if (Configuration.errorOnAutoCreate())
297              throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
298            else if (Configuration.doAutoCreate())
299              this.reference = new Identifier(); // cc
300          return this.reference;
301        }
302
303        public boolean hasReference() { 
304          return this.reference != null && !this.reference.isEmpty();
305        }
306
307        /**
308         * @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 # .)
309         */
310        public RelatedClaimComponent setReference(Identifier value)  { 
311          this.reference = value;
312          return this;
313        }
314
315        protected void listChildren(List<Property> children) {
316          super.listChildren(children);
317          children.add(new Property("claim", "Reference(Claim)", "Other claims which are related to this claim such as prior claim versions or for related services.", 0, 1, claim));
318          children.add(new Property("relationship", "CodeableConcept", "For example prior or umbrella.", 0, 1, relationship));
319          children.add(new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .", 0, 1, reference));
320        }
321
322        @Override
323        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
324          switch (_hash) {
325          case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "Other claims which are related to this claim such as prior claim versions or for related services.", 0, 1, claim);
326          case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "For example prior or umbrella.", 0, 1, relationship);
327          case -925155509: /*reference*/  return new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .", 0, 1, reference);
328          default: return super.getNamedProperty(_hash, _name, _checkValid);
329          }
330
331        }
332
333      @Override
334      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
335        switch (hash) {
336        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
337        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
338        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
339        default: return super.getProperty(hash, name, checkValid);
340        }
341
342      }
343
344      @Override
345      public Base setProperty(int hash, String name, Base value) throws FHIRException {
346        switch (hash) {
347        case 94742588: // claim
348          this.claim = castToReference(value); // Reference
349          return value;
350        case -261851592: // relationship
351          this.relationship = castToCodeableConcept(value); // CodeableConcept
352          return value;
353        case -925155509: // reference
354          this.reference = castToIdentifier(value); // Identifier
355          return value;
356        default: return super.setProperty(hash, name, value);
357        }
358
359      }
360
361      @Override
362      public Base setProperty(String name, Base value) throws FHIRException {
363        if (name.equals("claim")) {
364          this.claim = castToReference(value); // Reference
365        } else if (name.equals("relationship")) {
366          this.relationship = castToCodeableConcept(value); // CodeableConcept
367        } else if (name.equals("reference")) {
368          this.reference = castToIdentifier(value); // Identifier
369        } else
370          return super.setProperty(name, value);
371        return value;
372      }
373
374      @Override
375      public Base makeProperty(int hash, String name) throws FHIRException {
376        switch (hash) {
377        case 94742588:  return getClaim(); 
378        case -261851592:  return getRelationship(); 
379        case -925155509:  return getReference(); 
380        default: return super.makeProperty(hash, name);
381        }
382
383      }
384
385      @Override
386      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
387        switch (hash) {
388        case 94742588: /*claim*/ return new String[] {"Reference"};
389        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
390        case -925155509: /*reference*/ return new String[] {"Identifier"};
391        default: return super.getTypesForProperty(hash, name);
392        }
393
394      }
395
396      @Override
397      public Base addChild(String name) throws FHIRException {
398        if (name.equals("claim")) {
399          this.claim = new Reference();
400          return this.claim;
401        }
402        else if (name.equals("relationship")) {
403          this.relationship = new CodeableConcept();
404          return this.relationship;
405        }
406        else if (name.equals("reference")) {
407          this.reference = new Identifier();
408          return this.reference;
409        }
410        else
411          return super.addChild(name);
412      }
413
414      public RelatedClaimComponent copy() {
415        RelatedClaimComponent dst = new RelatedClaimComponent();
416        copyValues(dst);
417        dst.claim = claim == null ? null : claim.copy();
418        dst.relationship = relationship == null ? null : relationship.copy();
419        dst.reference = reference == null ? null : reference.copy();
420        return dst;
421      }
422
423      @Override
424      public boolean equalsDeep(Base other_) {
425        if (!super.equalsDeep(other_))
426          return false;
427        if (!(other_ instanceof RelatedClaimComponent))
428          return false;
429        RelatedClaimComponent o = (RelatedClaimComponent) other_;
430        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
431          ;
432      }
433
434      @Override
435      public boolean equalsShallow(Base other_) {
436        if (!super.equalsShallow(other_))
437          return false;
438        if (!(other_ instanceof RelatedClaimComponent))
439          return false;
440        RelatedClaimComponent o = (RelatedClaimComponent) other_;
441        return true;
442      }
443
444      public boolean isEmpty() {
445        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference
446          );
447      }
448
449  public String fhirType() {
450    return "ExplanationOfBenefit.related";
451
452  }
453
454  }
455
456    @Block()
457    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
458        /**
459         * Type of Party to be reimbursed: Subscriber, provider, other.
460         */
461        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
462        @Description(shortDefinition="Type of party: Subscriber, Provider, other", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
463        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payeetype")
464        protected CodeableConcept type;
465
466        /**
467         * organization | patient | practitioner | relatedperson.
468         */
469        @Child(name = "resourceType", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
470        @Description(shortDefinition="organization | patient | practitioner | relatedperson", formalDefinition="organization | patient | practitioner | relatedperson." )
471        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-type-link")
472        protected CodeableConcept resourceType;
473
474        /**
475         * Party to be reimbursed: Subscriber, provider, other.
476         */
477        @Child(name = "party", type = {Practitioner.class, Organization.class, Patient.class, RelatedPerson.class}, order=3, min=0, max=1, modifier=false, summary=false)
478        @Description(shortDefinition="Party to receive the payable", formalDefinition="Party to be reimbursed: Subscriber, provider, other." )
479        protected Reference party;
480
481        /**
482         * The actual object that is the target of the reference (Party to be reimbursed: Subscriber, provider, other.)
483         */
484        protected Resource partyTarget;
485
486        private static final long serialVersionUID = 1146157718L;
487
488    /**
489     * Constructor
490     */
491      public PayeeComponent() {
492        super();
493      }
494
495        /**
496         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
497         */
498        public CodeableConcept getType() { 
499          if (this.type == null)
500            if (Configuration.errorOnAutoCreate())
501              throw new Error("Attempt to auto-create PayeeComponent.type");
502            else if (Configuration.doAutoCreate())
503              this.type = new CodeableConcept(); // cc
504          return this.type;
505        }
506
507        public boolean hasType() { 
508          return this.type != null && !this.type.isEmpty();
509        }
510
511        /**
512         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
513         */
514        public PayeeComponent setType(CodeableConcept value)  { 
515          this.type = value;
516          return this;
517        }
518
519        /**
520         * @return {@link #resourceType} (organization | patient | practitioner | relatedperson.)
521         */
522        public CodeableConcept getResourceType() { 
523          if (this.resourceType == null)
524            if (Configuration.errorOnAutoCreate())
525              throw new Error("Attempt to auto-create PayeeComponent.resourceType");
526            else if (Configuration.doAutoCreate())
527              this.resourceType = new CodeableConcept(); // cc
528          return this.resourceType;
529        }
530
531        public boolean hasResourceType() { 
532          return this.resourceType != null && !this.resourceType.isEmpty();
533        }
534
535        /**
536         * @param value {@link #resourceType} (organization | patient | practitioner | relatedperson.)
537         */
538        public PayeeComponent setResourceType(CodeableConcept value)  { 
539          this.resourceType = value;
540          return this;
541        }
542
543        /**
544         * @return {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
545         */
546        public Reference getParty() { 
547          if (this.party == null)
548            if (Configuration.errorOnAutoCreate())
549              throw new Error("Attempt to auto-create PayeeComponent.party");
550            else if (Configuration.doAutoCreate())
551              this.party = new Reference(); // cc
552          return this.party;
553        }
554
555        public boolean hasParty() { 
556          return this.party != null && !this.party.isEmpty();
557        }
558
559        /**
560         * @param value {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
561         */
562        public PayeeComponent setParty(Reference value)  { 
563          this.party = value;
564          return this;
565        }
566
567        /**
568         * @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.)
569         */
570        public Resource getPartyTarget() { 
571          return this.partyTarget;
572        }
573
574        /**
575         * @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.)
576         */
577        public PayeeComponent setPartyTarget(Resource value) { 
578          this.partyTarget = value;
579          return this;
580        }
581
582        protected void listChildren(List<Property> children) {
583          super.listChildren(children);
584          children.add(new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
585          children.add(new Property("resourceType", "CodeableConcept", "organization | patient | practitioner | relatedperson.", 0, 1, resourceType));
586          children.add(new Property("party", "Reference(Practitioner|Organization|Patient|RelatedPerson)", "Party to be reimbursed: Subscriber, provider, other.", 0, 1, party));
587        }
588
589        @Override
590        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
591          switch (_hash) {
592          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
593          case -384364440: /*resourceType*/  return new Property("resourceType", "CodeableConcept", "organization | patient | practitioner | relatedperson.", 0, 1, resourceType);
594          case 106437350: /*party*/  return new Property("party", "Reference(Practitioner|Organization|Patient|RelatedPerson)", "Party to be reimbursed: Subscriber, provider, other.", 0, 1, party);
595          default: return super.getNamedProperty(_hash, _name, _checkValid);
596          }
597
598        }
599
600      @Override
601      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
602        switch (hash) {
603        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
604        case -384364440: /*resourceType*/ return this.resourceType == null ? new Base[0] : new Base[] {this.resourceType}; // CodeableConcept
605        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
606        default: return super.getProperty(hash, name, checkValid);
607        }
608
609      }
610
611      @Override
612      public Base setProperty(int hash, String name, Base value) throws FHIRException {
613        switch (hash) {
614        case 3575610: // type
615          this.type = castToCodeableConcept(value); // CodeableConcept
616          return value;
617        case -384364440: // resourceType
618          this.resourceType = castToCodeableConcept(value); // CodeableConcept
619          return value;
620        case 106437350: // party
621          this.party = castToReference(value); // Reference
622          return value;
623        default: return super.setProperty(hash, name, value);
624        }
625
626      }
627
628      @Override
629      public Base setProperty(String name, Base value) throws FHIRException {
630        if (name.equals("type")) {
631          this.type = castToCodeableConcept(value); // CodeableConcept
632        } else if (name.equals("resourceType")) {
633          this.resourceType = castToCodeableConcept(value); // CodeableConcept
634        } else if (name.equals("party")) {
635          this.party = castToReference(value); // Reference
636        } else
637          return super.setProperty(name, value);
638        return value;
639      }
640
641      @Override
642      public Base makeProperty(int hash, String name) throws FHIRException {
643        switch (hash) {
644        case 3575610:  return getType(); 
645        case -384364440:  return getResourceType(); 
646        case 106437350:  return getParty(); 
647        default: return super.makeProperty(hash, name);
648        }
649
650      }
651
652      @Override
653      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
654        switch (hash) {
655        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
656        case -384364440: /*resourceType*/ return new String[] {"CodeableConcept"};
657        case 106437350: /*party*/ return new String[] {"Reference"};
658        default: return super.getTypesForProperty(hash, name);
659        }
660
661      }
662
663      @Override
664      public Base addChild(String name) throws FHIRException {
665        if (name.equals("type")) {
666          this.type = new CodeableConcept();
667          return this.type;
668        }
669        else if (name.equals("resourceType")) {
670          this.resourceType = new CodeableConcept();
671          return this.resourceType;
672        }
673        else if (name.equals("party")) {
674          this.party = new Reference();
675          return this.party;
676        }
677        else
678          return super.addChild(name);
679      }
680
681      public PayeeComponent copy() {
682        PayeeComponent dst = new PayeeComponent();
683        copyValues(dst);
684        dst.type = type == null ? null : type.copy();
685        dst.resourceType = resourceType == null ? null : resourceType.copy();
686        dst.party = party == null ? null : party.copy();
687        return dst;
688      }
689
690      @Override
691      public boolean equalsDeep(Base other_) {
692        if (!super.equalsDeep(other_))
693          return false;
694        if (!(other_ instanceof PayeeComponent))
695          return false;
696        PayeeComponent o = (PayeeComponent) other_;
697        return compareDeep(type, o.type, true) && compareDeep(resourceType, o.resourceType, true) && compareDeep(party, o.party, true)
698          ;
699      }
700
701      @Override
702      public boolean equalsShallow(Base other_) {
703        if (!super.equalsShallow(other_))
704          return false;
705        if (!(other_ instanceof PayeeComponent))
706          return false;
707        PayeeComponent o = (PayeeComponent) other_;
708        return true;
709      }
710
711      public boolean isEmpty() {
712        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, resourceType, party
713          );
714      }
715
716  public String fhirType() {
717    return "ExplanationOfBenefit.payee";
718
719  }
720
721  }
722
723    @Block()
724    public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
725        /**
726         * Sequence of the information element which serves to provide a link.
727         */
728        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
729        @Description(shortDefinition="Information instance identifier", formalDefinition="Sequence of the information element which serves to provide a link." )
730        protected PositiveIntType sequence;
731
732        /**
733         * The general class of the information supplied: information; exception; accident, employment; onset, etc.
734         */
735        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
736        @Description(shortDefinition="General class of information", formalDefinition="The general class of the information supplied: information; exception; accident, employment; onset, etc." )
737        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-informationcategory")
738        protected CodeableConcept category;
739
740        /**
741         * 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.
742         */
743        @Child(name = "code", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
744        @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." )
745        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-exception")
746        protected CodeableConcept code;
747
748        /**
749         * The date when or period to which this information refers.
750         */
751        @Child(name = "timing", type = {DateType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
752        @Description(shortDefinition="When it occurred", formalDefinition="The date when or period to which this information refers." )
753        protected Type timing;
754
755        /**
756         * Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.
757         */
758        @Child(name = "value", type = {StringType.class, Quantity.class, Attachment.class, Reference.class}, order=5, min=0, max=1, modifier=false, summary=false)
759        @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." )
760        protected Type value;
761
762        /**
763         * 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.
764         */
765        @Child(name = "reason", type = {Coding.class}, order=6, min=0, max=1, modifier=false, summary=false)
766        @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." )
767        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/missing-tooth-reason")
768        protected Coding reason;
769
770        private static final long serialVersionUID = -410136661L;
771
772    /**
773     * Constructor
774     */
775      public SupportingInformationComponent() {
776        super();
777      }
778
779    /**
780     * Constructor
781     */
782      public SupportingInformationComponent(PositiveIntType sequence, CodeableConcept category) {
783        super();
784        this.sequence = sequence;
785        this.category = category;
786      }
787
788        /**
789         * @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
790         */
791        public PositiveIntType getSequenceElement() { 
792          if (this.sequence == null)
793            if (Configuration.errorOnAutoCreate())
794              throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
795            else if (Configuration.doAutoCreate())
796              this.sequence = new PositiveIntType(); // bb
797          return this.sequence;
798        }
799
800        public boolean hasSequenceElement() { 
801          return this.sequence != null && !this.sequence.isEmpty();
802        }
803
804        public boolean hasSequence() { 
805          return this.sequence != null && !this.sequence.isEmpty();
806        }
807
808        /**
809         * @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
810         */
811        public SupportingInformationComponent setSequenceElement(PositiveIntType value) { 
812          this.sequence = value;
813          return this;
814        }
815
816        /**
817         * @return Sequence of the information element which serves to provide a link.
818         */
819        public int getSequence() { 
820          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
821        }
822
823        /**
824         * @param value Sequence of the information element which serves to provide a link.
825         */
826        public SupportingInformationComponent setSequence(int value) { 
827            if (this.sequence == null)
828              this.sequence = new PositiveIntType();
829            this.sequence.setValue(value);
830          return this;
831        }
832
833        /**
834         * @return {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
835         */
836        public CodeableConcept getCategory() { 
837          if (this.category == null)
838            if (Configuration.errorOnAutoCreate())
839              throw new Error("Attempt to auto-create SupportingInformationComponent.category");
840            else if (Configuration.doAutoCreate())
841              this.category = new CodeableConcept(); // cc
842          return this.category;
843        }
844
845        public boolean hasCategory() { 
846          return this.category != null && !this.category.isEmpty();
847        }
848
849        /**
850         * @param value {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
851         */
852        public SupportingInformationComponent setCategory(CodeableConcept value)  { 
853          this.category = value;
854          return this;
855        }
856
857        /**
858         * @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.)
859         */
860        public CodeableConcept getCode() { 
861          if (this.code == null)
862            if (Configuration.errorOnAutoCreate())
863              throw new Error("Attempt to auto-create SupportingInformationComponent.code");
864            else if (Configuration.doAutoCreate())
865              this.code = new CodeableConcept(); // cc
866          return this.code;
867        }
868
869        public boolean hasCode() { 
870          return this.code != null && !this.code.isEmpty();
871        }
872
873        /**
874         * @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.)
875         */
876        public SupportingInformationComponent setCode(CodeableConcept value)  { 
877          this.code = value;
878          return this;
879        }
880
881        /**
882         * @return {@link #timing} (The date when or period to which this information refers.)
883         */
884        public Type getTiming() { 
885          return this.timing;
886        }
887
888        /**
889         * @return {@link #timing} (The date when or period to which this information refers.)
890         */
891        public DateType getTimingDateType() throws FHIRException { 
892          if (this.timing == null)
893            return null;
894          if (!(this.timing instanceof DateType))
895            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.timing.getClass().getName()+" was encountered");
896          return (DateType) this.timing;
897        }
898
899        public boolean hasTimingDateType() {
900            return this.timing instanceof DateType;
901        }
902
903        /**
904         * @return {@link #timing} (The date when or period to which this information refers.)
905         */
906        public Period getTimingPeriod() throws FHIRException { 
907          if (this.timing == null)
908            return null;
909          if (!(this.timing instanceof Period))
910            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
911          return (Period) this.timing;
912        }
913
914        public boolean hasTimingPeriod() {
915            return this.timing instanceof Period;
916        }
917
918        public boolean hasTiming() { 
919          return this.timing != null && !this.timing.isEmpty();
920        }
921
922        /**
923         * @param value {@link #timing} (The date when or period to which this information refers.)
924         */
925        public SupportingInformationComponent setTiming(Type value) throws FHIRFormatError { 
926          if (value != null && !(value instanceof DateType || value instanceof Period))
927            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.information.timing[x]: "+value.fhirType());
928          this.timing = value;
929          return this;
930        }
931
932        /**
933         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
934         */
935        public Type getValue() { 
936          return this.value;
937        }
938
939        /**
940         * @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.)
941         */
942        public StringType getValueStringType() throws FHIRException { 
943          if (this.value == null)
944            return null;
945          if (!(this.value instanceof StringType))
946            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
947          return (StringType) this.value;
948        }
949
950        public boolean hasValueStringType() {
951            return this.value instanceof StringType;
952        }
953
954        /**
955         * @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.)
956         */
957        public Quantity getValueQuantity() throws FHIRException { 
958          if (this.value == null)
959            return null;
960          if (!(this.value instanceof Quantity))
961            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
962          return (Quantity) this.value;
963        }
964
965        public boolean hasValueQuantity() {
966            return this.value instanceof Quantity;
967        }
968
969        /**
970         * @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.)
971         */
972        public Attachment getValueAttachment() throws FHIRException { 
973          if (this.value == null)
974            return null;
975          if (!(this.value instanceof Attachment))
976            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
977          return (Attachment) this.value;
978        }
979
980        public boolean hasValueAttachment() {
981            return this.value instanceof Attachment;
982        }
983
984        /**
985         * @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.)
986         */
987        public Reference getValueReference() throws FHIRException { 
988          if (this.value == null)
989            return null;
990          if (!(this.value instanceof Reference))
991            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
992          return (Reference) this.value;
993        }
994
995        public boolean hasValueReference() {
996            return this.value instanceof Reference;
997        }
998
999        public boolean hasValue() { 
1000          return this.value != null && !this.value.isEmpty();
1001        }
1002
1003        /**
1004         * @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.)
1005         */
1006        public SupportingInformationComponent setValue(Type value) throws FHIRFormatError { 
1007          if (value != null && !(value instanceof StringType || value instanceof Quantity || value instanceof Attachment || value instanceof Reference))
1008            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.information.value[x]: "+value.fhirType());
1009          this.value = value;
1010          return this;
1011        }
1012
1013        /**
1014         * @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.)
1015         */
1016        public Coding getReason() { 
1017          if (this.reason == null)
1018            if (Configuration.errorOnAutoCreate())
1019              throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1020            else if (Configuration.doAutoCreate())
1021              this.reason = new Coding(); // cc
1022          return this.reason;
1023        }
1024
1025        public boolean hasReason() { 
1026          return this.reason != null && !this.reason.isEmpty();
1027        }
1028
1029        /**
1030         * @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.)
1031         */
1032        public SupportingInformationComponent setReason(Coding value)  { 
1033          this.reason = value;
1034          return this;
1035        }
1036
1037        protected void listChildren(List<Property> children) {
1038          super.listChildren(children);
1039          children.add(new Property("sequence", "positiveInt", "Sequence of the information element which serves to provide a link.", 0, 1, sequence));
1040          children.add(new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category));
1041          children.add(new Property("code", "CodeableConcept", "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication.", 0, 1, code));
1042          children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing));
1043          children.add(new Property("value[x]", "string|Quantity|Attachment|Reference(Any)", "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.", 0, 1, value));
1044          children.add(new Property("reason", "Coding", "For example, provides the reason for: the additional stay, or missing tooth or any other situation where a reason code is required in addition to the content.", 0, 1, reason));
1045        }
1046
1047        @Override
1048        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1049          switch (_hash) {
1050          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of the information element which serves to provide a link.", 0, 1, sequence);
1051          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category);
1052          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication.", 0, 1, code);
1053          case 164632566: /*timing[x]*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1054          case -873664438: /*timing*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1055          case 807935768: /*timingDate*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1056          case -615615829: /*timingPeriod*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1057          case -1410166417: /*value[x]*/  return new Property("value[x]", "string|Quantity|Attachment|Reference(Any)", "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.", 0, 1, value);
1058          case 111972721: /*value*/  return new Property("value[x]", "string|Quantity|Attachment|Reference(Any)", "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.", 0, 1, value);
1059          case -1424603934: /*valueString*/  return new Property("value[x]", "string|Quantity|Attachment|Reference(Any)", "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.", 0, 1, value);
1060          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "string|Quantity|Attachment|Reference(Any)", "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.", 0, 1, value);
1061          case -475566732: /*valueAttachment*/  return new Property("value[x]", "string|Quantity|Attachment|Reference(Any)", "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.", 0, 1, value);
1062          case 1755241690: /*valueReference*/  return new Property("value[x]", "string|Quantity|Attachment|Reference(Any)", "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.", 0, 1, value);
1063          case -934964668: /*reason*/  return new Property("reason", "Coding", "For example, provides the reason for: the additional stay, or missing tooth or any other situation where a reason code is required in addition to the content.", 0, 1, reason);
1064          default: return super.getNamedProperty(_hash, _name, _checkValid);
1065          }
1066
1067        }
1068
1069      @Override
1070      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1071        switch (hash) {
1072        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1073        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1074        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1075        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type
1076        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
1077        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
1078        default: return super.getProperty(hash, name, checkValid);
1079        }
1080
1081      }
1082
1083      @Override
1084      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1085        switch (hash) {
1086        case 1349547969: // sequence
1087          this.sequence = castToPositiveInt(value); // PositiveIntType
1088          return value;
1089        case 50511102: // category
1090          this.category = castToCodeableConcept(value); // CodeableConcept
1091          return value;
1092        case 3059181: // code
1093          this.code = castToCodeableConcept(value); // CodeableConcept
1094          return value;
1095        case -873664438: // timing
1096          this.timing = castToType(value); // Type
1097          return value;
1098        case 111972721: // value
1099          this.value = castToType(value); // Type
1100          return value;
1101        case -934964668: // reason
1102          this.reason = castToCoding(value); // Coding
1103          return value;
1104        default: return super.setProperty(hash, name, value);
1105        }
1106
1107      }
1108
1109      @Override
1110      public Base setProperty(String name, Base value) throws FHIRException {
1111        if (name.equals("sequence")) {
1112          this.sequence = castToPositiveInt(value); // PositiveIntType
1113        } else if (name.equals("category")) {
1114          this.category = castToCodeableConcept(value); // CodeableConcept
1115        } else if (name.equals("code")) {
1116          this.code = castToCodeableConcept(value); // CodeableConcept
1117        } else if (name.equals("timing[x]")) {
1118          this.timing = castToType(value); // Type
1119        } else if (name.equals("value[x]")) {
1120          this.value = castToType(value); // Type
1121        } else if (name.equals("reason")) {
1122          this.reason = castToCoding(value); // Coding
1123        } else
1124          return super.setProperty(name, value);
1125        return value;
1126      }
1127
1128      @Override
1129      public Base makeProperty(int hash, String name) throws FHIRException {
1130        switch (hash) {
1131        case 1349547969:  return getSequenceElement();
1132        case 50511102:  return getCategory(); 
1133        case 3059181:  return getCode(); 
1134        case 164632566:  return getTiming(); 
1135        case -873664438:  return getTiming(); 
1136        case -1410166417:  return getValue(); 
1137        case 111972721:  return getValue(); 
1138        case -934964668:  return getReason(); 
1139        default: return super.makeProperty(hash, name);
1140        }
1141
1142      }
1143
1144      @Override
1145      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1146        switch (hash) {
1147        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1148        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1149        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1150        case -873664438: /*timing*/ return new String[] {"date", "Period"};
1151        case 111972721: /*value*/ return new String[] {"string", "Quantity", "Attachment", "Reference"};
1152        case -934964668: /*reason*/ return new String[] {"Coding"};
1153        default: return super.getTypesForProperty(hash, name);
1154        }
1155
1156      }
1157
1158      @Override
1159      public Base addChild(String name) throws FHIRException {
1160        if (name.equals("sequence")) {
1161          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
1162        }
1163        else if (name.equals("category")) {
1164          this.category = new CodeableConcept();
1165          return this.category;
1166        }
1167        else if (name.equals("code")) {
1168          this.code = new CodeableConcept();
1169          return this.code;
1170        }
1171        else if (name.equals("timingDate")) {
1172          this.timing = new DateType();
1173          return this.timing;
1174        }
1175        else if (name.equals("timingPeriod")) {
1176          this.timing = new Period();
1177          return this.timing;
1178        }
1179        else if (name.equals("valueString")) {
1180          this.value = new StringType();
1181          return this.value;
1182        }
1183        else if (name.equals("valueQuantity")) {
1184          this.value = new Quantity();
1185          return this.value;
1186        }
1187        else if (name.equals("valueAttachment")) {
1188          this.value = new Attachment();
1189          return this.value;
1190        }
1191        else if (name.equals("valueReference")) {
1192          this.value = new Reference();
1193          return this.value;
1194        }
1195        else if (name.equals("reason")) {
1196          this.reason = new Coding();
1197          return this.reason;
1198        }
1199        else
1200          return super.addChild(name);
1201      }
1202
1203      public SupportingInformationComponent copy() {
1204        SupportingInformationComponent dst = new SupportingInformationComponent();
1205        copyValues(dst);
1206        dst.sequence = sequence == null ? null : sequence.copy();
1207        dst.category = category == null ? null : category.copy();
1208        dst.code = code == null ? null : code.copy();
1209        dst.timing = timing == null ? null : timing.copy();
1210        dst.value = value == null ? null : value.copy();
1211        dst.reason = reason == null ? null : reason.copy();
1212        return dst;
1213      }
1214
1215      @Override
1216      public boolean equalsDeep(Base other_) {
1217        if (!super.equalsDeep(other_))
1218          return false;
1219        if (!(other_ instanceof SupportingInformationComponent))
1220          return false;
1221        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1222        return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true) && compareDeep(code, o.code, true)
1223           && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true) && compareDeep(reason, o.reason, true)
1224          ;
1225      }
1226
1227      @Override
1228      public boolean equalsShallow(Base other_) {
1229        if (!super.equalsShallow(other_))
1230          return false;
1231        if (!(other_ instanceof SupportingInformationComponent))
1232          return false;
1233        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1234        return compareValues(sequence, o.sequence, true);
1235      }
1236
1237      public boolean isEmpty() {
1238        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code
1239          , timing, value, reason);
1240      }
1241
1242  public String fhirType() {
1243    return "ExplanationOfBenefit.information";
1244
1245  }
1246
1247  }
1248
1249    @Block()
1250    public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
1251        /**
1252         * Sequence of careteam which serves to order and provide a link.
1253         */
1254        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1255        @Description(shortDefinition="Number to covey order of careteam", formalDefinition="Sequence of careteam which serves to order and provide a link." )
1256        protected PositiveIntType sequence;
1257
1258        /**
1259         * The members of the team who provided the overall service.
1260         */
1261        @Child(name = "provider", type = {Practitioner.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=false)
1262        @Description(shortDefinition="Member of the Care Team", formalDefinition="The members of the team who provided the overall service." )
1263        protected Reference provider;
1264
1265        /**
1266         * The actual object that is the target of the reference (The members of the team who provided the overall service.)
1267         */
1268        protected Resource providerTarget;
1269
1270        /**
1271         * The practitioner who is billing and responsible for the claimed services rendered to the patient.
1272         */
1273        @Child(name = "responsible", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
1274        @Description(shortDefinition="Billing practitioner", formalDefinition="The practitioner who is billing and responsible for the claimed services rendered to the patient." )
1275        protected BooleanType responsible;
1276
1277        /**
1278         * The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.
1279         */
1280        @Child(name = "role", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1281        @Description(shortDefinition="Role on the team", formalDefinition="The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team." )
1282        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-careteamrole")
1283        protected CodeableConcept role;
1284
1285        /**
1286         * The qualification which is applicable for this service.
1287         */
1288        @Child(name = "qualification", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1289        @Description(shortDefinition="Type, classification or Specialization", formalDefinition="The qualification which is applicable for this service." )
1290        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provider-qualification")
1291        protected CodeableConcept qualification;
1292
1293        private static final long serialVersionUID = 1758966968L;
1294
1295    /**
1296     * Constructor
1297     */
1298      public CareTeamComponent() {
1299        super();
1300      }
1301
1302    /**
1303     * Constructor
1304     */
1305      public CareTeamComponent(PositiveIntType sequence, Reference provider) {
1306        super();
1307        this.sequence = sequence;
1308        this.provider = provider;
1309      }
1310
1311        /**
1312         * @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
1313         */
1314        public PositiveIntType getSequenceElement() { 
1315          if (this.sequence == null)
1316            if (Configuration.errorOnAutoCreate())
1317              throw new Error("Attempt to auto-create CareTeamComponent.sequence");
1318            else if (Configuration.doAutoCreate())
1319              this.sequence = new PositiveIntType(); // bb
1320          return this.sequence;
1321        }
1322
1323        public boolean hasSequenceElement() { 
1324          return this.sequence != null && !this.sequence.isEmpty();
1325        }
1326
1327        public boolean hasSequence() { 
1328          return this.sequence != null && !this.sequence.isEmpty();
1329        }
1330
1331        /**
1332         * @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
1333         */
1334        public CareTeamComponent setSequenceElement(PositiveIntType value) { 
1335          this.sequence = value;
1336          return this;
1337        }
1338
1339        /**
1340         * @return Sequence of careteam which serves to order and provide a link.
1341         */
1342        public int getSequence() { 
1343          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1344        }
1345
1346        /**
1347         * @param value Sequence of careteam which serves to order and provide a link.
1348         */
1349        public CareTeamComponent setSequence(int value) { 
1350            if (this.sequence == null)
1351              this.sequence = new PositiveIntType();
1352            this.sequence.setValue(value);
1353          return this;
1354        }
1355
1356        /**
1357         * @return {@link #provider} (The members of the team who provided the overall service.)
1358         */
1359        public Reference getProvider() { 
1360          if (this.provider == null)
1361            if (Configuration.errorOnAutoCreate())
1362              throw new Error("Attempt to auto-create CareTeamComponent.provider");
1363            else if (Configuration.doAutoCreate())
1364              this.provider = new Reference(); // cc
1365          return this.provider;
1366        }
1367
1368        public boolean hasProvider() { 
1369          return this.provider != null && !this.provider.isEmpty();
1370        }
1371
1372        /**
1373         * @param value {@link #provider} (The members of the team who provided the overall service.)
1374         */
1375        public CareTeamComponent setProvider(Reference value)  { 
1376          this.provider = value;
1377          return this;
1378        }
1379
1380        /**
1381         * @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.)
1382         */
1383        public Resource getProviderTarget() { 
1384          return this.providerTarget;
1385        }
1386
1387        /**
1388         * @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.)
1389         */
1390        public CareTeamComponent setProviderTarget(Resource value) { 
1391          this.providerTarget = value;
1392          return this;
1393        }
1394
1395        /**
1396         * @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
1397         */
1398        public BooleanType getResponsibleElement() { 
1399          if (this.responsible == null)
1400            if (Configuration.errorOnAutoCreate())
1401              throw new Error("Attempt to auto-create CareTeamComponent.responsible");
1402            else if (Configuration.doAutoCreate())
1403              this.responsible = new BooleanType(); // bb
1404          return this.responsible;
1405        }
1406
1407        public boolean hasResponsibleElement() { 
1408          return this.responsible != null && !this.responsible.isEmpty();
1409        }
1410
1411        public boolean hasResponsible() { 
1412          return this.responsible != null && !this.responsible.isEmpty();
1413        }
1414
1415        /**
1416         * @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
1417         */
1418        public CareTeamComponent setResponsibleElement(BooleanType value) { 
1419          this.responsible = value;
1420          return this;
1421        }
1422
1423        /**
1424         * @return The practitioner who is billing and responsible for the claimed services rendered to the patient.
1425         */
1426        public boolean getResponsible() { 
1427          return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
1428        }
1429
1430        /**
1431         * @param value The practitioner who is billing and responsible for the claimed services rendered to the patient.
1432         */
1433        public CareTeamComponent setResponsible(boolean value) { 
1434            if (this.responsible == null)
1435              this.responsible = new BooleanType();
1436            this.responsible.setValue(value);
1437          return this;
1438        }
1439
1440        /**
1441         * @return {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.)
1442         */
1443        public CodeableConcept getRole() { 
1444          if (this.role == null)
1445            if (Configuration.errorOnAutoCreate())
1446              throw new Error("Attempt to auto-create CareTeamComponent.role");
1447            else if (Configuration.doAutoCreate())
1448              this.role = new CodeableConcept(); // cc
1449          return this.role;
1450        }
1451
1452        public boolean hasRole() { 
1453          return this.role != null && !this.role.isEmpty();
1454        }
1455
1456        /**
1457         * @param value {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.)
1458         */
1459        public CareTeamComponent setRole(CodeableConcept value)  { 
1460          this.role = value;
1461          return this;
1462        }
1463
1464        /**
1465         * @return {@link #qualification} (The qualification which is applicable for this service.)
1466         */
1467        public CodeableConcept getQualification() { 
1468          if (this.qualification == null)
1469            if (Configuration.errorOnAutoCreate())
1470              throw new Error("Attempt to auto-create CareTeamComponent.qualification");
1471            else if (Configuration.doAutoCreate())
1472              this.qualification = new CodeableConcept(); // cc
1473          return this.qualification;
1474        }
1475
1476        public boolean hasQualification() { 
1477          return this.qualification != null && !this.qualification.isEmpty();
1478        }
1479
1480        /**
1481         * @param value {@link #qualification} (The qualification which is applicable for this service.)
1482         */
1483        public CareTeamComponent setQualification(CodeableConcept value)  { 
1484          this.qualification = value;
1485          return this;
1486        }
1487
1488        protected void listChildren(List<Property> children) {
1489          super.listChildren(children);
1490          children.add(new Property("sequence", "positiveInt", "Sequence of careteam which serves to order and provide a link.", 0, 1, sequence));
1491          children.add(new Property("provider", "Reference(Practitioner|Organization)", "The members of the team who provided the overall service.", 0, 1, provider));
1492          children.add(new Property("responsible", "boolean", "The practitioner who is billing and responsible for the claimed services rendered to the patient.", 0, 1, responsible));
1493          children.add(new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.", 0, 1, role));
1494          children.add(new Property("qualification", "CodeableConcept", "The qualification which is applicable for this service.", 0, 1, qualification));
1495        }
1496
1497        @Override
1498        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1499          switch (_hash) {
1500          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of careteam which serves to order and provide a link.", 0, 1, sequence);
1501          case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|Organization)", "The members of the team who provided the overall service.", 0, 1, provider);
1502          case 1847674614: /*responsible*/  return new Property("responsible", "boolean", "The practitioner who is billing and responsible for the claimed services rendered to the patient.", 0, 1, responsible);
1503          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.", 0, 1, role);
1504          case -631333393: /*qualification*/  return new Property("qualification", "CodeableConcept", "The qualification which is applicable for this service.", 0, 1, qualification);
1505          default: return super.getNamedProperty(_hash, _name, _checkValid);
1506          }
1507
1508        }
1509
1510      @Override
1511      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1512        switch (hash) {
1513        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1514        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
1515        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // BooleanType
1516        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
1517        case -631333393: /*qualification*/ return this.qualification == null ? new Base[0] : new Base[] {this.qualification}; // CodeableConcept
1518        default: return super.getProperty(hash, name, checkValid);
1519        }
1520
1521      }
1522
1523      @Override
1524      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1525        switch (hash) {
1526        case 1349547969: // sequence
1527          this.sequence = castToPositiveInt(value); // PositiveIntType
1528          return value;
1529        case -987494927: // provider
1530          this.provider = castToReference(value); // Reference
1531          return value;
1532        case 1847674614: // responsible
1533          this.responsible = castToBoolean(value); // BooleanType
1534          return value;
1535        case 3506294: // role
1536          this.role = castToCodeableConcept(value); // CodeableConcept
1537          return value;
1538        case -631333393: // qualification
1539          this.qualification = castToCodeableConcept(value); // CodeableConcept
1540          return value;
1541        default: return super.setProperty(hash, name, value);
1542        }
1543
1544      }
1545
1546      @Override
1547      public Base setProperty(String name, Base value) throws FHIRException {
1548        if (name.equals("sequence")) {
1549          this.sequence = castToPositiveInt(value); // PositiveIntType
1550        } else if (name.equals("provider")) {
1551          this.provider = castToReference(value); // Reference
1552        } else if (name.equals("responsible")) {
1553          this.responsible = castToBoolean(value); // BooleanType
1554        } else if (name.equals("role")) {
1555          this.role = castToCodeableConcept(value); // CodeableConcept
1556        } else if (name.equals("qualification")) {
1557          this.qualification = castToCodeableConcept(value); // CodeableConcept
1558        } else
1559          return super.setProperty(name, value);
1560        return value;
1561      }
1562
1563      @Override
1564      public Base makeProperty(int hash, String name) throws FHIRException {
1565        switch (hash) {
1566        case 1349547969:  return getSequenceElement();
1567        case -987494927:  return getProvider(); 
1568        case 1847674614:  return getResponsibleElement();
1569        case 3506294:  return getRole(); 
1570        case -631333393:  return getQualification(); 
1571        default: return super.makeProperty(hash, name);
1572        }
1573
1574      }
1575
1576      @Override
1577      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1578        switch (hash) {
1579        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1580        case -987494927: /*provider*/ return new String[] {"Reference"};
1581        case 1847674614: /*responsible*/ return new String[] {"boolean"};
1582        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
1583        case -631333393: /*qualification*/ return new String[] {"CodeableConcept"};
1584        default: return super.getTypesForProperty(hash, name);
1585        }
1586
1587      }
1588
1589      @Override
1590      public Base addChild(String name) throws FHIRException {
1591        if (name.equals("sequence")) {
1592          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
1593        }
1594        else if (name.equals("provider")) {
1595          this.provider = new Reference();
1596          return this.provider;
1597        }
1598        else if (name.equals("responsible")) {
1599          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.responsible");
1600        }
1601        else if (name.equals("role")) {
1602          this.role = new CodeableConcept();
1603          return this.role;
1604        }
1605        else if (name.equals("qualification")) {
1606          this.qualification = new CodeableConcept();
1607          return this.qualification;
1608        }
1609        else
1610          return super.addChild(name);
1611      }
1612
1613      public CareTeamComponent copy() {
1614        CareTeamComponent dst = new CareTeamComponent();
1615        copyValues(dst);
1616        dst.sequence = sequence == null ? null : sequence.copy();
1617        dst.provider = provider == null ? null : provider.copy();
1618        dst.responsible = responsible == null ? null : responsible.copy();
1619        dst.role = role == null ? null : role.copy();
1620        dst.qualification = qualification == null ? null : qualification.copy();
1621        return dst;
1622      }
1623
1624      @Override
1625      public boolean equalsDeep(Base other_) {
1626        if (!super.equalsDeep(other_))
1627          return false;
1628        if (!(other_ instanceof CareTeamComponent))
1629          return false;
1630        CareTeamComponent o = (CareTeamComponent) other_;
1631        return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true) && compareDeep(responsible, o.responsible, true)
1632           && compareDeep(role, o.role, true) && compareDeep(qualification, o.qualification, true);
1633      }
1634
1635      @Override
1636      public boolean equalsShallow(Base other_) {
1637        if (!super.equalsShallow(other_))
1638          return false;
1639        if (!(other_ instanceof CareTeamComponent))
1640          return false;
1641        CareTeamComponent o = (CareTeamComponent) other_;
1642        return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true)
1643          ;
1644      }
1645
1646      public boolean isEmpty() {
1647        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible
1648          , role, qualification);
1649      }
1650
1651  public String fhirType() {
1652    return "ExplanationOfBenefit.careTeam";
1653
1654  }
1655
1656  }
1657
1658    @Block()
1659    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1660        /**
1661         * Sequence of diagnosis which serves to provide a link.
1662         */
1663        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1664        @Description(shortDefinition="Number to covey order of diagnosis", formalDefinition="Sequence of diagnosis which serves to provide a link." )
1665        protected PositiveIntType sequence;
1666
1667        /**
1668         * The diagnosis.
1669         */
1670        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=2, min=1, max=1, modifier=false, summary=false)
1671        @Description(shortDefinition="Patient's diagnosis", formalDefinition="The diagnosis." )
1672        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
1673        protected Type diagnosis;
1674
1675        /**
1676         * The type of the Diagnosis, for example: admitting, primary, secondary, discharge.
1677         */
1678        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1679        @Description(shortDefinition="Timing or nature of the diagnosis", formalDefinition="The type of the Diagnosis, for example: admitting, primary, secondary, discharge." )
1680        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosistype")
1681        protected List<CodeableConcept> type;
1682
1683        /**
1684         * The package billing code, for example DRG, based on the assigned grouping code system.
1685         */
1686        @Child(name = "packageCode", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1687        @Description(shortDefinition="Package billing code", formalDefinition="The package billing code, for example DRG, based on the assigned grouping code system." )
1688        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
1689        protected CodeableConcept packageCode;
1690
1691        private static final long serialVersionUID = -350960873L;
1692
1693    /**
1694     * Constructor
1695     */
1696      public DiagnosisComponent() {
1697        super();
1698      }
1699
1700    /**
1701     * Constructor
1702     */
1703      public DiagnosisComponent(PositiveIntType sequence, Type diagnosis) {
1704        super();
1705        this.sequence = sequence;
1706        this.diagnosis = diagnosis;
1707      }
1708
1709        /**
1710         * @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
1711         */
1712        public PositiveIntType getSequenceElement() { 
1713          if (this.sequence == null)
1714            if (Configuration.errorOnAutoCreate())
1715              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
1716            else if (Configuration.doAutoCreate())
1717              this.sequence = new PositiveIntType(); // bb
1718          return this.sequence;
1719        }
1720
1721        public boolean hasSequenceElement() { 
1722          return this.sequence != null && !this.sequence.isEmpty();
1723        }
1724
1725        public boolean hasSequence() { 
1726          return this.sequence != null && !this.sequence.isEmpty();
1727        }
1728
1729        /**
1730         * @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
1731         */
1732        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
1733          this.sequence = value;
1734          return this;
1735        }
1736
1737        /**
1738         * @return Sequence of diagnosis which serves to provide a link.
1739         */
1740        public int getSequence() { 
1741          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1742        }
1743
1744        /**
1745         * @param value Sequence of diagnosis which serves to provide a link.
1746         */
1747        public DiagnosisComponent setSequence(int value) { 
1748            if (this.sequence == null)
1749              this.sequence = new PositiveIntType();
1750            this.sequence.setValue(value);
1751          return this;
1752        }
1753
1754        /**
1755         * @return {@link #diagnosis} (The diagnosis.)
1756         */
1757        public Type getDiagnosis() { 
1758          return this.diagnosis;
1759        }
1760
1761        /**
1762         * @return {@link #diagnosis} (The diagnosis.)
1763         */
1764        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
1765          if (this.diagnosis == null)
1766            return null;
1767          if (!(this.diagnosis instanceof CodeableConcept))
1768            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1769          return (CodeableConcept) this.diagnosis;
1770        }
1771
1772        public boolean hasDiagnosisCodeableConcept() {
1773            return this.diagnosis instanceof CodeableConcept;
1774        }
1775
1776        /**
1777         * @return {@link #diagnosis} (The diagnosis.)
1778         */
1779        public Reference getDiagnosisReference() throws FHIRException { 
1780          if (this.diagnosis == null)
1781            return null;
1782          if (!(this.diagnosis instanceof Reference))
1783            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1784          return (Reference) this.diagnosis;
1785        }
1786
1787        public boolean hasDiagnosisReference() {
1788            return this.diagnosis instanceof Reference;
1789        }
1790
1791        public boolean hasDiagnosis() { 
1792          return this.diagnosis != null && !this.diagnosis.isEmpty();
1793        }
1794
1795        /**
1796         * @param value {@link #diagnosis} (The diagnosis.)
1797         */
1798        public DiagnosisComponent setDiagnosis(Type value) throws FHIRFormatError { 
1799          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1800            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: "+value.fhirType());
1801          this.diagnosis = value;
1802          return this;
1803        }
1804
1805        /**
1806         * @return {@link #type} (The type of the Diagnosis, for example: admitting, primary, secondary, discharge.)
1807         */
1808        public List<CodeableConcept> getType() { 
1809          if (this.type == null)
1810            this.type = new ArrayList<CodeableConcept>();
1811          return this.type;
1812        }
1813
1814        /**
1815         * @return Returns a reference to <code>this</code> for easy method chaining
1816         */
1817        public DiagnosisComponent setType(List<CodeableConcept> theType) { 
1818          this.type = theType;
1819          return this;
1820        }
1821
1822        public boolean hasType() { 
1823          if (this.type == null)
1824            return false;
1825          for (CodeableConcept item : this.type)
1826            if (!item.isEmpty())
1827              return true;
1828          return false;
1829        }
1830
1831        public CodeableConcept addType() { //3
1832          CodeableConcept t = new CodeableConcept();
1833          if (this.type == null)
1834            this.type = new ArrayList<CodeableConcept>();
1835          this.type.add(t);
1836          return t;
1837        }
1838
1839        public DiagnosisComponent addType(CodeableConcept t) { //3
1840          if (t == null)
1841            return this;
1842          if (this.type == null)
1843            this.type = new ArrayList<CodeableConcept>();
1844          this.type.add(t);
1845          return this;
1846        }
1847
1848        /**
1849         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
1850         */
1851        public CodeableConcept getTypeFirstRep() { 
1852          if (getType().isEmpty()) {
1853            addType();
1854          }
1855          return getType().get(0);
1856        }
1857
1858        /**
1859         * @return {@link #packageCode} (The package billing code, for example DRG, based on the assigned grouping code system.)
1860         */
1861        public CodeableConcept getPackageCode() { 
1862          if (this.packageCode == null)
1863            if (Configuration.errorOnAutoCreate())
1864              throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
1865            else if (Configuration.doAutoCreate())
1866              this.packageCode = new CodeableConcept(); // cc
1867          return this.packageCode;
1868        }
1869
1870        public boolean hasPackageCode() { 
1871          return this.packageCode != null && !this.packageCode.isEmpty();
1872        }
1873
1874        /**
1875         * @param value {@link #packageCode} (The package billing code, for example DRG, based on the assigned grouping code system.)
1876         */
1877        public DiagnosisComponent setPackageCode(CodeableConcept value)  { 
1878          this.packageCode = value;
1879          return this;
1880        }
1881
1882        protected void listChildren(List<Property> children) {
1883          super.listChildren(children);
1884          children.add(new Property("sequence", "positiveInt", "Sequence of diagnosis which serves to provide a link.", 0, 1, sequence));
1885          children.add(new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis));
1886          children.add(new Property("type", "CodeableConcept", "The type of the Diagnosis, for example: admitting, primary, secondary, discharge.", 0, java.lang.Integer.MAX_VALUE, type));
1887          children.add(new Property("packageCode", "CodeableConcept", "The package billing code, for example DRG, based on the assigned grouping code system.", 0, 1, packageCode));
1888        }
1889
1890        @Override
1891        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1892          switch (_hash) {
1893          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of diagnosis which serves to provide a link.", 0, 1, sequence);
1894          case -1487009809: /*diagnosis[x]*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
1895          case 1196993265: /*diagnosis*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
1896          case 277781616: /*diagnosisCodeableConcept*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
1897          case 2050454362: /*diagnosisReference*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
1898          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of the Diagnosis, for example: admitting, primary, secondary, discharge.", 0, java.lang.Integer.MAX_VALUE, type);
1899          case 908444499: /*packageCode*/  return new Property("packageCode", "CodeableConcept", "The package billing code, for example DRG, based on the assigned grouping code system.", 0, 1, packageCode);
1900          default: return super.getNamedProperty(_hash, _name, _checkValid);
1901          }
1902
1903        }
1904
1905      @Override
1906      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1907        switch (hash) {
1908        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1909        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // Type
1910        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
1911        case 908444499: /*packageCode*/ return this.packageCode == null ? new Base[0] : new Base[] {this.packageCode}; // CodeableConcept
1912        default: return super.getProperty(hash, name, checkValid);
1913        }
1914
1915      }
1916
1917      @Override
1918      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1919        switch (hash) {
1920        case 1349547969: // sequence
1921          this.sequence = castToPositiveInt(value); // PositiveIntType
1922          return value;
1923        case 1196993265: // diagnosis
1924          this.diagnosis = castToType(value); // Type
1925          return value;
1926        case 3575610: // type
1927          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
1928          return value;
1929        case 908444499: // packageCode
1930          this.packageCode = castToCodeableConcept(value); // CodeableConcept
1931          return value;
1932        default: return super.setProperty(hash, name, value);
1933        }
1934
1935      }
1936
1937      @Override
1938      public Base setProperty(String name, Base value) throws FHIRException {
1939        if (name.equals("sequence")) {
1940          this.sequence = castToPositiveInt(value); // PositiveIntType
1941        } else if (name.equals("diagnosis[x]")) {
1942          this.diagnosis = castToType(value); // Type
1943        } else if (name.equals("type")) {
1944          this.getType().add(castToCodeableConcept(value));
1945        } else if (name.equals("packageCode")) {
1946          this.packageCode = castToCodeableConcept(value); // CodeableConcept
1947        } else
1948          return super.setProperty(name, value);
1949        return value;
1950      }
1951
1952      @Override
1953      public Base makeProperty(int hash, String name) throws FHIRException {
1954        switch (hash) {
1955        case 1349547969:  return getSequenceElement();
1956        case -1487009809:  return getDiagnosis(); 
1957        case 1196993265:  return getDiagnosis(); 
1958        case 3575610:  return addType(); 
1959        case 908444499:  return getPackageCode(); 
1960        default: return super.makeProperty(hash, name);
1961        }
1962
1963      }
1964
1965      @Override
1966      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1967        switch (hash) {
1968        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1969        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
1970        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1971        case 908444499: /*packageCode*/ return new String[] {"CodeableConcept"};
1972        default: return super.getTypesForProperty(hash, name);
1973        }
1974
1975      }
1976
1977      @Override
1978      public Base addChild(String name) throws FHIRException {
1979        if (name.equals("sequence")) {
1980          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
1981        }
1982        else if (name.equals("diagnosisCodeableConcept")) {
1983          this.diagnosis = new CodeableConcept();
1984          return this.diagnosis;
1985        }
1986        else if (name.equals("diagnosisReference")) {
1987          this.diagnosis = new Reference();
1988          return this.diagnosis;
1989        }
1990        else if (name.equals("type")) {
1991          return addType();
1992        }
1993        else if (name.equals("packageCode")) {
1994          this.packageCode = new CodeableConcept();
1995          return this.packageCode;
1996        }
1997        else
1998          return super.addChild(name);
1999      }
2000
2001      public DiagnosisComponent copy() {
2002        DiagnosisComponent dst = new DiagnosisComponent();
2003        copyValues(dst);
2004        dst.sequence = sequence == null ? null : sequence.copy();
2005        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
2006        if (type != null) {
2007          dst.type = new ArrayList<CodeableConcept>();
2008          for (CodeableConcept i : type)
2009            dst.type.add(i.copy());
2010        };
2011        dst.packageCode = packageCode == null ? null : packageCode.copy();
2012        return dst;
2013      }
2014
2015      @Override
2016      public boolean equalsDeep(Base other_) {
2017        if (!super.equalsDeep(other_))
2018          return false;
2019        if (!(other_ instanceof DiagnosisComponent))
2020          return false;
2021        DiagnosisComponent o = (DiagnosisComponent) other_;
2022        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(type, o.type, true)
2023           && compareDeep(packageCode, o.packageCode, true);
2024      }
2025
2026      @Override
2027      public boolean equalsShallow(Base other_) {
2028        if (!super.equalsShallow(other_))
2029          return false;
2030        if (!(other_ instanceof DiagnosisComponent))
2031          return false;
2032        DiagnosisComponent o = (DiagnosisComponent) other_;
2033        return compareValues(sequence, o.sequence, true);
2034      }
2035
2036      public boolean isEmpty() {
2037        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type
2038          , packageCode);
2039      }
2040
2041  public String fhirType() {
2042    return "ExplanationOfBenefit.diagnosis";
2043
2044  }
2045
2046  }
2047
2048    @Block()
2049    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2050        /**
2051         * Sequence of procedures which serves to order and provide a link.
2052         */
2053        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2054        @Description(shortDefinition="Procedure sequence for reference", formalDefinition="Sequence of procedures which serves to order and provide a link." )
2055        protected PositiveIntType sequence;
2056
2057        /**
2058         * Date and optionally time the procedure was performed .
2059         */
2060        @Child(name = "date", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2061        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed ." )
2062        protected DateTimeType date;
2063
2064        /**
2065         * The procedure code.
2066         */
2067        @Child(name = "procedure", type = {CodeableConcept.class, Procedure.class}, order=3, min=1, max=1, modifier=false, summary=false)
2068        @Description(shortDefinition="Patient's list of procedures performed", formalDefinition="The procedure code." )
2069        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10-procedures")
2070        protected Type procedure;
2071
2072        private static final long serialVersionUID = 864307347L;
2073
2074    /**
2075     * Constructor
2076     */
2077      public ProcedureComponent() {
2078        super();
2079      }
2080
2081    /**
2082     * Constructor
2083     */
2084      public ProcedureComponent(PositiveIntType sequence, Type procedure) {
2085        super();
2086        this.sequence = sequence;
2087        this.procedure = procedure;
2088      }
2089
2090        /**
2091         * @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
2092         */
2093        public PositiveIntType getSequenceElement() { 
2094          if (this.sequence == null)
2095            if (Configuration.errorOnAutoCreate())
2096              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2097            else if (Configuration.doAutoCreate())
2098              this.sequence = new PositiveIntType(); // bb
2099          return this.sequence;
2100        }
2101
2102        public boolean hasSequenceElement() { 
2103          return this.sequence != null && !this.sequence.isEmpty();
2104        }
2105
2106        public boolean hasSequence() { 
2107          return this.sequence != null && !this.sequence.isEmpty();
2108        }
2109
2110        /**
2111         * @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
2112         */
2113        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
2114          this.sequence = value;
2115          return this;
2116        }
2117
2118        /**
2119         * @return Sequence of procedures which serves to order and provide a link.
2120         */
2121        public int getSequence() { 
2122          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2123        }
2124
2125        /**
2126         * @param value Sequence of procedures which serves to order and provide a link.
2127         */
2128        public ProcedureComponent setSequence(int value) { 
2129            if (this.sequence == null)
2130              this.sequence = new PositiveIntType();
2131            this.sequence.setValue(value);
2132          return this;
2133        }
2134
2135        /**
2136         * @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
2137         */
2138        public DateTimeType getDateElement() { 
2139          if (this.date == null)
2140            if (Configuration.errorOnAutoCreate())
2141              throw new Error("Attempt to auto-create ProcedureComponent.date");
2142            else if (Configuration.doAutoCreate())
2143              this.date = new DateTimeType(); // bb
2144          return this.date;
2145        }
2146
2147        public boolean hasDateElement() { 
2148          return this.date != null && !this.date.isEmpty();
2149        }
2150
2151        public boolean hasDate() { 
2152          return this.date != null && !this.date.isEmpty();
2153        }
2154
2155        /**
2156         * @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
2157         */
2158        public ProcedureComponent setDateElement(DateTimeType value) { 
2159          this.date = value;
2160          return this;
2161        }
2162
2163        /**
2164         * @return Date and optionally time the procedure was performed .
2165         */
2166        public Date getDate() { 
2167          return this.date == null ? null : this.date.getValue();
2168        }
2169
2170        /**
2171         * @param value Date and optionally time the procedure was performed .
2172         */
2173        public ProcedureComponent setDate(Date value) { 
2174          if (value == null)
2175            this.date = null;
2176          else {
2177            if (this.date == null)
2178              this.date = new DateTimeType();
2179            this.date.setValue(value);
2180          }
2181          return this;
2182        }
2183
2184        /**
2185         * @return {@link #procedure} (The procedure code.)
2186         */
2187        public Type getProcedure() { 
2188          return this.procedure;
2189        }
2190
2191        /**
2192         * @return {@link #procedure} (The procedure code.)
2193         */
2194        public CodeableConcept getProcedureCodeableConcept() throws FHIRException { 
2195          if (this.procedure == null)
2196            return null;
2197          if (!(this.procedure instanceof CodeableConcept))
2198            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.procedure.getClass().getName()+" was encountered");
2199          return (CodeableConcept) this.procedure;
2200        }
2201
2202        public boolean hasProcedureCodeableConcept() {
2203            return this.procedure instanceof CodeableConcept;
2204        }
2205
2206        /**
2207         * @return {@link #procedure} (The procedure code.)
2208         */
2209        public Reference getProcedureReference() throws FHIRException { 
2210          if (this.procedure == null)
2211            return null;
2212          if (!(this.procedure instanceof Reference))
2213            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
2214          return (Reference) this.procedure;
2215        }
2216
2217        public boolean hasProcedureReference() {
2218            return this.procedure instanceof Reference;
2219        }
2220
2221        public boolean hasProcedure() { 
2222          return this.procedure != null && !this.procedure.isEmpty();
2223        }
2224
2225        /**
2226         * @param value {@link #procedure} (The procedure code.)
2227         */
2228        public ProcedureComponent setProcedure(Type value) throws FHIRFormatError { 
2229          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2230            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: "+value.fhirType());
2231          this.procedure = value;
2232          return this;
2233        }
2234
2235        protected void listChildren(List<Property> children) {
2236          super.listChildren(children);
2237          children.add(new Property("sequence", "positiveInt", "Sequence of procedures which serves to order and provide a link.", 0, 1, sequence));
2238          children.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed .", 0, 1, date));
2239          children.add(new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure));
2240        }
2241
2242        @Override
2243        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2244          switch (_hash) {
2245          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of procedures which serves to order and provide a link.", 0, 1, sequence);
2246          case 3076014: /*date*/  return new Property("date", "dateTime", "Date and optionally time the procedure was performed .", 0, 1, date);
2247          case 1640074445: /*procedure[x]*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2248          case -1095204141: /*procedure*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2249          case -1284783026: /*procedureCodeableConcept*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2250          case 881809848: /*procedureReference*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2251          default: return super.getNamedProperty(_hash, _name, _checkValid);
2252          }
2253
2254        }
2255
2256      @Override
2257      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2258        switch (hash) {
2259        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2260        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2261        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // Type
2262        default: return super.getProperty(hash, name, checkValid);
2263        }
2264
2265      }
2266
2267      @Override
2268      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2269        switch (hash) {
2270        case 1349547969: // sequence
2271          this.sequence = castToPositiveInt(value); // PositiveIntType
2272          return value;
2273        case 3076014: // date
2274          this.date = castToDateTime(value); // DateTimeType
2275          return value;
2276        case -1095204141: // procedure
2277          this.procedure = castToType(value); // Type
2278          return value;
2279        default: return super.setProperty(hash, name, value);
2280        }
2281
2282      }
2283
2284      @Override
2285      public Base setProperty(String name, Base value) throws FHIRException {
2286        if (name.equals("sequence")) {
2287          this.sequence = castToPositiveInt(value); // PositiveIntType
2288        } else if (name.equals("date")) {
2289          this.date = castToDateTime(value); // DateTimeType
2290        } else if (name.equals("procedure[x]")) {
2291          this.procedure = castToType(value); // Type
2292        } else
2293          return super.setProperty(name, value);
2294        return value;
2295      }
2296
2297      @Override
2298      public Base makeProperty(int hash, String name) throws FHIRException {
2299        switch (hash) {
2300        case 1349547969:  return getSequenceElement();
2301        case 3076014:  return getDateElement();
2302        case 1640074445:  return getProcedure(); 
2303        case -1095204141:  return getProcedure(); 
2304        default: return super.makeProperty(hash, name);
2305        }
2306
2307      }
2308
2309      @Override
2310      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2311        switch (hash) {
2312        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2313        case 3076014: /*date*/ return new String[] {"dateTime"};
2314        case -1095204141: /*procedure*/ return new String[] {"CodeableConcept", "Reference"};
2315        default: return super.getTypesForProperty(hash, name);
2316        }
2317
2318      }
2319
2320      @Override
2321      public Base addChild(String name) throws FHIRException {
2322        if (name.equals("sequence")) {
2323          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
2324        }
2325        else if (name.equals("date")) {
2326          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.date");
2327        }
2328        else if (name.equals("procedureCodeableConcept")) {
2329          this.procedure = new CodeableConcept();
2330          return this.procedure;
2331        }
2332        else if (name.equals("procedureReference")) {
2333          this.procedure = new Reference();
2334          return this.procedure;
2335        }
2336        else
2337          return super.addChild(name);
2338      }
2339
2340      public ProcedureComponent copy() {
2341        ProcedureComponent dst = new ProcedureComponent();
2342        copyValues(dst);
2343        dst.sequence = sequence == null ? null : sequence.copy();
2344        dst.date = date == null ? null : date.copy();
2345        dst.procedure = procedure == null ? null : procedure.copy();
2346        return dst;
2347      }
2348
2349      @Override
2350      public boolean equalsDeep(Base other_) {
2351        if (!super.equalsDeep(other_))
2352          return false;
2353        if (!(other_ instanceof ProcedureComponent))
2354          return false;
2355        ProcedureComponent o = (ProcedureComponent) other_;
2356        return compareDeep(sequence, o.sequence, true) && compareDeep(date, o.date, true) && compareDeep(procedure, o.procedure, true)
2357          ;
2358      }
2359
2360      @Override
2361      public boolean equalsShallow(Base other_) {
2362        if (!super.equalsShallow(other_))
2363          return false;
2364        if (!(other_ instanceof ProcedureComponent))
2365          return false;
2366        ProcedureComponent o = (ProcedureComponent) other_;
2367        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
2368      }
2369
2370      public boolean isEmpty() {
2371        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, date, procedure
2372          );
2373      }
2374
2375  public String fhirType() {
2376    return "ExplanationOfBenefit.procedure";
2377
2378  }
2379
2380  }
2381
2382    @Block()
2383    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
2384        /**
2385         * Reference to the program or plan identification, underwriter or payor.
2386         */
2387        @Child(name = "coverage", type = {Coverage.class}, order=1, min=0, max=1, modifier=false, summary=false)
2388        @Description(shortDefinition="Insurance information", formalDefinition="Reference to the program or plan identification, underwriter or payor." )
2389        protected Reference coverage;
2390
2391        /**
2392         * The actual object that is the target of the reference (Reference to the program or plan identification, underwriter or payor.)
2393         */
2394        protected Coverage coverageTarget;
2395
2396        /**
2397         * A list of references from the Insurer to which these services pertain.
2398         */
2399        @Child(name = "preAuthRef", type = {StringType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2400        @Description(shortDefinition="Pre-Authorization/Determination Reference", formalDefinition="A list of references from the Insurer to which these services pertain." )
2401        protected List<StringType> preAuthRef;
2402
2403        private static final long serialVersionUID = -870298727L;
2404
2405    /**
2406     * Constructor
2407     */
2408      public InsuranceComponent() {
2409        super();
2410      }
2411
2412        /**
2413         * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
2414         */
2415        public Reference getCoverage() { 
2416          if (this.coverage == null)
2417            if (Configuration.errorOnAutoCreate())
2418              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2419            else if (Configuration.doAutoCreate())
2420              this.coverage = new Reference(); // cc
2421          return this.coverage;
2422        }
2423
2424        public boolean hasCoverage() { 
2425          return this.coverage != null && !this.coverage.isEmpty();
2426        }
2427
2428        /**
2429         * @param value {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
2430         */
2431        public InsuranceComponent setCoverage(Reference value)  { 
2432          this.coverage = value;
2433          return this;
2434        }
2435
2436        /**
2437         * @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.)
2438         */
2439        public Coverage getCoverageTarget() { 
2440          if (this.coverageTarget == null)
2441            if (Configuration.errorOnAutoCreate())
2442              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2443            else if (Configuration.doAutoCreate())
2444              this.coverageTarget = new Coverage(); // aa
2445          return this.coverageTarget;
2446        }
2447
2448        /**
2449         * @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.)
2450         */
2451        public InsuranceComponent setCoverageTarget(Coverage value) { 
2452          this.coverageTarget = value;
2453          return this;
2454        }
2455
2456        /**
2457         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2458         */
2459        public List<StringType> getPreAuthRef() { 
2460          if (this.preAuthRef == null)
2461            this.preAuthRef = new ArrayList<StringType>();
2462          return this.preAuthRef;
2463        }
2464
2465        /**
2466         * @return Returns a reference to <code>this</code> for easy method chaining
2467         */
2468        public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) { 
2469          this.preAuthRef = thePreAuthRef;
2470          return this;
2471        }
2472
2473        public boolean hasPreAuthRef() { 
2474          if (this.preAuthRef == null)
2475            return false;
2476          for (StringType item : this.preAuthRef)
2477            if (!item.isEmpty())
2478              return true;
2479          return false;
2480        }
2481
2482        /**
2483         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2484         */
2485        public StringType addPreAuthRefElement() {//2 
2486          StringType t = new StringType();
2487          if (this.preAuthRef == null)
2488            this.preAuthRef = new ArrayList<StringType>();
2489          this.preAuthRef.add(t);
2490          return t;
2491        }
2492
2493        /**
2494         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2495         */
2496        public InsuranceComponent addPreAuthRef(String value) { //1
2497          StringType t = new StringType();
2498          t.setValue(value);
2499          if (this.preAuthRef == null)
2500            this.preAuthRef = new ArrayList<StringType>();
2501          this.preAuthRef.add(t);
2502          return this;
2503        }
2504
2505        /**
2506         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2507         */
2508        public boolean hasPreAuthRef(String value) { 
2509          if (this.preAuthRef == null)
2510            return false;
2511          for (StringType v : this.preAuthRef)
2512            if (v.getValue().equals(value)) // string
2513              return true;
2514          return false;
2515        }
2516
2517        protected void listChildren(List<Property> children) {
2518          super.listChildren(children);
2519          children.add(new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, 1, coverage));
2520          children.add(new Property("preAuthRef", "string", "A list of references from the Insurer to which these services pertain.", 0, java.lang.Integer.MAX_VALUE, preAuthRef));
2521        }
2522
2523        @Override
2524        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2525          switch (_hash) {
2526          case -351767064: /*coverage*/  return new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, 1, coverage);
2527          case 522246568: /*preAuthRef*/  return new Property("preAuthRef", "string", "A list of references from the Insurer to which these services pertain.", 0, java.lang.Integer.MAX_VALUE, preAuthRef);
2528          default: return super.getNamedProperty(_hash, _name, _checkValid);
2529          }
2530
2531        }
2532
2533      @Override
2534      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2535        switch (hash) {
2536        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
2537        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
2538        default: return super.getProperty(hash, name, checkValid);
2539        }
2540
2541      }
2542
2543      @Override
2544      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2545        switch (hash) {
2546        case -351767064: // coverage
2547          this.coverage = castToReference(value); // Reference
2548          return value;
2549        case 522246568: // preAuthRef
2550          this.getPreAuthRef().add(castToString(value)); // StringType
2551          return value;
2552        default: return super.setProperty(hash, name, value);
2553        }
2554
2555      }
2556
2557      @Override
2558      public Base setProperty(String name, Base value) throws FHIRException {
2559        if (name.equals("coverage")) {
2560          this.coverage = castToReference(value); // Reference
2561        } else if (name.equals("preAuthRef")) {
2562          this.getPreAuthRef().add(castToString(value));
2563        } else
2564          return super.setProperty(name, value);
2565        return value;
2566      }
2567
2568      @Override
2569      public Base makeProperty(int hash, String name) throws FHIRException {
2570        switch (hash) {
2571        case -351767064:  return getCoverage(); 
2572        case 522246568:  return addPreAuthRefElement();
2573        default: return super.makeProperty(hash, name);
2574        }
2575
2576      }
2577
2578      @Override
2579      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2580        switch (hash) {
2581        case -351767064: /*coverage*/ return new String[] {"Reference"};
2582        case 522246568: /*preAuthRef*/ return new String[] {"string"};
2583        default: return super.getTypesForProperty(hash, name);
2584        }
2585
2586      }
2587
2588      @Override
2589      public Base addChild(String name) throws FHIRException {
2590        if (name.equals("coverage")) {
2591          this.coverage = new Reference();
2592          return this.coverage;
2593        }
2594        else if (name.equals("preAuthRef")) {
2595          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.preAuthRef");
2596        }
2597        else
2598          return super.addChild(name);
2599      }
2600
2601      public InsuranceComponent copy() {
2602        InsuranceComponent dst = new InsuranceComponent();
2603        copyValues(dst);
2604        dst.coverage = coverage == null ? null : coverage.copy();
2605        if (preAuthRef != null) {
2606          dst.preAuthRef = new ArrayList<StringType>();
2607          for (StringType i : preAuthRef)
2608            dst.preAuthRef.add(i.copy());
2609        };
2610        return dst;
2611      }
2612
2613      @Override
2614      public boolean equalsDeep(Base other_) {
2615        if (!super.equalsDeep(other_))
2616          return false;
2617        if (!(other_ instanceof InsuranceComponent))
2618          return false;
2619        InsuranceComponent o = (InsuranceComponent) other_;
2620        return compareDeep(coverage, o.coverage, true) && compareDeep(preAuthRef, o.preAuthRef, true);
2621      }
2622
2623      @Override
2624      public boolean equalsShallow(Base other_) {
2625        if (!super.equalsShallow(other_))
2626          return false;
2627        if (!(other_ instanceof InsuranceComponent))
2628          return false;
2629        InsuranceComponent o = (InsuranceComponent) other_;
2630        return compareValues(preAuthRef, o.preAuthRef, true);
2631      }
2632
2633      public boolean isEmpty() {
2634        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(coverage, preAuthRef);
2635      }
2636
2637  public String fhirType() {
2638    return "ExplanationOfBenefit.insurance";
2639
2640  }
2641
2642  }
2643
2644    @Block()
2645    public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
2646        /**
2647         * Date of an accident which these services are addressing.
2648         */
2649        @Child(name = "date", type = {DateType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2650        @Description(shortDefinition="When the accident occurred", formalDefinition="Date of an accident which these services are addressing." )
2651        protected DateType date;
2652
2653        /**
2654         * Type of accident: work, auto, etc.
2655         */
2656        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
2657        @Description(shortDefinition="The nature of the accident", formalDefinition="Type of accident: work, auto, etc." )
2658        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActIncidentCode")
2659        protected CodeableConcept type;
2660
2661        /**
2662         * Where the accident occurred.
2663         */
2664        @Child(name = "location", type = {Address.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=false)
2665        @Description(shortDefinition="Accident Place", formalDefinition="Where the accident occurred." )
2666        protected Type location;
2667
2668        private static final long serialVersionUID = 622904984L;
2669
2670    /**
2671     * Constructor
2672     */
2673      public AccidentComponent() {
2674        super();
2675      }
2676
2677        /**
2678         * @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
2679         */
2680        public DateType getDateElement() { 
2681          if (this.date == null)
2682            if (Configuration.errorOnAutoCreate())
2683              throw new Error("Attempt to auto-create AccidentComponent.date");
2684            else if (Configuration.doAutoCreate())
2685              this.date = new DateType(); // bb
2686          return this.date;
2687        }
2688
2689        public boolean hasDateElement() { 
2690          return this.date != null && !this.date.isEmpty();
2691        }
2692
2693        public boolean hasDate() { 
2694          return this.date != null && !this.date.isEmpty();
2695        }
2696
2697        /**
2698         * @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
2699         */
2700        public AccidentComponent setDateElement(DateType value) { 
2701          this.date = value;
2702          return this;
2703        }
2704
2705        /**
2706         * @return Date of an accident which these services are addressing.
2707         */
2708        public Date getDate() { 
2709          return this.date == null ? null : this.date.getValue();
2710        }
2711
2712        /**
2713         * @param value Date of an accident which these services are addressing.
2714         */
2715        public AccidentComponent setDate(Date value) { 
2716          if (value == null)
2717            this.date = null;
2718          else {
2719            if (this.date == null)
2720              this.date = new DateType();
2721            this.date.setValue(value);
2722          }
2723          return this;
2724        }
2725
2726        /**
2727         * @return {@link #type} (Type of accident: work, auto, etc.)
2728         */
2729        public CodeableConcept getType() { 
2730          if (this.type == null)
2731            if (Configuration.errorOnAutoCreate())
2732              throw new Error("Attempt to auto-create AccidentComponent.type");
2733            else if (Configuration.doAutoCreate())
2734              this.type = new CodeableConcept(); // cc
2735          return this.type;
2736        }
2737
2738        public boolean hasType() { 
2739          return this.type != null && !this.type.isEmpty();
2740        }
2741
2742        /**
2743         * @param value {@link #type} (Type of accident: work, auto, etc.)
2744         */
2745        public AccidentComponent setType(CodeableConcept value)  { 
2746          this.type = value;
2747          return this;
2748        }
2749
2750        /**
2751         * @return {@link #location} (Where the accident occurred.)
2752         */
2753        public Type getLocation() { 
2754          return this.location;
2755        }
2756
2757        /**
2758         * @return {@link #location} (Where the accident occurred.)
2759         */
2760        public Address getLocationAddress() throws FHIRException { 
2761          if (this.location == null)
2762            return null;
2763          if (!(this.location instanceof Address))
2764            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
2765          return (Address) this.location;
2766        }
2767
2768        public boolean hasLocationAddress() {
2769            return this.location instanceof Address;
2770        }
2771
2772        /**
2773         * @return {@link #location} (Where the accident occurred.)
2774         */
2775        public Reference getLocationReference() throws FHIRException { 
2776          if (this.location == null)
2777            return null;
2778          if (!(this.location instanceof Reference))
2779            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
2780          return (Reference) this.location;
2781        }
2782
2783        public boolean hasLocationReference() {
2784            return this.location instanceof Reference;
2785        }
2786
2787        public boolean hasLocation() { 
2788          return this.location != null && !this.location.isEmpty();
2789        }
2790
2791        /**
2792         * @param value {@link #location} (Where the accident occurred.)
2793         */
2794        public AccidentComponent setLocation(Type value) throws FHIRFormatError { 
2795          if (value != null && !(value instanceof Address || value instanceof Reference))
2796            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.accident.location[x]: "+value.fhirType());
2797          this.location = value;
2798          return this;
2799        }
2800
2801        protected void listChildren(List<Property> children) {
2802          super.listChildren(children);
2803          children.add(new Property("date", "date", "Date of an accident which these services are addressing.", 0, 1, date));
2804          children.add(new Property("type", "CodeableConcept", "Type of accident: work, auto, etc.", 0, 1, type));
2805          children.add(new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location));
2806        }
2807
2808        @Override
2809        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2810          switch (_hash) {
2811          case 3076014: /*date*/  return new Property("date", "date", "Date of an accident which these services are addressing.", 0, 1, date);
2812          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of accident: work, auto, etc.", 0, 1, type);
2813          case 552316075: /*location[x]*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
2814          case 1901043637: /*location*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
2815          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
2816          case 755866390: /*locationReference*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
2817          default: return super.getNamedProperty(_hash, _name, _checkValid);
2818          }
2819
2820        }
2821
2822      @Override
2823      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2824        switch (hash) {
2825        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
2826        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2827        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
2828        default: return super.getProperty(hash, name, checkValid);
2829        }
2830
2831      }
2832
2833      @Override
2834      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2835        switch (hash) {
2836        case 3076014: // date
2837          this.date = castToDate(value); // DateType
2838          return value;
2839        case 3575610: // type
2840          this.type = castToCodeableConcept(value); // CodeableConcept
2841          return value;
2842        case 1901043637: // location
2843          this.location = castToType(value); // Type
2844          return value;
2845        default: return super.setProperty(hash, name, value);
2846        }
2847
2848      }
2849
2850      @Override
2851      public Base setProperty(String name, Base value) throws FHIRException {
2852        if (name.equals("date")) {
2853          this.date = castToDate(value); // DateType
2854        } else if (name.equals("type")) {
2855          this.type = castToCodeableConcept(value); // CodeableConcept
2856        } else if (name.equals("location[x]")) {
2857          this.location = castToType(value); // Type
2858        } else
2859          return super.setProperty(name, value);
2860        return value;
2861      }
2862
2863      @Override
2864      public Base makeProperty(int hash, String name) throws FHIRException {
2865        switch (hash) {
2866        case 3076014:  return getDateElement();
2867        case 3575610:  return getType(); 
2868        case 552316075:  return getLocation(); 
2869        case 1901043637:  return getLocation(); 
2870        default: return super.makeProperty(hash, name);
2871        }
2872
2873      }
2874
2875      @Override
2876      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2877        switch (hash) {
2878        case 3076014: /*date*/ return new String[] {"date"};
2879        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2880        case 1901043637: /*location*/ return new String[] {"Address", "Reference"};
2881        default: return super.getTypesForProperty(hash, name);
2882        }
2883
2884      }
2885
2886      @Override
2887      public Base addChild(String name) throws FHIRException {
2888        if (name.equals("date")) {
2889          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.date");
2890        }
2891        else if (name.equals("type")) {
2892          this.type = new CodeableConcept();
2893          return this.type;
2894        }
2895        else if (name.equals("locationAddress")) {
2896          this.location = new Address();
2897          return this.location;
2898        }
2899        else if (name.equals("locationReference")) {
2900          this.location = new Reference();
2901          return this.location;
2902        }
2903        else
2904          return super.addChild(name);
2905      }
2906
2907      public AccidentComponent copy() {
2908        AccidentComponent dst = new AccidentComponent();
2909        copyValues(dst);
2910        dst.date = date == null ? null : date.copy();
2911        dst.type = type == null ? null : type.copy();
2912        dst.location = location == null ? null : location.copy();
2913        return dst;
2914      }
2915
2916      @Override
2917      public boolean equalsDeep(Base other_) {
2918        if (!super.equalsDeep(other_))
2919          return false;
2920        if (!(other_ instanceof AccidentComponent))
2921          return false;
2922        AccidentComponent o = (AccidentComponent) other_;
2923        return compareDeep(date, o.date, true) && compareDeep(type, o.type, true) && compareDeep(location, o.location, true)
2924          ;
2925      }
2926
2927      @Override
2928      public boolean equalsShallow(Base other_) {
2929        if (!super.equalsShallow(other_))
2930          return false;
2931        if (!(other_ instanceof AccidentComponent))
2932          return false;
2933        AccidentComponent o = (AccidentComponent) other_;
2934        return compareValues(date, o.date, true);
2935      }
2936
2937      public boolean isEmpty() {
2938        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
2939      }
2940
2941  public String fhirType() {
2942    return "ExplanationOfBenefit.accident";
2943
2944  }
2945
2946  }
2947
2948    @Block()
2949    public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
2950        /**
2951         * A service line number.
2952         */
2953        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2954        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
2955        protected PositiveIntType sequence;
2956
2957        /**
2958         * Careteam applicable for this service or product line.
2959         */
2960        @Child(name = "careTeamLinkId", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2961        @Description(shortDefinition="Applicable careteam members", formalDefinition="Careteam applicable for this service or product line." )
2962        protected List<PositiveIntType> careTeamLinkId;
2963
2964        /**
2965         * Diagnosis applicable for this service or product line.
2966         */
2967        @Child(name = "diagnosisLinkId", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2968        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnosis applicable for this service or product line." )
2969        protected List<PositiveIntType> diagnosisLinkId;
2970
2971        /**
2972         * Procedures applicable for this service or product line.
2973         */
2974        @Child(name = "procedureLinkId", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2975        @Description(shortDefinition="Applicable procedures", formalDefinition="Procedures applicable for this service or product line." )
2976        protected List<PositiveIntType> procedureLinkId;
2977
2978        /**
2979         * Exceptions, special conditions and supporting information pplicable for this service or product line.
2980         */
2981        @Child(name = "informationLinkId", type = {PositiveIntType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2982        @Description(shortDefinition="Applicable exception and supporting information", formalDefinition="Exceptions, special conditions and supporting information pplicable for this service or product line." )
2983        protected List<PositiveIntType> informationLinkId;
2984
2985        /**
2986         * The type of reveneu or cost center providing the product and/or service.
2987         */
2988        @Child(name = "revenue", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
2989        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
2990        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
2991        protected CodeableConcept revenue;
2992
2993        /**
2994         * Health Care Service Type Codes  to identify the classification of service or benefits.
2995         */
2996        @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
2997        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
2998        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
2999        protected CodeableConcept category;
3000
3001        /**
3002         * 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'.
3003         */
3004        @Child(name = "service", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
3005        @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'." )
3006        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
3007        protected CodeableConcept service;
3008
3009        /**
3010         * 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.
3011         */
3012        @Child(name = "modifier", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3013        @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." )
3014        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
3015        protected List<CodeableConcept> modifier;
3016
3017        /**
3018         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
3019         */
3020        @Child(name = "programCode", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3021        @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." )
3022        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
3023        protected List<CodeableConcept> programCode;
3024
3025        /**
3026         * The date or dates when the enclosed suite of services were performed or completed.
3027         */
3028        @Child(name = "serviced", type = {DateType.class, Period.class}, order=11, min=0, max=1, modifier=false, summary=false)
3029        @Description(shortDefinition="Date or dates of Service", formalDefinition="The date or dates when the enclosed suite of services were performed or completed." )
3030        protected Type serviced;
3031
3032        /**
3033         * Where the service was provided.
3034         */
3035        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
3036        @Description(shortDefinition="Place of service", formalDefinition="Where the service was provided." )
3037        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
3038        protected Type location;
3039
3040        /**
3041         * The number of repetitions of a service or product.
3042         */
3043        @Child(name = "quantity", type = {SimpleQuantity.class}, order=13, min=0, max=1, modifier=false, summary=false)
3044        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
3045        protected SimpleQuantity quantity;
3046
3047        /**
3048         * 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.
3049         */
3050        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
3051        @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." )
3052        protected Money unitPrice;
3053
3054        /**
3055         * 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.
3056         */
3057        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=false)
3058        @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." )
3059        protected DecimalType factor;
3060
3061        /**
3062         * 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.
3063         */
3064        @Child(name = "net", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
3065        @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." )
3066        protected Money net;
3067
3068        /**
3069         * List of Unique Device Identifiers associated with this line item.
3070         */
3071        @Child(name = "udi", type = {Device.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3072        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
3073        protected List<Reference> udi;
3074        /**
3075         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
3076         */
3077        protected List<Device> udiTarget;
3078
3079
3080        /**
3081         * Physical service site on the patient (limb, tooth, etc).
3082         */
3083        @Child(name = "bodySite", type = {CodeableConcept.class}, order=18, min=0, max=1, modifier=false, summary=false)
3084        @Description(shortDefinition="Service Location", formalDefinition="Physical service site on the patient (limb, tooth, etc)." )
3085        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
3086        protected CodeableConcept bodySite;
3087
3088        /**
3089         * A region or surface of the site, eg. limb region or tooth surface(s).
3090         */
3091        @Child(name = "subSite", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3092        @Description(shortDefinition="Service Sub-location", formalDefinition="A region or surface of the site, eg. limb region or tooth surface(s)." )
3093        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
3094        protected List<CodeableConcept> subSite;
3095
3096        /**
3097         * A billed item may include goods or services provided in multiple encounters.
3098         */
3099        @Child(name = "encounter", type = {Encounter.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3100        @Description(shortDefinition="Encounters related to this billed item", formalDefinition="A billed item may include goods or services provided in multiple encounters." )
3101        protected List<Reference> encounter;
3102        /**
3103         * The actual objects that are the target of the reference (A billed item may include goods or services provided in multiple encounters.)
3104         */
3105        protected List<Encounter> encounterTarget;
3106
3107
3108        /**
3109         * A list of note references to the notes provided below.
3110         */
3111        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3112        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
3113        protected List<PositiveIntType> noteNumber;
3114
3115        /**
3116         * The adjudications results.
3117         */
3118        @Child(name = "adjudication", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3119        @Description(shortDefinition="Adjudication details", formalDefinition="The adjudications results." )
3120        protected List<AdjudicationComponent> adjudication;
3121
3122        /**
3123         * Second tier of goods and services.
3124         */
3125        @Child(name = "detail", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3126        @Description(shortDefinition="Additional items", formalDefinition="Second tier of goods and services." )
3127        protected List<DetailComponent> detail;
3128
3129        private static final long serialVersionUID = -1567825229L;
3130
3131    /**
3132     * Constructor
3133     */
3134      public ItemComponent() {
3135        super();
3136      }
3137
3138    /**
3139     * Constructor
3140     */
3141      public ItemComponent(PositiveIntType sequence) {
3142        super();
3143        this.sequence = sequence;
3144      }
3145
3146        /**
3147         * @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
3148         */
3149        public PositiveIntType getSequenceElement() { 
3150          if (this.sequence == null)
3151            if (Configuration.errorOnAutoCreate())
3152              throw new Error("Attempt to auto-create ItemComponent.sequence");
3153            else if (Configuration.doAutoCreate())
3154              this.sequence = new PositiveIntType(); // bb
3155          return this.sequence;
3156        }
3157
3158        public boolean hasSequenceElement() { 
3159          return this.sequence != null && !this.sequence.isEmpty();
3160        }
3161
3162        public boolean hasSequence() { 
3163          return this.sequence != null && !this.sequence.isEmpty();
3164        }
3165
3166        /**
3167         * @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
3168         */
3169        public ItemComponent setSequenceElement(PositiveIntType value) { 
3170          this.sequence = value;
3171          return this;
3172        }
3173
3174        /**
3175         * @return A service line number.
3176         */
3177        public int getSequence() { 
3178          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3179        }
3180
3181        /**
3182         * @param value A service line number.
3183         */
3184        public ItemComponent setSequence(int value) { 
3185            if (this.sequence == null)
3186              this.sequence = new PositiveIntType();
3187            this.sequence.setValue(value);
3188          return this;
3189        }
3190
3191        /**
3192         * @return {@link #careTeamLinkId} (Careteam applicable for this service or product line.)
3193         */
3194        public List<PositiveIntType> getCareTeamLinkId() { 
3195          if (this.careTeamLinkId == null)
3196            this.careTeamLinkId = new ArrayList<PositiveIntType>();
3197          return this.careTeamLinkId;
3198        }
3199
3200        /**
3201         * @return Returns a reference to <code>this</code> for easy method chaining
3202         */
3203        public ItemComponent setCareTeamLinkId(List<PositiveIntType> theCareTeamLinkId) { 
3204          this.careTeamLinkId = theCareTeamLinkId;
3205          return this;
3206        }
3207
3208        public boolean hasCareTeamLinkId() { 
3209          if (this.careTeamLinkId == null)
3210            return false;
3211          for (PositiveIntType item : this.careTeamLinkId)
3212            if (!item.isEmpty())
3213              return true;
3214          return false;
3215        }
3216
3217        /**
3218         * @return {@link #careTeamLinkId} (Careteam applicable for this service or product line.)
3219         */
3220        public PositiveIntType addCareTeamLinkIdElement() {//2 
3221          PositiveIntType t = new PositiveIntType();
3222          if (this.careTeamLinkId == null)
3223            this.careTeamLinkId = new ArrayList<PositiveIntType>();
3224          this.careTeamLinkId.add(t);
3225          return t;
3226        }
3227
3228        /**
3229         * @param value {@link #careTeamLinkId} (Careteam applicable for this service or product line.)
3230         */
3231        public ItemComponent addCareTeamLinkId(int value) { //1
3232          PositiveIntType t = new PositiveIntType();
3233          t.setValue(value);
3234          if (this.careTeamLinkId == null)
3235            this.careTeamLinkId = new ArrayList<PositiveIntType>();
3236          this.careTeamLinkId.add(t);
3237          return this;
3238        }
3239
3240        /**
3241         * @param value {@link #careTeamLinkId} (Careteam applicable for this service or product line.)
3242         */
3243        public boolean hasCareTeamLinkId(int value) { 
3244          if (this.careTeamLinkId == null)
3245            return false;
3246          for (PositiveIntType v : this.careTeamLinkId)
3247            if (v.getValue().equals(value)) // positiveInt
3248              return true;
3249          return false;
3250        }
3251
3252        /**
3253         * @return {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
3254         */
3255        public List<PositiveIntType> getDiagnosisLinkId() { 
3256          if (this.diagnosisLinkId == null)
3257            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
3258          return this.diagnosisLinkId;
3259        }
3260
3261        /**
3262         * @return Returns a reference to <code>this</code> for easy method chaining
3263         */
3264        public ItemComponent setDiagnosisLinkId(List<PositiveIntType> theDiagnosisLinkId) { 
3265          this.diagnosisLinkId = theDiagnosisLinkId;
3266          return this;
3267        }
3268
3269        public boolean hasDiagnosisLinkId() { 
3270          if (this.diagnosisLinkId == null)
3271            return false;
3272          for (PositiveIntType item : this.diagnosisLinkId)
3273            if (!item.isEmpty())
3274              return true;
3275          return false;
3276        }
3277
3278        /**
3279         * @return {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
3280         */
3281        public PositiveIntType addDiagnosisLinkIdElement() {//2 
3282          PositiveIntType t = new PositiveIntType();
3283          if (this.diagnosisLinkId == null)
3284            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
3285          this.diagnosisLinkId.add(t);
3286          return t;
3287        }
3288
3289        /**
3290         * @param value {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
3291         */
3292        public ItemComponent addDiagnosisLinkId(int value) { //1
3293          PositiveIntType t = new PositiveIntType();
3294          t.setValue(value);
3295          if (this.diagnosisLinkId == null)
3296            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
3297          this.diagnosisLinkId.add(t);
3298          return this;
3299        }
3300
3301        /**
3302         * @param value {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
3303         */
3304        public boolean hasDiagnosisLinkId(int value) { 
3305          if (this.diagnosisLinkId == null)
3306            return false;
3307          for (PositiveIntType v : this.diagnosisLinkId)
3308            if (v.getValue().equals(value)) // positiveInt
3309              return true;
3310          return false;
3311        }
3312
3313        /**
3314         * @return {@link #procedureLinkId} (Procedures applicable for this service or product line.)
3315         */
3316        public List<PositiveIntType> getProcedureLinkId() { 
3317          if (this.procedureLinkId == null)
3318            this.procedureLinkId = new ArrayList<PositiveIntType>();
3319          return this.procedureLinkId;
3320        }
3321
3322        /**
3323         * @return Returns a reference to <code>this</code> for easy method chaining
3324         */
3325        public ItemComponent setProcedureLinkId(List<PositiveIntType> theProcedureLinkId) { 
3326          this.procedureLinkId = theProcedureLinkId;
3327          return this;
3328        }
3329
3330        public boolean hasProcedureLinkId() { 
3331          if (this.procedureLinkId == null)
3332            return false;
3333          for (PositiveIntType item : this.procedureLinkId)
3334            if (!item.isEmpty())
3335              return true;
3336          return false;
3337        }
3338
3339        /**
3340         * @return {@link #procedureLinkId} (Procedures applicable for this service or product line.)
3341         */
3342        public PositiveIntType addProcedureLinkIdElement() {//2 
3343          PositiveIntType t = new PositiveIntType();
3344          if (this.procedureLinkId == null)
3345            this.procedureLinkId = new ArrayList<PositiveIntType>();
3346          this.procedureLinkId.add(t);
3347          return t;
3348        }
3349
3350        /**
3351         * @param value {@link #procedureLinkId} (Procedures applicable for this service or product line.)
3352         */
3353        public ItemComponent addProcedureLinkId(int value) { //1
3354          PositiveIntType t = new PositiveIntType();
3355          t.setValue(value);
3356          if (this.procedureLinkId == null)
3357            this.procedureLinkId = new ArrayList<PositiveIntType>();
3358          this.procedureLinkId.add(t);
3359          return this;
3360        }
3361
3362        /**
3363         * @param value {@link #procedureLinkId} (Procedures applicable for this service or product line.)
3364         */
3365        public boolean hasProcedureLinkId(int value) { 
3366          if (this.procedureLinkId == null)
3367            return false;
3368          for (PositiveIntType v : this.procedureLinkId)
3369            if (v.getValue().equals(value)) // positiveInt
3370              return true;
3371          return false;
3372        }
3373
3374        /**
3375         * @return {@link #informationLinkId} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3376         */
3377        public List<PositiveIntType> getInformationLinkId() { 
3378          if (this.informationLinkId == null)
3379            this.informationLinkId = new ArrayList<PositiveIntType>();
3380          return this.informationLinkId;
3381        }
3382
3383        /**
3384         * @return Returns a reference to <code>this</code> for easy method chaining
3385         */
3386        public ItemComponent setInformationLinkId(List<PositiveIntType> theInformationLinkId) { 
3387          this.informationLinkId = theInformationLinkId;
3388          return this;
3389        }
3390
3391        public boolean hasInformationLinkId() { 
3392          if (this.informationLinkId == null)
3393            return false;
3394          for (PositiveIntType item : this.informationLinkId)
3395            if (!item.isEmpty())
3396              return true;
3397          return false;
3398        }
3399
3400        /**
3401         * @return {@link #informationLinkId} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3402         */
3403        public PositiveIntType addInformationLinkIdElement() {//2 
3404          PositiveIntType t = new PositiveIntType();
3405          if (this.informationLinkId == null)
3406            this.informationLinkId = new ArrayList<PositiveIntType>();
3407          this.informationLinkId.add(t);
3408          return t;
3409        }
3410
3411        /**
3412         * @param value {@link #informationLinkId} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3413         */
3414        public ItemComponent addInformationLinkId(int value) { //1
3415          PositiveIntType t = new PositiveIntType();
3416          t.setValue(value);
3417          if (this.informationLinkId == null)
3418            this.informationLinkId = new ArrayList<PositiveIntType>();
3419          this.informationLinkId.add(t);
3420          return this;
3421        }
3422
3423        /**
3424         * @param value {@link #informationLinkId} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3425         */
3426        public boolean hasInformationLinkId(int value) { 
3427          if (this.informationLinkId == null)
3428            return false;
3429          for (PositiveIntType v : this.informationLinkId)
3430            if (v.getValue().equals(value)) // positiveInt
3431              return true;
3432          return false;
3433        }
3434
3435        /**
3436         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
3437         */
3438        public CodeableConcept getRevenue() { 
3439          if (this.revenue == null)
3440            if (Configuration.errorOnAutoCreate())
3441              throw new Error("Attempt to auto-create ItemComponent.revenue");
3442            else if (Configuration.doAutoCreate())
3443              this.revenue = new CodeableConcept(); // cc
3444          return this.revenue;
3445        }
3446
3447        public boolean hasRevenue() { 
3448          return this.revenue != null && !this.revenue.isEmpty();
3449        }
3450
3451        /**
3452         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
3453         */
3454        public ItemComponent setRevenue(CodeableConcept value)  { 
3455          this.revenue = value;
3456          return this;
3457        }
3458
3459        /**
3460         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
3461         */
3462        public CodeableConcept getCategory() { 
3463          if (this.category == null)
3464            if (Configuration.errorOnAutoCreate())
3465              throw new Error("Attempt to auto-create ItemComponent.category");
3466            else if (Configuration.doAutoCreate())
3467              this.category = new CodeableConcept(); // cc
3468          return this.category;
3469        }
3470
3471        public boolean hasCategory() { 
3472          return this.category != null && !this.category.isEmpty();
3473        }
3474
3475        /**
3476         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
3477         */
3478        public ItemComponent setCategory(CodeableConcept value)  { 
3479          this.category = value;
3480          return this;
3481        }
3482
3483        /**
3484         * @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'.)
3485         */
3486        public CodeableConcept getService() { 
3487          if (this.service == null)
3488            if (Configuration.errorOnAutoCreate())
3489              throw new Error("Attempt to auto-create ItemComponent.service");
3490            else if (Configuration.doAutoCreate())
3491              this.service = new CodeableConcept(); // cc
3492          return this.service;
3493        }
3494
3495        public boolean hasService() { 
3496          return this.service != null && !this.service.isEmpty();
3497        }
3498
3499        /**
3500         * @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'.)
3501         */
3502        public ItemComponent setService(CodeableConcept value)  { 
3503          this.service = value;
3504          return this;
3505        }
3506
3507        /**
3508         * @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.)
3509         */
3510        public List<CodeableConcept> getModifier() { 
3511          if (this.modifier == null)
3512            this.modifier = new ArrayList<CodeableConcept>();
3513          return this.modifier;
3514        }
3515
3516        /**
3517         * @return Returns a reference to <code>this</code> for easy method chaining
3518         */
3519        public ItemComponent setModifier(List<CodeableConcept> theModifier) { 
3520          this.modifier = theModifier;
3521          return this;
3522        }
3523
3524        public boolean hasModifier() { 
3525          if (this.modifier == null)
3526            return false;
3527          for (CodeableConcept item : this.modifier)
3528            if (!item.isEmpty())
3529              return true;
3530          return false;
3531        }
3532
3533        public CodeableConcept addModifier() { //3
3534          CodeableConcept t = new CodeableConcept();
3535          if (this.modifier == null)
3536            this.modifier = new ArrayList<CodeableConcept>();
3537          this.modifier.add(t);
3538          return t;
3539        }
3540
3541        public ItemComponent addModifier(CodeableConcept t) { //3
3542          if (t == null)
3543            return this;
3544          if (this.modifier == null)
3545            this.modifier = new ArrayList<CodeableConcept>();
3546          this.modifier.add(t);
3547          return this;
3548        }
3549
3550        /**
3551         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
3552         */
3553        public CodeableConcept getModifierFirstRep() { 
3554          if (getModifier().isEmpty()) {
3555            addModifier();
3556          }
3557          return getModifier().get(0);
3558        }
3559
3560        /**
3561         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
3562         */
3563        public List<CodeableConcept> getProgramCode() { 
3564          if (this.programCode == null)
3565            this.programCode = new ArrayList<CodeableConcept>();
3566          return this.programCode;
3567        }
3568
3569        /**
3570         * @return Returns a reference to <code>this</code> for easy method chaining
3571         */
3572        public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
3573          this.programCode = theProgramCode;
3574          return this;
3575        }
3576
3577        public boolean hasProgramCode() { 
3578          if (this.programCode == null)
3579            return false;
3580          for (CodeableConcept item : this.programCode)
3581            if (!item.isEmpty())
3582              return true;
3583          return false;
3584        }
3585
3586        public CodeableConcept addProgramCode() { //3
3587          CodeableConcept t = new CodeableConcept();
3588          if (this.programCode == null)
3589            this.programCode = new ArrayList<CodeableConcept>();
3590          this.programCode.add(t);
3591          return t;
3592        }
3593
3594        public ItemComponent addProgramCode(CodeableConcept t) { //3
3595          if (t == null)
3596            return this;
3597          if (this.programCode == null)
3598            this.programCode = new ArrayList<CodeableConcept>();
3599          this.programCode.add(t);
3600          return this;
3601        }
3602
3603        /**
3604         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
3605         */
3606        public CodeableConcept getProgramCodeFirstRep() { 
3607          if (getProgramCode().isEmpty()) {
3608            addProgramCode();
3609          }
3610          return getProgramCode().get(0);
3611        }
3612
3613        /**
3614         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3615         */
3616        public Type getServiced() { 
3617          return this.serviced;
3618        }
3619
3620        /**
3621         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3622         */
3623        public DateType getServicedDateType() throws FHIRException { 
3624          if (this.serviced == null)
3625            return null;
3626          if (!(this.serviced instanceof DateType))
3627            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
3628          return (DateType) this.serviced;
3629        }
3630
3631        public boolean hasServicedDateType() {
3632            return this.serviced instanceof DateType;
3633        }
3634
3635        /**
3636         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3637         */
3638        public Period getServicedPeriod() throws FHIRException { 
3639          if (this.serviced == null)
3640            return null;
3641          if (!(this.serviced instanceof Period))
3642            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
3643          return (Period) this.serviced;
3644        }
3645
3646        public boolean hasServicedPeriod() {
3647            return this.serviced instanceof Period;
3648        }
3649
3650        public boolean hasServiced() { 
3651          return this.serviced != null && !this.serviced.isEmpty();
3652        }
3653
3654        /**
3655         * @param value {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3656         */
3657        public ItemComponent setServiced(Type value) throws FHIRFormatError { 
3658          if (value != null && !(value instanceof DateType || value instanceof Period))
3659            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.item.serviced[x]: "+value.fhirType());
3660          this.serviced = value;
3661          return this;
3662        }
3663
3664        /**
3665         * @return {@link #location} (Where the service was provided.)
3666         */
3667        public Type getLocation() { 
3668          return this.location;
3669        }
3670
3671        /**
3672         * @return {@link #location} (Where the service was provided.)
3673         */
3674        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
3675          if (this.location == null)
3676            return null;
3677          if (!(this.location instanceof CodeableConcept))
3678            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
3679          return (CodeableConcept) this.location;
3680        }
3681
3682        public boolean hasLocationCodeableConcept() {
3683            return this.location instanceof CodeableConcept;
3684        }
3685
3686        /**
3687         * @return {@link #location} (Where the service was provided.)
3688         */
3689        public Address getLocationAddress() throws FHIRException { 
3690          if (this.location == null)
3691            return null;
3692          if (!(this.location instanceof Address))
3693            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3694          return (Address) this.location;
3695        }
3696
3697        public boolean hasLocationAddress() {
3698            return this.location instanceof Address;
3699        }
3700
3701        /**
3702         * @return {@link #location} (Where the service was provided.)
3703         */
3704        public Reference getLocationReference() throws FHIRException { 
3705          if (this.location == null)
3706            return null;
3707          if (!(this.location instanceof Reference))
3708            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3709          return (Reference) this.location;
3710        }
3711
3712        public boolean hasLocationReference() {
3713            return this.location instanceof Reference;
3714        }
3715
3716        public boolean hasLocation() { 
3717          return this.location != null && !this.location.isEmpty();
3718        }
3719
3720        /**
3721         * @param value {@link #location} (Where the service was provided.)
3722         */
3723        public ItemComponent setLocation(Type value) throws FHIRFormatError { 
3724          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
3725            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.item.location[x]: "+value.fhirType());
3726          this.location = value;
3727          return this;
3728        }
3729
3730        /**
3731         * @return {@link #quantity} (The number of repetitions of a service or product.)
3732         */
3733        public SimpleQuantity getQuantity() { 
3734          if (this.quantity == null)
3735            if (Configuration.errorOnAutoCreate())
3736              throw new Error("Attempt to auto-create ItemComponent.quantity");
3737            else if (Configuration.doAutoCreate())
3738              this.quantity = new SimpleQuantity(); // cc
3739          return this.quantity;
3740        }
3741
3742        public boolean hasQuantity() { 
3743          return this.quantity != null && !this.quantity.isEmpty();
3744        }
3745
3746        /**
3747         * @param value {@link #quantity} (The number of repetitions of a service or product.)
3748         */
3749        public ItemComponent setQuantity(SimpleQuantity value)  { 
3750          this.quantity = value;
3751          return this;
3752        }
3753
3754        /**
3755         * @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.)
3756         */
3757        public Money getUnitPrice() { 
3758          if (this.unitPrice == null)
3759            if (Configuration.errorOnAutoCreate())
3760              throw new Error("Attempt to auto-create ItemComponent.unitPrice");
3761            else if (Configuration.doAutoCreate())
3762              this.unitPrice = new Money(); // cc
3763          return this.unitPrice;
3764        }
3765
3766        public boolean hasUnitPrice() { 
3767          return this.unitPrice != null && !this.unitPrice.isEmpty();
3768        }
3769
3770        /**
3771         * @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.)
3772         */
3773        public ItemComponent setUnitPrice(Money value)  { 
3774          this.unitPrice = value;
3775          return this;
3776        }
3777
3778        /**
3779         * @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
3780         */
3781        public DecimalType getFactorElement() { 
3782          if (this.factor == null)
3783            if (Configuration.errorOnAutoCreate())
3784              throw new Error("Attempt to auto-create ItemComponent.factor");
3785            else if (Configuration.doAutoCreate())
3786              this.factor = new DecimalType(); // bb
3787          return this.factor;
3788        }
3789
3790        public boolean hasFactorElement() { 
3791          return this.factor != null && !this.factor.isEmpty();
3792        }
3793
3794        public boolean hasFactor() { 
3795          return this.factor != null && !this.factor.isEmpty();
3796        }
3797
3798        /**
3799         * @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
3800         */
3801        public ItemComponent setFactorElement(DecimalType value) { 
3802          this.factor = value;
3803          return this;
3804        }
3805
3806        /**
3807         * @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.
3808         */
3809        public BigDecimal getFactor() { 
3810          return this.factor == null ? null : this.factor.getValue();
3811        }
3812
3813        /**
3814         * @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.
3815         */
3816        public ItemComponent setFactor(BigDecimal value) { 
3817          if (value == null)
3818            this.factor = null;
3819          else {
3820            if (this.factor == null)
3821              this.factor = new DecimalType();
3822            this.factor.setValue(value);
3823          }
3824          return this;
3825        }
3826
3827        /**
3828         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3829         */
3830        public ItemComponent setFactor(long value) { 
3831              this.factor = new DecimalType();
3832            this.factor.setValue(value);
3833          return this;
3834        }
3835
3836        /**
3837         * @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.
3838         */
3839        public ItemComponent setFactor(double value) { 
3840              this.factor = new DecimalType();
3841            this.factor.setValue(value);
3842          return this;
3843        }
3844
3845        /**
3846         * @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.)
3847         */
3848        public Money getNet() { 
3849          if (this.net == null)
3850            if (Configuration.errorOnAutoCreate())
3851              throw new Error("Attempt to auto-create ItemComponent.net");
3852            else if (Configuration.doAutoCreate())
3853              this.net = new Money(); // cc
3854          return this.net;
3855        }
3856
3857        public boolean hasNet() { 
3858          return this.net != null && !this.net.isEmpty();
3859        }
3860
3861        /**
3862         * @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.)
3863         */
3864        public ItemComponent setNet(Money value)  { 
3865          this.net = value;
3866          return this;
3867        }
3868
3869        /**
3870         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
3871         */
3872        public List<Reference> getUdi() { 
3873          if (this.udi == null)
3874            this.udi = new ArrayList<Reference>();
3875          return this.udi;
3876        }
3877
3878        /**
3879         * @return Returns a reference to <code>this</code> for easy method chaining
3880         */
3881        public ItemComponent setUdi(List<Reference> theUdi) { 
3882          this.udi = theUdi;
3883          return this;
3884        }
3885
3886        public boolean hasUdi() { 
3887          if (this.udi == null)
3888            return false;
3889          for (Reference item : this.udi)
3890            if (!item.isEmpty())
3891              return true;
3892          return false;
3893        }
3894
3895        public Reference addUdi() { //3
3896          Reference t = new Reference();
3897          if (this.udi == null)
3898            this.udi = new ArrayList<Reference>();
3899          this.udi.add(t);
3900          return t;
3901        }
3902
3903        public ItemComponent addUdi(Reference t) { //3
3904          if (t == null)
3905            return this;
3906          if (this.udi == null)
3907            this.udi = new ArrayList<Reference>();
3908          this.udi.add(t);
3909          return this;
3910        }
3911
3912        /**
3913         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
3914         */
3915        public Reference getUdiFirstRep() { 
3916          if (getUdi().isEmpty()) {
3917            addUdi();
3918          }
3919          return getUdi().get(0);
3920        }
3921
3922        /**
3923         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc).)
3924         */
3925        public CodeableConcept getBodySite() { 
3926          if (this.bodySite == null)
3927            if (Configuration.errorOnAutoCreate())
3928              throw new Error("Attempt to auto-create ItemComponent.bodySite");
3929            else if (Configuration.doAutoCreate())
3930              this.bodySite = new CodeableConcept(); // cc
3931          return this.bodySite;
3932        }
3933
3934        public boolean hasBodySite() { 
3935          return this.bodySite != null && !this.bodySite.isEmpty();
3936        }
3937
3938        /**
3939         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc).)
3940         */
3941        public ItemComponent setBodySite(CodeableConcept value)  { 
3942          this.bodySite = value;
3943          return this;
3944        }
3945
3946        /**
3947         * @return {@link #subSite} (A region or surface of the site, eg. limb region or tooth surface(s).)
3948         */
3949        public List<CodeableConcept> getSubSite() { 
3950          if (this.subSite == null)
3951            this.subSite = new ArrayList<CodeableConcept>();
3952          return this.subSite;
3953        }
3954
3955        /**
3956         * @return Returns a reference to <code>this</code> for easy method chaining
3957         */
3958        public ItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
3959          this.subSite = theSubSite;
3960          return this;
3961        }
3962
3963        public boolean hasSubSite() { 
3964          if (this.subSite == null)
3965            return false;
3966          for (CodeableConcept item : this.subSite)
3967            if (!item.isEmpty())
3968              return true;
3969          return false;
3970        }
3971
3972        public CodeableConcept addSubSite() { //3
3973          CodeableConcept t = new CodeableConcept();
3974          if (this.subSite == null)
3975            this.subSite = new ArrayList<CodeableConcept>();
3976          this.subSite.add(t);
3977          return t;
3978        }
3979
3980        public ItemComponent addSubSite(CodeableConcept t) { //3
3981          if (t == null)
3982            return this;
3983          if (this.subSite == null)
3984            this.subSite = new ArrayList<CodeableConcept>();
3985          this.subSite.add(t);
3986          return this;
3987        }
3988
3989        /**
3990         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist
3991         */
3992        public CodeableConcept getSubSiteFirstRep() { 
3993          if (getSubSite().isEmpty()) {
3994            addSubSite();
3995          }
3996          return getSubSite().get(0);
3997        }
3998
3999        /**
4000         * @return {@link #encounter} (A billed item may include goods or services provided in multiple encounters.)
4001         */
4002        public List<Reference> getEncounter() { 
4003          if (this.encounter == null)
4004            this.encounter = new ArrayList<Reference>();
4005          return this.encounter;
4006        }
4007
4008        /**
4009         * @return Returns a reference to <code>this</code> for easy method chaining
4010         */
4011        public ItemComponent setEncounter(List<Reference> theEncounter) { 
4012          this.encounter = theEncounter;
4013          return this;
4014        }
4015
4016        public boolean hasEncounter() { 
4017          if (this.encounter == null)
4018            return false;
4019          for (Reference item : this.encounter)
4020            if (!item.isEmpty())
4021              return true;
4022          return false;
4023        }
4024
4025        public Reference addEncounter() { //3
4026          Reference t = new Reference();
4027          if (this.encounter == null)
4028            this.encounter = new ArrayList<Reference>();
4029          this.encounter.add(t);
4030          return t;
4031        }
4032
4033        public ItemComponent addEncounter(Reference t) { //3
4034          if (t == null)
4035            return this;
4036          if (this.encounter == null)
4037            this.encounter = new ArrayList<Reference>();
4038          this.encounter.add(t);
4039          return this;
4040        }
4041
4042        /**
4043         * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist
4044         */
4045        public Reference getEncounterFirstRep() { 
4046          if (getEncounter().isEmpty()) {
4047            addEncounter();
4048          }
4049          return getEncounter().get(0);
4050        }
4051
4052        /**
4053         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
4054         */
4055        public List<PositiveIntType> getNoteNumber() { 
4056          if (this.noteNumber == null)
4057            this.noteNumber = new ArrayList<PositiveIntType>();
4058          return this.noteNumber;
4059        }
4060
4061        /**
4062         * @return Returns a reference to <code>this</code> for easy method chaining
4063         */
4064        public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
4065          this.noteNumber = theNoteNumber;
4066          return this;
4067        }
4068
4069        public boolean hasNoteNumber() { 
4070          if (this.noteNumber == null)
4071            return false;
4072          for (PositiveIntType item : this.noteNumber)
4073            if (!item.isEmpty())
4074              return true;
4075          return false;
4076        }
4077
4078        /**
4079         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
4080         */
4081        public PositiveIntType addNoteNumberElement() {//2 
4082          PositiveIntType t = new PositiveIntType();
4083          if (this.noteNumber == null)
4084            this.noteNumber = new ArrayList<PositiveIntType>();
4085          this.noteNumber.add(t);
4086          return t;
4087        }
4088
4089        /**
4090         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
4091         */
4092        public ItemComponent addNoteNumber(int value) { //1
4093          PositiveIntType t = new PositiveIntType();
4094          t.setValue(value);
4095          if (this.noteNumber == null)
4096            this.noteNumber = new ArrayList<PositiveIntType>();
4097          this.noteNumber.add(t);
4098          return this;
4099        }
4100
4101        /**
4102         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
4103         */
4104        public boolean hasNoteNumber(int value) { 
4105          if (this.noteNumber == null)
4106            return false;
4107          for (PositiveIntType v : this.noteNumber)
4108            if (v.getValue().equals(value)) // positiveInt
4109              return true;
4110          return false;
4111        }
4112
4113        /**
4114         * @return {@link #adjudication} (The adjudications results.)
4115         */
4116        public List<AdjudicationComponent> getAdjudication() { 
4117          if (this.adjudication == null)
4118            this.adjudication = new ArrayList<AdjudicationComponent>();
4119          return this.adjudication;
4120        }
4121
4122        /**
4123         * @return Returns a reference to <code>this</code> for easy method chaining
4124         */
4125        public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
4126          this.adjudication = theAdjudication;
4127          return this;
4128        }
4129
4130        public boolean hasAdjudication() { 
4131          if (this.adjudication == null)
4132            return false;
4133          for (AdjudicationComponent item : this.adjudication)
4134            if (!item.isEmpty())
4135              return true;
4136          return false;
4137        }
4138
4139        public AdjudicationComponent addAdjudication() { //3
4140          AdjudicationComponent t = new AdjudicationComponent();
4141          if (this.adjudication == null)
4142            this.adjudication = new ArrayList<AdjudicationComponent>();
4143          this.adjudication.add(t);
4144          return t;
4145        }
4146
4147        public ItemComponent addAdjudication(AdjudicationComponent t) { //3
4148          if (t == null)
4149            return this;
4150          if (this.adjudication == null)
4151            this.adjudication = new ArrayList<AdjudicationComponent>();
4152          this.adjudication.add(t);
4153          return this;
4154        }
4155
4156        /**
4157         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
4158         */
4159        public AdjudicationComponent getAdjudicationFirstRep() { 
4160          if (getAdjudication().isEmpty()) {
4161            addAdjudication();
4162          }
4163          return getAdjudication().get(0);
4164        }
4165
4166        /**
4167         * @return {@link #detail} (Second tier of goods and services.)
4168         */
4169        public List<DetailComponent> getDetail() { 
4170          if (this.detail == null)
4171            this.detail = new ArrayList<DetailComponent>();
4172          return this.detail;
4173        }
4174
4175        /**
4176         * @return Returns a reference to <code>this</code> for easy method chaining
4177         */
4178        public ItemComponent setDetail(List<DetailComponent> theDetail) { 
4179          this.detail = theDetail;
4180          return this;
4181        }
4182
4183        public boolean hasDetail() { 
4184          if (this.detail == null)
4185            return false;
4186          for (DetailComponent item : this.detail)
4187            if (!item.isEmpty())
4188              return true;
4189          return false;
4190        }
4191
4192        public DetailComponent addDetail() { //3
4193          DetailComponent t = new DetailComponent();
4194          if (this.detail == null)
4195            this.detail = new ArrayList<DetailComponent>();
4196          this.detail.add(t);
4197          return t;
4198        }
4199
4200        public ItemComponent addDetail(DetailComponent t) { //3
4201          if (t == null)
4202            return this;
4203          if (this.detail == null)
4204            this.detail = new ArrayList<DetailComponent>();
4205          this.detail.add(t);
4206          return this;
4207        }
4208
4209        /**
4210         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
4211         */
4212        public DetailComponent getDetailFirstRep() { 
4213          if (getDetail().isEmpty()) {
4214            addDetail();
4215          }
4216          return getDetail().get(0);
4217        }
4218
4219        protected void listChildren(List<Property> children) {
4220          super.listChildren(children);
4221          children.add(new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence));
4222          children.add(new Property("careTeamLinkId", "positiveInt", "Careteam applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, careTeamLinkId));
4223          children.add(new Property("diagnosisLinkId", "positiveInt", "Diagnosis applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, diagnosisLinkId));
4224          children.add(new Property("procedureLinkId", "positiveInt", "Procedures applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, procedureLinkId));
4225          children.add(new Property("informationLinkId", "positiveInt", "Exceptions, special conditions and supporting information pplicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, informationLinkId));
4226          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
4227          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
4228          children.add(new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, service));
4229          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
4230          children.add(new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode));
4231          children.add(new Property("serviced[x]", "date|Period", "The date or dates when the enclosed suite of services were performed or completed.", 0, 1, serviced));
4232          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location));
4233          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
4234          children.add(new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice));
4235          children.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor));
4236          children.add(new Property("net", "Money", "The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net));
4237          children.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
4238          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc).", 0, 1, bodySite));
4239          children.add(new Property("subSite", "CodeableConcept", "A region or surface of the site, eg. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite));
4240          children.add(new Property("encounter", "Reference(Encounter)", "A billed item may include goods or services provided in multiple encounters.", 0, java.lang.Integer.MAX_VALUE, encounter));
4241          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
4242          children.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
4243          children.add(new Property("detail", "", "Second tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
4244        }
4245
4246        @Override
4247        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4248          switch (_hash) {
4249          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence);
4250          case -186757789: /*careTeamLinkId*/  return new Property("careTeamLinkId", "positiveInt", "Careteam applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, careTeamLinkId);
4251          case -1659207418: /*diagnosisLinkId*/  return new Property("diagnosisLinkId", "positiveInt", "Diagnosis applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, diagnosisLinkId);
4252          case -532846744: /*procedureLinkId*/  return new Property("procedureLinkId", "positiveInt", "Procedures applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, procedureLinkId);
4253          case 1965585153: /*informationLinkId*/  return new Property("informationLinkId", "positiveInt", "Exceptions, special conditions and supporting information pplicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, informationLinkId);
4254          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
4255          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
4256          case 1984153269: /*service*/  return new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, service);
4257          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier);
4258          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode);
4259          case -1927922223: /*serviced[x]*/  return new Property("serviced[x]", "date|Period", "The date or dates when the enclosed suite of services were performed or completed.", 0, 1, serviced);
4260          case 1379209295: /*serviced*/  return new Property("serviced[x]", "date|Period", "The date or dates when the enclosed suite of services were performed or completed.", 0, 1, serviced);
4261          case 363246749: /*servicedDate*/  return new Property("serviced[x]", "date|Period", "The date or dates when the enclosed suite of services were performed or completed.", 0, 1, serviced);
4262          case 1534966512: /*servicedPeriod*/  return new Property("serviced[x]", "date|Period", "The date or dates when the enclosed suite of services were performed or completed.", 0, 1, serviced);
4263          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4264          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4265          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4266          case -1280020865: /*locationAddress*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4267          case 755866390: /*locationReference*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4268          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
4269          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice);
4270          case -1282148017: /*factor*/  return new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor);
4271          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net);
4272          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
4273          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc).", 0, 1, bodySite);
4274          case -1868566105: /*subSite*/  return new Property("subSite", "CodeableConcept", "A region or surface of the site, eg. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite);
4275          case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "A billed item may include goods or services provided in multiple encounters.", 0, java.lang.Integer.MAX_VALUE, encounter);
4276          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
4277          case -231349275: /*adjudication*/  return new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
4278          case -1335224239: /*detail*/  return new Property("detail", "", "Second tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail);
4279          default: return super.getNamedProperty(_hash, _name, _checkValid);
4280          }
4281
4282        }
4283
4284      @Override
4285      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4286        switch (hash) {
4287        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
4288        case -186757789: /*careTeamLinkId*/ return this.careTeamLinkId == null ? new Base[0] : this.careTeamLinkId.toArray(new Base[this.careTeamLinkId.size()]); // PositiveIntType
4289        case -1659207418: /*diagnosisLinkId*/ return this.diagnosisLinkId == null ? new Base[0] : this.diagnosisLinkId.toArray(new Base[this.diagnosisLinkId.size()]); // PositiveIntType
4290        case -532846744: /*procedureLinkId*/ return this.procedureLinkId == null ? new Base[0] : this.procedureLinkId.toArray(new Base[this.procedureLinkId.size()]); // PositiveIntType
4291        case 1965585153: /*informationLinkId*/ return this.informationLinkId == null ? new Base[0] : this.informationLinkId.toArray(new Base[this.informationLinkId.size()]); // PositiveIntType
4292        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
4293        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4294        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
4295        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
4296        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
4297        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
4298        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
4299        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
4300        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
4301        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
4302        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
4303        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
4304        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
4305        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
4306        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
4307        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
4308        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
4309        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
4310        default: return super.getProperty(hash, name, checkValid);
4311        }
4312
4313      }
4314
4315      @Override
4316      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4317        switch (hash) {
4318        case 1349547969: // sequence
4319          this.sequence = castToPositiveInt(value); // PositiveIntType
4320          return value;
4321        case -186757789: // careTeamLinkId
4322          this.getCareTeamLinkId().add(castToPositiveInt(value)); // PositiveIntType
4323          return value;
4324        case -1659207418: // diagnosisLinkId
4325          this.getDiagnosisLinkId().add(castToPositiveInt(value)); // PositiveIntType
4326          return value;
4327        case -532846744: // procedureLinkId
4328          this.getProcedureLinkId().add(castToPositiveInt(value)); // PositiveIntType
4329          return value;
4330        case 1965585153: // informationLinkId
4331          this.getInformationLinkId().add(castToPositiveInt(value)); // PositiveIntType
4332          return value;
4333        case 1099842588: // revenue
4334          this.revenue = castToCodeableConcept(value); // CodeableConcept
4335          return value;
4336        case 50511102: // category
4337          this.category = castToCodeableConcept(value); // CodeableConcept
4338          return value;
4339        case 1984153269: // service
4340          this.service = castToCodeableConcept(value); // CodeableConcept
4341          return value;
4342        case -615513385: // modifier
4343          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
4344          return value;
4345        case 1010065041: // programCode
4346          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
4347          return value;
4348        case 1379209295: // serviced
4349          this.serviced = castToType(value); // Type
4350          return value;
4351        case 1901043637: // location
4352          this.location = castToType(value); // Type
4353          return value;
4354        case -1285004149: // quantity
4355          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
4356          return value;
4357        case -486196699: // unitPrice
4358          this.unitPrice = castToMoney(value); // Money
4359          return value;
4360        case -1282148017: // factor
4361          this.factor = castToDecimal(value); // DecimalType
4362          return value;
4363        case 108957: // net
4364          this.net = castToMoney(value); // Money
4365          return value;
4366        case 115642: // udi
4367          this.getUdi().add(castToReference(value)); // Reference
4368          return value;
4369        case 1702620169: // bodySite
4370          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4371          return value;
4372        case -1868566105: // subSite
4373          this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
4374          return value;
4375        case 1524132147: // encounter
4376          this.getEncounter().add(castToReference(value)); // Reference
4377          return value;
4378        case -1110033957: // noteNumber
4379          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
4380          return value;
4381        case -231349275: // adjudication
4382          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
4383          return value;
4384        case -1335224239: // detail
4385          this.getDetail().add((DetailComponent) value); // DetailComponent
4386          return value;
4387        default: return super.setProperty(hash, name, value);
4388        }
4389
4390      }
4391
4392      @Override
4393      public Base setProperty(String name, Base value) throws FHIRException {
4394        if (name.equals("sequence")) {
4395          this.sequence = castToPositiveInt(value); // PositiveIntType
4396        } else if (name.equals("careTeamLinkId")) {
4397          this.getCareTeamLinkId().add(castToPositiveInt(value));
4398        } else if (name.equals("diagnosisLinkId")) {
4399          this.getDiagnosisLinkId().add(castToPositiveInt(value));
4400        } else if (name.equals("procedureLinkId")) {
4401          this.getProcedureLinkId().add(castToPositiveInt(value));
4402        } else if (name.equals("informationLinkId")) {
4403          this.getInformationLinkId().add(castToPositiveInt(value));
4404        } else if (name.equals("revenue")) {
4405          this.revenue = castToCodeableConcept(value); // CodeableConcept
4406        } else if (name.equals("category")) {
4407          this.category = castToCodeableConcept(value); // CodeableConcept
4408        } else if (name.equals("service")) {
4409          this.service = castToCodeableConcept(value); // CodeableConcept
4410        } else if (name.equals("modifier")) {
4411          this.getModifier().add(castToCodeableConcept(value));
4412        } else if (name.equals("programCode")) {
4413          this.getProgramCode().add(castToCodeableConcept(value));
4414        } else if (name.equals("serviced[x]")) {
4415          this.serviced = castToType(value); // Type
4416        } else if (name.equals("location[x]")) {
4417          this.location = castToType(value); // Type
4418        } else if (name.equals("quantity")) {
4419          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
4420        } else if (name.equals("unitPrice")) {
4421          this.unitPrice = castToMoney(value); // Money
4422        } else if (name.equals("factor")) {
4423          this.factor = castToDecimal(value); // DecimalType
4424        } else if (name.equals("net")) {
4425          this.net = castToMoney(value); // Money
4426        } else if (name.equals("udi")) {
4427          this.getUdi().add(castToReference(value));
4428        } else if (name.equals("bodySite")) {
4429          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4430        } else if (name.equals("subSite")) {
4431          this.getSubSite().add(castToCodeableConcept(value));
4432        } else if (name.equals("encounter")) {
4433          this.getEncounter().add(castToReference(value));
4434        } else if (name.equals("noteNumber")) {
4435          this.getNoteNumber().add(castToPositiveInt(value));
4436        } else if (name.equals("adjudication")) {
4437          this.getAdjudication().add((AdjudicationComponent) value);
4438        } else if (name.equals("detail")) {
4439          this.getDetail().add((DetailComponent) value);
4440        } else
4441          return super.setProperty(name, value);
4442        return value;
4443      }
4444
4445      @Override
4446      public Base makeProperty(int hash, String name) throws FHIRException {
4447        switch (hash) {
4448        case 1349547969:  return getSequenceElement();
4449        case -186757789:  return addCareTeamLinkIdElement();
4450        case -1659207418:  return addDiagnosisLinkIdElement();
4451        case -532846744:  return addProcedureLinkIdElement();
4452        case 1965585153:  return addInformationLinkIdElement();
4453        case 1099842588:  return getRevenue(); 
4454        case 50511102:  return getCategory(); 
4455        case 1984153269:  return getService(); 
4456        case -615513385:  return addModifier(); 
4457        case 1010065041:  return addProgramCode(); 
4458        case -1927922223:  return getServiced(); 
4459        case 1379209295:  return getServiced(); 
4460        case 552316075:  return getLocation(); 
4461        case 1901043637:  return getLocation(); 
4462        case -1285004149:  return getQuantity(); 
4463        case -486196699:  return getUnitPrice(); 
4464        case -1282148017:  return getFactorElement();
4465        case 108957:  return getNet(); 
4466        case 115642:  return addUdi(); 
4467        case 1702620169:  return getBodySite(); 
4468        case -1868566105:  return addSubSite(); 
4469        case 1524132147:  return addEncounter(); 
4470        case -1110033957:  return addNoteNumberElement();
4471        case -231349275:  return addAdjudication(); 
4472        case -1335224239:  return addDetail(); 
4473        default: return super.makeProperty(hash, name);
4474        }
4475
4476      }
4477
4478      @Override
4479      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4480        switch (hash) {
4481        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
4482        case -186757789: /*careTeamLinkId*/ return new String[] {"positiveInt"};
4483        case -1659207418: /*diagnosisLinkId*/ return new String[] {"positiveInt"};
4484        case -532846744: /*procedureLinkId*/ return new String[] {"positiveInt"};
4485        case 1965585153: /*informationLinkId*/ return new String[] {"positiveInt"};
4486        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
4487        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4488        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
4489        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
4490        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
4491        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
4492        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
4493        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
4494        case -486196699: /*unitPrice*/ return new String[] {"Money"};
4495        case -1282148017: /*factor*/ return new String[] {"decimal"};
4496        case 108957: /*net*/ return new String[] {"Money"};
4497        case 115642: /*udi*/ return new String[] {"Reference"};
4498        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
4499        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
4500        case 1524132147: /*encounter*/ return new String[] {"Reference"};
4501        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
4502        case -231349275: /*adjudication*/ return new String[] {};
4503        case -1335224239: /*detail*/ return new String[] {};
4504        default: return super.getTypesForProperty(hash, name);
4505        }
4506
4507      }
4508
4509      @Override
4510      public Base addChild(String name) throws FHIRException {
4511        if (name.equals("sequence")) {
4512          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
4513        }
4514        else if (name.equals("careTeamLinkId")) {
4515          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.careTeamLinkId");
4516        }
4517        else if (name.equals("diagnosisLinkId")) {
4518          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.diagnosisLinkId");
4519        }
4520        else if (name.equals("procedureLinkId")) {
4521          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.procedureLinkId");
4522        }
4523        else if (name.equals("informationLinkId")) {
4524          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.informationLinkId");
4525        }
4526        else if (name.equals("revenue")) {
4527          this.revenue = new CodeableConcept();
4528          return this.revenue;
4529        }
4530        else if (name.equals("category")) {
4531          this.category = new CodeableConcept();
4532          return this.category;
4533        }
4534        else if (name.equals("service")) {
4535          this.service = new CodeableConcept();
4536          return this.service;
4537        }
4538        else if (name.equals("modifier")) {
4539          return addModifier();
4540        }
4541        else if (name.equals("programCode")) {
4542          return addProgramCode();
4543        }
4544        else if (name.equals("servicedDate")) {
4545          this.serviced = new DateType();
4546          return this.serviced;
4547        }
4548        else if (name.equals("servicedPeriod")) {
4549          this.serviced = new Period();
4550          return this.serviced;
4551        }
4552        else if (name.equals("locationCodeableConcept")) {
4553          this.location = new CodeableConcept();
4554          return this.location;
4555        }
4556        else if (name.equals("locationAddress")) {
4557          this.location = new Address();
4558          return this.location;
4559        }
4560        else if (name.equals("locationReference")) {
4561          this.location = new Reference();
4562          return this.location;
4563        }
4564        else if (name.equals("quantity")) {
4565          this.quantity = new SimpleQuantity();
4566          return this.quantity;
4567        }
4568        else if (name.equals("unitPrice")) {
4569          this.unitPrice = new Money();
4570          return this.unitPrice;
4571        }
4572        else if (name.equals("factor")) {
4573          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
4574        }
4575        else if (name.equals("net")) {
4576          this.net = new Money();
4577          return this.net;
4578        }
4579        else if (name.equals("udi")) {
4580          return addUdi();
4581        }
4582        else if (name.equals("bodySite")) {
4583          this.bodySite = new CodeableConcept();
4584          return this.bodySite;
4585        }
4586        else if (name.equals("subSite")) {
4587          return addSubSite();
4588        }
4589        else if (name.equals("encounter")) {
4590          return addEncounter();
4591        }
4592        else if (name.equals("noteNumber")) {
4593          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
4594        }
4595        else if (name.equals("adjudication")) {
4596          return addAdjudication();
4597        }
4598        else if (name.equals("detail")) {
4599          return addDetail();
4600        }
4601        else
4602          return super.addChild(name);
4603      }
4604
4605      public ItemComponent copy() {
4606        ItemComponent dst = new ItemComponent();
4607        copyValues(dst);
4608        dst.sequence = sequence == null ? null : sequence.copy();
4609        if (careTeamLinkId != null) {
4610          dst.careTeamLinkId = new ArrayList<PositiveIntType>();
4611          for (PositiveIntType i : careTeamLinkId)
4612            dst.careTeamLinkId.add(i.copy());
4613        };
4614        if (diagnosisLinkId != null) {
4615          dst.diagnosisLinkId = new ArrayList<PositiveIntType>();
4616          for (PositiveIntType i : diagnosisLinkId)
4617            dst.diagnosisLinkId.add(i.copy());
4618        };
4619        if (procedureLinkId != null) {
4620          dst.procedureLinkId = new ArrayList<PositiveIntType>();
4621          for (PositiveIntType i : procedureLinkId)
4622            dst.procedureLinkId.add(i.copy());
4623        };
4624        if (informationLinkId != null) {
4625          dst.informationLinkId = new ArrayList<PositiveIntType>();
4626          for (PositiveIntType i : informationLinkId)
4627            dst.informationLinkId.add(i.copy());
4628        };
4629        dst.revenue = revenue == null ? null : revenue.copy();
4630        dst.category = category == null ? null : category.copy();
4631        dst.service = service == null ? null : service.copy();
4632        if (modifier != null) {
4633          dst.modifier = new ArrayList<CodeableConcept>();
4634          for (CodeableConcept i : modifier)
4635            dst.modifier.add(i.copy());
4636        };
4637        if (programCode != null) {
4638          dst.programCode = new ArrayList<CodeableConcept>();
4639          for (CodeableConcept i : programCode)
4640            dst.programCode.add(i.copy());
4641        };
4642        dst.serviced = serviced == null ? null : serviced.copy();
4643        dst.location = location == null ? null : location.copy();
4644        dst.quantity = quantity == null ? null : quantity.copy();
4645        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
4646        dst.factor = factor == null ? null : factor.copy();
4647        dst.net = net == null ? null : net.copy();
4648        if (udi != null) {
4649          dst.udi = new ArrayList<Reference>();
4650          for (Reference i : udi)
4651            dst.udi.add(i.copy());
4652        };
4653        dst.bodySite = bodySite == null ? null : bodySite.copy();
4654        if (subSite != null) {
4655          dst.subSite = new ArrayList<CodeableConcept>();
4656          for (CodeableConcept i : subSite)
4657            dst.subSite.add(i.copy());
4658        };
4659        if (encounter != null) {
4660          dst.encounter = new ArrayList<Reference>();
4661          for (Reference i : encounter)
4662            dst.encounter.add(i.copy());
4663        };
4664        if (noteNumber != null) {
4665          dst.noteNumber = new ArrayList<PositiveIntType>();
4666          for (PositiveIntType i : noteNumber)
4667            dst.noteNumber.add(i.copy());
4668        };
4669        if (adjudication != null) {
4670          dst.adjudication = new ArrayList<AdjudicationComponent>();
4671          for (AdjudicationComponent i : adjudication)
4672            dst.adjudication.add(i.copy());
4673        };
4674        if (detail != null) {
4675          dst.detail = new ArrayList<DetailComponent>();
4676          for (DetailComponent i : detail)
4677            dst.detail.add(i.copy());
4678        };
4679        return dst;
4680      }
4681
4682      @Override
4683      public boolean equalsDeep(Base other_) {
4684        if (!super.equalsDeep(other_))
4685          return false;
4686        if (!(other_ instanceof ItemComponent))
4687          return false;
4688        ItemComponent o = (ItemComponent) other_;
4689        return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamLinkId, o.careTeamLinkId, true)
4690           && compareDeep(diagnosisLinkId, o.diagnosisLinkId, true) && compareDeep(procedureLinkId, o.procedureLinkId, true)
4691           && compareDeep(informationLinkId, o.informationLinkId, true) && compareDeep(revenue, o.revenue, true)
4692           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
4693           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
4694           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
4695           && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true) && compareDeep(bodySite, o.bodySite, true)
4696           && compareDeep(subSite, o.subSite, true) && compareDeep(encounter, o.encounter, true) && compareDeep(noteNumber, o.noteNumber, true)
4697           && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
4698      }
4699
4700      @Override
4701      public boolean equalsShallow(Base other_) {
4702        if (!super.equalsShallow(other_))
4703          return false;
4704        if (!(other_ instanceof ItemComponent))
4705          return false;
4706        ItemComponent o = (ItemComponent) other_;
4707        return compareValues(sequence, o.sequence, true) && compareValues(careTeamLinkId, o.careTeamLinkId, true)
4708           && compareValues(diagnosisLinkId, o.diagnosisLinkId, true) && compareValues(procedureLinkId, o.procedureLinkId, true)
4709           && compareValues(informationLinkId, o.informationLinkId, true) && compareValues(factor, o.factor, true)
4710           && compareValues(noteNumber, o.noteNumber, true);
4711      }
4712
4713      public boolean isEmpty() {
4714        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamLinkId, diagnosisLinkId
4715          , procedureLinkId, informationLinkId, revenue, category, service, modifier, programCode
4716          , serviced, location, quantity, unitPrice, factor, net, udi, bodySite, subSite
4717          , encounter, noteNumber, adjudication, detail);
4718      }
4719
4720  public String fhirType() {
4721    return "ExplanationOfBenefit.item";
4722
4723  }
4724
4725  }
4726
4727    @Block()
4728    public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
4729        /**
4730         * Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.
4731         */
4732        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
4733        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc." )
4734        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
4735        protected CodeableConcept category;
4736
4737        /**
4738         * Adjudication reason such as limit reached.
4739         */
4740        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
4741        @Description(shortDefinition="Explanation of Adjudication outcome", formalDefinition="Adjudication reason such as limit reached." )
4742        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-reason")
4743        protected CodeableConcept reason;
4744
4745        /**
4746         * Monitory amount associated with the code.
4747         */
4748        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
4749        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
4750        protected Money amount;
4751
4752        /**
4753         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4754         */
4755        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
4756        @Description(shortDefinition="Non-monitory value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
4757        protected DecimalType value;
4758
4759        private static final long serialVersionUID = 1559898786L;
4760
4761    /**
4762     * Constructor
4763     */
4764      public AdjudicationComponent() {
4765        super();
4766      }
4767
4768    /**
4769     * Constructor
4770     */
4771      public AdjudicationComponent(CodeableConcept category) {
4772        super();
4773        this.category = category;
4774      }
4775
4776        /**
4777         * @return {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
4778         */
4779        public CodeableConcept getCategory() { 
4780          if (this.category == null)
4781            if (Configuration.errorOnAutoCreate())
4782              throw new Error("Attempt to auto-create AdjudicationComponent.category");
4783            else if (Configuration.doAutoCreate())
4784              this.category = new CodeableConcept(); // cc
4785          return this.category;
4786        }
4787
4788        public boolean hasCategory() { 
4789          return this.category != null && !this.category.isEmpty();
4790        }
4791
4792        /**
4793         * @param value {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
4794         */
4795        public AdjudicationComponent setCategory(CodeableConcept value)  { 
4796          this.category = value;
4797          return this;
4798        }
4799
4800        /**
4801         * @return {@link #reason} (Adjudication reason such as limit reached.)
4802         */
4803        public CodeableConcept getReason() { 
4804          if (this.reason == null)
4805            if (Configuration.errorOnAutoCreate())
4806              throw new Error("Attempt to auto-create AdjudicationComponent.reason");
4807            else if (Configuration.doAutoCreate())
4808              this.reason = new CodeableConcept(); // cc
4809          return this.reason;
4810        }
4811
4812        public boolean hasReason() { 
4813          return this.reason != null && !this.reason.isEmpty();
4814        }
4815
4816        /**
4817         * @param value {@link #reason} (Adjudication reason such as limit reached.)
4818         */
4819        public AdjudicationComponent setReason(CodeableConcept value)  { 
4820          this.reason = value;
4821          return this;
4822        }
4823
4824        /**
4825         * @return {@link #amount} (Monitory amount associated with the code.)
4826         */
4827        public Money getAmount() { 
4828          if (this.amount == null)
4829            if (Configuration.errorOnAutoCreate())
4830              throw new Error("Attempt to auto-create AdjudicationComponent.amount");
4831            else if (Configuration.doAutoCreate())
4832              this.amount = new Money(); // cc
4833          return this.amount;
4834        }
4835
4836        public boolean hasAmount() { 
4837          return this.amount != null && !this.amount.isEmpty();
4838        }
4839
4840        /**
4841         * @param value {@link #amount} (Monitory amount associated with the code.)
4842         */
4843        public AdjudicationComponent setAmount(Money value)  { 
4844          this.amount = value;
4845          return this;
4846        }
4847
4848        /**
4849         * @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
4850         */
4851        public DecimalType getValueElement() { 
4852          if (this.value == null)
4853            if (Configuration.errorOnAutoCreate())
4854              throw new Error("Attempt to auto-create AdjudicationComponent.value");
4855            else if (Configuration.doAutoCreate())
4856              this.value = new DecimalType(); // bb
4857          return this.value;
4858        }
4859
4860        public boolean hasValueElement() { 
4861          return this.value != null && !this.value.isEmpty();
4862        }
4863
4864        public boolean hasValue() { 
4865          return this.value != null && !this.value.isEmpty();
4866        }
4867
4868        /**
4869         * @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
4870         */
4871        public AdjudicationComponent setValueElement(DecimalType value) { 
4872          this.value = value;
4873          return this;
4874        }
4875
4876        /**
4877         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4878         */
4879        public BigDecimal getValue() { 
4880          return this.value == null ? null : this.value.getValue();
4881        }
4882
4883        /**
4884         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4885         */
4886        public AdjudicationComponent setValue(BigDecimal value) { 
4887          if (value == null)
4888            this.value = null;
4889          else {
4890            if (this.value == null)
4891              this.value = new DecimalType();
4892            this.value.setValue(value);
4893          }
4894          return this;
4895        }
4896
4897        /**
4898         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4899         */
4900        public AdjudicationComponent setValue(long value) { 
4901              this.value = new DecimalType();
4902            this.value.setValue(value);
4903          return this;
4904        }
4905
4906        /**
4907         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4908         */
4909        public AdjudicationComponent setValue(double value) { 
4910              this.value = new DecimalType();
4911            this.value.setValue(value);
4912          return this;
4913        }
4914
4915        protected void listChildren(List<Property> children) {
4916          super.listChildren(children);
4917          children.add(new Property("category", "CodeableConcept", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, 1, category));
4918          children.add(new Property("reason", "CodeableConcept", "Adjudication reason such as limit reached.", 0, 1, reason));
4919          children.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, 1, amount));
4920          children.add(new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, 1, value));
4921        }
4922
4923        @Override
4924        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4925          switch (_hash) {
4926          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, 1, category);
4927          case -934964668: /*reason*/  return new Property("reason", "CodeableConcept", "Adjudication reason such as limit reached.", 0, 1, reason);
4928          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monitory amount associated with the code.", 0, 1, amount);
4929          case 111972721: /*value*/  return new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, 1, value);
4930          default: return super.getNamedProperty(_hash, _name, _checkValid);
4931          }
4932
4933        }
4934
4935      @Override
4936      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4937        switch (hash) {
4938        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4939        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
4940        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
4941        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
4942        default: return super.getProperty(hash, name, checkValid);
4943        }
4944
4945      }
4946
4947      @Override
4948      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4949        switch (hash) {
4950        case 50511102: // category
4951          this.category = castToCodeableConcept(value); // CodeableConcept
4952          return value;
4953        case -934964668: // reason
4954          this.reason = castToCodeableConcept(value); // CodeableConcept
4955          return value;
4956        case -1413853096: // amount
4957          this.amount = castToMoney(value); // Money
4958          return value;
4959        case 111972721: // value
4960          this.value = castToDecimal(value); // DecimalType
4961          return value;
4962        default: return super.setProperty(hash, name, value);
4963        }
4964
4965      }
4966
4967      @Override
4968      public Base setProperty(String name, Base value) throws FHIRException {
4969        if (name.equals("category")) {
4970          this.category = castToCodeableConcept(value); // CodeableConcept
4971        } else if (name.equals("reason")) {
4972          this.reason = castToCodeableConcept(value); // CodeableConcept
4973        } else if (name.equals("amount")) {
4974          this.amount = castToMoney(value); // Money
4975        } else if (name.equals("value")) {
4976          this.value = castToDecimal(value); // DecimalType
4977        } else
4978          return super.setProperty(name, value);
4979        return value;
4980      }
4981
4982      @Override
4983      public Base makeProperty(int hash, String name) throws FHIRException {
4984        switch (hash) {
4985        case 50511102:  return getCategory(); 
4986        case -934964668:  return getReason(); 
4987        case -1413853096:  return getAmount(); 
4988        case 111972721:  return getValueElement();
4989        default: return super.makeProperty(hash, name);
4990        }
4991
4992      }
4993
4994      @Override
4995      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4996        switch (hash) {
4997        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4998        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
4999        case -1413853096: /*amount*/ return new String[] {"Money"};
5000        case 111972721: /*value*/ return new String[] {"decimal"};
5001        default: return super.getTypesForProperty(hash, name);
5002        }
5003
5004      }
5005
5006      @Override
5007      public Base addChild(String name) throws FHIRException {
5008        if (name.equals("category")) {
5009          this.category = new CodeableConcept();
5010          return this.category;
5011        }
5012        else if (name.equals("reason")) {
5013          this.reason = new CodeableConcept();
5014          return this.reason;
5015        }
5016        else if (name.equals("amount")) {
5017          this.amount = new Money();
5018          return this.amount;
5019        }
5020        else if (name.equals("value")) {
5021          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.value");
5022        }
5023        else
5024          return super.addChild(name);
5025      }
5026
5027      public AdjudicationComponent copy() {
5028        AdjudicationComponent dst = new AdjudicationComponent();
5029        copyValues(dst);
5030        dst.category = category == null ? null : category.copy();
5031        dst.reason = reason == null ? null : reason.copy();
5032        dst.amount = amount == null ? null : amount.copy();
5033        dst.value = value == null ? null : value.copy();
5034        return dst;
5035      }
5036
5037      @Override
5038      public boolean equalsDeep(Base other_) {
5039        if (!super.equalsDeep(other_))
5040          return false;
5041        if (!(other_ instanceof AdjudicationComponent))
5042          return false;
5043        AdjudicationComponent o = (AdjudicationComponent) other_;
5044        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
5045           && compareDeep(value, o.value, true);
5046      }
5047
5048      @Override
5049      public boolean equalsShallow(Base other_) {
5050        if (!super.equalsShallow(other_))
5051          return false;
5052        if (!(other_ instanceof AdjudicationComponent))
5053          return false;
5054        AdjudicationComponent o = (AdjudicationComponent) other_;
5055        return compareValues(value, o.value, true);
5056      }
5057
5058      public boolean isEmpty() {
5059        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount
5060          , value);
5061      }
5062
5063  public String fhirType() {
5064    return "ExplanationOfBenefit.item.adjudication";
5065
5066  }
5067
5068  }
5069
5070    @Block()
5071    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
5072        /**
5073         * A service line number.
5074         */
5075        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
5076        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
5077        protected PositiveIntType sequence;
5078
5079        /**
5080         * The type of product or service.
5081         */
5082        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
5083        @Description(shortDefinition="Group or type of product or service", formalDefinition="The type of product or service." )
5084        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActInvoiceGroupCode")
5085        protected CodeableConcept type;
5086
5087        /**
5088         * The type of reveneu or cost center providing the product and/or service.
5089         */
5090        @Child(name = "revenue", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
5091        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
5092        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
5093        protected CodeableConcept revenue;
5094
5095        /**
5096         * Health Care Service Type Codes  to identify the classification of service or benefits.
5097         */
5098        @Child(name = "category", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
5099        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
5100        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
5101        protected CodeableConcept category;
5102
5103        /**
5104         * 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'.
5105         */
5106        @Child(name = "service", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
5107        @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'." )
5108        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
5109        protected CodeableConcept service;
5110
5111        /**
5112         * 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.
5113         */
5114        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5115        @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." )
5116        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
5117        protected List<CodeableConcept> modifier;
5118
5119        /**
5120         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
5121         */
5122        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5123        @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." )
5124        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
5125        protected List<CodeableConcept> programCode;
5126
5127        /**
5128         * The number of repetitions of a service or product.
5129         */
5130        @Child(name = "quantity", type = {SimpleQuantity.class}, order=8, min=0, max=1, modifier=false, summary=false)
5131        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
5132        protected SimpleQuantity quantity;
5133
5134        /**
5135         * 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.
5136         */
5137        @Child(name = "unitPrice", type = {Money.class}, order=9, min=0, max=1, modifier=false, summary=false)
5138        @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." )
5139        protected Money unitPrice;
5140
5141        /**
5142         * 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.
5143         */
5144        @Child(name = "factor", type = {DecimalType.class}, order=10, min=0, max=1, modifier=false, summary=false)
5145        @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." )
5146        protected DecimalType factor;
5147
5148        /**
5149         * 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.
5150         */
5151        @Child(name = "net", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=false)
5152        @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." )
5153        protected Money net;
5154
5155        /**
5156         * List of Unique Device Identifiers associated with this line item.
5157         */
5158        @Child(name = "udi", type = {Device.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5159        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
5160        protected List<Reference> udi;
5161        /**
5162         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
5163         */
5164        protected List<Device> udiTarget;
5165
5166
5167        /**
5168         * A list of note references to the notes provided below.
5169         */
5170        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5171        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
5172        protected List<PositiveIntType> noteNumber;
5173
5174        /**
5175         * The adjudications results.
5176         */
5177        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5178        @Description(shortDefinition="Detail level adjudication details", formalDefinition="The adjudications results." )
5179        protected List<AdjudicationComponent> adjudication;
5180
5181        /**
5182         * Third tier of goods and services.
5183         */
5184        @Child(name = "subDetail", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5185        @Description(shortDefinition="Additional items", formalDefinition="Third tier of goods and services." )
5186        protected List<SubDetailComponent> subDetail;
5187
5188        private static final long serialVersionUID = -276371489L;
5189
5190    /**
5191     * Constructor
5192     */
5193      public DetailComponent() {
5194        super();
5195      }
5196
5197    /**
5198     * Constructor
5199     */
5200      public DetailComponent(PositiveIntType sequence, CodeableConcept type) {
5201        super();
5202        this.sequence = sequence;
5203        this.type = type;
5204      }
5205
5206        /**
5207         * @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
5208         */
5209        public PositiveIntType getSequenceElement() { 
5210          if (this.sequence == null)
5211            if (Configuration.errorOnAutoCreate())
5212              throw new Error("Attempt to auto-create DetailComponent.sequence");
5213            else if (Configuration.doAutoCreate())
5214              this.sequence = new PositiveIntType(); // bb
5215          return this.sequence;
5216        }
5217
5218        public boolean hasSequenceElement() { 
5219          return this.sequence != null && !this.sequence.isEmpty();
5220        }
5221
5222        public boolean hasSequence() { 
5223          return this.sequence != null && !this.sequence.isEmpty();
5224        }
5225
5226        /**
5227         * @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
5228         */
5229        public DetailComponent setSequenceElement(PositiveIntType value) { 
5230          this.sequence = value;
5231          return this;
5232        }
5233
5234        /**
5235         * @return A service line number.
5236         */
5237        public int getSequence() { 
5238          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
5239        }
5240
5241        /**
5242         * @param value A service line number.
5243         */
5244        public DetailComponent setSequence(int value) { 
5245            if (this.sequence == null)
5246              this.sequence = new PositiveIntType();
5247            this.sequence.setValue(value);
5248          return this;
5249        }
5250
5251        /**
5252         * @return {@link #type} (The type of product or service.)
5253         */
5254        public CodeableConcept getType() { 
5255          if (this.type == null)
5256            if (Configuration.errorOnAutoCreate())
5257              throw new Error("Attempt to auto-create DetailComponent.type");
5258            else if (Configuration.doAutoCreate())
5259              this.type = new CodeableConcept(); // cc
5260          return this.type;
5261        }
5262
5263        public boolean hasType() { 
5264          return this.type != null && !this.type.isEmpty();
5265        }
5266
5267        /**
5268         * @param value {@link #type} (The type of product or service.)
5269         */
5270        public DetailComponent setType(CodeableConcept value)  { 
5271          this.type = value;
5272          return this;
5273        }
5274
5275        /**
5276         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
5277         */
5278        public CodeableConcept getRevenue() { 
5279          if (this.revenue == null)
5280            if (Configuration.errorOnAutoCreate())
5281              throw new Error("Attempt to auto-create DetailComponent.revenue");
5282            else if (Configuration.doAutoCreate())
5283              this.revenue = new CodeableConcept(); // cc
5284          return this.revenue;
5285        }
5286
5287        public boolean hasRevenue() { 
5288          return this.revenue != null && !this.revenue.isEmpty();
5289        }
5290
5291        /**
5292         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
5293         */
5294        public DetailComponent setRevenue(CodeableConcept value)  { 
5295          this.revenue = value;
5296          return this;
5297        }
5298
5299        /**
5300         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
5301         */
5302        public CodeableConcept getCategory() { 
5303          if (this.category == null)
5304            if (Configuration.errorOnAutoCreate())
5305              throw new Error("Attempt to auto-create DetailComponent.category");
5306            else if (Configuration.doAutoCreate())
5307              this.category = new CodeableConcept(); // cc
5308          return this.category;
5309        }
5310
5311        public boolean hasCategory() { 
5312          return this.category != null && !this.category.isEmpty();
5313        }
5314
5315        /**
5316         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
5317         */
5318        public DetailComponent setCategory(CodeableConcept value)  { 
5319          this.category = value;
5320          return this;
5321        }
5322
5323        /**
5324         * @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'.)
5325         */
5326        public CodeableConcept getService() { 
5327          if (this.service == null)
5328            if (Configuration.errorOnAutoCreate())
5329              throw new Error("Attempt to auto-create DetailComponent.service");
5330            else if (Configuration.doAutoCreate())
5331              this.service = new CodeableConcept(); // cc
5332          return this.service;
5333        }
5334
5335        public boolean hasService() { 
5336          return this.service != null && !this.service.isEmpty();
5337        }
5338
5339        /**
5340         * @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'.)
5341         */
5342        public DetailComponent setService(CodeableConcept value)  { 
5343          this.service = value;
5344          return this;
5345        }
5346
5347        /**
5348         * @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.)
5349         */
5350        public List<CodeableConcept> getModifier() { 
5351          if (this.modifier == null)
5352            this.modifier = new ArrayList<CodeableConcept>();
5353          return this.modifier;
5354        }
5355
5356        /**
5357         * @return Returns a reference to <code>this</code> for easy method chaining
5358         */
5359        public DetailComponent setModifier(List<CodeableConcept> theModifier) { 
5360          this.modifier = theModifier;
5361          return this;
5362        }
5363
5364        public boolean hasModifier() { 
5365          if (this.modifier == null)
5366            return false;
5367          for (CodeableConcept item : this.modifier)
5368            if (!item.isEmpty())
5369              return true;
5370          return false;
5371        }
5372
5373        public CodeableConcept addModifier() { //3
5374          CodeableConcept t = new CodeableConcept();
5375          if (this.modifier == null)
5376            this.modifier = new ArrayList<CodeableConcept>();
5377          this.modifier.add(t);
5378          return t;
5379        }
5380
5381        public DetailComponent addModifier(CodeableConcept t) { //3
5382          if (t == null)
5383            return this;
5384          if (this.modifier == null)
5385            this.modifier = new ArrayList<CodeableConcept>();
5386          this.modifier.add(t);
5387          return this;
5388        }
5389
5390        /**
5391         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
5392         */
5393        public CodeableConcept getModifierFirstRep() { 
5394          if (getModifier().isEmpty()) {
5395            addModifier();
5396          }
5397          return getModifier().get(0);
5398        }
5399
5400        /**
5401         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
5402         */
5403        public List<CodeableConcept> getProgramCode() { 
5404          if (this.programCode == null)
5405            this.programCode = new ArrayList<CodeableConcept>();
5406          return this.programCode;
5407        }
5408
5409        /**
5410         * @return Returns a reference to <code>this</code> for easy method chaining
5411         */
5412        public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
5413          this.programCode = theProgramCode;
5414          return this;
5415        }
5416
5417        public boolean hasProgramCode() { 
5418          if (this.programCode == null)
5419            return false;
5420          for (CodeableConcept item : this.programCode)
5421            if (!item.isEmpty())
5422              return true;
5423          return false;
5424        }
5425
5426        public CodeableConcept addProgramCode() { //3
5427          CodeableConcept t = new CodeableConcept();
5428          if (this.programCode == null)
5429            this.programCode = new ArrayList<CodeableConcept>();
5430          this.programCode.add(t);
5431          return t;
5432        }
5433
5434        public DetailComponent addProgramCode(CodeableConcept t) { //3
5435          if (t == null)
5436            return this;
5437          if (this.programCode == null)
5438            this.programCode = new ArrayList<CodeableConcept>();
5439          this.programCode.add(t);
5440          return this;
5441        }
5442
5443        /**
5444         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
5445         */
5446        public CodeableConcept getProgramCodeFirstRep() { 
5447          if (getProgramCode().isEmpty()) {
5448            addProgramCode();
5449          }
5450          return getProgramCode().get(0);
5451        }
5452
5453        /**
5454         * @return {@link #quantity} (The number of repetitions of a service or product.)
5455         */
5456        public SimpleQuantity getQuantity() { 
5457          if (this.quantity == null)
5458            if (Configuration.errorOnAutoCreate())
5459              throw new Error("Attempt to auto-create DetailComponent.quantity");
5460            else if (Configuration.doAutoCreate())
5461              this.quantity = new SimpleQuantity(); // cc
5462          return this.quantity;
5463        }
5464
5465        public boolean hasQuantity() { 
5466          return this.quantity != null && !this.quantity.isEmpty();
5467        }
5468
5469        /**
5470         * @param value {@link #quantity} (The number of repetitions of a service or product.)
5471         */
5472        public DetailComponent setQuantity(SimpleQuantity value)  { 
5473          this.quantity = value;
5474          return this;
5475        }
5476
5477        /**
5478         * @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.)
5479         */
5480        public Money getUnitPrice() { 
5481          if (this.unitPrice == null)
5482            if (Configuration.errorOnAutoCreate())
5483              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
5484            else if (Configuration.doAutoCreate())
5485              this.unitPrice = new Money(); // cc
5486          return this.unitPrice;
5487        }
5488
5489        public boolean hasUnitPrice() { 
5490          return this.unitPrice != null && !this.unitPrice.isEmpty();
5491        }
5492
5493        /**
5494         * @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.)
5495         */
5496        public DetailComponent setUnitPrice(Money value)  { 
5497          this.unitPrice = value;
5498          return this;
5499        }
5500
5501        /**
5502         * @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
5503         */
5504        public DecimalType getFactorElement() { 
5505          if (this.factor == null)
5506            if (Configuration.errorOnAutoCreate())
5507              throw new Error("Attempt to auto-create DetailComponent.factor");
5508            else if (Configuration.doAutoCreate())
5509              this.factor = new DecimalType(); // bb
5510          return this.factor;
5511        }
5512
5513        public boolean hasFactorElement() { 
5514          return this.factor != null && !this.factor.isEmpty();
5515        }
5516
5517        public boolean hasFactor() { 
5518          return this.factor != null && !this.factor.isEmpty();
5519        }
5520
5521        /**
5522         * @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
5523         */
5524        public DetailComponent setFactorElement(DecimalType value) { 
5525          this.factor = value;
5526          return this;
5527        }
5528
5529        /**
5530         * @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.
5531         */
5532        public BigDecimal getFactor() { 
5533          return this.factor == null ? null : this.factor.getValue();
5534        }
5535
5536        /**
5537         * @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.
5538         */
5539        public DetailComponent setFactor(BigDecimal value) { 
5540          if (value == null)
5541            this.factor = null;
5542          else {
5543            if (this.factor == null)
5544              this.factor = new DecimalType();
5545            this.factor.setValue(value);
5546          }
5547          return this;
5548        }
5549
5550        /**
5551         * @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.
5552         */
5553        public DetailComponent setFactor(long value) { 
5554              this.factor = new DecimalType();
5555            this.factor.setValue(value);
5556          return this;
5557        }
5558
5559        /**
5560         * @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.
5561         */
5562        public DetailComponent setFactor(double value) { 
5563              this.factor = new DecimalType();
5564            this.factor.setValue(value);
5565          return this;
5566        }
5567
5568        /**
5569         * @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.)
5570         */
5571        public Money getNet() { 
5572          if (this.net == null)
5573            if (Configuration.errorOnAutoCreate())
5574              throw new Error("Attempt to auto-create DetailComponent.net");
5575            else if (Configuration.doAutoCreate())
5576              this.net = new Money(); // cc
5577          return this.net;
5578        }
5579
5580        public boolean hasNet() { 
5581          return this.net != null && !this.net.isEmpty();
5582        }
5583
5584        /**
5585         * @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.)
5586         */
5587        public DetailComponent setNet(Money value)  { 
5588          this.net = value;
5589          return this;
5590        }
5591
5592        /**
5593         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
5594         */
5595        public List<Reference> getUdi() { 
5596          if (this.udi == null)
5597            this.udi = new ArrayList<Reference>();
5598          return this.udi;
5599        }
5600
5601        /**
5602         * @return Returns a reference to <code>this</code> for easy method chaining
5603         */
5604        public DetailComponent setUdi(List<Reference> theUdi) { 
5605          this.udi = theUdi;
5606          return this;
5607        }
5608
5609        public boolean hasUdi() { 
5610          if (this.udi == null)
5611            return false;
5612          for (Reference item : this.udi)
5613            if (!item.isEmpty())
5614              return true;
5615          return false;
5616        }
5617
5618        public Reference addUdi() { //3
5619          Reference t = new Reference();
5620          if (this.udi == null)
5621            this.udi = new ArrayList<Reference>();
5622          this.udi.add(t);
5623          return t;
5624        }
5625
5626        public DetailComponent addUdi(Reference t) { //3
5627          if (t == null)
5628            return this;
5629          if (this.udi == null)
5630            this.udi = new ArrayList<Reference>();
5631          this.udi.add(t);
5632          return this;
5633        }
5634
5635        /**
5636         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
5637         */
5638        public Reference getUdiFirstRep() { 
5639          if (getUdi().isEmpty()) {
5640            addUdi();
5641          }
5642          return getUdi().get(0);
5643        }
5644
5645        /**
5646         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
5647         */
5648        public List<PositiveIntType> getNoteNumber() { 
5649          if (this.noteNumber == null)
5650            this.noteNumber = new ArrayList<PositiveIntType>();
5651          return this.noteNumber;
5652        }
5653
5654        /**
5655         * @return Returns a reference to <code>this</code> for easy method chaining
5656         */
5657        public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
5658          this.noteNumber = theNoteNumber;
5659          return this;
5660        }
5661
5662        public boolean hasNoteNumber() { 
5663          if (this.noteNumber == null)
5664            return false;
5665          for (PositiveIntType item : this.noteNumber)
5666            if (!item.isEmpty())
5667              return true;
5668          return false;
5669        }
5670
5671        /**
5672         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
5673         */
5674        public PositiveIntType addNoteNumberElement() {//2 
5675          PositiveIntType t = new PositiveIntType();
5676          if (this.noteNumber == null)
5677            this.noteNumber = new ArrayList<PositiveIntType>();
5678          this.noteNumber.add(t);
5679          return t;
5680        }
5681
5682        /**
5683         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
5684         */
5685        public DetailComponent addNoteNumber(int value) { //1
5686          PositiveIntType t = new PositiveIntType();
5687          t.setValue(value);
5688          if (this.noteNumber == null)
5689            this.noteNumber = new ArrayList<PositiveIntType>();
5690          this.noteNumber.add(t);
5691          return this;
5692        }
5693
5694        /**
5695         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
5696         */
5697        public boolean hasNoteNumber(int value) { 
5698          if (this.noteNumber == null)
5699            return false;
5700          for (PositiveIntType v : this.noteNumber)
5701            if (v.getValue().equals(value)) // positiveInt
5702              return true;
5703          return false;
5704        }
5705
5706        /**
5707         * @return {@link #adjudication} (The adjudications results.)
5708         */
5709        public List<AdjudicationComponent> getAdjudication() { 
5710          if (this.adjudication == null)
5711            this.adjudication = new ArrayList<AdjudicationComponent>();
5712          return this.adjudication;
5713        }
5714
5715        /**
5716         * @return Returns a reference to <code>this</code> for easy method chaining
5717         */
5718        public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
5719          this.adjudication = theAdjudication;
5720          return this;
5721        }
5722
5723        public boolean hasAdjudication() { 
5724          if (this.adjudication == null)
5725            return false;
5726          for (AdjudicationComponent item : this.adjudication)
5727            if (!item.isEmpty())
5728              return true;
5729          return false;
5730        }
5731
5732        public AdjudicationComponent addAdjudication() { //3
5733          AdjudicationComponent t = new AdjudicationComponent();
5734          if (this.adjudication == null)
5735            this.adjudication = new ArrayList<AdjudicationComponent>();
5736          this.adjudication.add(t);
5737          return t;
5738        }
5739
5740        public DetailComponent addAdjudication(AdjudicationComponent t) { //3
5741          if (t == null)
5742            return this;
5743          if (this.adjudication == null)
5744            this.adjudication = new ArrayList<AdjudicationComponent>();
5745          this.adjudication.add(t);
5746          return this;
5747        }
5748
5749        /**
5750         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
5751         */
5752        public AdjudicationComponent getAdjudicationFirstRep() { 
5753          if (getAdjudication().isEmpty()) {
5754            addAdjudication();
5755          }
5756          return getAdjudication().get(0);
5757        }
5758
5759        /**
5760         * @return {@link #subDetail} (Third tier of goods and services.)
5761         */
5762        public List<SubDetailComponent> getSubDetail() { 
5763          if (this.subDetail == null)
5764            this.subDetail = new ArrayList<SubDetailComponent>();
5765          return this.subDetail;
5766        }
5767
5768        /**
5769         * @return Returns a reference to <code>this</code> for easy method chaining
5770         */
5771        public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) { 
5772          this.subDetail = theSubDetail;
5773          return this;
5774        }
5775
5776        public boolean hasSubDetail() { 
5777          if (this.subDetail == null)
5778            return false;
5779          for (SubDetailComponent item : this.subDetail)
5780            if (!item.isEmpty())
5781              return true;
5782          return false;
5783        }
5784
5785        public SubDetailComponent addSubDetail() { //3
5786          SubDetailComponent t = new SubDetailComponent();
5787          if (this.subDetail == null)
5788            this.subDetail = new ArrayList<SubDetailComponent>();
5789          this.subDetail.add(t);
5790          return t;
5791        }
5792
5793        public DetailComponent addSubDetail(SubDetailComponent t) { //3
5794          if (t == null)
5795            return this;
5796          if (this.subDetail == null)
5797            this.subDetail = new ArrayList<SubDetailComponent>();
5798          this.subDetail.add(t);
5799          return this;
5800        }
5801
5802        /**
5803         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
5804         */
5805        public SubDetailComponent getSubDetailFirstRep() { 
5806          if (getSubDetail().isEmpty()) {
5807            addSubDetail();
5808          }
5809          return getSubDetail().get(0);
5810        }
5811
5812        protected void listChildren(List<Property> children) {
5813          super.listChildren(children);
5814          children.add(new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence));
5815          children.add(new Property("type", "CodeableConcept", "The type of product or service.", 0, 1, type));
5816          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
5817          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
5818          children.add(new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, service));
5819          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
5820          children.add(new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode));
5821          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
5822          children.add(new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice));
5823          children.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor));
5824          children.add(new Property("net", "Money", "The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net));
5825          children.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
5826          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
5827          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
5828          children.add(new Property("subDetail", "", "Third tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
5829        }
5830
5831        @Override
5832        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5833          switch (_hash) {
5834          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence);
5835          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of product or service.", 0, 1, type);
5836          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
5837          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
5838          case 1984153269: /*service*/  return new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, service);
5839          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier);
5840          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode);
5841          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
5842          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice);
5843          case -1282148017: /*factor*/  return new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor);
5844          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net);
5845          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
5846          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
5847          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
5848          case -828829007: /*subDetail*/  return new Property("subDetail", "", "Third tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
5849          default: return super.getNamedProperty(_hash, _name, _checkValid);
5850          }
5851
5852        }
5853
5854      @Override
5855      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5856        switch (hash) {
5857        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
5858        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
5859        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
5860        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
5861        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
5862        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
5863        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
5864        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
5865        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
5866        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
5867        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
5868        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
5869        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
5870        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
5871        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
5872        default: return super.getProperty(hash, name, checkValid);
5873        }
5874
5875      }
5876
5877      @Override
5878      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5879        switch (hash) {
5880        case 1349547969: // sequence
5881          this.sequence = castToPositiveInt(value); // PositiveIntType
5882          return value;
5883        case 3575610: // type
5884          this.type = castToCodeableConcept(value); // CodeableConcept
5885          return value;
5886        case 1099842588: // revenue
5887          this.revenue = castToCodeableConcept(value); // CodeableConcept
5888          return value;
5889        case 50511102: // category
5890          this.category = castToCodeableConcept(value); // CodeableConcept
5891          return value;
5892        case 1984153269: // service
5893          this.service = castToCodeableConcept(value); // CodeableConcept
5894          return value;
5895        case -615513385: // modifier
5896          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
5897          return value;
5898        case 1010065041: // programCode
5899          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
5900          return value;
5901        case -1285004149: // quantity
5902          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
5903          return value;
5904        case -486196699: // unitPrice
5905          this.unitPrice = castToMoney(value); // Money
5906          return value;
5907        case -1282148017: // factor
5908          this.factor = castToDecimal(value); // DecimalType
5909          return value;
5910        case 108957: // net
5911          this.net = castToMoney(value); // Money
5912          return value;
5913        case 115642: // udi
5914          this.getUdi().add(castToReference(value)); // Reference
5915          return value;
5916        case -1110033957: // noteNumber
5917          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
5918          return value;
5919        case -231349275: // adjudication
5920          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
5921          return value;
5922        case -828829007: // subDetail
5923          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
5924          return value;
5925        default: return super.setProperty(hash, name, value);
5926        }
5927
5928      }
5929
5930      @Override
5931      public Base setProperty(String name, Base value) throws FHIRException {
5932        if (name.equals("sequence")) {
5933          this.sequence = castToPositiveInt(value); // PositiveIntType
5934        } else if (name.equals("type")) {
5935          this.type = castToCodeableConcept(value); // CodeableConcept
5936        } else if (name.equals("revenue")) {
5937          this.revenue = castToCodeableConcept(value); // CodeableConcept
5938        } else if (name.equals("category")) {
5939          this.category = castToCodeableConcept(value); // CodeableConcept
5940        } else if (name.equals("service")) {
5941          this.service = castToCodeableConcept(value); // CodeableConcept
5942        } else if (name.equals("modifier")) {
5943          this.getModifier().add(castToCodeableConcept(value));
5944        } else if (name.equals("programCode")) {
5945          this.getProgramCode().add(castToCodeableConcept(value));
5946        } else if (name.equals("quantity")) {
5947          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
5948        } else if (name.equals("unitPrice")) {
5949          this.unitPrice = castToMoney(value); // Money
5950        } else if (name.equals("factor")) {
5951          this.factor = castToDecimal(value); // DecimalType
5952        } else if (name.equals("net")) {
5953          this.net = castToMoney(value); // Money
5954        } else if (name.equals("udi")) {
5955          this.getUdi().add(castToReference(value));
5956        } else if (name.equals("noteNumber")) {
5957          this.getNoteNumber().add(castToPositiveInt(value));
5958        } else if (name.equals("adjudication")) {
5959          this.getAdjudication().add((AdjudicationComponent) value);
5960        } else if (name.equals("subDetail")) {
5961          this.getSubDetail().add((SubDetailComponent) value);
5962        } else
5963          return super.setProperty(name, value);
5964        return value;
5965      }
5966
5967      @Override
5968      public Base makeProperty(int hash, String name) throws FHIRException {
5969        switch (hash) {
5970        case 1349547969:  return getSequenceElement();
5971        case 3575610:  return getType(); 
5972        case 1099842588:  return getRevenue(); 
5973        case 50511102:  return getCategory(); 
5974        case 1984153269:  return getService(); 
5975        case -615513385:  return addModifier(); 
5976        case 1010065041:  return addProgramCode(); 
5977        case -1285004149:  return getQuantity(); 
5978        case -486196699:  return getUnitPrice(); 
5979        case -1282148017:  return getFactorElement();
5980        case 108957:  return getNet(); 
5981        case 115642:  return addUdi(); 
5982        case -1110033957:  return addNoteNumberElement();
5983        case -231349275:  return addAdjudication(); 
5984        case -828829007:  return addSubDetail(); 
5985        default: return super.makeProperty(hash, name);
5986        }
5987
5988      }
5989
5990      @Override
5991      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5992        switch (hash) {
5993        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
5994        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
5995        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
5996        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5997        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
5998        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
5999        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
6000        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
6001        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6002        case -1282148017: /*factor*/ return new String[] {"decimal"};
6003        case 108957: /*net*/ return new String[] {"Money"};
6004        case 115642: /*udi*/ return new String[] {"Reference"};
6005        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
6006        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
6007        case -828829007: /*subDetail*/ return new String[] {};
6008        default: return super.getTypesForProperty(hash, name);
6009        }
6010
6011      }
6012
6013      @Override
6014      public Base addChild(String name) throws FHIRException {
6015        if (name.equals("sequence")) {
6016          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
6017        }
6018        else if (name.equals("type")) {
6019          this.type = new CodeableConcept();
6020          return this.type;
6021        }
6022        else if (name.equals("revenue")) {
6023          this.revenue = new CodeableConcept();
6024          return this.revenue;
6025        }
6026        else if (name.equals("category")) {
6027          this.category = new CodeableConcept();
6028          return this.category;
6029        }
6030        else if (name.equals("service")) {
6031          this.service = new CodeableConcept();
6032          return this.service;
6033        }
6034        else if (name.equals("modifier")) {
6035          return addModifier();
6036        }
6037        else if (name.equals("programCode")) {
6038          return addProgramCode();
6039        }
6040        else if (name.equals("quantity")) {
6041          this.quantity = new SimpleQuantity();
6042          return this.quantity;
6043        }
6044        else if (name.equals("unitPrice")) {
6045          this.unitPrice = new Money();
6046          return this.unitPrice;
6047        }
6048        else if (name.equals("factor")) {
6049          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
6050        }
6051        else if (name.equals("net")) {
6052          this.net = new Money();
6053          return this.net;
6054        }
6055        else if (name.equals("udi")) {
6056          return addUdi();
6057        }
6058        else if (name.equals("noteNumber")) {
6059          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
6060        }
6061        else if (name.equals("adjudication")) {
6062          return addAdjudication();
6063        }
6064        else if (name.equals("subDetail")) {
6065          return addSubDetail();
6066        }
6067        else
6068          return super.addChild(name);
6069      }
6070
6071      public DetailComponent copy() {
6072        DetailComponent dst = new DetailComponent();
6073        copyValues(dst);
6074        dst.sequence = sequence == null ? null : sequence.copy();
6075        dst.type = type == null ? null : type.copy();
6076        dst.revenue = revenue == null ? null : revenue.copy();
6077        dst.category = category == null ? null : category.copy();
6078        dst.service = service == null ? null : service.copy();
6079        if (modifier != null) {
6080          dst.modifier = new ArrayList<CodeableConcept>();
6081          for (CodeableConcept i : modifier)
6082            dst.modifier.add(i.copy());
6083        };
6084        if (programCode != null) {
6085          dst.programCode = new ArrayList<CodeableConcept>();
6086          for (CodeableConcept i : programCode)
6087            dst.programCode.add(i.copy());
6088        };
6089        dst.quantity = quantity == null ? null : quantity.copy();
6090        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6091        dst.factor = factor == null ? null : factor.copy();
6092        dst.net = net == null ? null : net.copy();
6093        if (udi != null) {
6094          dst.udi = new ArrayList<Reference>();
6095          for (Reference i : udi)
6096            dst.udi.add(i.copy());
6097        };
6098        if (noteNumber != null) {
6099          dst.noteNumber = new ArrayList<PositiveIntType>();
6100          for (PositiveIntType i : noteNumber)
6101            dst.noteNumber.add(i.copy());
6102        };
6103        if (adjudication != null) {
6104          dst.adjudication = new ArrayList<AdjudicationComponent>();
6105          for (AdjudicationComponent i : adjudication)
6106            dst.adjudication.add(i.copy());
6107        };
6108        if (subDetail != null) {
6109          dst.subDetail = new ArrayList<SubDetailComponent>();
6110          for (SubDetailComponent i : subDetail)
6111            dst.subDetail.add(i.copy());
6112        };
6113        return dst;
6114      }
6115
6116      @Override
6117      public boolean equalsDeep(Base other_) {
6118        if (!super.equalsDeep(other_))
6119          return false;
6120        if (!(other_ instanceof DetailComponent))
6121          return false;
6122        DetailComponent o = (DetailComponent) other_;
6123        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(revenue, o.revenue, true)
6124           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
6125           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
6126           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6127           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
6128           && compareDeep(subDetail, o.subDetail, true);
6129      }
6130
6131      @Override
6132      public boolean equalsShallow(Base other_) {
6133        if (!super.equalsShallow(other_))
6134          return false;
6135        if (!(other_ instanceof DetailComponent))
6136          return false;
6137        DetailComponent o = (DetailComponent) other_;
6138        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
6139          ;
6140      }
6141
6142      public boolean isEmpty() {
6143        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, revenue
6144          , category, service, modifier, programCode, quantity, unitPrice, factor, net
6145          , udi, noteNumber, adjudication, subDetail);
6146      }
6147
6148  public String fhirType() {
6149    return "ExplanationOfBenefit.item.detail";
6150
6151  }
6152
6153  }
6154
6155    @Block()
6156    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
6157        /**
6158         * A service line number.
6159         */
6160        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
6161        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
6162        protected PositiveIntType sequence;
6163
6164        /**
6165         * The type of product or service.
6166         */
6167        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
6168        @Description(shortDefinition="Type of product or service", formalDefinition="The type of product or service." )
6169        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActInvoiceGroupCode")
6170        protected CodeableConcept type;
6171
6172        /**
6173         * The type of reveneu or cost center providing the product and/or service.
6174         */
6175        @Child(name = "revenue", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
6176        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
6177        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
6178        protected CodeableConcept revenue;
6179
6180        /**
6181         * Health Care Service Type Codes  to identify the classification of service or benefits.
6182         */
6183        @Child(name = "category", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
6184        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
6185        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
6186        protected CodeableConcept category;
6187
6188        /**
6189         * A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).
6190         */
6191        @Child(name = "service", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
6192        @Description(shortDefinition="Billing Code", formalDefinition="A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI)." )
6193        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6194        protected CodeableConcept service;
6195
6196        /**
6197         * 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.
6198         */
6199        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6200        @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." )
6201        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
6202        protected List<CodeableConcept> modifier;
6203
6204        /**
6205         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
6206         */
6207        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6208        @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." )
6209        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
6210        protected List<CodeableConcept> programCode;
6211
6212        /**
6213         * The number of repetitions of a service or product.
6214         */
6215        @Child(name = "quantity", type = {SimpleQuantity.class}, order=8, min=0, max=1, modifier=false, summary=false)
6216        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
6217        protected SimpleQuantity quantity;
6218
6219        /**
6220         * The fee for an addittional service or product or charge.
6221         */
6222        @Child(name = "unitPrice", type = {Money.class}, order=9, min=0, max=1, modifier=false, summary=false)
6223        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="The fee for an addittional service or product or charge." )
6224        protected Money unitPrice;
6225
6226        /**
6227         * 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.
6228         */
6229        @Child(name = "factor", type = {DecimalType.class}, order=10, min=0, max=1, modifier=false, summary=false)
6230        @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." )
6231        protected DecimalType factor;
6232
6233        /**
6234         * 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.
6235         */
6236        @Child(name = "net", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=false)
6237        @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." )
6238        protected Money net;
6239
6240        /**
6241         * List of Unique Device Identifiers associated with this line item.
6242         */
6243        @Child(name = "udi", type = {Device.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6244        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
6245        protected List<Reference> udi;
6246        /**
6247         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
6248         */
6249        protected List<Device> udiTarget;
6250
6251
6252        /**
6253         * A list of note references to the notes provided below.
6254         */
6255        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6256        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
6257        protected List<PositiveIntType> noteNumber;
6258
6259        /**
6260         * The adjudications results.
6261         */
6262        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6263        @Description(shortDefinition="Language if different from the resource", formalDefinition="The adjudications results." )
6264        protected List<AdjudicationComponent> adjudication;
6265
6266        private static final long serialVersionUID = 1621872130L;
6267
6268    /**
6269     * Constructor
6270     */
6271      public SubDetailComponent() {
6272        super();
6273      }
6274
6275    /**
6276     * Constructor
6277     */
6278      public SubDetailComponent(PositiveIntType sequence, CodeableConcept type) {
6279        super();
6280        this.sequence = sequence;
6281        this.type = type;
6282      }
6283
6284        /**
6285         * @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
6286         */
6287        public PositiveIntType getSequenceElement() { 
6288          if (this.sequence == null)
6289            if (Configuration.errorOnAutoCreate())
6290              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
6291            else if (Configuration.doAutoCreate())
6292              this.sequence = new PositiveIntType(); // bb
6293          return this.sequence;
6294        }
6295
6296        public boolean hasSequenceElement() { 
6297          return this.sequence != null && !this.sequence.isEmpty();
6298        }
6299
6300        public boolean hasSequence() { 
6301          return this.sequence != null && !this.sequence.isEmpty();
6302        }
6303
6304        /**
6305         * @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
6306         */
6307        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
6308          this.sequence = value;
6309          return this;
6310        }
6311
6312        /**
6313         * @return A service line number.
6314         */
6315        public int getSequence() { 
6316          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6317        }
6318
6319        /**
6320         * @param value A service line number.
6321         */
6322        public SubDetailComponent setSequence(int value) { 
6323            if (this.sequence == null)
6324              this.sequence = new PositiveIntType();
6325            this.sequence.setValue(value);
6326          return this;
6327        }
6328
6329        /**
6330         * @return {@link #type} (The type of product or service.)
6331         */
6332        public CodeableConcept getType() { 
6333          if (this.type == null)
6334            if (Configuration.errorOnAutoCreate())
6335              throw new Error("Attempt to auto-create SubDetailComponent.type");
6336            else if (Configuration.doAutoCreate())
6337              this.type = new CodeableConcept(); // cc
6338          return this.type;
6339        }
6340
6341        public boolean hasType() { 
6342          return this.type != null && !this.type.isEmpty();
6343        }
6344
6345        /**
6346         * @param value {@link #type} (The type of product or service.)
6347         */
6348        public SubDetailComponent setType(CodeableConcept value)  { 
6349          this.type = value;
6350          return this;
6351        }
6352
6353        /**
6354         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
6355         */
6356        public CodeableConcept getRevenue() { 
6357          if (this.revenue == null)
6358            if (Configuration.errorOnAutoCreate())
6359              throw new Error("Attempt to auto-create SubDetailComponent.revenue");
6360            else if (Configuration.doAutoCreate())
6361              this.revenue = new CodeableConcept(); // cc
6362          return this.revenue;
6363        }
6364
6365        public boolean hasRevenue() { 
6366          return this.revenue != null && !this.revenue.isEmpty();
6367        }
6368
6369        /**
6370         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
6371         */
6372        public SubDetailComponent setRevenue(CodeableConcept value)  { 
6373          this.revenue = value;
6374          return this;
6375        }
6376
6377        /**
6378         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
6379         */
6380        public CodeableConcept getCategory() { 
6381          if (this.category == null)
6382            if (Configuration.errorOnAutoCreate())
6383              throw new Error("Attempt to auto-create SubDetailComponent.category");
6384            else if (Configuration.doAutoCreate())
6385              this.category = new CodeableConcept(); // cc
6386          return this.category;
6387        }
6388
6389        public boolean hasCategory() { 
6390          return this.category != null && !this.category.isEmpty();
6391        }
6392
6393        /**
6394         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
6395         */
6396        public SubDetailComponent setCategory(CodeableConcept value)  { 
6397          this.category = value;
6398          return this;
6399        }
6400
6401        /**
6402         * @return {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
6403         */
6404        public CodeableConcept getService() { 
6405          if (this.service == null)
6406            if (Configuration.errorOnAutoCreate())
6407              throw new Error("Attempt to auto-create SubDetailComponent.service");
6408            else if (Configuration.doAutoCreate())
6409              this.service = new CodeableConcept(); // cc
6410          return this.service;
6411        }
6412
6413        public boolean hasService() { 
6414          return this.service != null && !this.service.isEmpty();
6415        }
6416
6417        /**
6418         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
6419         */
6420        public SubDetailComponent setService(CodeableConcept value)  { 
6421          this.service = value;
6422          return this;
6423        }
6424
6425        /**
6426         * @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.)
6427         */
6428        public List<CodeableConcept> getModifier() { 
6429          if (this.modifier == null)
6430            this.modifier = new ArrayList<CodeableConcept>();
6431          return this.modifier;
6432        }
6433
6434        /**
6435         * @return Returns a reference to <code>this</code> for easy method chaining
6436         */
6437        public SubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
6438          this.modifier = theModifier;
6439          return this;
6440        }
6441
6442        public boolean hasModifier() { 
6443          if (this.modifier == null)
6444            return false;
6445          for (CodeableConcept item : this.modifier)
6446            if (!item.isEmpty())
6447              return true;
6448          return false;
6449        }
6450
6451        public CodeableConcept addModifier() { //3
6452          CodeableConcept t = new CodeableConcept();
6453          if (this.modifier == null)
6454            this.modifier = new ArrayList<CodeableConcept>();
6455          this.modifier.add(t);
6456          return t;
6457        }
6458
6459        public SubDetailComponent addModifier(CodeableConcept t) { //3
6460          if (t == null)
6461            return this;
6462          if (this.modifier == null)
6463            this.modifier = new ArrayList<CodeableConcept>();
6464          this.modifier.add(t);
6465          return this;
6466        }
6467
6468        /**
6469         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
6470         */
6471        public CodeableConcept getModifierFirstRep() { 
6472          if (getModifier().isEmpty()) {
6473            addModifier();
6474          }
6475          return getModifier().get(0);
6476        }
6477
6478        /**
6479         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
6480         */
6481        public List<CodeableConcept> getProgramCode() { 
6482          if (this.programCode == null)
6483            this.programCode = new ArrayList<CodeableConcept>();
6484          return this.programCode;
6485        }
6486
6487        /**
6488         * @return Returns a reference to <code>this</code> for easy method chaining
6489         */
6490        public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
6491          this.programCode = theProgramCode;
6492          return this;
6493        }
6494
6495        public boolean hasProgramCode() { 
6496          if (this.programCode == null)
6497            return false;
6498          for (CodeableConcept item : this.programCode)
6499            if (!item.isEmpty())
6500              return true;
6501          return false;
6502        }
6503
6504        public CodeableConcept addProgramCode() { //3
6505          CodeableConcept t = new CodeableConcept();
6506          if (this.programCode == null)
6507            this.programCode = new ArrayList<CodeableConcept>();
6508          this.programCode.add(t);
6509          return t;
6510        }
6511
6512        public SubDetailComponent addProgramCode(CodeableConcept t) { //3
6513          if (t == null)
6514            return this;
6515          if (this.programCode == null)
6516            this.programCode = new ArrayList<CodeableConcept>();
6517          this.programCode.add(t);
6518          return this;
6519        }
6520
6521        /**
6522         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
6523         */
6524        public CodeableConcept getProgramCodeFirstRep() { 
6525          if (getProgramCode().isEmpty()) {
6526            addProgramCode();
6527          }
6528          return getProgramCode().get(0);
6529        }
6530
6531        /**
6532         * @return {@link #quantity} (The number of repetitions of a service or product.)
6533         */
6534        public SimpleQuantity getQuantity() { 
6535          if (this.quantity == null)
6536            if (Configuration.errorOnAutoCreate())
6537              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
6538            else if (Configuration.doAutoCreate())
6539              this.quantity = new SimpleQuantity(); // cc
6540          return this.quantity;
6541        }
6542
6543        public boolean hasQuantity() { 
6544          return this.quantity != null && !this.quantity.isEmpty();
6545        }
6546
6547        /**
6548         * @param value {@link #quantity} (The number of repetitions of a service or product.)
6549         */
6550        public SubDetailComponent setQuantity(SimpleQuantity value)  { 
6551          this.quantity = value;
6552          return this;
6553        }
6554
6555        /**
6556         * @return {@link #unitPrice} (The fee for an addittional service or product or charge.)
6557         */
6558        public Money getUnitPrice() { 
6559          if (this.unitPrice == null)
6560            if (Configuration.errorOnAutoCreate())
6561              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
6562            else if (Configuration.doAutoCreate())
6563              this.unitPrice = new Money(); // cc
6564          return this.unitPrice;
6565        }
6566
6567        public boolean hasUnitPrice() { 
6568          return this.unitPrice != null && !this.unitPrice.isEmpty();
6569        }
6570
6571        /**
6572         * @param value {@link #unitPrice} (The fee for an addittional service or product or charge.)
6573         */
6574        public SubDetailComponent setUnitPrice(Money value)  { 
6575          this.unitPrice = value;
6576          return this;
6577        }
6578
6579        /**
6580         * @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
6581         */
6582        public DecimalType getFactorElement() { 
6583          if (this.factor == null)
6584            if (Configuration.errorOnAutoCreate())
6585              throw new Error("Attempt to auto-create SubDetailComponent.factor");
6586            else if (Configuration.doAutoCreate())
6587              this.factor = new DecimalType(); // bb
6588          return this.factor;
6589        }
6590
6591        public boolean hasFactorElement() { 
6592          return this.factor != null && !this.factor.isEmpty();
6593        }
6594
6595        public boolean hasFactor() { 
6596          return this.factor != null && !this.factor.isEmpty();
6597        }
6598
6599        /**
6600         * @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
6601         */
6602        public SubDetailComponent setFactorElement(DecimalType value) { 
6603          this.factor = value;
6604          return this;
6605        }
6606
6607        /**
6608         * @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.
6609         */
6610        public BigDecimal getFactor() { 
6611          return this.factor == null ? null : this.factor.getValue();
6612        }
6613
6614        /**
6615         * @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.
6616         */
6617        public SubDetailComponent setFactor(BigDecimal value) { 
6618          if (value == null)
6619            this.factor = null;
6620          else {
6621            if (this.factor == null)
6622              this.factor = new DecimalType();
6623            this.factor.setValue(value);
6624          }
6625          return this;
6626        }
6627
6628        /**
6629         * @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.
6630         */
6631        public SubDetailComponent setFactor(long value) { 
6632              this.factor = new DecimalType();
6633            this.factor.setValue(value);
6634          return this;
6635        }
6636
6637        /**
6638         * @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.
6639         */
6640        public SubDetailComponent setFactor(double value) { 
6641              this.factor = new DecimalType();
6642            this.factor.setValue(value);
6643          return this;
6644        }
6645
6646        /**
6647         * @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.)
6648         */
6649        public Money getNet() { 
6650          if (this.net == null)
6651            if (Configuration.errorOnAutoCreate())
6652              throw new Error("Attempt to auto-create SubDetailComponent.net");
6653            else if (Configuration.doAutoCreate())
6654              this.net = new Money(); // cc
6655          return this.net;
6656        }
6657
6658        public boolean hasNet() { 
6659          return this.net != null && !this.net.isEmpty();
6660        }
6661
6662        /**
6663         * @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.)
6664         */
6665        public SubDetailComponent setNet(Money value)  { 
6666          this.net = value;
6667          return this;
6668        }
6669
6670        /**
6671         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
6672         */
6673        public List<Reference> getUdi() { 
6674          if (this.udi == null)
6675            this.udi = new ArrayList<Reference>();
6676          return this.udi;
6677        }
6678
6679        /**
6680         * @return Returns a reference to <code>this</code> for easy method chaining
6681         */
6682        public SubDetailComponent setUdi(List<Reference> theUdi) { 
6683          this.udi = theUdi;
6684          return this;
6685        }
6686
6687        public boolean hasUdi() { 
6688          if (this.udi == null)
6689            return false;
6690          for (Reference item : this.udi)
6691            if (!item.isEmpty())
6692              return true;
6693          return false;
6694        }
6695
6696        public Reference addUdi() { //3
6697          Reference t = new Reference();
6698          if (this.udi == null)
6699            this.udi = new ArrayList<Reference>();
6700          this.udi.add(t);
6701          return t;
6702        }
6703
6704        public SubDetailComponent addUdi(Reference t) { //3
6705          if (t == null)
6706            return this;
6707          if (this.udi == null)
6708            this.udi = new ArrayList<Reference>();
6709          this.udi.add(t);
6710          return this;
6711        }
6712
6713        /**
6714         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
6715         */
6716        public Reference getUdiFirstRep() { 
6717          if (getUdi().isEmpty()) {
6718            addUdi();
6719          }
6720          return getUdi().get(0);
6721        }
6722
6723        /**
6724         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
6725         */
6726        public List<PositiveIntType> getNoteNumber() { 
6727          if (this.noteNumber == null)
6728            this.noteNumber = new ArrayList<PositiveIntType>();
6729          return this.noteNumber;
6730        }
6731
6732        /**
6733         * @return Returns a reference to <code>this</code> for easy method chaining
6734         */
6735        public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
6736          this.noteNumber = theNoteNumber;
6737          return this;
6738        }
6739
6740        public boolean hasNoteNumber() { 
6741          if (this.noteNumber == null)
6742            return false;
6743          for (PositiveIntType item : this.noteNumber)
6744            if (!item.isEmpty())
6745              return true;
6746          return false;
6747        }
6748
6749        /**
6750         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
6751         */
6752        public PositiveIntType addNoteNumberElement() {//2 
6753          PositiveIntType t = new PositiveIntType();
6754          if (this.noteNumber == null)
6755            this.noteNumber = new ArrayList<PositiveIntType>();
6756          this.noteNumber.add(t);
6757          return t;
6758        }
6759
6760        /**
6761         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
6762         */
6763        public SubDetailComponent addNoteNumber(int value) { //1
6764          PositiveIntType t = new PositiveIntType();
6765          t.setValue(value);
6766          if (this.noteNumber == null)
6767            this.noteNumber = new ArrayList<PositiveIntType>();
6768          this.noteNumber.add(t);
6769          return this;
6770        }
6771
6772        /**
6773         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
6774         */
6775        public boolean hasNoteNumber(int value) { 
6776          if (this.noteNumber == null)
6777            return false;
6778          for (PositiveIntType v : this.noteNumber)
6779            if (v.getValue().equals(value)) // positiveInt
6780              return true;
6781          return false;
6782        }
6783
6784        /**
6785         * @return {@link #adjudication} (The adjudications results.)
6786         */
6787        public List<AdjudicationComponent> getAdjudication() { 
6788          if (this.adjudication == null)
6789            this.adjudication = new ArrayList<AdjudicationComponent>();
6790          return this.adjudication;
6791        }
6792
6793        /**
6794         * @return Returns a reference to <code>this</code> for easy method chaining
6795         */
6796        public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
6797          this.adjudication = theAdjudication;
6798          return this;
6799        }
6800
6801        public boolean hasAdjudication() { 
6802          if (this.adjudication == null)
6803            return false;
6804          for (AdjudicationComponent item : this.adjudication)
6805            if (!item.isEmpty())
6806              return true;
6807          return false;
6808        }
6809
6810        public AdjudicationComponent addAdjudication() { //3
6811          AdjudicationComponent t = new AdjudicationComponent();
6812          if (this.adjudication == null)
6813            this.adjudication = new ArrayList<AdjudicationComponent>();
6814          this.adjudication.add(t);
6815          return t;
6816        }
6817
6818        public SubDetailComponent addAdjudication(AdjudicationComponent t) { //3
6819          if (t == null)
6820            return this;
6821          if (this.adjudication == null)
6822            this.adjudication = new ArrayList<AdjudicationComponent>();
6823          this.adjudication.add(t);
6824          return this;
6825        }
6826
6827        /**
6828         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
6829         */
6830        public AdjudicationComponent getAdjudicationFirstRep() { 
6831          if (getAdjudication().isEmpty()) {
6832            addAdjudication();
6833          }
6834          return getAdjudication().get(0);
6835        }
6836
6837        protected void listChildren(List<Property> children) {
6838          super.listChildren(children);
6839          children.add(new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence));
6840          children.add(new Property("type", "CodeableConcept", "The type of product or service.", 0, 1, type));
6841          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
6842          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
6843          children.add(new Property("service", "CodeableConcept", "A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).", 0, 1, service));
6844          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
6845          children.add(new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode));
6846          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
6847          children.add(new Property("unitPrice", "Money", "The fee for an addittional service or product or charge.", 0, 1, unitPrice));
6848          children.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor));
6849          children.add(new Property("net", "Money", "The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net));
6850          children.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
6851          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
6852          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6853        }
6854
6855        @Override
6856        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6857          switch (_hash) {
6858          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence);
6859          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of product or service.", 0, 1, type);
6860          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
6861          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
6862          case 1984153269: /*service*/  return new Property("service", "CodeableConcept", "A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).", 0, 1, service);
6863          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier);
6864          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode);
6865          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
6866          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "The fee for an addittional service or product or charge.", 0, 1, unitPrice);
6867          case -1282148017: /*factor*/  return new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor);
6868          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net);
6869          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
6870          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
6871          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6872          default: return super.getNamedProperty(_hash, _name, _checkValid);
6873          }
6874
6875        }
6876
6877      @Override
6878      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6879        switch (hash) {
6880        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6881        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
6882        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6883        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6884        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
6885        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6886        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6887        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
6888        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6889        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6890        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6891        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6892        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
6893        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
6894        default: return super.getProperty(hash, name, checkValid);
6895        }
6896
6897      }
6898
6899      @Override
6900      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6901        switch (hash) {
6902        case 1349547969: // sequence
6903          this.sequence = castToPositiveInt(value); // PositiveIntType
6904          return value;
6905        case 3575610: // type
6906          this.type = castToCodeableConcept(value); // CodeableConcept
6907          return value;
6908        case 1099842588: // revenue
6909          this.revenue = castToCodeableConcept(value); // CodeableConcept
6910          return value;
6911        case 50511102: // category
6912          this.category = castToCodeableConcept(value); // CodeableConcept
6913          return value;
6914        case 1984153269: // service
6915          this.service = castToCodeableConcept(value); // CodeableConcept
6916          return value;
6917        case -615513385: // modifier
6918          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
6919          return value;
6920        case 1010065041: // programCode
6921          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
6922          return value;
6923        case -1285004149: // quantity
6924          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
6925          return value;
6926        case -486196699: // unitPrice
6927          this.unitPrice = castToMoney(value); // Money
6928          return value;
6929        case -1282148017: // factor
6930          this.factor = castToDecimal(value); // DecimalType
6931          return value;
6932        case 108957: // net
6933          this.net = castToMoney(value); // Money
6934          return value;
6935        case 115642: // udi
6936          this.getUdi().add(castToReference(value)); // Reference
6937          return value;
6938        case -1110033957: // noteNumber
6939          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
6940          return value;
6941        case -231349275: // adjudication
6942          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
6943          return value;
6944        default: return super.setProperty(hash, name, value);
6945        }
6946
6947      }
6948
6949      @Override
6950      public Base setProperty(String name, Base value) throws FHIRException {
6951        if (name.equals("sequence")) {
6952          this.sequence = castToPositiveInt(value); // PositiveIntType
6953        } else if (name.equals("type")) {
6954          this.type = castToCodeableConcept(value); // CodeableConcept
6955        } else if (name.equals("revenue")) {
6956          this.revenue = castToCodeableConcept(value); // CodeableConcept
6957        } else if (name.equals("category")) {
6958          this.category = castToCodeableConcept(value); // CodeableConcept
6959        } else if (name.equals("service")) {
6960          this.service = castToCodeableConcept(value); // CodeableConcept
6961        } else if (name.equals("modifier")) {
6962          this.getModifier().add(castToCodeableConcept(value));
6963        } else if (name.equals("programCode")) {
6964          this.getProgramCode().add(castToCodeableConcept(value));
6965        } else if (name.equals("quantity")) {
6966          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
6967        } else if (name.equals("unitPrice")) {
6968          this.unitPrice = castToMoney(value); // Money
6969        } else if (name.equals("factor")) {
6970          this.factor = castToDecimal(value); // DecimalType
6971        } else if (name.equals("net")) {
6972          this.net = castToMoney(value); // Money
6973        } else if (name.equals("udi")) {
6974          this.getUdi().add(castToReference(value));
6975        } else if (name.equals("noteNumber")) {
6976          this.getNoteNumber().add(castToPositiveInt(value));
6977        } else if (name.equals("adjudication")) {
6978          this.getAdjudication().add((AdjudicationComponent) value);
6979        } else
6980          return super.setProperty(name, value);
6981        return value;
6982      }
6983
6984      @Override
6985      public Base makeProperty(int hash, String name) throws FHIRException {
6986        switch (hash) {
6987        case 1349547969:  return getSequenceElement();
6988        case 3575610:  return getType(); 
6989        case 1099842588:  return getRevenue(); 
6990        case 50511102:  return getCategory(); 
6991        case 1984153269:  return getService(); 
6992        case -615513385:  return addModifier(); 
6993        case 1010065041:  return addProgramCode(); 
6994        case -1285004149:  return getQuantity(); 
6995        case -486196699:  return getUnitPrice(); 
6996        case -1282148017:  return getFactorElement();
6997        case 108957:  return getNet(); 
6998        case 115642:  return addUdi(); 
6999        case -1110033957:  return addNoteNumberElement();
7000        case -231349275:  return addAdjudication(); 
7001        default: return super.makeProperty(hash, name);
7002        }
7003
7004      }
7005
7006      @Override
7007      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7008        switch (hash) {
7009        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
7010        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
7011        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7012        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7013        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
7014        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7015        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
7016        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
7017        case -486196699: /*unitPrice*/ return new String[] {"Money"};
7018        case -1282148017: /*factor*/ return new String[] {"decimal"};
7019        case 108957: /*net*/ return new String[] {"Money"};
7020        case 115642: /*udi*/ return new String[] {"Reference"};
7021        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7022        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7023        default: return super.getTypesForProperty(hash, name);
7024        }
7025
7026      }
7027
7028      @Override
7029      public Base addChild(String name) throws FHIRException {
7030        if (name.equals("sequence")) {
7031          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
7032        }
7033        else if (name.equals("type")) {
7034          this.type = new CodeableConcept();
7035          return this.type;
7036        }
7037        else if (name.equals("revenue")) {
7038          this.revenue = new CodeableConcept();
7039          return this.revenue;
7040        }
7041        else if (name.equals("category")) {
7042          this.category = new CodeableConcept();
7043          return this.category;
7044        }
7045        else if (name.equals("service")) {
7046          this.service = new CodeableConcept();
7047          return this.service;
7048        }
7049        else if (name.equals("modifier")) {
7050          return addModifier();
7051        }
7052        else if (name.equals("programCode")) {
7053          return addProgramCode();
7054        }
7055        else if (name.equals("quantity")) {
7056          this.quantity = new SimpleQuantity();
7057          return this.quantity;
7058        }
7059        else if (name.equals("unitPrice")) {
7060          this.unitPrice = new Money();
7061          return this.unitPrice;
7062        }
7063        else if (name.equals("factor")) {
7064          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
7065        }
7066        else if (name.equals("net")) {
7067          this.net = new Money();
7068          return this.net;
7069        }
7070        else if (name.equals("udi")) {
7071          return addUdi();
7072        }
7073        else if (name.equals("noteNumber")) {
7074          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
7075        }
7076        else if (name.equals("adjudication")) {
7077          return addAdjudication();
7078        }
7079        else
7080          return super.addChild(name);
7081      }
7082
7083      public SubDetailComponent copy() {
7084        SubDetailComponent dst = new SubDetailComponent();
7085        copyValues(dst);
7086        dst.sequence = sequence == null ? null : sequence.copy();
7087        dst.type = type == null ? null : type.copy();
7088        dst.revenue = revenue == null ? null : revenue.copy();
7089        dst.category = category == null ? null : category.copy();
7090        dst.service = service == null ? null : service.copy();
7091        if (modifier != null) {
7092          dst.modifier = new ArrayList<CodeableConcept>();
7093          for (CodeableConcept i : modifier)
7094            dst.modifier.add(i.copy());
7095        };
7096        if (programCode != null) {
7097          dst.programCode = new ArrayList<CodeableConcept>();
7098          for (CodeableConcept i : programCode)
7099            dst.programCode.add(i.copy());
7100        };
7101        dst.quantity = quantity == null ? null : quantity.copy();
7102        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7103        dst.factor = factor == null ? null : factor.copy();
7104        dst.net = net == null ? null : net.copy();
7105        if (udi != null) {
7106          dst.udi = new ArrayList<Reference>();
7107          for (Reference i : udi)
7108            dst.udi.add(i.copy());
7109        };
7110        if (noteNumber != null) {
7111          dst.noteNumber = new ArrayList<PositiveIntType>();
7112          for (PositiveIntType i : noteNumber)
7113            dst.noteNumber.add(i.copy());
7114        };
7115        if (adjudication != null) {
7116          dst.adjudication = new ArrayList<AdjudicationComponent>();
7117          for (AdjudicationComponent i : adjudication)
7118            dst.adjudication.add(i.copy());
7119        };
7120        return dst;
7121      }
7122
7123      @Override
7124      public boolean equalsDeep(Base other_) {
7125        if (!super.equalsDeep(other_))
7126          return false;
7127        if (!(other_ instanceof SubDetailComponent))
7128          return false;
7129        SubDetailComponent o = (SubDetailComponent) other_;
7130        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(revenue, o.revenue, true)
7131           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
7132           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
7133           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
7134           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
7135          ;
7136      }
7137
7138      @Override
7139      public boolean equalsShallow(Base other_) {
7140        if (!super.equalsShallow(other_))
7141          return false;
7142        if (!(other_ instanceof SubDetailComponent))
7143          return false;
7144        SubDetailComponent o = (SubDetailComponent) other_;
7145        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
7146          ;
7147      }
7148
7149      public boolean isEmpty() {
7150        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, revenue
7151          , category, service, modifier, programCode, quantity, unitPrice, factor, net
7152          , udi, noteNumber, adjudication);
7153      }
7154
7155  public String fhirType() {
7156    return "ExplanationOfBenefit.item.detail.subDetail";
7157
7158  }
7159
7160  }
7161
7162    @Block()
7163    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
7164        /**
7165         * List of input service items which this service line is intended to replace.
7166         */
7167        @Child(name = "sequenceLinkId", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7168        @Description(shortDefinition="Service instances", formalDefinition="List of input service items which this service line is intended to replace." )
7169        protected List<PositiveIntType> sequenceLinkId;
7170
7171        /**
7172         * The type of reveneu or cost center providing the product and/or service.
7173         */
7174        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
7175        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
7176        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
7177        protected CodeableConcept revenue;
7178
7179        /**
7180         * Health Care Service Type Codes  to identify the classification of service or benefits.
7181         */
7182        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
7183        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
7184        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
7185        protected CodeableConcept category;
7186
7187        /**
7188         * 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'.
7189         */
7190        @Child(name = "service", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
7191        @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'." )
7192        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7193        protected CodeableConcept service;
7194
7195        /**
7196         * 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.
7197         */
7198        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7199        @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." )
7200        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
7201        protected List<CodeableConcept> modifier;
7202
7203        /**
7204         * The fee charged for the professional service or product.
7205         */
7206        @Child(name = "fee", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
7207        @Description(shortDefinition="Professional fee or Product charge", formalDefinition="The fee charged for the professional service or product." )
7208        protected Money fee;
7209
7210        /**
7211         * A list of note references to the notes provided below.
7212         */
7213        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7214        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
7215        protected List<PositiveIntType> noteNumber;
7216
7217        /**
7218         * The adjudications results.
7219         */
7220        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7221        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudications results." )
7222        protected List<AdjudicationComponent> adjudication;
7223
7224        /**
7225         * The second tier service adjudications for payor added services.
7226         */
7227        @Child(name = "detail", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7228        @Description(shortDefinition="Added items details", formalDefinition="The second tier service adjudications for payor added services." )
7229        protected List<AddedItemsDetailComponent> detail;
7230
7231        private static final long serialVersionUID = 1969703165L;
7232
7233    /**
7234     * Constructor
7235     */
7236      public AddedItemComponent() {
7237        super();
7238      }
7239
7240        /**
7241         * @return {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
7242         */
7243        public List<PositiveIntType> getSequenceLinkId() { 
7244          if (this.sequenceLinkId == null)
7245            this.sequenceLinkId = new ArrayList<PositiveIntType>();
7246          return this.sequenceLinkId;
7247        }
7248
7249        /**
7250         * @return Returns a reference to <code>this</code> for easy method chaining
7251         */
7252        public AddedItemComponent setSequenceLinkId(List<PositiveIntType> theSequenceLinkId) { 
7253          this.sequenceLinkId = theSequenceLinkId;
7254          return this;
7255        }
7256
7257        public boolean hasSequenceLinkId() { 
7258          if (this.sequenceLinkId == null)
7259            return false;
7260          for (PositiveIntType item : this.sequenceLinkId)
7261            if (!item.isEmpty())
7262              return true;
7263          return false;
7264        }
7265
7266        /**
7267         * @return {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
7268         */
7269        public PositiveIntType addSequenceLinkIdElement() {//2 
7270          PositiveIntType t = new PositiveIntType();
7271          if (this.sequenceLinkId == null)
7272            this.sequenceLinkId = new ArrayList<PositiveIntType>();
7273          this.sequenceLinkId.add(t);
7274          return t;
7275        }
7276
7277        /**
7278         * @param value {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
7279         */
7280        public AddedItemComponent addSequenceLinkId(int value) { //1
7281          PositiveIntType t = new PositiveIntType();
7282          t.setValue(value);
7283          if (this.sequenceLinkId == null)
7284            this.sequenceLinkId = new ArrayList<PositiveIntType>();
7285          this.sequenceLinkId.add(t);
7286          return this;
7287        }
7288
7289        /**
7290         * @param value {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
7291         */
7292        public boolean hasSequenceLinkId(int value) { 
7293          if (this.sequenceLinkId == null)
7294            return false;
7295          for (PositiveIntType v : this.sequenceLinkId)
7296            if (v.getValue().equals(value)) // positiveInt
7297              return true;
7298          return false;
7299        }
7300
7301        /**
7302         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
7303         */
7304        public CodeableConcept getRevenue() { 
7305          if (this.revenue == null)
7306            if (Configuration.errorOnAutoCreate())
7307              throw new Error("Attempt to auto-create AddedItemComponent.revenue");
7308            else if (Configuration.doAutoCreate())
7309              this.revenue = new CodeableConcept(); // cc
7310          return this.revenue;
7311        }
7312
7313        public boolean hasRevenue() { 
7314          return this.revenue != null && !this.revenue.isEmpty();
7315        }
7316
7317        /**
7318         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
7319         */
7320        public AddedItemComponent setRevenue(CodeableConcept value)  { 
7321          this.revenue = value;
7322          return this;
7323        }
7324
7325        /**
7326         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
7327         */
7328        public CodeableConcept getCategory() { 
7329          if (this.category == null)
7330            if (Configuration.errorOnAutoCreate())
7331              throw new Error("Attempt to auto-create AddedItemComponent.category");
7332            else if (Configuration.doAutoCreate())
7333              this.category = new CodeableConcept(); // cc
7334          return this.category;
7335        }
7336
7337        public boolean hasCategory() { 
7338          return this.category != null && !this.category.isEmpty();
7339        }
7340
7341        /**
7342         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
7343         */
7344        public AddedItemComponent setCategory(CodeableConcept value)  { 
7345          this.category = value;
7346          return this;
7347        }
7348
7349        /**
7350         * @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'.)
7351         */
7352        public CodeableConcept getService() { 
7353          if (this.service == null)
7354            if (Configuration.errorOnAutoCreate())
7355              throw new Error("Attempt to auto-create AddedItemComponent.service");
7356            else if (Configuration.doAutoCreate())
7357              this.service = new CodeableConcept(); // cc
7358          return this.service;
7359        }
7360
7361        public boolean hasService() { 
7362          return this.service != null && !this.service.isEmpty();
7363        }
7364
7365        /**
7366         * @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'.)
7367         */
7368        public AddedItemComponent setService(CodeableConcept value)  { 
7369          this.service = value;
7370          return this;
7371        }
7372
7373        /**
7374         * @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.)
7375         */
7376        public List<CodeableConcept> getModifier() { 
7377          if (this.modifier == null)
7378            this.modifier = new ArrayList<CodeableConcept>();
7379          return this.modifier;
7380        }
7381
7382        /**
7383         * @return Returns a reference to <code>this</code> for easy method chaining
7384         */
7385        public AddedItemComponent setModifier(List<CodeableConcept> theModifier) { 
7386          this.modifier = theModifier;
7387          return this;
7388        }
7389
7390        public boolean hasModifier() { 
7391          if (this.modifier == null)
7392            return false;
7393          for (CodeableConcept item : this.modifier)
7394            if (!item.isEmpty())
7395              return true;
7396          return false;
7397        }
7398
7399        public CodeableConcept addModifier() { //3
7400          CodeableConcept t = new CodeableConcept();
7401          if (this.modifier == null)
7402            this.modifier = new ArrayList<CodeableConcept>();
7403          this.modifier.add(t);
7404          return t;
7405        }
7406
7407        public AddedItemComponent addModifier(CodeableConcept t) { //3
7408          if (t == null)
7409            return this;
7410          if (this.modifier == null)
7411            this.modifier = new ArrayList<CodeableConcept>();
7412          this.modifier.add(t);
7413          return this;
7414        }
7415
7416        /**
7417         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
7418         */
7419        public CodeableConcept getModifierFirstRep() { 
7420          if (getModifier().isEmpty()) {
7421            addModifier();
7422          }
7423          return getModifier().get(0);
7424        }
7425
7426        /**
7427         * @return {@link #fee} (The fee charged for the professional service or product.)
7428         */
7429        public Money getFee() { 
7430          if (this.fee == null)
7431            if (Configuration.errorOnAutoCreate())
7432              throw new Error("Attempt to auto-create AddedItemComponent.fee");
7433            else if (Configuration.doAutoCreate())
7434              this.fee = new Money(); // cc
7435          return this.fee;
7436        }
7437
7438        public boolean hasFee() { 
7439          return this.fee != null && !this.fee.isEmpty();
7440        }
7441
7442        /**
7443         * @param value {@link #fee} (The fee charged for the professional service or product.)
7444         */
7445        public AddedItemComponent setFee(Money value)  { 
7446          this.fee = value;
7447          return this;
7448        }
7449
7450        /**
7451         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
7452         */
7453        public List<PositiveIntType> getNoteNumber() { 
7454          if (this.noteNumber == null)
7455            this.noteNumber = new ArrayList<PositiveIntType>();
7456          return this.noteNumber;
7457        }
7458
7459        /**
7460         * @return Returns a reference to <code>this</code> for easy method chaining
7461         */
7462        public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
7463          this.noteNumber = theNoteNumber;
7464          return this;
7465        }
7466
7467        public boolean hasNoteNumber() { 
7468          if (this.noteNumber == null)
7469            return false;
7470          for (PositiveIntType item : this.noteNumber)
7471            if (!item.isEmpty())
7472              return true;
7473          return false;
7474        }
7475
7476        /**
7477         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
7478         */
7479        public PositiveIntType addNoteNumberElement() {//2 
7480          PositiveIntType t = new PositiveIntType();
7481          if (this.noteNumber == null)
7482            this.noteNumber = new ArrayList<PositiveIntType>();
7483          this.noteNumber.add(t);
7484          return t;
7485        }
7486
7487        /**
7488         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
7489         */
7490        public AddedItemComponent addNoteNumber(int value) { //1
7491          PositiveIntType t = new PositiveIntType();
7492          t.setValue(value);
7493          if (this.noteNumber == null)
7494            this.noteNumber = new ArrayList<PositiveIntType>();
7495          this.noteNumber.add(t);
7496          return this;
7497        }
7498
7499        /**
7500         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
7501         */
7502        public boolean hasNoteNumber(int value) { 
7503          if (this.noteNumber == null)
7504            return false;
7505          for (PositiveIntType v : this.noteNumber)
7506            if (v.getValue().equals(value)) // positiveInt
7507              return true;
7508          return false;
7509        }
7510
7511        /**
7512         * @return {@link #adjudication} (The adjudications results.)
7513         */
7514        public List<AdjudicationComponent> getAdjudication() { 
7515          if (this.adjudication == null)
7516            this.adjudication = new ArrayList<AdjudicationComponent>();
7517          return this.adjudication;
7518        }
7519
7520        /**
7521         * @return Returns a reference to <code>this</code> for easy method chaining
7522         */
7523        public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
7524          this.adjudication = theAdjudication;
7525          return this;
7526        }
7527
7528        public boolean hasAdjudication() { 
7529          if (this.adjudication == null)
7530            return false;
7531          for (AdjudicationComponent item : this.adjudication)
7532            if (!item.isEmpty())
7533              return true;
7534          return false;
7535        }
7536
7537        public AdjudicationComponent addAdjudication() { //3
7538          AdjudicationComponent t = new AdjudicationComponent();
7539          if (this.adjudication == null)
7540            this.adjudication = new ArrayList<AdjudicationComponent>();
7541          this.adjudication.add(t);
7542          return t;
7543        }
7544
7545        public AddedItemComponent addAdjudication(AdjudicationComponent t) { //3
7546          if (t == null)
7547            return this;
7548          if (this.adjudication == null)
7549            this.adjudication = new ArrayList<AdjudicationComponent>();
7550          this.adjudication.add(t);
7551          return this;
7552        }
7553
7554        /**
7555         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
7556         */
7557        public AdjudicationComponent getAdjudicationFirstRep() { 
7558          if (getAdjudication().isEmpty()) {
7559            addAdjudication();
7560          }
7561          return getAdjudication().get(0);
7562        }
7563
7564        /**
7565         * @return {@link #detail} (The second tier service adjudications for payor added services.)
7566         */
7567        public List<AddedItemsDetailComponent> getDetail() { 
7568          if (this.detail == null)
7569            this.detail = new ArrayList<AddedItemsDetailComponent>();
7570          return this.detail;
7571        }
7572
7573        /**
7574         * @return Returns a reference to <code>this</code> for easy method chaining
7575         */
7576        public AddedItemComponent setDetail(List<AddedItemsDetailComponent> theDetail) { 
7577          this.detail = theDetail;
7578          return this;
7579        }
7580
7581        public boolean hasDetail() { 
7582          if (this.detail == null)
7583            return false;
7584          for (AddedItemsDetailComponent item : this.detail)
7585            if (!item.isEmpty())
7586              return true;
7587          return false;
7588        }
7589
7590        public AddedItemsDetailComponent addDetail() { //3
7591          AddedItemsDetailComponent t = new AddedItemsDetailComponent();
7592          if (this.detail == null)
7593            this.detail = new ArrayList<AddedItemsDetailComponent>();
7594          this.detail.add(t);
7595          return t;
7596        }
7597
7598        public AddedItemComponent addDetail(AddedItemsDetailComponent t) { //3
7599          if (t == null)
7600            return this;
7601          if (this.detail == null)
7602            this.detail = new ArrayList<AddedItemsDetailComponent>();
7603          this.detail.add(t);
7604          return this;
7605        }
7606
7607        /**
7608         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
7609         */
7610        public AddedItemsDetailComponent getDetailFirstRep() { 
7611          if (getDetail().isEmpty()) {
7612            addDetail();
7613          }
7614          return getDetail().get(0);
7615        }
7616
7617        protected void listChildren(List<Property> children) {
7618          super.listChildren(children);
7619          children.add(new Property("sequenceLinkId", "positiveInt", "List of input service items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, sequenceLinkId));
7620          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
7621          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
7622          children.add(new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, service));
7623          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
7624          children.add(new Property("fee", "Money", "The fee charged for the professional service or product.", 0, 1, fee));
7625          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
7626          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
7627          children.add(new Property("detail", "", "The second tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
7628        }
7629
7630        @Override
7631        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7632          switch (_hash) {
7633          case -1422298666: /*sequenceLinkId*/  return new Property("sequenceLinkId", "positiveInt", "List of input service items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, sequenceLinkId);
7634          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
7635          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
7636          case 1984153269: /*service*/  return new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, service);
7637          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier);
7638          case 101254: /*fee*/  return new Property("fee", "Money", "The fee charged for the professional service or product.", 0, 1, fee);
7639          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
7640          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
7641          case -1335224239: /*detail*/  return new Property("detail", "", "The second tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail);
7642          default: return super.getNamedProperty(_hash, _name, _checkValid);
7643          }
7644
7645        }
7646
7647      @Override
7648      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7649        switch (hash) {
7650        case -1422298666: /*sequenceLinkId*/ return this.sequenceLinkId == null ? new Base[0] : this.sequenceLinkId.toArray(new Base[this.sequenceLinkId.size()]); // PositiveIntType
7651        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
7652        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
7653        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
7654        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7655        case 101254: /*fee*/ return this.fee == null ? new Base[0] : new Base[] {this.fee}; // Money
7656        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7657        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7658        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemsDetailComponent
7659        default: return super.getProperty(hash, name, checkValid);
7660        }
7661
7662      }
7663
7664      @Override
7665      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7666        switch (hash) {
7667        case -1422298666: // sequenceLinkId
7668          this.getSequenceLinkId().add(castToPositiveInt(value)); // PositiveIntType
7669          return value;
7670        case 1099842588: // revenue
7671          this.revenue = castToCodeableConcept(value); // CodeableConcept
7672          return value;
7673        case 50511102: // category
7674          this.category = castToCodeableConcept(value); // CodeableConcept
7675          return value;
7676        case 1984153269: // service
7677          this.service = castToCodeableConcept(value); // CodeableConcept
7678          return value;
7679        case -615513385: // modifier
7680          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7681          return value;
7682        case 101254: // fee
7683          this.fee = castToMoney(value); // Money
7684          return value;
7685        case -1110033957: // noteNumber
7686          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
7687          return value;
7688        case -231349275: // adjudication
7689          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7690          return value;
7691        case -1335224239: // detail
7692          this.getDetail().add((AddedItemsDetailComponent) value); // AddedItemsDetailComponent
7693          return value;
7694        default: return super.setProperty(hash, name, value);
7695        }
7696
7697      }
7698
7699      @Override
7700      public Base setProperty(String name, Base value) throws FHIRException {
7701        if (name.equals("sequenceLinkId")) {
7702          this.getSequenceLinkId().add(castToPositiveInt(value));
7703        } else if (name.equals("revenue")) {
7704          this.revenue = castToCodeableConcept(value); // CodeableConcept
7705        } else if (name.equals("category")) {
7706          this.category = castToCodeableConcept(value); // CodeableConcept
7707        } else if (name.equals("service")) {
7708          this.service = castToCodeableConcept(value); // CodeableConcept
7709        } else if (name.equals("modifier")) {
7710          this.getModifier().add(castToCodeableConcept(value));
7711        } else if (name.equals("fee")) {
7712          this.fee = castToMoney(value); // Money
7713        } else if (name.equals("noteNumber")) {
7714          this.getNoteNumber().add(castToPositiveInt(value));
7715        } else if (name.equals("adjudication")) {
7716          this.getAdjudication().add((AdjudicationComponent) value);
7717        } else if (name.equals("detail")) {
7718          this.getDetail().add((AddedItemsDetailComponent) value);
7719        } else
7720          return super.setProperty(name, value);
7721        return value;
7722      }
7723
7724      @Override
7725      public Base makeProperty(int hash, String name) throws FHIRException {
7726        switch (hash) {
7727        case -1422298666:  return addSequenceLinkIdElement();
7728        case 1099842588:  return getRevenue(); 
7729        case 50511102:  return getCategory(); 
7730        case 1984153269:  return getService(); 
7731        case -615513385:  return addModifier(); 
7732        case 101254:  return getFee(); 
7733        case -1110033957:  return addNoteNumberElement();
7734        case -231349275:  return addAdjudication(); 
7735        case -1335224239:  return addDetail(); 
7736        default: return super.makeProperty(hash, name);
7737        }
7738
7739      }
7740
7741      @Override
7742      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7743        switch (hash) {
7744        case -1422298666: /*sequenceLinkId*/ return new String[] {"positiveInt"};
7745        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7746        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7747        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
7748        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7749        case 101254: /*fee*/ return new String[] {"Money"};
7750        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7751        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7752        case -1335224239: /*detail*/ return new String[] {};
7753        default: return super.getTypesForProperty(hash, name);
7754        }
7755
7756      }
7757
7758      @Override
7759      public Base addChild(String name) throws FHIRException {
7760        if (name.equals("sequenceLinkId")) {
7761          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequenceLinkId");
7762        }
7763        else if (name.equals("revenue")) {
7764          this.revenue = new CodeableConcept();
7765          return this.revenue;
7766        }
7767        else if (name.equals("category")) {
7768          this.category = new CodeableConcept();
7769          return this.category;
7770        }
7771        else if (name.equals("service")) {
7772          this.service = new CodeableConcept();
7773          return this.service;
7774        }
7775        else if (name.equals("modifier")) {
7776          return addModifier();
7777        }
7778        else if (name.equals("fee")) {
7779          this.fee = new Money();
7780          return this.fee;
7781        }
7782        else if (name.equals("noteNumber")) {
7783          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
7784        }
7785        else if (name.equals("adjudication")) {
7786          return addAdjudication();
7787        }
7788        else if (name.equals("detail")) {
7789          return addDetail();
7790        }
7791        else
7792          return super.addChild(name);
7793      }
7794
7795      public AddedItemComponent copy() {
7796        AddedItemComponent dst = new AddedItemComponent();
7797        copyValues(dst);
7798        if (sequenceLinkId != null) {
7799          dst.sequenceLinkId = new ArrayList<PositiveIntType>();
7800          for (PositiveIntType i : sequenceLinkId)
7801            dst.sequenceLinkId.add(i.copy());
7802        };
7803        dst.revenue = revenue == null ? null : revenue.copy();
7804        dst.category = category == null ? null : category.copy();
7805        dst.service = service == null ? null : service.copy();
7806        if (modifier != null) {
7807          dst.modifier = new ArrayList<CodeableConcept>();
7808          for (CodeableConcept i : modifier)
7809            dst.modifier.add(i.copy());
7810        };
7811        dst.fee = fee == null ? null : fee.copy();
7812        if (noteNumber != null) {
7813          dst.noteNumber = new ArrayList<PositiveIntType>();
7814          for (PositiveIntType i : noteNumber)
7815            dst.noteNumber.add(i.copy());
7816        };
7817        if (adjudication != null) {
7818          dst.adjudication = new ArrayList<AdjudicationComponent>();
7819          for (AdjudicationComponent i : adjudication)
7820            dst.adjudication.add(i.copy());
7821        };
7822        if (detail != null) {
7823          dst.detail = new ArrayList<AddedItemsDetailComponent>();
7824          for (AddedItemsDetailComponent i : detail)
7825            dst.detail.add(i.copy());
7826        };
7827        return dst;
7828      }
7829
7830      @Override
7831      public boolean equalsDeep(Base other_) {
7832        if (!super.equalsDeep(other_))
7833          return false;
7834        if (!(other_ instanceof AddedItemComponent))
7835          return false;
7836        AddedItemComponent o = (AddedItemComponent) other_;
7837        return compareDeep(sequenceLinkId, o.sequenceLinkId, true) && compareDeep(revenue, o.revenue, true)
7838           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
7839           && compareDeep(fee, o.fee, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
7840           && compareDeep(detail, o.detail, true);
7841      }
7842
7843      @Override
7844      public boolean equalsShallow(Base other_) {
7845        if (!super.equalsShallow(other_))
7846          return false;
7847        if (!(other_ instanceof AddedItemComponent))
7848          return false;
7849        AddedItemComponent o = (AddedItemComponent) other_;
7850        return compareValues(sequenceLinkId, o.sequenceLinkId, true) && compareValues(noteNumber, o.noteNumber, true)
7851          ;
7852      }
7853
7854      public boolean isEmpty() {
7855        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequenceLinkId, revenue, category
7856          , service, modifier, fee, noteNumber, adjudication, detail);
7857      }
7858
7859  public String fhirType() {
7860    return "ExplanationOfBenefit.addItem";
7861
7862  }
7863
7864  }
7865
7866    @Block()
7867    public static class AddedItemsDetailComponent extends BackboneElement implements IBaseBackboneElement {
7868        /**
7869         * The type of reveneu or cost center providing the product and/or service.
7870         */
7871        @Child(name = "revenue", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
7872        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
7873        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
7874        protected CodeableConcept revenue;
7875
7876        /**
7877         * Health Care Service Type Codes  to identify the classification of service or benefits.
7878         */
7879        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
7880        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
7881        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
7882        protected CodeableConcept category;
7883
7884        /**
7885         * A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).
7886         */
7887        @Child(name = "service", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
7888        @Description(shortDefinition="Billing Code", formalDefinition="A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI)." )
7889        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7890        protected CodeableConcept service;
7891
7892        /**
7893         * 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.
7894         */
7895        @Child(name = "modifier", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7896        @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." )
7897        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
7898        protected List<CodeableConcept> modifier;
7899
7900        /**
7901         * The fee charged for the professional service or product.
7902         */
7903        @Child(name = "fee", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
7904        @Description(shortDefinition="Professional fee or Product charge", formalDefinition="The fee charged for the professional service or product." )
7905        protected Money fee;
7906
7907        /**
7908         * A list of note references to the notes provided below.
7909         */
7910        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7911        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
7912        protected List<PositiveIntType> noteNumber;
7913
7914        /**
7915         * The adjudications results.
7916         */
7917        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7918        @Description(shortDefinition="Added items detail adjudication", formalDefinition="The adjudications results." )
7919        protected List<AdjudicationComponent> adjudication;
7920
7921        private static final long serialVersionUID = -311484980L;
7922
7923    /**
7924     * Constructor
7925     */
7926      public AddedItemsDetailComponent() {
7927        super();
7928      }
7929
7930        /**
7931         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
7932         */
7933        public CodeableConcept getRevenue() { 
7934          if (this.revenue == null)
7935            if (Configuration.errorOnAutoCreate())
7936              throw new Error("Attempt to auto-create AddedItemsDetailComponent.revenue");
7937            else if (Configuration.doAutoCreate())
7938              this.revenue = new CodeableConcept(); // cc
7939          return this.revenue;
7940        }
7941
7942        public boolean hasRevenue() { 
7943          return this.revenue != null && !this.revenue.isEmpty();
7944        }
7945
7946        /**
7947         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
7948         */
7949        public AddedItemsDetailComponent setRevenue(CodeableConcept value)  { 
7950          this.revenue = value;
7951          return this;
7952        }
7953
7954        /**
7955         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
7956         */
7957        public CodeableConcept getCategory() { 
7958          if (this.category == null)
7959            if (Configuration.errorOnAutoCreate())
7960              throw new Error("Attempt to auto-create AddedItemsDetailComponent.category");
7961            else if (Configuration.doAutoCreate())
7962              this.category = new CodeableConcept(); // cc
7963          return this.category;
7964        }
7965
7966        public boolean hasCategory() { 
7967          return this.category != null && !this.category.isEmpty();
7968        }
7969
7970        /**
7971         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
7972         */
7973        public AddedItemsDetailComponent setCategory(CodeableConcept value)  { 
7974          this.category = value;
7975          return this;
7976        }
7977
7978        /**
7979         * @return {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
7980         */
7981        public CodeableConcept getService() { 
7982          if (this.service == null)
7983            if (Configuration.errorOnAutoCreate())
7984              throw new Error("Attempt to auto-create AddedItemsDetailComponent.service");
7985            else if (Configuration.doAutoCreate())
7986              this.service = new CodeableConcept(); // cc
7987          return this.service;
7988        }
7989
7990        public boolean hasService() { 
7991          return this.service != null && !this.service.isEmpty();
7992        }
7993
7994        /**
7995         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
7996         */
7997        public AddedItemsDetailComponent setService(CodeableConcept value)  { 
7998          this.service = value;
7999          return this;
8000        }
8001
8002        /**
8003         * @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.)
8004         */
8005        public List<CodeableConcept> getModifier() { 
8006          if (this.modifier == null)
8007            this.modifier = new ArrayList<CodeableConcept>();
8008          return this.modifier;
8009        }
8010
8011        /**
8012         * @return Returns a reference to <code>this</code> for easy method chaining
8013         */
8014        public AddedItemsDetailComponent setModifier(List<CodeableConcept> theModifier) { 
8015          this.modifier = theModifier;
8016          return this;
8017        }
8018
8019        public boolean hasModifier() { 
8020          if (this.modifier == null)
8021            return false;
8022          for (CodeableConcept item : this.modifier)
8023            if (!item.isEmpty())
8024              return true;
8025          return false;
8026        }
8027
8028        public CodeableConcept addModifier() { //3
8029          CodeableConcept t = new CodeableConcept();
8030          if (this.modifier == null)
8031            this.modifier = new ArrayList<CodeableConcept>();
8032          this.modifier.add(t);
8033          return t;
8034        }
8035
8036        public AddedItemsDetailComponent addModifier(CodeableConcept t) { //3
8037          if (t == null)
8038            return this;
8039          if (this.modifier == null)
8040            this.modifier = new ArrayList<CodeableConcept>();
8041          this.modifier.add(t);
8042          return this;
8043        }
8044
8045        /**
8046         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
8047         */
8048        public CodeableConcept getModifierFirstRep() { 
8049          if (getModifier().isEmpty()) {
8050            addModifier();
8051          }
8052          return getModifier().get(0);
8053        }
8054
8055        /**
8056         * @return {@link #fee} (The fee charged for the professional service or product.)
8057         */
8058        public Money getFee() { 
8059          if (this.fee == null)
8060            if (Configuration.errorOnAutoCreate())
8061              throw new Error("Attempt to auto-create AddedItemsDetailComponent.fee");
8062            else if (Configuration.doAutoCreate())
8063              this.fee = new Money(); // cc
8064          return this.fee;
8065        }
8066
8067        public boolean hasFee() { 
8068          return this.fee != null && !this.fee.isEmpty();
8069        }
8070
8071        /**
8072         * @param value {@link #fee} (The fee charged for the professional service or product.)
8073         */
8074        public AddedItemsDetailComponent setFee(Money value)  { 
8075          this.fee = value;
8076          return this;
8077        }
8078
8079        /**
8080         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
8081         */
8082        public List<PositiveIntType> getNoteNumber() { 
8083          if (this.noteNumber == null)
8084            this.noteNumber = new ArrayList<PositiveIntType>();
8085          return this.noteNumber;
8086        }
8087
8088        /**
8089         * @return Returns a reference to <code>this</code> for easy method chaining
8090         */
8091        public AddedItemsDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
8092          this.noteNumber = theNoteNumber;
8093          return this;
8094        }
8095
8096        public boolean hasNoteNumber() { 
8097          if (this.noteNumber == null)
8098            return false;
8099          for (PositiveIntType item : this.noteNumber)
8100            if (!item.isEmpty())
8101              return true;
8102          return false;
8103        }
8104
8105        /**
8106         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
8107         */
8108        public PositiveIntType addNoteNumberElement() {//2 
8109          PositiveIntType t = new PositiveIntType();
8110          if (this.noteNumber == null)
8111            this.noteNumber = new ArrayList<PositiveIntType>();
8112          this.noteNumber.add(t);
8113          return t;
8114        }
8115
8116        /**
8117         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
8118         */
8119        public AddedItemsDetailComponent addNoteNumber(int value) { //1
8120          PositiveIntType t = new PositiveIntType();
8121          t.setValue(value);
8122          if (this.noteNumber == null)
8123            this.noteNumber = new ArrayList<PositiveIntType>();
8124          this.noteNumber.add(t);
8125          return this;
8126        }
8127
8128        /**
8129         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
8130         */
8131        public boolean hasNoteNumber(int value) { 
8132          if (this.noteNumber == null)
8133            return false;
8134          for (PositiveIntType v : this.noteNumber)
8135            if (v.getValue().equals(value)) // positiveInt
8136              return true;
8137          return false;
8138        }
8139
8140        /**
8141         * @return {@link #adjudication} (The adjudications results.)
8142         */
8143        public List<AdjudicationComponent> getAdjudication() { 
8144          if (this.adjudication == null)
8145            this.adjudication = new ArrayList<AdjudicationComponent>();
8146          return this.adjudication;
8147        }
8148
8149        /**
8150         * @return Returns a reference to <code>this</code> for easy method chaining
8151         */
8152        public AddedItemsDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
8153          this.adjudication = theAdjudication;
8154          return this;
8155        }
8156
8157        public boolean hasAdjudication() { 
8158          if (this.adjudication == null)
8159            return false;
8160          for (AdjudicationComponent item : this.adjudication)
8161            if (!item.isEmpty())
8162              return true;
8163          return false;
8164        }
8165
8166        public AdjudicationComponent addAdjudication() { //3
8167          AdjudicationComponent t = new AdjudicationComponent();
8168          if (this.adjudication == null)
8169            this.adjudication = new ArrayList<AdjudicationComponent>();
8170          this.adjudication.add(t);
8171          return t;
8172        }
8173
8174        public AddedItemsDetailComponent addAdjudication(AdjudicationComponent t) { //3
8175          if (t == null)
8176            return this;
8177          if (this.adjudication == null)
8178            this.adjudication = new ArrayList<AdjudicationComponent>();
8179          this.adjudication.add(t);
8180          return this;
8181        }
8182
8183        /**
8184         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
8185         */
8186        public AdjudicationComponent getAdjudicationFirstRep() { 
8187          if (getAdjudication().isEmpty()) {
8188            addAdjudication();
8189          }
8190          return getAdjudication().get(0);
8191        }
8192
8193        protected void listChildren(List<Property> children) {
8194          super.listChildren(children);
8195          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
8196          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
8197          children.add(new Property("service", "CodeableConcept", "A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).", 0, 1, service));
8198          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
8199          children.add(new Property("fee", "Money", "The fee charged for the professional service or product.", 0, 1, fee));
8200          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
8201          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
8202        }
8203
8204        @Override
8205        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8206          switch (_hash) {
8207          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
8208          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
8209          case 1984153269: /*service*/  return new Property("service", "CodeableConcept", "A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).", 0, 1, service);
8210          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier);
8211          case 101254: /*fee*/  return new Property("fee", "Money", "The fee charged for the professional service or product.", 0, 1, fee);
8212          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
8213          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
8214          default: return super.getNamedProperty(_hash, _name, _checkValid);
8215          }
8216
8217        }
8218
8219      @Override
8220      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8221        switch (hash) {
8222        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
8223        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
8224        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
8225        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
8226        case 101254: /*fee*/ return this.fee == null ? new Base[0] : new Base[] {this.fee}; // Money
8227        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
8228        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
8229        default: return super.getProperty(hash, name, checkValid);
8230        }
8231
8232      }
8233
8234      @Override
8235      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8236        switch (hash) {
8237        case 1099842588: // revenue
8238          this.revenue = castToCodeableConcept(value); // CodeableConcept
8239          return value;
8240        case 50511102: // category
8241          this.category = castToCodeableConcept(value); // CodeableConcept
8242          return value;
8243        case 1984153269: // service
8244          this.service = castToCodeableConcept(value); // CodeableConcept
8245          return value;
8246        case -615513385: // modifier
8247          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
8248          return value;
8249        case 101254: // fee
8250          this.fee = castToMoney(value); // Money
8251          return value;
8252        case -1110033957: // noteNumber
8253          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
8254          return value;
8255        case -231349275: // adjudication
8256          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
8257          return value;
8258        default: return super.setProperty(hash, name, value);
8259        }
8260
8261      }
8262
8263      @Override
8264      public Base setProperty(String name, Base value) throws FHIRException {
8265        if (name.equals("revenue")) {
8266          this.revenue = castToCodeableConcept(value); // CodeableConcept
8267        } else if (name.equals("category")) {
8268          this.category = castToCodeableConcept(value); // CodeableConcept
8269        } else if (name.equals("service")) {
8270          this.service = castToCodeableConcept(value); // CodeableConcept
8271        } else if (name.equals("modifier")) {
8272          this.getModifier().add(castToCodeableConcept(value));
8273        } else if (name.equals("fee")) {
8274          this.fee = castToMoney(value); // Money
8275        } else if (name.equals("noteNumber")) {
8276          this.getNoteNumber().add(castToPositiveInt(value));
8277        } else if (name.equals("adjudication")) {
8278          this.getAdjudication().add((AdjudicationComponent) value);
8279        } else
8280          return super.setProperty(name, value);
8281        return value;
8282      }
8283
8284      @Override
8285      public Base makeProperty(int hash, String name) throws FHIRException {
8286        switch (hash) {
8287        case 1099842588:  return getRevenue(); 
8288        case 50511102:  return getCategory(); 
8289        case 1984153269:  return getService(); 
8290        case -615513385:  return addModifier(); 
8291        case 101254:  return getFee(); 
8292        case -1110033957:  return addNoteNumberElement();
8293        case -231349275:  return addAdjudication(); 
8294        default: return super.makeProperty(hash, name);
8295        }
8296
8297      }
8298
8299      @Override
8300      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8301        switch (hash) {
8302        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
8303        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
8304        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
8305        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
8306        case 101254: /*fee*/ return new String[] {"Money"};
8307        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
8308        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
8309        default: return super.getTypesForProperty(hash, name);
8310        }
8311
8312      }
8313
8314      @Override
8315      public Base addChild(String name) throws FHIRException {
8316        if (name.equals("revenue")) {
8317          this.revenue = new CodeableConcept();
8318          return this.revenue;
8319        }
8320        else if (name.equals("category")) {
8321          this.category = new CodeableConcept();
8322          return this.category;
8323        }
8324        else if (name.equals("service")) {
8325          this.service = new CodeableConcept();
8326          return this.service;
8327        }
8328        else if (name.equals("modifier")) {
8329          return addModifier();
8330        }
8331        else if (name.equals("fee")) {
8332          this.fee = new Money();
8333          return this.fee;
8334        }
8335        else if (name.equals("noteNumber")) {
8336          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
8337        }
8338        else if (name.equals("adjudication")) {
8339          return addAdjudication();
8340        }
8341        else
8342          return super.addChild(name);
8343      }
8344
8345      public AddedItemsDetailComponent copy() {
8346        AddedItemsDetailComponent dst = new AddedItemsDetailComponent();
8347        copyValues(dst);
8348        dst.revenue = revenue == null ? null : revenue.copy();
8349        dst.category = category == null ? null : category.copy();
8350        dst.service = service == null ? null : service.copy();
8351        if (modifier != null) {
8352          dst.modifier = new ArrayList<CodeableConcept>();
8353          for (CodeableConcept i : modifier)
8354            dst.modifier.add(i.copy());
8355        };
8356        dst.fee = fee == null ? null : fee.copy();
8357        if (noteNumber != null) {
8358          dst.noteNumber = new ArrayList<PositiveIntType>();
8359          for (PositiveIntType i : noteNumber)
8360            dst.noteNumber.add(i.copy());
8361        };
8362        if (adjudication != null) {
8363          dst.adjudication = new ArrayList<AdjudicationComponent>();
8364          for (AdjudicationComponent i : adjudication)
8365            dst.adjudication.add(i.copy());
8366        };
8367        return dst;
8368      }
8369
8370      @Override
8371      public boolean equalsDeep(Base other_) {
8372        if (!super.equalsDeep(other_))
8373          return false;
8374        if (!(other_ instanceof AddedItemsDetailComponent))
8375          return false;
8376        AddedItemsDetailComponent o = (AddedItemsDetailComponent) other_;
8377        return compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true) && compareDeep(service, o.service, true)
8378           && compareDeep(modifier, o.modifier, true) && compareDeep(fee, o.fee, true) && compareDeep(noteNumber, o.noteNumber, true)
8379           && compareDeep(adjudication, o.adjudication, true);
8380      }
8381
8382      @Override
8383      public boolean equalsShallow(Base other_) {
8384        if (!super.equalsShallow(other_))
8385          return false;
8386        if (!(other_ instanceof AddedItemsDetailComponent))
8387          return false;
8388        AddedItemsDetailComponent o = (AddedItemsDetailComponent) other_;
8389        return compareValues(noteNumber, o.noteNumber, true);
8390      }
8391
8392      public boolean isEmpty() {
8393        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(revenue, category, service
8394          , modifier, fee, noteNumber, adjudication);
8395      }
8396
8397  public String fhirType() {
8398    return "ExplanationOfBenefit.addItem.detail";
8399
8400  }
8401
8402  }
8403
8404    @Block()
8405    public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
8406        /**
8407         * Whether this represents partial or complete payment of the claim.
8408         */
8409        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
8410        @Description(shortDefinition="Partial or Complete", formalDefinition="Whether this represents partial or complete payment of the claim." )
8411        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-paymenttype")
8412        protected CodeableConcept type;
8413
8414        /**
8415         * Adjustment to the payment of this transaction which is not related to adjudication of this transaction.
8416         */
8417        @Child(name = "adjustment", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
8418        @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." )
8419        protected Money adjustment;
8420
8421        /**
8422         * Reason for the payment adjustment.
8423         */
8424        @Child(name = "adjustmentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
8425        @Description(shortDefinition="Explanation for the non-claim adjustment", formalDefinition="Reason for the payment adjustment." )
8426        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
8427        protected CodeableConcept adjustmentReason;
8428
8429        /**
8430         * Estimated payment date.
8431         */
8432        @Child(name = "date", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=false)
8433        @Description(shortDefinition="Expected date of Payment", formalDefinition="Estimated payment date." )
8434        protected DateType date;
8435
8436        /**
8437         * Payable less any payment adjustment.
8438         */
8439        @Child(name = "amount", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
8440        @Description(shortDefinition="Payable amount after adjustment", formalDefinition="Payable less any payment adjustment." )
8441        protected Money amount;
8442
8443        /**
8444         * Payment identifer.
8445         */
8446        @Child(name = "identifier", type = {Identifier.class}, order=6, min=0, max=1, modifier=false, summary=false)
8447        @Description(shortDefinition="Identifier of the payment instrument", formalDefinition="Payment identifer." )
8448        protected Identifier identifier;
8449
8450        private static final long serialVersionUID = 1539906026L;
8451
8452    /**
8453     * Constructor
8454     */
8455      public PaymentComponent() {
8456        super();
8457      }
8458
8459        /**
8460         * @return {@link #type} (Whether this represents partial or complete payment of the claim.)
8461         */
8462        public CodeableConcept getType() { 
8463          if (this.type == null)
8464            if (Configuration.errorOnAutoCreate())
8465              throw new Error("Attempt to auto-create PaymentComponent.type");
8466            else if (Configuration.doAutoCreate())
8467              this.type = new CodeableConcept(); // cc
8468          return this.type;
8469        }
8470
8471        public boolean hasType() { 
8472          return this.type != null && !this.type.isEmpty();
8473        }
8474
8475        /**
8476         * @param value {@link #type} (Whether this represents partial or complete payment of the claim.)
8477         */
8478        public PaymentComponent setType(CodeableConcept value)  { 
8479          this.type = value;
8480          return this;
8481        }
8482
8483        /**
8484         * @return {@link #adjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
8485         */
8486        public Money getAdjustment() { 
8487          if (this.adjustment == null)
8488            if (Configuration.errorOnAutoCreate())
8489              throw new Error("Attempt to auto-create PaymentComponent.adjustment");
8490            else if (Configuration.doAutoCreate())
8491              this.adjustment = new Money(); // cc
8492          return this.adjustment;
8493        }
8494
8495        public boolean hasAdjustment() { 
8496          return this.adjustment != null && !this.adjustment.isEmpty();
8497        }
8498
8499        /**
8500         * @param value {@link #adjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
8501         */
8502        public PaymentComponent setAdjustment(Money value)  { 
8503          this.adjustment = value;
8504          return this;
8505        }
8506
8507        /**
8508         * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
8509         */
8510        public CodeableConcept getAdjustmentReason() { 
8511          if (this.adjustmentReason == null)
8512            if (Configuration.errorOnAutoCreate())
8513              throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
8514            else if (Configuration.doAutoCreate())
8515              this.adjustmentReason = new CodeableConcept(); // cc
8516          return this.adjustmentReason;
8517        }
8518
8519        public boolean hasAdjustmentReason() { 
8520          return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
8521        }
8522
8523        /**
8524         * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
8525         */
8526        public PaymentComponent setAdjustmentReason(CodeableConcept value)  { 
8527          this.adjustmentReason = value;
8528          return this;
8529        }
8530
8531        /**
8532         * @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
8533         */
8534        public DateType getDateElement() { 
8535          if (this.date == null)
8536            if (Configuration.errorOnAutoCreate())
8537              throw new Error("Attempt to auto-create PaymentComponent.date");
8538            else if (Configuration.doAutoCreate())
8539              this.date = new DateType(); // bb
8540          return this.date;
8541        }
8542
8543        public boolean hasDateElement() { 
8544          return this.date != null && !this.date.isEmpty();
8545        }
8546
8547        public boolean hasDate() { 
8548          return this.date != null && !this.date.isEmpty();
8549        }
8550
8551        /**
8552         * @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
8553         */
8554        public PaymentComponent setDateElement(DateType value) { 
8555          this.date = value;
8556          return this;
8557        }
8558
8559        /**
8560         * @return Estimated payment date.
8561         */
8562        public Date getDate() { 
8563          return this.date == null ? null : this.date.getValue();
8564        }
8565
8566        /**
8567         * @param value Estimated payment date.
8568         */
8569        public PaymentComponent setDate(Date value) { 
8570          if (value == null)
8571            this.date = null;
8572          else {
8573            if (this.date == null)
8574              this.date = new DateType();
8575            this.date.setValue(value);
8576          }
8577          return this;
8578        }
8579
8580        /**
8581         * @return {@link #amount} (Payable less any payment adjustment.)
8582         */
8583        public Money getAmount() { 
8584          if (this.amount == null)
8585            if (Configuration.errorOnAutoCreate())
8586              throw new Error("Attempt to auto-create PaymentComponent.amount");
8587            else if (Configuration.doAutoCreate())
8588              this.amount = new Money(); // cc
8589          return this.amount;
8590        }
8591
8592        public boolean hasAmount() { 
8593          return this.amount != null && !this.amount.isEmpty();
8594        }
8595
8596        /**
8597         * @param value {@link #amount} (Payable less any payment adjustment.)
8598         */
8599        public PaymentComponent setAmount(Money value)  { 
8600          this.amount = value;
8601          return this;
8602        }
8603
8604        /**
8605         * @return {@link #identifier} (Payment identifer.)
8606         */
8607        public Identifier getIdentifier() { 
8608          if (this.identifier == null)
8609            if (Configuration.errorOnAutoCreate())
8610              throw new Error("Attempt to auto-create PaymentComponent.identifier");
8611            else if (Configuration.doAutoCreate())
8612              this.identifier = new Identifier(); // cc
8613          return this.identifier;
8614        }
8615
8616        public boolean hasIdentifier() { 
8617          return this.identifier != null && !this.identifier.isEmpty();
8618        }
8619
8620        /**
8621         * @param value {@link #identifier} (Payment identifer.)
8622         */
8623        public PaymentComponent setIdentifier(Identifier value)  { 
8624          this.identifier = value;
8625          return this;
8626        }
8627
8628        protected void listChildren(List<Property> children) {
8629          super.listChildren(children);
8630          children.add(new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the claim.", 0, 1, type));
8631          children.add(new Property("adjustment", "Money", "Adjustment to the payment of this transaction which is not related to adjudication of this transaction.", 0, 1, adjustment));
8632          children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason));
8633          children.add(new Property("date", "date", "Estimated payment date.", 0, 1, date));
8634          children.add(new Property("amount", "Money", "Payable less any payment adjustment.", 0, 1, amount));
8635          children.add(new Property("identifier", "Identifier", "Payment identifer.", 0, 1, identifier));
8636        }
8637
8638        @Override
8639        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8640          switch (_hash) {
8641          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the claim.", 0, 1, type);
8642          case 1977085293: /*adjustment*/  return new Property("adjustment", "Money", "Adjustment to the payment of this transaction which is not related to adjudication of this transaction.", 0, 1, adjustment);
8643          case -1255938543: /*adjustmentReason*/  return new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason);
8644          case 3076014: /*date*/  return new Property("date", "date", "Estimated payment date.", 0, 1, date);
8645          case -1413853096: /*amount*/  return new Property("amount", "Money", "Payable less any payment adjustment.", 0, 1, amount);
8646          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Payment identifer.", 0, 1, identifier);
8647          default: return super.getNamedProperty(_hash, _name, _checkValid);
8648          }
8649
8650        }
8651
8652      @Override
8653      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8654        switch (hash) {
8655        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
8656        case 1977085293: /*adjustment*/ return this.adjustment == null ? new Base[0] : new Base[] {this.adjustment}; // Money
8657        case -1255938543: /*adjustmentReason*/ return this.adjustmentReason == null ? new Base[0] : new Base[] {this.adjustmentReason}; // CodeableConcept
8658        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
8659        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
8660        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
8661        default: return super.getProperty(hash, name, checkValid);
8662        }
8663
8664      }
8665
8666      @Override
8667      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8668        switch (hash) {
8669        case 3575610: // type
8670          this.type = castToCodeableConcept(value); // CodeableConcept
8671          return value;
8672        case 1977085293: // adjustment
8673          this.adjustment = castToMoney(value); // Money
8674          return value;
8675        case -1255938543: // adjustmentReason
8676          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
8677          return value;
8678        case 3076014: // date
8679          this.date = castToDate(value); // DateType
8680          return value;
8681        case -1413853096: // amount
8682          this.amount = castToMoney(value); // Money
8683          return value;
8684        case -1618432855: // identifier
8685          this.identifier = castToIdentifier(value); // Identifier
8686          return value;
8687        default: return super.setProperty(hash, name, value);
8688        }
8689
8690      }
8691
8692      @Override
8693      public Base setProperty(String name, Base value) throws FHIRException {
8694        if (name.equals("type")) {
8695          this.type = castToCodeableConcept(value); // CodeableConcept
8696        } else if (name.equals("adjustment")) {
8697          this.adjustment = castToMoney(value); // Money
8698        } else if (name.equals("adjustmentReason")) {
8699          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
8700        } else if (name.equals("date")) {
8701          this.date = castToDate(value); // DateType
8702        } else if (name.equals("amount")) {
8703          this.amount = castToMoney(value); // Money
8704        } else if (name.equals("identifier")) {
8705          this.identifier = castToIdentifier(value); // Identifier
8706        } else
8707          return super.setProperty(name, value);
8708        return value;
8709      }
8710
8711      @Override
8712      public Base makeProperty(int hash, String name) throws FHIRException {
8713        switch (hash) {
8714        case 3575610:  return getType(); 
8715        case 1977085293:  return getAdjustment(); 
8716        case -1255938543:  return getAdjustmentReason(); 
8717        case 3076014:  return getDateElement();
8718        case -1413853096:  return getAmount(); 
8719        case -1618432855:  return getIdentifier(); 
8720        default: return super.makeProperty(hash, name);
8721        }
8722
8723      }
8724
8725      @Override
8726      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8727        switch (hash) {
8728        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
8729        case 1977085293: /*adjustment*/ return new String[] {"Money"};
8730        case -1255938543: /*adjustmentReason*/ return new String[] {"CodeableConcept"};
8731        case 3076014: /*date*/ return new String[] {"date"};
8732        case -1413853096: /*amount*/ return new String[] {"Money"};
8733        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
8734        default: return super.getTypesForProperty(hash, name);
8735        }
8736
8737      }
8738
8739      @Override
8740      public Base addChild(String name) throws FHIRException {
8741        if (name.equals("type")) {
8742          this.type = new CodeableConcept();
8743          return this.type;
8744        }
8745        else if (name.equals("adjustment")) {
8746          this.adjustment = new Money();
8747          return this.adjustment;
8748        }
8749        else if (name.equals("adjustmentReason")) {
8750          this.adjustmentReason = new CodeableConcept();
8751          return this.adjustmentReason;
8752        }
8753        else if (name.equals("date")) {
8754          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.date");
8755        }
8756        else if (name.equals("amount")) {
8757          this.amount = new Money();
8758          return this.amount;
8759        }
8760        else if (name.equals("identifier")) {
8761          this.identifier = new Identifier();
8762          return this.identifier;
8763        }
8764        else
8765          return super.addChild(name);
8766      }
8767
8768      public PaymentComponent copy() {
8769        PaymentComponent dst = new PaymentComponent();
8770        copyValues(dst);
8771        dst.type = type == null ? null : type.copy();
8772        dst.adjustment = adjustment == null ? null : adjustment.copy();
8773        dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
8774        dst.date = date == null ? null : date.copy();
8775        dst.amount = amount == null ? null : amount.copy();
8776        dst.identifier = identifier == null ? null : identifier.copy();
8777        return dst;
8778      }
8779
8780      @Override
8781      public boolean equalsDeep(Base other_) {
8782        if (!super.equalsDeep(other_))
8783          return false;
8784        if (!(other_ instanceof PaymentComponent))
8785          return false;
8786        PaymentComponent o = (PaymentComponent) other_;
8787        return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true) && compareDeep(adjustmentReason, o.adjustmentReason, true)
8788           && compareDeep(date, o.date, true) && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true)
8789          ;
8790      }
8791
8792      @Override
8793      public boolean equalsShallow(Base other_) {
8794        if (!super.equalsShallow(other_))
8795          return false;
8796        if (!(other_ instanceof PaymentComponent))
8797          return false;
8798        PaymentComponent o = (PaymentComponent) other_;
8799        return compareValues(date, o.date, true);
8800      }
8801
8802      public boolean isEmpty() {
8803        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason
8804          , date, amount, identifier);
8805      }
8806
8807  public String fhirType() {
8808    return "ExplanationOfBenefit.payment";
8809
8810  }
8811
8812  }
8813
8814    @Block()
8815    public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
8816        /**
8817         * An integer associated with each note which may be referred to from each service line item.
8818         */
8819        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
8820        @Description(shortDefinition="Sequence number for this note", formalDefinition="An integer associated with each note which may be referred to from each service line item." )
8821        protected PositiveIntType number;
8822
8823        /**
8824         * The note purpose: Print/Display.
8825         */
8826        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
8827        @Description(shortDefinition="display | print | printoper", formalDefinition="The note purpose: Print/Display." )
8828        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
8829        protected CodeableConcept type;
8830
8831        /**
8832         * The note text.
8833         */
8834        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
8835        @Description(shortDefinition="Note explanitory text", formalDefinition="The note text." )
8836        protected StringType text;
8837
8838        /**
8839         * 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.
8840         */
8841        @Child(name = "language", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
8842        @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." )
8843        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
8844        protected CodeableConcept language;
8845
8846        private static final long serialVersionUID = -944255449L;
8847
8848    /**
8849     * Constructor
8850     */
8851      public NoteComponent() {
8852        super();
8853      }
8854
8855        /**
8856         * @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
8857         */
8858        public PositiveIntType getNumberElement() { 
8859          if (this.number == null)
8860            if (Configuration.errorOnAutoCreate())
8861              throw new Error("Attempt to auto-create NoteComponent.number");
8862            else if (Configuration.doAutoCreate())
8863              this.number = new PositiveIntType(); // bb
8864          return this.number;
8865        }
8866
8867        public boolean hasNumberElement() { 
8868          return this.number != null && !this.number.isEmpty();
8869        }
8870
8871        public boolean hasNumber() { 
8872          return this.number != null && !this.number.isEmpty();
8873        }
8874
8875        /**
8876         * @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
8877         */
8878        public NoteComponent setNumberElement(PositiveIntType value) { 
8879          this.number = value;
8880          return this;
8881        }
8882
8883        /**
8884         * @return An integer associated with each note which may be referred to from each service line item.
8885         */
8886        public int getNumber() { 
8887          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
8888        }
8889
8890        /**
8891         * @param value An integer associated with each note which may be referred to from each service line item.
8892         */
8893        public NoteComponent setNumber(int value) { 
8894            if (this.number == null)
8895              this.number = new PositiveIntType();
8896            this.number.setValue(value);
8897          return this;
8898        }
8899
8900        /**
8901         * @return {@link #type} (The note purpose: Print/Display.)
8902         */
8903        public CodeableConcept getType() { 
8904          if (this.type == null)
8905            if (Configuration.errorOnAutoCreate())
8906              throw new Error("Attempt to auto-create NoteComponent.type");
8907            else if (Configuration.doAutoCreate())
8908              this.type = new CodeableConcept(); // cc
8909          return this.type;
8910        }
8911
8912        public boolean hasType() { 
8913          return this.type != null && !this.type.isEmpty();
8914        }
8915
8916        /**
8917         * @param value {@link #type} (The note purpose: Print/Display.)
8918         */
8919        public NoteComponent setType(CodeableConcept value)  { 
8920          this.type = value;
8921          return this;
8922        }
8923
8924        /**
8925         * @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
8926         */
8927        public StringType getTextElement() { 
8928          if (this.text == null)
8929            if (Configuration.errorOnAutoCreate())
8930              throw new Error("Attempt to auto-create NoteComponent.text");
8931            else if (Configuration.doAutoCreate())
8932              this.text = new StringType(); // bb
8933          return this.text;
8934        }
8935
8936        public boolean hasTextElement() { 
8937          return this.text != null && !this.text.isEmpty();
8938        }
8939
8940        public boolean hasText() { 
8941          return this.text != null && !this.text.isEmpty();
8942        }
8943
8944        /**
8945         * @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
8946         */
8947        public NoteComponent setTextElement(StringType value) { 
8948          this.text = value;
8949          return this;
8950        }
8951
8952        /**
8953         * @return The note text.
8954         */
8955        public String getText() { 
8956          return this.text == null ? null : this.text.getValue();
8957        }
8958
8959        /**
8960         * @param value The note text.
8961         */
8962        public NoteComponent setText(String value) { 
8963          if (Utilities.noString(value))
8964            this.text = null;
8965          else {
8966            if (this.text == null)
8967              this.text = new StringType();
8968            this.text.setValue(value);
8969          }
8970          return this;
8971        }
8972
8973        /**
8974         * @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.)
8975         */
8976        public CodeableConcept getLanguage() { 
8977          if (this.language == null)
8978            if (Configuration.errorOnAutoCreate())
8979              throw new Error("Attempt to auto-create NoteComponent.language");
8980            else if (Configuration.doAutoCreate())
8981              this.language = new CodeableConcept(); // cc
8982          return this.language;
8983        }
8984
8985        public boolean hasLanguage() { 
8986          return this.language != null && !this.language.isEmpty();
8987        }
8988
8989        /**
8990         * @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.)
8991         */
8992        public NoteComponent setLanguage(CodeableConcept value)  { 
8993          this.language = value;
8994          return this;
8995        }
8996
8997        protected void listChildren(List<Property> children) {
8998          super.listChildren(children);
8999          children.add(new Property("number", "positiveInt", "An integer associated with each note which may be referred to from each service line item.", 0, 1, number));
9000          children.add(new Property("type", "CodeableConcept", "The note purpose: Print/Display.", 0, 1, type));
9001          children.add(new Property("text", "string", "The note text.", 0, 1, text));
9002          children.add(new Property("language", "CodeableConcept", "The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English.", 0, 1, language));
9003        }
9004
9005        @Override
9006        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9007          switch (_hash) {
9008          case -1034364087: /*number*/  return new Property("number", "positiveInt", "An integer associated with each note which may be referred to from each service line item.", 0, 1, number);
9009          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The note purpose: Print/Display.", 0, 1, type);
9010          case 3556653: /*text*/  return new Property("text", "string", "The note text.", 0, 1, text);
9011          case -1613589672: /*language*/  return new Property("language", "CodeableConcept", "The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English.", 0, 1, language);
9012          default: return super.getNamedProperty(_hash, _name, _checkValid);
9013          }
9014
9015        }
9016
9017      @Override
9018      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9019        switch (hash) {
9020        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
9021        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
9022        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
9023        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
9024        default: return super.getProperty(hash, name, checkValid);
9025        }
9026
9027      }
9028
9029      @Override
9030      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9031        switch (hash) {
9032        case -1034364087: // number
9033          this.number = castToPositiveInt(value); // PositiveIntType
9034          return value;
9035        case 3575610: // type
9036          this.type = castToCodeableConcept(value); // CodeableConcept
9037          return value;
9038        case 3556653: // text
9039          this.text = castToString(value); // StringType
9040          return value;
9041        case -1613589672: // language
9042          this.language = castToCodeableConcept(value); // CodeableConcept
9043          return value;
9044        default: return super.setProperty(hash, name, value);
9045        }
9046
9047      }
9048
9049      @Override
9050      public Base setProperty(String name, Base value) throws FHIRException {
9051        if (name.equals("number")) {
9052          this.number = castToPositiveInt(value); // PositiveIntType
9053        } else if (name.equals("type")) {
9054          this.type = castToCodeableConcept(value); // CodeableConcept
9055        } else if (name.equals("text")) {
9056          this.text = castToString(value); // StringType
9057        } else if (name.equals("language")) {
9058          this.language = castToCodeableConcept(value); // CodeableConcept
9059        } else
9060          return super.setProperty(name, value);
9061        return value;
9062      }
9063
9064      @Override
9065      public Base makeProperty(int hash, String name) throws FHIRException {
9066        switch (hash) {
9067        case -1034364087:  return getNumberElement();
9068        case 3575610:  return getType(); 
9069        case 3556653:  return getTextElement();
9070        case -1613589672:  return getLanguage(); 
9071        default: return super.makeProperty(hash, name);
9072        }
9073
9074      }
9075
9076      @Override
9077      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9078        switch (hash) {
9079        case -1034364087: /*number*/ return new String[] {"positiveInt"};
9080        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
9081        case 3556653: /*text*/ return new String[] {"string"};
9082        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
9083        default: return super.getTypesForProperty(hash, name);
9084        }
9085
9086      }
9087
9088      @Override
9089      public Base addChild(String name) throws FHIRException {
9090        if (name.equals("number")) {
9091          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.number");
9092        }
9093        else if (name.equals("type")) {
9094          this.type = new CodeableConcept();
9095          return this.type;
9096        }
9097        else if (name.equals("text")) {
9098          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.text");
9099        }
9100        else if (name.equals("language")) {
9101          this.language = new CodeableConcept();
9102          return this.language;
9103        }
9104        else
9105          return super.addChild(name);
9106      }
9107
9108      public NoteComponent copy() {
9109        NoteComponent dst = new NoteComponent();
9110        copyValues(dst);
9111        dst.number = number == null ? null : number.copy();
9112        dst.type = type == null ? null : type.copy();
9113        dst.text = text == null ? null : text.copy();
9114        dst.language = language == null ? null : language.copy();
9115        return dst;
9116      }
9117
9118      @Override
9119      public boolean equalsDeep(Base other_) {
9120        if (!super.equalsDeep(other_))
9121          return false;
9122        if (!(other_ instanceof NoteComponent))
9123          return false;
9124        NoteComponent o = (NoteComponent) other_;
9125        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
9126           && compareDeep(language, o.language, true);
9127      }
9128
9129      @Override
9130      public boolean equalsShallow(Base other_) {
9131        if (!super.equalsShallow(other_))
9132          return false;
9133        if (!(other_ instanceof NoteComponent))
9134          return false;
9135        NoteComponent o = (NoteComponent) other_;
9136        return compareValues(number, o.number, true) && compareValues(text, o.text, true);
9137      }
9138
9139      public boolean isEmpty() {
9140        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language
9141          );
9142      }
9143
9144  public String fhirType() {
9145    return "ExplanationOfBenefit.processNote";
9146
9147  }
9148
9149  }
9150
9151    @Block()
9152    public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
9153        /**
9154         * Dental, Vision, Medical, Pharmacy, Rehab etc.
9155         */
9156        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9157        @Description(shortDefinition="Type of services covered", formalDefinition="Dental, Vision, Medical, Pharmacy, Rehab etc." )
9158        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-category")
9159        protected CodeableConcept category;
9160
9161        /**
9162         * Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.
9163         */
9164        @Child(name = "subCategory", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
9165        @Description(shortDefinition="Detailed services covered within the type", formalDefinition="Dental: basic, major, ortho; Vision exam, glasses, contacts; etc." )
9166        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
9167        protected CodeableConcept subCategory;
9168
9169        /**
9170         * True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.
9171         */
9172        @Child(name = "excluded", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
9173        @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." )
9174        protected BooleanType excluded;
9175
9176        /**
9177         * A short name or tag for the benefit, for example MED01, or DENT2.
9178         */
9179        @Child(name = "name", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
9180        @Description(shortDefinition="Short name for the benefit", formalDefinition="A short name or tag for the benefit, for example MED01, or DENT2." )
9181        protected StringType name;
9182
9183        /**
9184         * A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.
9185         */
9186        @Child(name = "description", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
9187        @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'." )
9188        protected StringType description;
9189
9190        /**
9191         * Network designation.
9192         */
9193        @Child(name = "network", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
9194        @Description(shortDefinition="In or out of network", formalDefinition="Network designation." )
9195        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-network")
9196        protected CodeableConcept network;
9197
9198        /**
9199         * Unit designation: individual or family.
9200         */
9201        @Child(name = "unit", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
9202        @Description(shortDefinition="Individual or family", formalDefinition="Unit designation: individual or family." )
9203        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-unit")
9204        protected CodeableConcept unit;
9205
9206        /**
9207         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.
9208         */
9209        @Child(name = "term", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
9210        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'." )
9211        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-term")
9212        protected CodeableConcept term;
9213
9214        /**
9215         * Benefits Used to date.
9216         */
9217        @Child(name = "financial", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9218        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
9219        protected List<BenefitComponent> financial;
9220
9221        private static final long serialVersionUID = 833826021L;
9222
9223    /**
9224     * Constructor
9225     */
9226      public BenefitBalanceComponent() {
9227        super();
9228      }
9229
9230    /**
9231     * Constructor
9232     */
9233      public BenefitBalanceComponent(CodeableConcept category) {
9234        super();
9235        this.category = category;
9236      }
9237
9238        /**
9239         * @return {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
9240         */
9241        public CodeableConcept getCategory() { 
9242          if (this.category == null)
9243            if (Configuration.errorOnAutoCreate())
9244              throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
9245            else if (Configuration.doAutoCreate())
9246              this.category = new CodeableConcept(); // cc
9247          return this.category;
9248        }
9249
9250        public boolean hasCategory() { 
9251          return this.category != null && !this.category.isEmpty();
9252        }
9253
9254        /**
9255         * @param value {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
9256         */
9257        public BenefitBalanceComponent setCategory(CodeableConcept value)  { 
9258          this.category = value;
9259          return this;
9260        }
9261
9262        /**
9263         * @return {@link #subCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
9264         */
9265        public CodeableConcept getSubCategory() { 
9266          if (this.subCategory == null)
9267            if (Configuration.errorOnAutoCreate())
9268              throw new Error("Attempt to auto-create BenefitBalanceComponent.subCategory");
9269            else if (Configuration.doAutoCreate())
9270              this.subCategory = new CodeableConcept(); // cc
9271          return this.subCategory;
9272        }
9273
9274        public boolean hasSubCategory() { 
9275          return this.subCategory != null && !this.subCategory.isEmpty();
9276        }
9277
9278        /**
9279         * @param value {@link #subCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
9280         */
9281        public BenefitBalanceComponent setSubCategory(CodeableConcept value)  { 
9282          this.subCategory = value;
9283          return this;
9284        }
9285
9286        /**
9287         * @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
9288         */
9289        public BooleanType getExcludedElement() { 
9290          if (this.excluded == null)
9291            if (Configuration.errorOnAutoCreate())
9292              throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
9293            else if (Configuration.doAutoCreate())
9294              this.excluded = new BooleanType(); // bb
9295          return this.excluded;
9296        }
9297
9298        public boolean hasExcludedElement() { 
9299          return this.excluded != null && !this.excluded.isEmpty();
9300        }
9301
9302        public boolean hasExcluded() { 
9303          return this.excluded != null && !this.excluded.isEmpty();
9304        }
9305
9306        /**
9307         * @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
9308         */
9309        public BenefitBalanceComponent setExcludedElement(BooleanType value) { 
9310          this.excluded = value;
9311          return this;
9312        }
9313
9314        /**
9315         * @return True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.
9316         */
9317        public boolean getExcluded() { 
9318          return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
9319        }
9320
9321        /**
9322         * @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.
9323         */
9324        public BenefitBalanceComponent setExcluded(boolean value) { 
9325            if (this.excluded == null)
9326              this.excluded = new BooleanType();
9327            this.excluded.setValue(value);
9328          return this;
9329        }
9330
9331        /**
9332         * @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
9333         */
9334        public StringType getNameElement() { 
9335          if (this.name == null)
9336            if (Configuration.errorOnAutoCreate())
9337              throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
9338            else if (Configuration.doAutoCreate())
9339              this.name = new StringType(); // bb
9340          return this.name;
9341        }
9342
9343        public boolean hasNameElement() { 
9344          return this.name != null && !this.name.isEmpty();
9345        }
9346
9347        public boolean hasName() { 
9348          return this.name != null && !this.name.isEmpty();
9349        }
9350
9351        /**
9352         * @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
9353         */
9354        public BenefitBalanceComponent setNameElement(StringType value) { 
9355          this.name = value;
9356          return this;
9357        }
9358
9359        /**
9360         * @return A short name or tag for the benefit, for example MED01, or DENT2.
9361         */
9362        public String getName() { 
9363          return this.name == null ? null : this.name.getValue();
9364        }
9365
9366        /**
9367         * @param value A short name or tag for the benefit, for example MED01, or DENT2.
9368         */
9369        public BenefitBalanceComponent setName(String value) { 
9370          if (Utilities.noString(value))
9371            this.name = null;
9372          else {
9373            if (this.name == null)
9374              this.name = new StringType();
9375            this.name.setValue(value);
9376          }
9377          return this;
9378        }
9379
9380        /**
9381         * @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
9382         */
9383        public StringType getDescriptionElement() { 
9384          if (this.description == null)
9385            if (Configuration.errorOnAutoCreate())
9386              throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
9387            else if (Configuration.doAutoCreate())
9388              this.description = new StringType(); // bb
9389          return this.description;
9390        }
9391
9392        public boolean hasDescriptionElement() { 
9393          return this.description != null && !this.description.isEmpty();
9394        }
9395
9396        public boolean hasDescription() { 
9397          return this.description != null && !this.description.isEmpty();
9398        }
9399
9400        /**
9401         * @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
9402         */
9403        public BenefitBalanceComponent setDescriptionElement(StringType value) { 
9404          this.description = value;
9405          return this;
9406        }
9407
9408        /**
9409         * @return A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.
9410         */
9411        public String getDescription() { 
9412          return this.description == null ? null : this.description.getValue();
9413        }
9414
9415        /**
9416         * @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'.
9417         */
9418        public BenefitBalanceComponent setDescription(String value) { 
9419          if (Utilities.noString(value))
9420            this.description = null;
9421          else {
9422            if (this.description == null)
9423              this.description = new StringType();
9424            this.description.setValue(value);
9425          }
9426          return this;
9427        }
9428
9429        /**
9430         * @return {@link #network} (Network designation.)
9431         */
9432        public CodeableConcept getNetwork() { 
9433          if (this.network == null)
9434            if (Configuration.errorOnAutoCreate())
9435              throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
9436            else if (Configuration.doAutoCreate())
9437              this.network = new CodeableConcept(); // cc
9438          return this.network;
9439        }
9440
9441        public boolean hasNetwork() { 
9442          return this.network != null && !this.network.isEmpty();
9443        }
9444
9445        /**
9446         * @param value {@link #network} (Network designation.)
9447         */
9448        public BenefitBalanceComponent setNetwork(CodeableConcept value)  { 
9449          this.network = value;
9450          return this;
9451        }
9452
9453        /**
9454         * @return {@link #unit} (Unit designation: individual or family.)
9455         */
9456        public CodeableConcept getUnit() { 
9457          if (this.unit == null)
9458            if (Configuration.errorOnAutoCreate())
9459              throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
9460            else if (Configuration.doAutoCreate())
9461              this.unit = new CodeableConcept(); // cc
9462          return this.unit;
9463        }
9464
9465        public boolean hasUnit() { 
9466          return this.unit != null && !this.unit.isEmpty();
9467        }
9468
9469        /**
9470         * @param value {@link #unit} (Unit designation: individual or family.)
9471         */
9472        public BenefitBalanceComponent setUnit(CodeableConcept value)  { 
9473          this.unit = value;
9474          return this;
9475        }
9476
9477        /**
9478         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
9479         */
9480        public CodeableConcept getTerm() { 
9481          if (this.term == null)
9482            if (Configuration.errorOnAutoCreate())
9483              throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
9484            else if (Configuration.doAutoCreate())
9485              this.term = new CodeableConcept(); // cc
9486          return this.term;
9487        }
9488
9489        public boolean hasTerm() { 
9490          return this.term != null && !this.term.isEmpty();
9491        }
9492
9493        /**
9494         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
9495         */
9496        public BenefitBalanceComponent setTerm(CodeableConcept value)  { 
9497          this.term = value;
9498          return this;
9499        }
9500
9501        /**
9502         * @return {@link #financial} (Benefits Used to date.)
9503         */
9504        public List<BenefitComponent> getFinancial() { 
9505          if (this.financial == null)
9506            this.financial = new ArrayList<BenefitComponent>();
9507          return this.financial;
9508        }
9509
9510        /**
9511         * @return Returns a reference to <code>this</code> for easy method chaining
9512         */
9513        public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) { 
9514          this.financial = theFinancial;
9515          return this;
9516        }
9517
9518        public boolean hasFinancial() { 
9519          if (this.financial == null)
9520            return false;
9521          for (BenefitComponent item : this.financial)
9522            if (!item.isEmpty())
9523              return true;
9524          return false;
9525        }
9526
9527        public BenefitComponent addFinancial() { //3
9528          BenefitComponent t = new BenefitComponent();
9529          if (this.financial == null)
9530            this.financial = new ArrayList<BenefitComponent>();
9531          this.financial.add(t);
9532          return t;
9533        }
9534
9535        public BenefitBalanceComponent addFinancial(BenefitComponent t) { //3
9536          if (t == null)
9537            return this;
9538          if (this.financial == null)
9539            this.financial = new ArrayList<BenefitComponent>();
9540          this.financial.add(t);
9541          return this;
9542        }
9543
9544        /**
9545         * @return The first repetition of repeating field {@link #financial}, creating it if it does not already exist
9546         */
9547        public BenefitComponent getFinancialFirstRep() { 
9548          if (getFinancial().isEmpty()) {
9549            addFinancial();
9550          }
9551          return getFinancial().get(0);
9552        }
9553
9554        protected void listChildren(List<Property> children) {
9555          super.listChildren(children);
9556          children.add(new Property("category", "CodeableConcept", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, 1, category));
9557          children.add(new Property("subCategory", "CodeableConcept", "Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.", 0, 1, subCategory));
9558          children.add(new Property("excluded", "boolean", "True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.", 0, 1, excluded));
9559          children.add(new Property("name", "string", "A short name or tag for the benefit, for example MED01, or DENT2.", 0, 1, name));
9560          children.add(new Property("description", "string", "A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.", 0, 1, description));
9561          children.add(new Property("network", "CodeableConcept", "Network designation.", 0, 1, network));
9562          children.add(new Property("unit", "CodeableConcept", "Unit designation: individual or family.", 0, 1, unit));
9563          children.add(new Property("term", "CodeableConcept", "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.", 0, 1, term));
9564          children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
9565        }
9566
9567        @Override
9568        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9569          switch (_hash) {
9570          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, 1, category);
9571          case 1365024606: /*subCategory*/  return new Property("subCategory", "CodeableConcept", "Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.", 0, 1, subCategory);
9572          case 1994055114: /*excluded*/  return new Property("excluded", "boolean", "True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.", 0, 1, excluded);
9573          case 3373707: /*name*/  return new Property("name", "string", "A short name or tag for the benefit, for example MED01, or DENT2.", 0, 1, name);
9574          case -1724546052: /*description*/  return new Property("description", "string", "A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.", 0, 1, description);
9575          case 1843485230: /*network*/  return new Property("network", "CodeableConcept", "Network designation.", 0, 1, network);
9576          case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "Unit designation: individual or family.", 0, 1, unit);
9577          case 3556460: /*term*/  return new Property("term", "CodeableConcept", "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.", 0, 1, term);
9578          case 357555337: /*financial*/  return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial);
9579          default: return super.getNamedProperty(_hash, _name, _checkValid);
9580          }
9581
9582        }
9583
9584      @Override
9585      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9586        switch (hash) {
9587        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
9588        case 1365024606: /*subCategory*/ return this.subCategory == null ? new Base[0] : new Base[] {this.subCategory}; // CodeableConcept
9589        case 1994055114: /*excluded*/ return this.excluded == null ? new Base[0] : new Base[] {this.excluded}; // BooleanType
9590        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
9591        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
9592        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // CodeableConcept
9593        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
9594        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // CodeableConcept
9595        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
9596        default: return super.getProperty(hash, name, checkValid);
9597        }
9598
9599      }
9600
9601      @Override
9602      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9603        switch (hash) {
9604        case 50511102: // category
9605          this.category = castToCodeableConcept(value); // CodeableConcept
9606          return value;
9607        case 1365024606: // subCategory
9608          this.subCategory = castToCodeableConcept(value); // CodeableConcept
9609          return value;
9610        case 1994055114: // excluded
9611          this.excluded = castToBoolean(value); // BooleanType
9612          return value;
9613        case 3373707: // name
9614          this.name = castToString(value); // StringType
9615          return value;
9616        case -1724546052: // description
9617          this.description = castToString(value); // StringType
9618          return value;
9619        case 1843485230: // network
9620          this.network = castToCodeableConcept(value); // CodeableConcept
9621          return value;
9622        case 3594628: // unit
9623          this.unit = castToCodeableConcept(value); // CodeableConcept
9624          return value;
9625        case 3556460: // term
9626          this.term = castToCodeableConcept(value); // CodeableConcept
9627          return value;
9628        case 357555337: // financial
9629          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
9630          return value;
9631        default: return super.setProperty(hash, name, value);
9632        }
9633
9634      }
9635
9636      @Override
9637      public Base setProperty(String name, Base value) throws FHIRException {
9638        if (name.equals("category")) {
9639          this.category = castToCodeableConcept(value); // CodeableConcept
9640        } else if (name.equals("subCategory")) {
9641          this.subCategory = castToCodeableConcept(value); // CodeableConcept
9642        } else if (name.equals("excluded")) {
9643          this.excluded = castToBoolean(value); // BooleanType
9644        } else if (name.equals("name")) {
9645          this.name = castToString(value); // StringType
9646        } else if (name.equals("description")) {
9647          this.description = castToString(value); // StringType
9648        } else if (name.equals("network")) {
9649          this.network = castToCodeableConcept(value); // CodeableConcept
9650        } else if (name.equals("unit")) {
9651          this.unit = castToCodeableConcept(value); // CodeableConcept
9652        } else if (name.equals("term")) {
9653          this.term = castToCodeableConcept(value); // CodeableConcept
9654        } else if (name.equals("financial")) {
9655          this.getFinancial().add((BenefitComponent) value);
9656        } else
9657          return super.setProperty(name, value);
9658        return value;
9659      }
9660
9661      @Override
9662      public Base makeProperty(int hash, String name) throws FHIRException {
9663        switch (hash) {
9664        case 50511102:  return getCategory(); 
9665        case 1365024606:  return getSubCategory(); 
9666        case 1994055114:  return getExcludedElement();
9667        case 3373707:  return getNameElement();
9668        case -1724546052:  return getDescriptionElement();
9669        case 1843485230:  return getNetwork(); 
9670        case 3594628:  return getUnit(); 
9671        case 3556460:  return getTerm(); 
9672        case 357555337:  return addFinancial(); 
9673        default: return super.makeProperty(hash, name);
9674        }
9675
9676      }
9677
9678      @Override
9679      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9680        switch (hash) {
9681        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
9682        case 1365024606: /*subCategory*/ return new String[] {"CodeableConcept"};
9683        case 1994055114: /*excluded*/ return new String[] {"boolean"};
9684        case 3373707: /*name*/ return new String[] {"string"};
9685        case -1724546052: /*description*/ return new String[] {"string"};
9686        case 1843485230: /*network*/ return new String[] {"CodeableConcept"};
9687        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
9688        case 3556460: /*term*/ return new String[] {"CodeableConcept"};
9689        case 357555337: /*financial*/ return new String[] {};
9690        default: return super.getTypesForProperty(hash, name);
9691        }
9692
9693      }
9694
9695      @Override
9696      public Base addChild(String name) throws FHIRException {
9697        if (name.equals("category")) {
9698          this.category = new CodeableConcept();
9699          return this.category;
9700        }
9701        else if (name.equals("subCategory")) {
9702          this.subCategory = new CodeableConcept();
9703          return this.subCategory;
9704        }
9705        else if (name.equals("excluded")) {
9706          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.excluded");
9707        }
9708        else if (name.equals("name")) {
9709          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.name");
9710        }
9711        else if (name.equals("description")) {
9712          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.description");
9713        }
9714        else if (name.equals("network")) {
9715          this.network = new CodeableConcept();
9716          return this.network;
9717        }
9718        else if (name.equals("unit")) {
9719          this.unit = new CodeableConcept();
9720          return this.unit;
9721        }
9722        else if (name.equals("term")) {
9723          this.term = new CodeableConcept();
9724          return this.term;
9725        }
9726        else if (name.equals("financial")) {
9727          return addFinancial();
9728        }
9729        else
9730          return super.addChild(name);
9731      }
9732
9733      public BenefitBalanceComponent copy() {
9734        BenefitBalanceComponent dst = new BenefitBalanceComponent();
9735        copyValues(dst);
9736        dst.category = category == null ? null : category.copy();
9737        dst.subCategory = subCategory == null ? null : subCategory.copy();
9738        dst.excluded = excluded == null ? null : excluded.copy();
9739        dst.name = name == null ? null : name.copy();
9740        dst.description = description == null ? null : description.copy();
9741        dst.network = network == null ? null : network.copy();
9742        dst.unit = unit == null ? null : unit.copy();
9743        dst.term = term == null ? null : term.copy();
9744        if (financial != null) {
9745          dst.financial = new ArrayList<BenefitComponent>();
9746          for (BenefitComponent i : financial)
9747            dst.financial.add(i.copy());
9748        };
9749        return dst;
9750      }
9751
9752      @Override
9753      public boolean equalsDeep(Base other_) {
9754        if (!super.equalsDeep(other_))
9755          return false;
9756        if (!(other_ instanceof BenefitBalanceComponent))
9757          return false;
9758        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
9759        return compareDeep(category, o.category, true) && compareDeep(subCategory, o.subCategory, true)
9760           && compareDeep(excluded, o.excluded, true) && compareDeep(name, o.name, true) && compareDeep(description, o.description, true)
9761           && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true) && compareDeep(term, o.term, true)
9762           && compareDeep(financial, o.financial, true);
9763      }
9764
9765      @Override
9766      public boolean equalsShallow(Base other_) {
9767        if (!super.equalsShallow(other_))
9768          return false;
9769        if (!(other_ instanceof BenefitBalanceComponent))
9770          return false;
9771        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
9772        return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
9773          ;
9774      }
9775
9776      public boolean isEmpty() {
9777        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, subCategory, excluded
9778          , name, description, network, unit, term, financial);
9779      }
9780
9781  public String fhirType() {
9782    return "ExplanationOfBenefit.benefitBalance";
9783
9784  }
9785
9786  }
9787
9788    @Block()
9789    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
9790        /**
9791         * Deductable, visits, benefit amount.
9792         */
9793        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9794        @Description(shortDefinition="Deductable, visits, benefit amount", formalDefinition="Deductable, visits, benefit amount." )
9795        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-type")
9796        protected CodeableConcept type;
9797
9798        /**
9799         * Benefits allowed.
9800         */
9801        @Child(name = "allowed", type = {UnsignedIntType.class, StringType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
9802        @Description(shortDefinition="Benefits allowed", formalDefinition="Benefits allowed." )
9803        protected Type allowed;
9804
9805        /**
9806         * Benefits used.
9807         */
9808        @Child(name = "used", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
9809        @Description(shortDefinition="Benefits used", formalDefinition="Benefits used." )
9810        protected Type used;
9811
9812        private static final long serialVersionUID = -1506285314L;
9813
9814    /**
9815     * Constructor
9816     */
9817      public BenefitComponent() {
9818        super();
9819      }
9820
9821    /**
9822     * Constructor
9823     */
9824      public BenefitComponent(CodeableConcept type) {
9825        super();
9826        this.type = type;
9827      }
9828
9829        /**
9830         * @return {@link #type} (Deductable, visits, benefit amount.)
9831         */
9832        public CodeableConcept getType() { 
9833          if (this.type == null)
9834            if (Configuration.errorOnAutoCreate())
9835              throw new Error("Attempt to auto-create BenefitComponent.type");
9836            else if (Configuration.doAutoCreate())
9837              this.type = new CodeableConcept(); // cc
9838          return this.type;
9839        }
9840
9841        public boolean hasType() { 
9842          return this.type != null && !this.type.isEmpty();
9843        }
9844
9845        /**
9846         * @param value {@link #type} (Deductable, visits, benefit amount.)
9847         */
9848        public BenefitComponent setType(CodeableConcept value)  { 
9849          this.type = value;
9850          return this;
9851        }
9852
9853        /**
9854         * @return {@link #allowed} (Benefits allowed.)
9855         */
9856        public Type getAllowed() { 
9857          return this.allowed;
9858        }
9859
9860        /**
9861         * @return {@link #allowed} (Benefits allowed.)
9862         */
9863        public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException { 
9864          if (this.allowed == null)
9865            return null;
9866          if (!(this.allowed instanceof UnsignedIntType))
9867            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.allowed.getClass().getName()+" was encountered");
9868          return (UnsignedIntType) this.allowed;
9869        }
9870
9871        public boolean hasAllowedUnsignedIntType() {
9872            return this.allowed instanceof UnsignedIntType;
9873        }
9874
9875        /**
9876         * @return {@link #allowed} (Benefits allowed.)
9877         */
9878        public StringType getAllowedStringType() throws FHIRException { 
9879          if (this.allowed == null)
9880            return null;
9881          if (!(this.allowed instanceof StringType))
9882            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.allowed.getClass().getName()+" was encountered");
9883          return (StringType) this.allowed;
9884        }
9885
9886        public boolean hasAllowedStringType() {
9887            return this.allowed instanceof StringType;
9888        }
9889
9890        /**
9891         * @return {@link #allowed} (Benefits allowed.)
9892         */
9893        public Money getAllowedMoney() throws FHIRException { 
9894          if (this.allowed == null)
9895            return null;
9896          if (!(this.allowed instanceof Money))
9897            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.allowed.getClass().getName()+" was encountered");
9898          return (Money) this.allowed;
9899        }
9900
9901        public boolean hasAllowedMoney() {
9902            return this.allowed instanceof Money;
9903        }
9904
9905        public boolean hasAllowed() { 
9906          return this.allowed != null && !this.allowed.isEmpty();
9907        }
9908
9909        /**
9910         * @param value {@link #allowed} (Benefits allowed.)
9911         */
9912        public BenefitComponent setAllowed(Type value) throws FHIRFormatError { 
9913          if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
9914            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.benefitBalance.financial.allowed[x]: "+value.fhirType());
9915          this.allowed = value;
9916          return this;
9917        }
9918
9919        /**
9920         * @return {@link #used} (Benefits used.)
9921         */
9922        public Type getUsed() { 
9923          return this.used;
9924        }
9925
9926        /**
9927         * @return {@link #used} (Benefits used.)
9928         */
9929        public UnsignedIntType getUsedUnsignedIntType() throws FHIRException { 
9930          if (this.used == null)
9931            return null;
9932          if (!(this.used instanceof UnsignedIntType))
9933            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.used.getClass().getName()+" was encountered");
9934          return (UnsignedIntType) this.used;
9935        }
9936
9937        public boolean hasUsedUnsignedIntType() {
9938            return this.used instanceof UnsignedIntType;
9939        }
9940
9941        /**
9942         * @return {@link #used} (Benefits used.)
9943         */
9944        public Money getUsedMoney() throws FHIRException { 
9945          if (this.used == null)
9946            return null;
9947          if (!(this.used instanceof Money))
9948            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.used.getClass().getName()+" was encountered");
9949          return (Money) this.used;
9950        }
9951
9952        public boolean hasUsedMoney() {
9953            return this.used instanceof Money;
9954        }
9955
9956        public boolean hasUsed() { 
9957          return this.used != null && !this.used.isEmpty();
9958        }
9959
9960        /**
9961         * @param value {@link #used} (Benefits used.)
9962         */
9963        public BenefitComponent setUsed(Type value) throws FHIRFormatError { 
9964          if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
9965            throw new FHIRFormatError("Not the right type for ExplanationOfBenefit.benefitBalance.financial.used[x]: "+value.fhirType());
9966          this.used = value;
9967          return this;
9968        }
9969
9970        protected void listChildren(List<Property> children) {
9971          super.listChildren(children);
9972          children.add(new Property("type", "CodeableConcept", "Deductable, visits, benefit amount.", 0, 1, type));
9973          children.add(new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed));
9974          children.add(new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used));
9975        }
9976
9977        @Override
9978        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9979          switch (_hash) {
9980          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Deductable, visits, benefit amount.", 0, 1, type);
9981          case -1336663592: /*allowed[x]*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
9982          case -911343192: /*allowed*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
9983          case 1668802034: /*allowedUnsignedInt*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
9984          case -2135265319: /*allowedString*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
9985          case -351668232: /*allowedMoney*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
9986          case -147553373: /*used[x]*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
9987          case 3599293: /*used*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
9988          case 1252740285: /*usedUnsignedInt*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
9989          case -78048509: /*usedMoney*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
9990          default: return super.getNamedProperty(_hash, _name, _checkValid);
9991          }
9992
9993        }
9994
9995      @Override
9996      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9997        switch (hash) {
9998        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
9999        case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // Type
10000        case 3599293: /*used*/ return this.used == null ? new Base[0] : new Base[] {this.used}; // Type
10001        default: return super.getProperty(hash, name, checkValid);
10002        }
10003
10004      }
10005
10006      @Override
10007      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10008        switch (hash) {
10009        case 3575610: // type
10010          this.type = castToCodeableConcept(value); // CodeableConcept
10011          return value;
10012        case -911343192: // allowed
10013          this.allowed = castToType(value); // Type
10014          return value;
10015        case 3599293: // used
10016          this.used = castToType(value); // Type
10017          return value;
10018        default: return super.setProperty(hash, name, value);
10019        }
10020
10021      }
10022
10023      @Override
10024      public Base setProperty(String name, Base value) throws FHIRException {
10025        if (name.equals("type")) {
10026          this.type = castToCodeableConcept(value); // CodeableConcept
10027        } else if (name.equals("allowed[x]")) {
10028          this.allowed = castToType(value); // Type
10029        } else if (name.equals("used[x]")) {
10030          this.used = castToType(value); // Type
10031        } else
10032          return super.setProperty(name, value);
10033        return value;
10034      }
10035
10036      @Override
10037      public Base makeProperty(int hash, String name) throws FHIRException {
10038        switch (hash) {
10039        case 3575610:  return getType(); 
10040        case -1336663592:  return getAllowed(); 
10041        case -911343192:  return getAllowed(); 
10042        case -147553373:  return getUsed(); 
10043        case 3599293:  return getUsed(); 
10044        default: return super.makeProperty(hash, name);
10045        }
10046
10047      }
10048
10049      @Override
10050      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10051        switch (hash) {
10052        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
10053        case -911343192: /*allowed*/ return new String[] {"unsignedInt", "string", "Money"};
10054        case 3599293: /*used*/ return new String[] {"unsignedInt", "Money"};
10055        default: return super.getTypesForProperty(hash, name);
10056        }
10057
10058      }
10059
10060      @Override
10061      public Base addChild(String name) throws FHIRException {
10062        if (name.equals("type")) {
10063          this.type = new CodeableConcept();
10064          return this.type;
10065        }
10066        else if (name.equals("allowedUnsignedInt")) {
10067          this.allowed = new UnsignedIntType();
10068          return this.allowed;
10069        }
10070        else if (name.equals("allowedString")) {
10071          this.allowed = new StringType();
10072          return this.allowed;
10073        }
10074        else if (name.equals("allowedMoney")) {
10075          this.allowed = new Money();
10076          return this.allowed;
10077        }
10078        else if (name.equals("usedUnsignedInt")) {
10079          this.used = new UnsignedIntType();
10080          return this.used;
10081        }
10082        else if (name.equals("usedMoney")) {
10083          this.used = new Money();
10084          return this.used;
10085        }
10086        else
10087          return super.addChild(name);
10088      }
10089
10090      public BenefitComponent copy() {
10091        BenefitComponent dst = new BenefitComponent();
10092        copyValues(dst);
10093        dst.type = type == null ? null : type.copy();
10094        dst.allowed = allowed == null ? null : allowed.copy();
10095        dst.used = used == null ? null : used.copy();
10096        return dst;
10097      }
10098
10099      @Override
10100      public boolean equalsDeep(Base other_) {
10101        if (!super.equalsDeep(other_))
10102          return false;
10103        if (!(other_ instanceof BenefitComponent))
10104          return false;
10105        BenefitComponent o = (BenefitComponent) other_;
10106        return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true) && compareDeep(used, o.used, true)
10107          ;
10108      }
10109
10110      @Override
10111      public boolean equalsShallow(Base other_) {
10112        if (!super.equalsShallow(other_))
10113          return false;
10114        if (!(other_ instanceof BenefitComponent))
10115          return false;
10116        BenefitComponent o = (BenefitComponent) other_;
10117        return true;
10118      }
10119
10120      public boolean isEmpty() {
10121        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
10122      }
10123
10124  public String fhirType() {
10125    return "ExplanationOfBenefit.benefitBalance.financial";
10126
10127  }
10128
10129  }
10130
10131    /**
10132     * The EOB Business Identifier.
10133     */
10134    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10135    @Description(shortDefinition="Business Identifier", formalDefinition="The EOB Business Identifier." )
10136    protected List<Identifier> identifier;
10137
10138    /**
10139     * The status of the resource instance.
10140     */
10141    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
10142    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
10143    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
10144    protected Enumeration<ExplanationOfBenefitStatus> status;
10145
10146    /**
10147     * The category of claim, eg, oral, pharmacy, vision, insitutional, professional.
10148     */
10149    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
10150    @Description(shortDefinition="Type or discipline", formalDefinition="The category of claim, eg, oral, pharmacy, vision, insitutional, professional." )
10151    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-type")
10152    protected CodeableConcept type;
10153
10154    /**
10155     * A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType.
10156     */
10157    @Child(name = "subType", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10158    @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." )
10159    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-subtype")
10160    protected List<CodeableConcept> subType;
10161
10162    /**
10163     * Patient Resource.
10164     */
10165    @Child(name = "patient", type = {Patient.class}, order=4, min=0, max=1, modifier=false, summary=false)
10166    @Description(shortDefinition="The subject of the Products and Services", formalDefinition="Patient Resource." )
10167    protected Reference patient;
10168
10169    /**
10170     * The actual object that is the target of the reference (Patient Resource.)
10171     */
10172    protected Patient patientTarget;
10173
10174    /**
10175     * The billable period for which charges are being submitted.
10176     */
10177    @Child(name = "billablePeriod", type = {Period.class}, order=5, min=0, max=1, modifier=false, summary=false)
10178    @Description(shortDefinition="Period for charge submission", formalDefinition="The billable period for which charges are being submitted." )
10179    protected Period billablePeriod;
10180
10181    /**
10182     * The date when the EOB was created.
10183     */
10184    @Child(name = "created", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=false)
10185    @Description(shortDefinition="Creation date", formalDefinition="The date when the EOB was created." )
10186    protected DateTimeType created;
10187
10188    /**
10189     * The person who created the explanation of benefit.
10190     */
10191    @Child(name = "enterer", type = {Practitioner.class}, order=7, min=0, max=1, modifier=false, summary=false)
10192    @Description(shortDefinition="Author", formalDefinition="The person who created the explanation of benefit." )
10193    protected Reference enterer;
10194
10195    /**
10196     * The actual object that is the target of the reference (The person who created the explanation of benefit.)
10197     */
10198    protected Practitioner entererTarget;
10199
10200    /**
10201     * The insurer which is responsible for the explanation of benefit.
10202     */
10203    @Child(name = "insurer", type = {Organization.class}, order=8, min=0, max=1, modifier=false, summary=false)
10204    @Description(shortDefinition="Insurer responsible for the EOB", formalDefinition="The insurer which is responsible for the explanation of benefit." )
10205    protected Reference insurer;
10206
10207    /**
10208     * The actual object that is the target of the reference (The insurer which is responsible for the explanation of benefit.)
10209     */
10210    protected Organization insurerTarget;
10211
10212    /**
10213     * The provider which is responsible for the claim.
10214     */
10215    @Child(name = "provider", type = {Practitioner.class}, order=9, min=0, max=1, modifier=false, summary=false)
10216    @Description(shortDefinition="Responsible provider for the claim", formalDefinition="The provider which is responsible for the claim." )
10217    protected Reference provider;
10218
10219    /**
10220     * The actual object that is the target of the reference (The provider which is responsible for the claim.)
10221     */
10222    protected Practitioner providerTarget;
10223
10224    /**
10225     * The provider which is responsible for the claim.
10226     */
10227    @Child(name = "organization", type = {Organization.class}, order=10, min=0, max=1, modifier=false, summary=false)
10228    @Description(shortDefinition="Responsible organization for the claim", formalDefinition="The provider which is responsible for the claim." )
10229    protected Reference organization;
10230
10231    /**
10232     * The actual object that is the target of the reference (The provider which is responsible for the claim.)
10233     */
10234    protected Organization organizationTarget;
10235
10236    /**
10237     * The referral resource which lists the date, practitioner, reason and other supporting information.
10238     */
10239    @Child(name = "referral", type = {ReferralRequest.class}, order=11, min=0, max=1, modifier=false, summary=false)
10240    @Description(shortDefinition="Treatment Referral", formalDefinition="The referral resource which lists the date, practitioner, reason and other supporting information." )
10241    protected Reference referral;
10242
10243    /**
10244     * The actual object that is the target of the reference (The referral resource which lists the date, practitioner, reason and other supporting information.)
10245     */
10246    protected ReferralRequest referralTarget;
10247
10248    /**
10249     * Facility where the services were provided.
10250     */
10251    @Child(name = "facility", type = {Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
10252    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
10253    protected Reference facility;
10254
10255    /**
10256     * The actual object that is the target of the reference (Facility where the services were provided.)
10257     */
10258    protected Location facilityTarget;
10259
10260    /**
10261     * The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.
10262     */
10263    @Child(name = "claim", type = {Claim.class}, order=13, min=0, max=1, modifier=false, summary=false)
10264    @Description(shortDefinition="Claim reference", formalDefinition="The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number." )
10265    protected Reference claim;
10266
10267    /**
10268     * 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.)
10269     */
10270    protected Claim claimTarget;
10271
10272    /**
10273     * The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.
10274     */
10275    @Child(name = "claimResponse", type = {ClaimResponse.class}, order=14, min=0, max=1, modifier=false, summary=false)
10276    @Description(shortDefinition="Claim response reference", formalDefinition="The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number." )
10277    protected Reference claimResponse;
10278
10279    /**
10280     * 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.)
10281     */
10282    protected ClaimResponse claimResponseTarget;
10283
10284    /**
10285     * Processing outcome errror, partial or complete processing.
10286     */
10287    @Child(name = "outcome", type = {CodeableConcept.class}, order=15, min=0, max=1, modifier=false, summary=false)
10288    @Description(shortDefinition="complete | error | partial", formalDefinition="Processing outcome errror, partial or complete processing." )
10289    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
10290    protected CodeableConcept outcome;
10291
10292    /**
10293     * A description of the status of the adjudication.
10294     */
10295    @Child(name = "disposition", type = {StringType.class}, order=16, min=0, max=1, modifier=false, summary=false)
10296    @Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
10297    protected StringType disposition;
10298
10299    /**
10300     * Other claims which are related to this claim such as prior claim versions or for related services.
10301     */
10302    @Child(name = "related", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10303    @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." )
10304    protected List<RelatedClaimComponent> related;
10305
10306    /**
10307     * Prescription to support the dispensing of Pharmacy or Vision products.
10308     */
10309    @Child(name = "prescription", type = {MedicationRequest.class, VisionPrescription.class}, order=18, min=0, max=1, modifier=false, summary=false)
10310    @Description(shortDefinition="Prescription authorizing services or products", formalDefinition="Prescription to support the dispensing of Pharmacy or Vision products." )
10311    protected Reference prescription;
10312
10313    /**
10314     * The actual object that is the target of the reference (Prescription to support the dispensing of Pharmacy or Vision products.)
10315     */
10316    protected Resource prescriptionTarget;
10317
10318    /**
10319     * 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'.
10320     */
10321    @Child(name = "originalPrescription", type = {MedicationRequest.class}, order=19, min=0, max=1, modifier=false, summary=false)
10322    @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'." )
10323    protected Reference originalPrescription;
10324
10325    /**
10326     * 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'.)
10327     */
10328    protected MedicationRequest originalPrescriptionTarget;
10329
10330    /**
10331     * The party to be reimbursed for the services.
10332     */
10333    @Child(name = "payee", type = {}, order=20, min=0, max=1, modifier=false, summary=false)
10334    @Description(shortDefinition="Party to be paid any benefits payable", formalDefinition="The party to be reimbursed for the services." )
10335    protected PayeeComponent payee;
10336
10337    /**
10338     * Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required.
10339     */
10340    @Child(name = "information", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10341    @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." )
10342    protected List<SupportingInformationComponent> information;
10343
10344    /**
10345     * The members of the team who provided the overall service as well as their role and whether responsible and qualifications.
10346     */
10347    @Child(name = "careTeam", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10348    @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." )
10349    protected List<CareTeamComponent> careTeam;
10350
10351    /**
10352     * Ordered list of patient diagnosis for which care is sought.
10353     */
10354    @Child(name = "diagnosis", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10355    @Description(shortDefinition="List of Diagnosis", formalDefinition="Ordered list of patient diagnosis for which care is sought." )
10356    protected List<DiagnosisComponent> diagnosis;
10357
10358    /**
10359     * Ordered list of patient procedures performed to support the adjudication.
10360     */
10361    @Child(name = "procedure", type = {}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10362    @Description(shortDefinition="Procedures performed", formalDefinition="Ordered list of patient procedures performed to support the adjudication." )
10363    protected List<ProcedureComponent> procedure;
10364
10365    /**
10366     * Precedence (primary, secondary, etc.).
10367     */
10368    @Child(name = "precedence", type = {PositiveIntType.class}, order=25, min=0, max=1, modifier=false, summary=false)
10369    @Description(shortDefinition="Precedence (primary, secondary, etc.)", formalDefinition="Precedence (primary, secondary, etc.)." )
10370    protected PositiveIntType precedence;
10371
10372    /**
10373     * Financial instrument by which payment information for health care.
10374     */
10375    @Child(name = "insurance", type = {}, order=26, min=0, max=1, modifier=false, summary=false)
10376    @Description(shortDefinition="Insurance or medical plan", formalDefinition="Financial instrument by which payment information for health care." )
10377    protected InsuranceComponent insurance;
10378
10379    /**
10380     * An accident which resulted in the need for healthcare services.
10381     */
10382    @Child(name = "accident", type = {}, order=27, min=0, max=1, modifier=false, summary=false)
10383    @Description(shortDefinition="Details of an accident", formalDefinition="An accident which resulted in the need for healthcare services." )
10384    protected AccidentComponent accident;
10385
10386    /**
10387     * The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).
10388     */
10389    @Child(name = "employmentImpacted", type = {Period.class}, order=28, min=0, max=1, modifier=false, summary=false)
10390    @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)." )
10391    protected Period employmentImpacted;
10392
10393    /**
10394     * The start and optional end dates of when the patient was confined to a treatment center.
10395     */
10396    @Child(name = "hospitalization", type = {Period.class}, order=29, min=0, max=1, modifier=false, summary=false)
10397    @Description(shortDefinition="Period in hospital", formalDefinition="The start and optional end dates of when the patient was confined to a treatment center." )
10398    protected Period hospitalization;
10399
10400    /**
10401     * First tier of goods and services.
10402     */
10403    @Child(name = "item", type = {}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10404    @Description(shortDefinition="Goods and Services", formalDefinition="First tier of goods and services." )
10405    protected List<ItemComponent> item;
10406
10407    /**
10408     * The first tier service adjudications for payor added services.
10409     */
10410    @Child(name = "addItem", type = {}, order=31, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10411    @Description(shortDefinition="Insurer added line items", formalDefinition="The first tier service adjudications for payor added services." )
10412    protected List<AddedItemComponent> addItem;
10413
10414    /**
10415     * The total cost of the services reported.
10416     */
10417    @Child(name = "totalCost", type = {Money.class}, order=32, min=0, max=1, modifier=false, summary=false)
10418    @Description(shortDefinition="Total Cost of service from the Claim", formalDefinition="The total cost of the services reported." )
10419    protected Money totalCost;
10420
10421    /**
10422     * The amount of deductable applied which was not allocated to any particular service line.
10423     */
10424    @Child(name = "unallocDeductable", type = {Money.class}, order=33, min=0, max=1, modifier=false, summary=false)
10425    @Description(shortDefinition="Unallocated deductable", formalDefinition="The amount of deductable applied which was not allocated to any particular service line." )
10426    protected Money unallocDeductable;
10427
10428    /**
10429     * Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable).
10430     */
10431    @Child(name = "totalBenefit", type = {Money.class}, order=34, min=0, max=1, modifier=false, summary=false)
10432    @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)." )
10433    protected Money totalBenefit;
10434
10435    /**
10436     * Payment details for the claim if the claim has been paid.
10437     */
10438    @Child(name = "payment", type = {}, order=35, min=0, max=1, modifier=false, summary=false)
10439    @Description(shortDefinition="Payment (if paid)", formalDefinition="Payment details for the claim if the claim has been paid." )
10440    protected PaymentComponent payment;
10441
10442    /**
10443     * The form to be used for printing the content.
10444     */
10445    @Child(name = "form", type = {CodeableConcept.class}, order=36, min=0, max=1, modifier=false, summary=false)
10446    @Description(shortDefinition="Printed Form Identifier", formalDefinition="The form to be used for printing the content." )
10447    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
10448    protected CodeableConcept form;
10449
10450    /**
10451     * Note text.
10452     */
10453    @Child(name = "processNote", type = {}, order=37, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10454    @Description(shortDefinition="Processing notes", formalDefinition="Note text." )
10455    protected List<NoteComponent> processNote;
10456
10457    /**
10458     * Balance by Benefit Category.
10459     */
10460    @Child(name = "benefitBalance", type = {}, order=38, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10461    @Description(shortDefinition="Balance by Benefit Category", formalDefinition="Balance by Benefit Category." )
10462    protected List<BenefitBalanceComponent> benefitBalance;
10463
10464    private static final long serialVersionUID = -1301056913L;
10465
10466  /**
10467   * Constructor
10468   */
10469    public ExplanationOfBenefit() {
10470      super();
10471    }
10472
10473    /**
10474     * @return {@link #identifier} (The EOB Business Identifier.)
10475     */
10476    public List<Identifier> getIdentifier() { 
10477      if (this.identifier == null)
10478        this.identifier = new ArrayList<Identifier>();
10479      return this.identifier;
10480    }
10481
10482    /**
10483     * @return Returns a reference to <code>this</code> for easy method chaining
10484     */
10485    public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) { 
10486      this.identifier = theIdentifier;
10487      return this;
10488    }
10489
10490    public boolean hasIdentifier() { 
10491      if (this.identifier == null)
10492        return false;
10493      for (Identifier item : this.identifier)
10494        if (!item.isEmpty())
10495          return true;
10496      return false;
10497    }
10498
10499    public Identifier addIdentifier() { //3
10500      Identifier t = new Identifier();
10501      if (this.identifier == null)
10502        this.identifier = new ArrayList<Identifier>();
10503      this.identifier.add(t);
10504      return t;
10505    }
10506
10507    public ExplanationOfBenefit addIdentifier(Identifier t) { //3
10508      if (t == null)
10509        return this;
10510      if (this.identifier == null)
10511        this.identifier = new ArrayList<Identifier>();
10512      this.identifier.add(t);
10513      return this;
10514    }
10515
10516    /**
10517     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
10518     */
10519    public Identifier getIdentifierFirstRep() { 
10520      if (getIdentifier().isEmpty()) {
10521        addIdentifier();
10522      }
10523      return getIdentifier().get(0);
10524    }
10525
10526    /**
10527     * @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
10528     */
10529    public Enumeration<ExplanationOfBenefitStatus> getStatusElement() { 
10530      if (this.status == null)
10531        if (Configuration.errorOnAutoCreate())
10532          throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
10533        else if (Configuration.doAutoCreate())
10534          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
10535      return this.status;
10536    }
10537
10538    public boolean hasStatusElement() { 
10539      return this.status != null && !this.status.isEmpty();
10540    }
10541
10542    public boolean hasStatus() { 
10543      return this.status != null && !this.status.isEmpty();
10544    }
10545
10546    /**
10547     * @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
10548     */
10549    public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) { 
10550      this.status = value;
10551      return this;
10552    }
10553
10554    /**
10555     * @return The status of the resource instance.
10556     */
10557    public ExplanationOfBenefitStatus getStatus() { 
10558      return this.status == null ? null : this.status.getValue();
10559    }
10560
10561    /**
10562     * @param value The status of the resource instance.
10563     */
10564    public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) { 
10565      if (value == null)
10566        this.status = null;
10567      else {
10568        if (this.status == null)
10569          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
10570        this.status.setValue(value);
10571      }
10572      return this;
10573    }
10574
10575    /**
10576     * @return {@link #type} (The category of claim, eg, oral, pharmacy, vision, insitutional, professional.)
10577     */
10578    public CodeableConcept getType() { 
10579      if (this.type == null)
10580        if (Configuration.errorOnAutoCreate())
10581          throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
10582        else if (Configuration.doAutoCreate())
10583          this.type = new CodeableConcept(); // cc
10584      return this.type;
10585    }
10586
10587    public boolean hasType() { 
10588      return this.type != null && !this.type.isEmpty();
10589    }
10590
10591    /**
10592     * @param value {@link #type} (The category of claim, eg, oral, pharmacy, vision, insitutional, professional.)
10593     */
10594    public ExplanationOfBenefit setType(CodeableConcept value)  { 
10595      this.type = value;
10596      return this;
10597    }
10598
10599    /**
10600     * @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.)
10601     */
10602    public List<CodeableConcept> getSubType() { 
10603      if (this.subType == null)
10604        this.subType = new ArrayList<CodeableConcept>();
10605      return this.subType;
10606    }
10607
10608    /**
10609     * @return Returns a reference to <code>this</code> for easy method chaining
10610     */
10611    public ExplanationOfBenefit setSubType(List<CodeableConcept> theSubType) { 
10612      this.subType = theSubType;
10613      return this;
10614    }
10615
10616    public boolean hasSubType() { 
10617      if (this.subType == null)
10618        return false;
10619      for (CodeableConcept item : this.subType)
10620        if (!item.isEmpty())
10621          return true;
10622      return false;
10623    }
10624
10625    public CodeableConcept addSubType() { //3
10626      CodeableConcept t = new CodeableConcept();
10627      if (this.subType == null)
10628        this.subType = new ArrayList<CodeableConcept>();
10629      this.subType.add(t);
10630      return t;
10631    }
10632
10633    public ExplanationOfBenefit addSubType(CodeableConcept t) { //3
10634      if (t == null)
10635        return this;
10636      if (this.subType == null)
10637        this.subType = new ArrayList<CodeableConcept>();
10638      this.subType.add(t);
10639      return this;
10640    }
10641
10642    /**
10643     * @return The first repetition of repeating field {@link #subType}, creating it if it does not already exist
10644     */
10645    public CodeableConcept getSubTypeFirstRep() { 
10646      if (getSubType().isEmpty()) {
10647        addSubType();
10648      }
10649      return getSubType().get(0);
10650    }
10651
10652    /**
10653     * @return {@link #patient} (Patient Resource.)
10654     */
10655    public Reference getPatient() { 
10656      if (this.patient == null)
10657        if (Configuration.errorOnAutoCreate())
10658          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
10659        else if (Configuration.doAutoCreate())
10660          this.patient = new Reference(); // cc
10661      return this.patient;
10662    }
10663
10664    public boolean hasPatient() { 
10665      return this.patient != null && !this.patient.isEmpty();
10666    }
10667
10668    /**
10669     * @param value {@link #patient} (Patient Resource.)
10670     */
10671    public ExplanationOfBenefit setPatient(Reference value)  { 
10672      this.patient = value;
10673      return this;
10674    }
10675
10676    /**
10677     * @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.)
10678     */
10679    public Patient getPatientTarget() { 
10680      if (this.patientTarget == null)
10681        if (Configuration.errorOnAutoCreate())
10682          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
10683        else if (Configuration.doAutoCreate())
10684          this.patientTarget = new Patient(); // aa
10685      return this.patientTarget;
10686    }
10687
10688    /**
10689     * @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.)
10690     */
10691    public ExplanationOfBenefit setPatientTarget(Patient value) { 
10692      this.patientTarget = value;
10693      return this;
10694    }
10695
10696    /**
10697     * @return {@link #billablePeriod} (The billable period for which charges are being submitted.)
10698     */
10699    public Period getBillablePeriod() { 
10700      if (this.billablePeriod == null)
10701        if (Configuration.errorOnAutoCreate())
10702          throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
10703        else if (Configuration.doAutoCreate())
10704          this.billablePeriod = new Period(); // cc
10705      return this.billablePeriod;
10706    }
10707
10708    public boolean hasBillablePeriod() { 
10709      return this.billablePeriod != null && !this.billablePeriod.isEmpty();
10710    }
10711
10712    /**
10713     * @param value {@link #billablePeriod} (The billable period for which charges are being submitted.)
10714     */
10715    public ExplanationOfBenefit setBillablePeriod(Period value)  { 
10716      this.billablePeriod = value;
10717      return this;
10718    }
10719
10720    /**
10721     * @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
10722     */
10723    public DateTimeType getCreatedElement() { 
10724      if (this.created == null)
10725        if (Configuration.errorOnAutoCreate())
10726          throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
10727        else if (Configuration.doAutoCreate())
10728          this.created = new DateTimeType(); // bb
10729      return this.created;
10730    }
10731
10732    public boolean hasCreatedElement() { 
10733      return this.created != null && !this.created.isEmpty();
10734    }
10735
10736    public boolean hasCreated() { 
10737      return this.created != null && !this.created.isEmpty();
10738    }
10739
10740    /**
10741     * @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
10742     */
10743    public ExplanationOfBenefit setCreatedElement(DateTimeType value) { 
10744      this.created = value;
10745      return this;
10746    }
10747
10748    /**
10749     * @return The date when the EOB was created.
10750     */
10751    public Date getCreated() { 
10752      return this.created == null ? null : this.created.getValue();
10753    }
10754
10755    /**
10756     * @param value The date when the EOB was created.
10757     */
10758    public ExplanationOfBenefit setCreated(Date value) { 
10759      if (value == null)
10760        this.created = null;
10761      else {
10762        if (this.created == null)
10763          this.created = new DateTimeType();
10764        this.created.setValue(value);
10765      }
10766      return this;
10767    }
10768
10769    /**
10770     * @return {@link #enterer} (The person who created the explanation of benefit.)
10771     */
10772    public Reference getEnterer() { 
10773      if (this.enterer == null)
10774        if (Configuration.errorOnAutoCreate())
10775          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
10776        else if (Configuration.doAutoCreate())
10777          this.enterer = new Reference(); // cc
10778      return this.enterer;
10779    }
10780
10781    public boolean hasEnterer() { 
10782      return this.enterer != null && !this.enterer.isEmpty();
10783    }
10784
10785    /**
10786     * @param value {@link #enterer} (The person who created the explanation of benefit.)
10787     */
10788    public ExplanationOfBenefit setEnterer(Reference value)  { 
10789      this.enterer = value;
10790      return this;
10791    }
10792
10793    /**
10794     * @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.)
10795     */
10796    public Practitioner getEntererTarget() { 
10797      if (this.entererTarget == null)
10798        if (Configuration.errorOnAutoCreate())
10799          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
10800        else if (Configuration.doAutoCreate())
10801          this.entererTarget = new Practitioner(); // aa
10802      return this.entererTarget;
10803    }
10804
10805    /**
10806     * @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.)
10807     */
10808    public ExplanationOfBenefit setEntererTarget(Practitioner value) { 
10809      this.entererTarget = value;
10810      return this;
10811    }
10812
10813    /**
10814     * @return {@link #insurer} (The insurer which is responsible for the explanation of benefit.)
10815     */
10816    public Reference getInsurer() { 
10817      if (this.insurer == null)
10818        if (Configuration.errorOnAutoCreate())
10819          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
10820        else if (Configuration.doAutoCreate())
10821          this.insurer = new Reference(); // cc
10822      return this.insurer;
10823    }
10824
10825    public boolean hasInsurer() { 
10826      return this.insurer != null && !this.insurer.isEmpty();
10827    }
10828
10829    /**
10830     * @param value {@link #insurer} (The insurer which is responsible for the explanation of benefit.)
10831     */
10832    public ExplanationOfBenefit setInsurer(Reference value)  { 
10833      this.insurer = value;
10834      return this;
10835    }
10836
10837    /**
10838     * @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.)
10839     */
10840    public Organization getInsurerTarget() { 
10841      if (this.insurerTarget == null)
10842        if (Configuration.errorOnAutoCreate())
10843          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
10844        else if (Configuration.doAutoCreate())
10845          this.insurerTarget = new Organization(); // aa
10846      return this.insurerTarget;
10847    }
10848
10849    /**
10850     * @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.)
10851     */
10852    public ExplanationOfBenefit setInsurerTarget(Organization value) { 
10853      this.insurerTarget = value;
10854      return this;
10855    }
10856
10857    /**
10858     * @return {@link #provider} (The provider which is responsible for the claim.)
10859     */
10860    public Reference getProvider() { 
10861      if (this.provider == null)
10862        if (Configuration.errorOnAutoCreate())
10863          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
10864        else if (Configuration.doAutoCreate())
10865          this.provider = new Reference(); // cc
10866      return this.provider;
10867    }
10868
10869    public boolean hasProvider() { 
10870      return this.provider != null && !this.provider.isEmpty();
10871    }
10872
10873    /**
10874     * @param value {@link #provider} (The provider which is responsible for the claim.)
10875     */
10876    public ExplanationOfBenefit setProvider(Reference value)  { 
10877      this.provider = value;
10878      return this;
10879    }
10880
10881    /**
10882     * @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.)
10883     */
10884    public Practitioner getProviderTarget() { 
10885      if (this.providerTarget == null)
10886        if (Configuration.errorOnAutoCreate())
10887          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
10888        else if (Configuration.doAutoCreate())
10889          this.providerTarget = new Practitioner(); // aa
10890      return this.providerTarget;
10891    }
10892
10893    /**
10894     * @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.)
10895     */
10896    public ExplanationOfBenefit setProviderTarget(Practitioner value) { 
10897      this.providerTarget = value;
10898      return this;
10899    }
10900
10901    /**
10902     * @return {@link #organization} (The provider which is responsible for the claim.)
10903     */
10904    public Reference getOrganization() { 
10905      if (this.organization == null)
10906        if (Configuration.errorOnAutoCreate())
10907          throw new Error("Attempt to auto-create ExplanationOfBenefit.organization");
10908        else if (Configuration.doAutoCreate())
10909          this.organization = new Reference(); // cc
10910      return this.organization;
10911    }
10912
10913    public boolean hasOrganization() { 
10914      return this.organization != null && !this.organization.isEmpty();
10915    }
10916
10917    /**
10918     * @param value {@link #organization} (The provider which is responsible for the claim.)
10919     */
10920    public ExplanationOfBenefit setOrganization(Reference value)  { 
10921      this.organization = value;
10922      return this;
10923    }
10924
10925    /**
10926     * @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.)
10927     */
10928    public Organization getOrganizationTarget() { 
10929      if (this.organizationTarget == null)
10930        if (Configuration.errorOnAutoCreate())
10931          throw new Error("Attempt to auto-create ExplanationOfBenefit.organization");
10932        else if (Configuration.doAutoCreate())
10933          this.organizationTarget = new Organization(); // aa
10934      return this.organizationTarget;
10935    }
10936
10937    /**
10938     * @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.)
10939     */
10940    public ExplanationOfBenefit setOrganizationTarget(Organization value) { 
10941      this.organizationTarget = value;
10942      return this;
10943    }
10944
10945    /**
10946     * @return {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
10947     */
10948    public Reference getReferral() { 
10949      if (this.referral == null)
10950        if (Configuration.errorOnAutoCreate())
10951          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
10952        else if (Configuration.doAutoCreate())
10953          this.referral = new Reference(); // cc
10954      return this.referral;
10955    }
10956
10957    public boolean hasReferral() { 
10958      return this.referral != null && !this.referral.isEmpty();
10959    }
10960
10961    /**
10962     * @param value {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
10963     */
10964    public ExplanationOfBenefit setReferral(Reference value)  { 
10965      this.referral = value;
10966      return this;
10967    }
10968
10969    /**
10970     * @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.)
10971     */
10972    public ReferralRequest getReferralTarget() { 
10973      if (this.referralTarget == null)
10974        if (Configuration.errorOnAutoCreate())
10975          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
10976        else if (Configuration.doAutoCreate())
10977          this.referralTarget = new ReferralRequest(); // aa
10978      return this.referralTarget;
10979    }
10980
10981    /**
10982     * @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.)
10983     */
10984    public ExplanationOfBenefit setReferralTarget(ReferralRequest value) { 
10985      this.referralTarget = value;
10986      return this;
10987    }
10988
10989    /**
10990     * @return {@link #facility} (Facility where the services were provided.)
10991     */
10992    public Reference getFacility() { 
10993      if (this.facility == null)
10994        if (Configuration.errorOnAutoCreate())
10995          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
10996        else if (Configuration.doAutoCreate())
10997          this.facility = new Reference(); // cc
10998      return this.facility;
10999    }
11000
11001    public boolean hasFacility() { 
11002      return this.facility != null && !this.facility.isEmpty();
11003    }
11004
11005    /**
11006     * @param value {@link #facility} (Facility where the services were provided.)
11007     */
11008    public ExplanationOfBenefit setFacility(Reference value)  { 
11009      this.facility = value;
11010      return this;
11011    }
11012
11013    /**
11014     * @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.)
11015     */
11016    public Location getFacilityTarget() { 
11017      if (this.facilityTarget == null)
11018        if (Configuration.errorOnAutoCreate())
11019          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
11020        else if (Configuration.doAutoCreate())
11021          this.facilityTarget = new Location(); // aa
11022      return this.facilityTarget;
11023    }
11024
11025    /**
11026     * @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.)
11027     */
11028    public ExplanationOfBenefit setFacilityTarget(Location value) { 
11029      this.facilityTarget = value;
11030      return this;
11031    }
11032
11033    /**
11034     * @return {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
11035     */
11036    public Reference getClaim() { 
11037      if (this.claim == null)
11038        if (Configuration.errorOnAutoCreate())
11039          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
11040        else if (Configuration.doAutoCreate())
11041          this.claim = new Reference(); // cc
11042      return this.claim;
11043    }
11044
11045    public boolean hasClaim() { 
11046      return this.claim != null && !this.claim.isEmpty();
11047    }
11048
11049    /**
11050     * @param value {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
11051     */
11052    public ExplanationOfBenefit setClaim(Reference value)  { 
11053      this.claim = value;
11054      return this;
11055    }
11056
11057    /**
11058     * @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.)
11059     */
11060    public Claim getClaimTarget() { 
11061      if (this.claimTarget == null)
11062        if (Configuration.errorOnAutoCreate())
11063          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
11064        else if (Configuration.doAutoCreate())
11065          this.claimTarget = new Claim(); // aa
11066      return this.claimTarget;
11067    }
11068
11069    /**
11070     * @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.)
11071     */
11072    public ExplanationOfBenefit setClaimTarget(Claim value) { 
11073      this.claimTarget = value;
11074      return this;
11075    }
11076
11077    /**
11078     * @return {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
11079     */
11080    public Reference getClaimResponse() { 
11081      if (this.claimResponse == null)
11082        if (Configuration.errorOnAutoCreate())
11083          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
11084        else if (Configuration.doAutoCreate())
11085          this.claimResponse = new Reference(); // cc
11086      return this.claimResponse;
11087    }
11088
11089    public boolean hasClaimResponse() { 
11090      return this.claimResponse != null && !this.claimResponse.isEmpty();
11091    }
11092
11093    /**
11094     * @param value {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
11095     */
11096    public ExplanationOfBenefit setClaimResponse(Reference value)  { 
11097      this.claimResponse = value;
11098      return this;
11099    }
11100
11101    /**
11102     * @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.)
11103     */
11104    public ClaimResponse getClaimResponseTarget() { 
11105      if (this.claimResponseTarget == null)
11106        if (Configuration.errorOnAutoCreate())
11107          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
11108        else if (Configuration.doAutoCreate())
11109          this.claimResponseTarget = new ClaimResponse(); // aa
11110      return this.claimResponseTarget;
11111    }
11112
11113    /**
11114     * @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.)
11115     */
11116    public ExplanationOfBenefit setClaimResponseTarget(ClaimResponse value) { 
11117      this.claimResponseTarget = value;
11118      return this;
11119    }
11120
11121    /**
11122     * @return {@link #outcome} (Processing outcome errror, partial or complete processing.)
11123     */
11124    public CodeableConcept getOutcome() { 
11125      if (this.outcome == null)
11126        if (Configuration.errorOnAutoCreate())
11127          throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
11128        else if (Configuration.doAutoCreate())
11129          this.outcome = new CodeableConcept(); // cc
11130      return this.outcome;
11131    }
11132
11133    public boolean hasOutcome() { 
11134      return this.outcome != null && !this.outcome.isEmpty();
11135    }
11136
11137    /**
11138     * @param value {@link #outcome} (Processing outcome errror, partial or complete processing.)
11139     */
11140    public ExplanationOfBenefit setOutcome(CodeableConcept value)  { 
11141      this.outcome = value;
11142      return this;
11143    }
11144
11145    /**
11146     * @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
11147     */
11148    public StringType getDispositionElement() { 
11149      if (this.disposition == null)
11150        if (Configuration.errorOnAutoCreate())
11151          throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
11152        else if (Configuration.doAutoCreate())
11153          this.disposition = new StringType(); // bb
11154      return this.disposition;
11155    }
11156
11157    public boolean hasDispositionElement() { 
11158      return this.disposition != null && !this.disposition.isEmpty();
11159    }
11160
11161    public boolean hasDisposition() { 
11162      return this.disposition != null && !this.disposition.isEmpty();
11163    }
11164
11165    /**
11166     * @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
11167     */
11168    public ExplanationOfBenefit setDispositionElement(StringType value) { 
11169      this.disposition = value;
11170      return this;
11171    }
11172
11173    /**
11174     * @return A description of the status of the adjudication.
11175     */
11176    public String getDisposition() { 
11177      return this.disposition == null ? null : this.disposition.getValue();
11178    }
11179
11180    /**
11181     * @param value A description of the status of the adjudication.
11182     */
11183    public ExplanationOfBenefit setDisposition(String value) { 
11184      if (Utilities.noString(value))
11185        this.disposition = null;
11186      else {
11187        if (this.disposition == null)
11188          this.disposition = new StringType();
11189        this.disposition.setValue(value);
11190      }
11191      return this;
11192    }
11193
11194    /**
11195     * @return {@link #related} (Other claims which are related to this claim such as prior claim versions or for related services.)
11196     */
11197    public List<RelatedClaimComponent> getRelated() { 
11198      if (this.related == null)
11199        this.related = new ArrayList<RelatedClaimComponent>();
11200      return this.related;
11201    }
11202
11203    /**
11204     * @return Returns a reference to <code>this</code> for easy method chaining
11205     */
11206    public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) { 
11207      this.related = theRelated;
11208      return this;
11209    }
11210
11211    public boolean hasRelated() { 
11212      if (this.related == null)
11213        return false;
11214      for (RelatedClaimComponent item : this.related)
11215        if (!item.isEmpty())
11216          return true;
11217      return false;
11218    }
11219
11220    public RelatedClaimComponent addRelated() { //3
11221      RelatedClaimComponent t = new RelatedClaimComponent();
11222      if (this.related == null)
11223        this.related = new ArrayList<RelatedClaimComponent>();
11224      this.related.add(t);
11225      return t;
11226    }
11227
11228    public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { //3
11229      if (t == null)
11230        return this;
11231      if (this.related == null)
11232        this.related = new ArrayList<RelatedClaimComponent>();
11233      this.related.add(t);
11234      return this;
11235    }
11236
11237    /**
11238     * @return The first repetition of repeating field {@link #related}, creating it if it does not already exist
11239     */
11240    public RelatedClaimComponent getRelatedFirstRep() { 
11241      if (getRelated().isEmpty()) {
11242        addRelated();
11243      }
11244      return getRelated().get(0);
11245    }
11246
11247    /**
11248     * @return {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
11249     */
11250    public Reference getPrescription() { 
11251      if (this.prescription == null)
11252        if (Configuration.errorOnAutoCreate())
11253          throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
11254        else if (Configuration.doAutoCreate())
11255          this.prescription = new Reference(); // cc
11256      return this.prescription;
11257    }
11258
11259    public boolean hasPrescription() { 
11260      return this.prescription != null && !this.prescription.isEmpty();
11261    }
11262
11263    /**
11264     * @param value {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
11265     */
11266    public ExplanationOfBenefit setPrescription(Reference value)  { 
11267      this.prescription = value;
11268      return this;
11269    }
11270
11271    /**
11272     * @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.)
11273     */
11274    public Resource getPrescriptionTarget() { 
11275      return this.prescriptionTarget;
11276    }
11277
11278    /**
11279     * @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.)
11280     */
11281    public ExplanationOfBenefit setPrescriptionTarget(Resource value) { 
11282      this.prescriptionTarget = value;
11283      return this;
11284    }
11285
11286    /**
11287     * @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'.)
11288     */
11289    public Reference getOriginalPrescription() { 
11290      if (this.originalPrescription == null)
11291        if (Configuration.errorOnAutoCreate())
11292          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
11293        else if (Configuration.doAutoCreate())
11294          this.originalPrescription = new Reference(); // cc
11295      return this.originalPrescription;
11296    }
11297
11298    public boolean hasOriginalPrescription() { 
11299      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
11300    }
11301
11302    /**
11303     * @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'.)
11304     */
11305    public ExplanationOfBenefit setOriginalPrescription(Reference value)  { 
11306      this.originalPrescription = value;
11307      return this;
11308    }
11309
11310    /**
11311     * @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'.)
11312     */
11313    public MedicationRequest getOriginalPrescriptionTarget() { 
11314      if (this.originalPrescriptionTarget == null)
11315        if (Configuration.errorOnAutoCreate())
11316          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
11317        else if (Configuration.doAutoCreate())
11318          this.originalPrescriptionTarget = new MedicationRequest(); // aa
11319      return this.originalPrescriptionTarget;
11320    }
11321
11322    /**
11323     * @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'.)
11324     */
11325    public ExplanationOfBenefit setOriginalPrescriptionTarget(MedicationRequest value) { 
11326      this.originalPrescriptionTarget = value;
11327      return this;
11328    }
11329
11330    /**
11331     * @return {@link #payee} (The party to be reimbursed for the services.)
11332     */
11333    public PayeeComponent getPayee() { 
11334      if (this.payee == null)
11335        if (Configuration.errorOnAutoCreate())
11336          throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
11337        else if (Configuration.doAutoCreate())
11338          this.payee = new PayeeComponent(); // cc
11339      return this.payee;
11340    }
11341
11342    public boolean hasPayee() { 
11343      return this.payee != null && !this.payee.isEmpty();
11344    }
11345
11346    /**
11347     * @param value {@link #payee} (The party to be reimbursed for the services.)
11348     */
11349    public ExplanationOfBenefit setPayee(PayeeComponent value)  { 
11350      this.payee = value;
11351      return this;
11352    }
11353
11354    /**
11355     * @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.)
11356     */
11357    public List<SupportingInformationComponent> getInformation() { 
11358      if (this.information == null)
11359        this.information = new ArrayList<SupportingInformationComponent>();
11360      return this.information;
11361    }
11362
11363    /**
11364     * @return Returns a reference to <code>this</code> for easy method chaining
11365     */
11366    public ExplanationOfBenefit setInformation(List<SupportingInformationComponent> theInformation) { 
11367      this.information = theInformation;
11368      return this;
11369    }
11370
11371    public boolean hasInformation() { 
11372      if (this.information == null)
11373        return false;
11374      for (SupportingInformationComponent item : this.information)
11375        if (!item.isEmpty())
11376          return true;
11377      return false;
11378    }
11379
11380    public SupportingInformationComponent addInformation() { //3
11381      SupportingInformationComponent t = new SupportingInformationComponent();
11382      if (this.information == null)
11383        this.information = new ArrayList<SupportingInformationComponent>();
11384      this.information.add(t);
11385      return t;
11386    }
11387
11388    public ExplanationOfBenefit addInformation(SupportingInformationComponent t) { //3
11389      if (t == null)
11390        return this;
11391      if (this.information == null)
11392        this.information = new ArrayList<SupportingInformationComponent>();
11393      this.information.add(t);
11394      return this;
11395    }
11396
11397    /**
11398     * @return The first repetition of repeating field {@link #information}, creating it if it does not already exist
11399     */
11400    public SupportingInformationComponent getInformationFirstRep() { 
11401      if (getInformation().isEmpty()) {
11402        addInformation();
11403      }
11404      return getInformation().get(0);
11405    }
11406
11407    /**
11408     * @return {@link #careTeam} (The members of the team who provided the overall service as well as their role and whether responsible and qualifications.)
11409     */
11410    public List<CareTeamComponent> getCareTeam() { 
11411      if (this.careTeam == null)
11412        this.careTeam = new ArrayList<CareTeamComponent>();
11413      return this.careTeam;
11414    }
11415
11416    /**
11417     * @return Returns a reference to <code>this</code> for easy method chaining
11418     */
11419    public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) { 
11420      this.careTeam = theCareTeam;
11421      return this;
11422    }
11423
11424    public boolean hasCareTeam() { 
11425      if (this.careTeam == null)
11426        return false;
11427      for (CareTeamComponent item : this.careTeam)
11428        if (!item.isEmpty())
11429          return true;
11430      return false;
11431    }
11432
11433    public CareTeamComponent addCareTeam() { //3
11434      CareTeamComponent t = new CareTeamComponent();
11435      if (this.careTeam == null)
11436        this.careTeam = new ArrayList<CareTeamComponent>();
11437      this.careTeam.add(t);
11438      return t;
11439    }
11440
11441    public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { //3
11442      if (t == null)
11443        return this;
11444      if (this.careTeam == null)
11445        this.careTeam = new ArrayList<CareTeamComponent>();
11446      this.careTeam.add(t);
11447      return this;
11448    }
11449
11450    /**
11451     * @return The first repetition of repeating field {@link #careTeam}, creating it if it does not already exist
11452     */
11453    public CareTeamComponent getCareTeamFirstRep() { 
11454      if (getCareTeam().isEmpty()) {
11455        addCareTeam();
11456      }
11457      return getCareTeam().get(0);
11458    }
11459
11460    /**
11461     * @return {@link #diagnosis} (Ordered list of patient diagnosis for which care is sought.)
11462     */
11463    public List<DiagnosisComponent> getDiagnosis() { 
11464      if (this.diagnosis == null)
11465        this.diagnosis = new ArrayList<DiagnosisComponent>();
11466      return this.diagnosis;
11467    }
11468
11469    /**
11470     * @return Returns a reference to <code>this</code> for easy method chaining
11471     */
11472    public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
11473      this.diagnosis = theDiagnosis;
11474      return this;
11475    }
11476
11477    public boolean hasDiagnosis() { 
11478      if (this.diagnosis == null)
11479        return false;
11480      for (DiagnosisComponent item : this.diagnosis)
11481        if (!item.isEmpty())
11482          return true;
11483      return false;
11484    }
11485
11486    public DiagnosisComponent addDiagnosis() { //3
11487      DiagnosisComponent t = new DiagnosisComponent();
11488      if (this.diagnosis == null)
11489        this.diagnosis = new ArrayList<DiagnosisComponent>();
11490      this.diagnosis.add(t);
11491      return t;
11492    }
11493
11494    public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { //3
11495      if (t == null)
11496        return this;
11497      if (this.diagnosis == null)
11498        this.diagnosis = new ArrayList<DiagnosisComponent>();
11499      this.diagnosis.add(t);
11500      return this;
11501    }
11502
11503    /**
11504     * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist
11505     */
11506    public DiagnosisComponent getDiagnosisFirstRep() { 
11507      if (getDiagnosis().isEmpty()) {
11508        addDiagnosis();
11509      }
11510      return getDiagnosis().get(0);
11511    }
11512
11513    /**
11514     * @return {@link #procedure} (Ordered list of patient procedures performed to support the adjudication.)
11515     */
11516    public List<ProcedureComponent> getProcedure() { 
11517      if (this.procedure == null)
11518        this.procedure = new ArrayList<ProcedureComponent>();
11519      return this.procedure;
11520    }
11521
11522    /**
11523     * @return Returns a reference to <code>this</code> for easy method chaining
11524     */
11525    public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) { 
11526      this.procedure = theProcedure;
11527      return this;
11528    }
11529
11530    public boolean hasProcedure() { 
11531      if (this.procedure == null)
11532        return false;
11533      for (ProcedureComponent item : this.procedure)
11534        if (!item.isEmpty())
11535          return true;
11536      return false;
11537    }
11538
11539    public ProcedureComponent addProcedure() { //3
11540      ProcedureComponent t = new ProcedureComponent();
11541      if (this.procedure == null)
11542        this.procedure = new ArrayList<ProcedureComponent>();
11543      this.procedure.add(t);
11544      return t;
11545    }
11546
11547    public ExplanationOfBenefit addProcedure(ProcedureComponent t) { //3
11548      if (t == null)
11549        return this;
11550      if (this.procedure == null)
11551        this.procedure = new ArrayList<ProcedureComponent>();
11552      this.procedure.add(t);
11553      return this;
11554    }
11555
11556    /**
11557     * @return The first repetition of repeating field {@link #procedure}, creating it if it does not already exist
11558     */
11559    public ProcedureComponent getProcedureFirstRep() { 
11560      if (getProcedure().isEmpty()) {
11561        addProcedure();
11562      }
11563      return getProcedure().get(0);
11564    }
11565
11566    /**
11567     * @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
11568     */
11569    public PositiveIntType getPrecedenceElement() { 
11570      if (this.precedence == null)
11571        if (Configuration.errorOnAutoCreate())
11572          throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
11573        else if (Configuration.doAutoCreate())
11574          this.precedence = new PositiveIntType(); // bb
11575      return this.precedence;
11576    }
11577
11578    public boolean hasPrecedenceElement() { 
11579      return this.precedence != null && !this.precedence.isEmpty();
11580    }
11581
11582    public boolean hasPrecedence() { 
11583      return this.precedence != null && !this.precedence.isEmpty();
11584    }
11585
11586    /**
11587     * @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
11588     */
11589    public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) { 
11590      this.precedence = value;
11591      return this;
11592    }
11593
11594    /**
11595     * @return Precedence (primary, secondary, etc.).
11596     */
11597    public int getPrecedence() { 
11598      return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
11599    }
11600
11601    /**
11602     * @param value Precedence (primary, secondary, etc.).
11603     */
11604    public ExplanationOfBenefit setPrecedence(int value) { 
11605        if (this.precedence == null)
11606          this.precedence = new PositiveIntType();
11607        this.precedence.setValue(value);
11608      return this;
11609    }
11610
11611    /**
11612     * @return {@link #insurance} (Financial instrument by which payment information for health care.)
11613     */
11614    public InsuranceComponent getInsurance() { 
11615      if (this.insurance == null)
11616        if (Configuration.errorOnAutoCreate())
11617          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurance");
11618        else if (Configuration.doAutoCreate())
11619          this.insurance = new InsuranceComponent(); // cc
11620      return this.insurance;
11621    }
11622
11623    public boolean hasInsurance() { 
11624      return this.insurance != null && !this.insurance.isEmpty();
11625    }
11626
11627    /**
11628     * @param value {@link #insurance} (Financial instrument by which payment information for health care.)
11629     */
11630    public ExplanationOfBenefit setInsurance(InsuranceComponent value)  { 
11631      this.insurance = value;
11632      return this;
11633    }
11634
11635    /**
11636     * @return {@link #accident} (An accident which resulted in the need for healthcare services.)
11637     */
11638    public AccidentComponent getAccident() { 
11639      if (this.accident == null)
11640        if (Configuration.errorOnAutoCreate())
11641          throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
11642        else if (Configuration.doAutoCreate())
11643          this.accident = new AccidentComponent(); // cc
11644      return this.accident;
11645    }
11646
11647    public boolean hasAccident() { 
11648      return this.accident != null && !this.accident.isEmpty();
11649    }
11650
11651    /**
11652     * @param value {@link #accident} (An accident which resulted in the need for healthcare services.)
11653     */
11654    public ExplanationOfBenefit setAccident(AccidentComponent value)  { 
11655      this.accident = value;
11656      return this;
11657    }
11658
11659    /**
11660     * @return {@link #employmentImpacted} (The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).)
11661     */
11662    public Period getEmploymentImpacted() { 
11663      if (this.employmentImpacted == null)
11664        if (Configuration.errorOnAutoCreate())
11665          throw new Error("Attempt to auto-create ExplanationOfBenefit.employmentImpacted");
11666        else if (Configuration.doAutoCreate())
11667          this.employmentImpacted = new Period(); // cc
11668      return this.employmentImpacted;
11669    }
11670
11671    public boolean hasEmploymentImpacted() { 
11672      return this.employmentImpacted != null && !this.employmentImpacted.isEmpty();
11673    }
11674
11675    /**
11676     * @param value {@link #employmentImpacted} (The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).)
11677     */
11678    public ExplanationOfBenefit setEmploymentImpacted(Period value)  { 
11679      this.employmentImpacted = value;
11680      return this;
11681    }
11682
11683    /**
11684     * @return {@link #hospitalization} (The start and optional end dates of when the patient was confined to a treatment center.)
11685     */
11686    public Period getHospitalization() { 
11687      if (this.hospitalization == null)
11688        if (Configuration.errorOnAutoCreate())
11689          throw new Error("Attempt to auto-create ExplanationOfBenefit.hospitalization");
11690        else if (Configuration.doAutoCreate())
11691          this.hospitalization = new Period(); // cc
11692      return this.hospitalization;
11693    }
11694
11695    public boolean hasHospitalization() { 
11696      return this.hospitalization != null && !this.hospitalization.isEmpty();
11697    }
11698
11699    /**
11700     * @param value {@link #hospitalization} (The start and optional end dates of when the patient was confined to a treatment center.)
11701     */
11702    public ExplanationOfBenefit setHospitalization(Period value)  { 
11703      this.hospitalization = value;
11704      return this;
11705    }
11706
11707    /**
11708     * @return {@link #item} (First tier of goods and services.)
11709     */
11710    public List<ItemComponent> getItem() { 
11711      if (this.item == null)
11712        this.item = new ArrayList<ItemComponent>();
11713      return this.item;
11714    }
11715
11716    /**
11717     * @return Returns a reference to <code>this</code> for easy method chaining
11718     */
11719    public ExplanationOfBenefit setItem(List<ItemComponent> theItem) { 
11720      this.item = theItem;
11721      return this;
11722    }
11723
11724    public boolean hasItem() { 
11725      if (this.item == null)
11726        return false;
11727      for (ItemComponent item : this.item)
11728        if (!item.isEmpty())
11729          return true;
11730      return false;
11731    }
11732
11733    public ItemComponent addItem() { //3
11734      ItemComponent t = new ItemComponent();
11735      if (this.item == null)
11736        this.item = new ArrayList<ItemComponent>();
11737      this.item.add(t);
11738      return t;
11739    }
11740
11741    public ExplanationOfBenefit addItem(ItemComponent t) { //3
11742      if (t == null)
11743        return this;
11744      if (this.item == null)
11745        this.item = new ArrayList<ItemComponent>();
11746      this.item.add(t);
11747      return this;
11748    }
11749
11750    /**
11751     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
11752     */
11753    public ItemComponent getItemFirstRep() { 
11754      if (getItem().isEmpty()) {
11755        addItem();
11756      }
11757      return getItem().get(0);
11758    }
11759
11760    /**
11761     * @return {@link #addItem} (The first tier service adjudications for payor added services.)
11762     */
11763    public List<AddedItemComponent> getAddItem() { 
11764      if (this.addItem == null)
11765        this.addItem = new ArrayList<AddedItemComponent>();
11766      return this.addItem;
11767    }
11768
11769    /**
11770     * @return Returns a reference to <code>this</code> for easy method chaining
11771     */
11772    public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) { 
11773      this.addItem = theAddItem;
11774      return this;
11775    }
11776
11777    public boolean hasAddItem() { 
11778      if (this.addItem == null)
11779        return false;
11780      for (AddedItemComponent item : this.addItem)
11781        if (!item.isEmpty())
11782          return true;
11783      return false;
11784    }
11785
11786    public AddedItemComponent addAddItem() { //3
11787      AddedItemComponent t = new AddedItemComponent();
11788      if (this.addItem == null)
11789        this.addItem = new ArrayList<AddedItemComponent>();
11790      this.addItem.add(t);
11791      return t;
11792    }
11793
11794    public ExplanationOfBenefit addAddItem(AddedItemComponent t) { //3
11795      if (t == null)
11796        return this;
11797      if (this.addItem == null)
11798        this.addItem = new ArrayList<AddedItemComponent>();
11799      this.addItem.add(t);
11800      return this;
11801    }
11802
11803    /**
11804     * @return The first repetition of repeating field {@link #addItem}, creating it if it does not already exist
11805     */
11806    public AddedItemComponent getAddItemFirstRep() { 
11807      if (getAddItem().isEmpty()) {
11808        addAddItem();
11809      }
11810      return getAddItem().get(0);
11811    }
11812
11813    /**
11814     * @return {@link #totalCost} (The total cost of the services reported.)
11815     */
11816    public Money getTotalCost() { 
11817      if (this.totalCost == null)
11818        if (Configuration.errorOnAutoCreate())
11819          throw new Error("Attempt to auto-create ExplanationOfBenefit.totalCost");
11820        else if (Configuration.doAutoCreate())
11821          this.totalCost = new Money(); // cc
11822      return this.totalCost;
11823    }
11824
11825    public boolean hasTotalCost() { 
11826      return this.totalCost != null && !this.totalCost.isEmpty();
11827    }
11828
11829    /**
11830     * @param value {@link #totalCost} (The total cost of the services reported.)
11831     */
11832    public ExplanationOfBenefit setTotalCost(Money value)  { 
11833      this.totalCost = value;
11834      return this;
11835    }
11836
11837    /**
11838     * @return {@link #unallocDeductable} (The amount of deductable applied which was not allocated to any particular service line.)
11839     */
11840    public Money getUnallocDeductable() { 
11841      if (this.unallocDeductable == null)
11842        if (Configuration.errorOnAutoCreate())
11843          throw new Error("Attempt to auto-create ExplanationOfBenefit.unallocDeductable");
11844        else if (Configuration.doAutoCreate())
11845          this.unallocDeductable = new Money(); // cc
11846      return this.unallocDeductable;
11847    }
11848
11849    public boolean hasUnallocDeductable() { 
11850      return this.unallocDeductable != null && !this.unallocDeductable.isEmpty();
11851    }
11852
11853    /**
11854     * @param value {@link #unallocDeductable} (The amount of deductable applied which was not allocated to any particular service line.)
11855     */
11856    public ExplanationOfBenefit setUnallocDeductable(Money value)  { 
11857      this.unallocDeductable = value;
11858      return this;
11859    }
11860
11861    /**
11862     * @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).)
11863     */
11864    public Money getTotalBenefit() { 
11865      if (this.totalBenefit == null)
11866        if (Configuration.errorOnAutoCreate())
11867          throw new Error("Attempt to auto-create ExplanationOfBenefit.totalBenefit");
11868        else if (Configuration.doAutoCreate())
11869          this.totalBenefit = new Money(); // cc
11870      return this.totalBenefit;
11871    }
11872
11873    public boolean hasTotalBenefit() { 
11874      return this.totalBenefit != null && !this.totalBenefit.isEmpty();
11875    }
11876
11877    /**
11878     * @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).)
11879     */
11880    public ExplanationOfBenefit setTotalBenefit(Money value)  { 
11881      this.totalBenefit = value;
11882      return this;
11883    }
11884
11885    /**
11886     * @return {@link #payment} (Payment details for the claim if the claim has been paid.)
11887     */
11888    public PaymentComponent getPayment() { 
11889      if (this.payment == null)
11890        if (Configuration.errorOnAutoCreate())
11891          throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
11892        else if (Configuration.doAutoCreate())
11893          this.payment = new PaymentComponent(); // cc
11894      return this.payment;
11895    }
11896
11897    public boolean hasPayment() { 
11898      return this.payment != null && !this.payment.isEmpty();
11899    }
11900
11901    /**
11902     * @param value {@link #payment} (Payment details for the claim if the claim has been paid.)
11903     */
11904    public ExplanationOfBenefit setPayment(PaymentComponent value)  { 
11905      this.payment = value;
11906      return this;
11907    }
11908
11909    /**
11910     * @return {@link #form} (The form to be used for printing the content.)
11911     */
11912    public CodeableConcept getForm() { 
11913      if (this.form == null)
11914        if (Configuration.errorOnAutoCreate())
11915          throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
11916        else if (Configuration.doAutoCreate())
11917          this.form = new CodeableConcept(); // cc
11918      return this.form;
11919    }
11920
11921    public boolean hasForm() { 
11922      return this.form != null && !this.form.isEmpty();
11923    }
11924
11925    /**
11926     * @param value {@link #form} (The form to be used for printing the content.)
11927     */
11928    public ExplanationOfBenefit setForm(CodeableConcept value)  { 
11929      this.form = value;
11930      return this;
11931    }
11932
11933    /**
11934     * @return {@link #processNote} (Note text.)
11935     */
11936    public List<NoteComponent> getProcessNote() { 
11937      if (this.processNote == null)
11938        this.processNote = new ArrayList<NoteComponent>();
11939      return this.processNote;
11940    }
11941
11942    /**
11943     * @return Returns a reference to <code>this</code> for easy method chaining
11944     */
11945    public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) { 
11946      this.processNote = theProcessNote;
11947      return this;
11948    }
11949
11950    public boolean hasProcessNote() { 
11951      if (this.processNote == null)
11952        return false;
11953      for (NoteComponent item : this.processNote)
11954        if (!item.isEmpty())
11955          return true;
11956      return false;
11957    }
11958
11959    public NoteComponent addProcessNote() { //3
11960      NoteComponent t = new NoteComponent();
11961      if (this.processNote == null)
11962        this.processNote = new ArrayList<NoteComponent>();
11963      this.processNote.add(t);
11964      return t;
11965    }
11966
11967    public ExplanationOfBenefit addProcessNote(NoteComponent t) { //3
11968      if (t == null)
11969        return this;
11970      if (this.processNote == null)
11971        this.processNote = new ArrayList<NoteComponent>();
11972      this.processNote.add(t);
11973      return this;
11974    }
11975
11976    /**
11977     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist
11978     */
11979    public NoteComponent getProcessNoteFirstRep() { 
11980      if (getProcessNote().isEmpty()) {
11981        addProcessNote();
11982      }
11983      return getProcessNote().get(0);
11984    }
11985
11986    /**
11987     * @return {@link #benefitBalance} (Balance by Benefit Category.)
11988     */
11989    public List<BenefitBalanceComponent> getBenefitBalance() { 
11990      if (this.benefitBalance == null)
11991        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
11992      return this.benefitBalance;
11993    }
11994
11995    /**
11996     * @return Returns a reference to <code>this</code> for easy method chaining
11997     */
11998    public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) { 
11999      this.benefitBalance = theBenefitBalance;
12000      return this;
12001    }
12002
12003    public boolean hasBenefitBalance() { 
12004      if (this.benefitBalance == null)
12005        return false;
12006      for (BenefitBalanceComponent item : this.benefitBalance)
12007        if (!item.isEmpty())
12008          return true;
12009      return false;
12010    }
12011
12012    public BenefitBalanceComponent addBenefitBalance() { //3
12013      BenefitBalanceComponent t = new BenefitBalanceComponent();
12014      if (this.benefitBalance == null)
12015        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
12016      this.benefitBalance.add(t);
12017      return t;
12018    }
12019
12020    public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { //3
12021      if (t == null)
12022        return this;
12023      if (this.benefitBalance == null)
12024        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
12025      this.benefitBalance.add(t);
12026      return this;
12027    }
12028
12029    /**
12030     * @return The first repetition of repeating field {@link #benefitBalance}, creating it if it does not already exist
12031     */
12032    public BenefitBalanceComponent getBenefitBalanceFirstRep() { 
12033      if (getBenefitBalance().isEmpty()) {
12034        addBenefitBalance();
12035      }
12036      return getBenefitBalance().get(0);
12037    }
12038
12039      protected void listChildren(List<Property> children) {
12040        super.listChildren(children);
12041        children.add(new Property("identifier", "Identifier", "The EOB Business Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
12042        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
12043        children.add(new Property("type", "CodeableConcept", "The category of claim, eg, oral, pharmacy, vision, insitutional, professional.", 0, 1, type));
12044        children.add(new Property("subType", "CodeableConcept", "A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType.", 0, java.lang.Integer.MAX_VALUE, subType));
12045        children.add(new Property("patient", "Reference(Patient)", "Patient Resource.", 0, 1, patient));
12046        children.add(new Property("billablePeriod", "Period", "The billable period for which charges are being submitted.", 0, 1, billablePeriod));
12047        children.add(new Property("created", "dateTime", "The date when the EOB was created.", 0, 1, created));
12048        children.add(new Property("enterer", "Reference(Practitioner)", "The person who created the explanation of benefit.", 0, 1, enterer));
12049        children.add(new Property("insurer", "Reference(Organization)", "The insurer which is responsible for the explanation of benefit.", 0, 1, insurer));
12050        children.add(new Property("provider", "Reference(Practitioner)", "The provider which is responsible for the claim.", 0, 1, provider));
12051        children.add(new Property("organization", "Reference(Organization)", "The provider which is responsible for the claim.", 0, 1, organization));
12052        children.add(new Property("referral", "Reference(ReferralRequest)", "The referral resource which lists the date, practitioner, reason and other supporting information.", 0, 1, referral));
12053        children.add(new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
12054        children.add(new Property("claim", "Reference(Claim)", "The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.", 0, 1, claim));
12055        children.add(new Property("claimResponse", "Reference(ClaimResponse)", "The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.", 0, 1, claimResponse));
12056        children.add(new Property("outcome", "CodeableConcept", "Processing outcome errror, partial or complete processing.", 0, 1, outcome));
12057        children.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition));
12058        children.add(new Property("related", "", "Other claims which are related to this claim such as prior claim versions or for related services.", 0, java.lang.Integer.MAX_VALUE, related));
12059        children.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of Pharmacy or Vision products.", 0, 1, prescription));
12060        children.add(new Property("originalPrescription", "Reference(MedicationRequest)", "Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.", 0, 1, originalPrescription));
12061        children.add(new Property("payee", "", "The party to be reimbursed for the services.", 0, 1, payee));
12062        children.add(new Property("information", "", "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required.", 0, java.lang.Integer.MAX_VALUE, information));
12063        children.add(new Property("careTeam", "", "The members of the team who provided the overall service as well as their role and whether responsible and qualifications.", 0, java.lang.Integer.MAX_VALUE, careTeam));
12064        children.add(new Property("diagnosis", "", "Ordered list of patient diagnosis for which care is sought.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
12065        children.add(new Property("procedure", "", "Ordered list of patient procedures performed to support the adjudication.", 0, java.lang.Integer.MAX_VALUE, procedure));
12066        children.add(new Property("precedence", "positiveInt", "Precedence (primary, secondary, etc.).", 0, 1, precedence));
12067        children.add(new Property("insurance", "", "Financial instrument by which payment information for health care.", 0, 1, insurance));
12068        children.add(new Property("accident", "", "An accident which resulted in the need for healthcare services.", 0, 1, accident));
12069        children.add(new Property("employmentImpacted", "Period", "The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).", 0, 1, employmentImpacted));
12070        children.add(new Property("hospitalization", "Period", "The start and optional end dates of when the patient was confined to a treatment center.", 0, 1, hospitalization));
12071        children.add(new Property("item", "", "First tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, item));
12072        children.add(new Property("addItem", "", "The first tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, addItem));
12073        children.add(new Property("totalCost", "Money", "The total cost of the services reported.", 0, 1, totalCost));
12074        children.add(new Property("unallocDeductable", "Money", "The amount of deductable applied which was not allocated to any particular service line.", 0, 1, unallocDeductable));
12075        children.add(new Property("totalBenefit", "Money", "Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable).", 0, 1, totalBenefit));
12076        children.add(new Property("payment", "", "Payment details for the claim if the claim has been paid.", 0, 1, payment));
12077        children.add(new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, 1, form));
12078        children.add(new Property("processNote", "", "Note text.", 0, java.lang.Integer.MAX_VALUE, processNote));
12079        children.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
12080      }
12081
12082      @Override
12083      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
12084        switch (_hash) {
12085        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The EOB Business Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier);
12086        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
12087        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The category of claim, eg, oral, pharmacy, vision, insitutional, professional.", 0, 1, type);
12088        case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType.", 0, java.lang.Integer.MAX_VALUE, subType);
12089        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "Patient Resource.", 0, 1, patient);
12090        case -332066046: /*billablePeriod*/  return new Property("billablePeriod", "Period", "The billable period for which charges are being submitted.", 0, 1, billablePeriod);
12091        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date when the EOB was created.", 0, 1, created);
12092        case -1591951995: /*enterer*/  return new Property("enterer", "Reference(Practitioner)", "The person who created the explanation of benefit.", 0, 1, enterer);
12093        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The insurer which is responsible for the explanation of benefit.", 0, 1, insurer);
12094        case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner)", "The provider which is responsible for the claim.", 0, 1, provider);
12095        case 1178922291: /*organization*/  return new Property("organization", "Reference(Organization)", "The provider which is responsible for the claim.", 0, 1, organization);
12096        case -722568291: /*referral*/  return new Property("referral", "Reference(ReferralRequest)", "The referral resource which lists the date, practitioner, reason and other supporting information.", 0, 1, referral);
12097        case 501116579: /*facility*/  return new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility);
12098        case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.", 0, 1, claim);
12099        case 689513629: /*claimResponse*/  return new Property("claimResponse", "Reference(ClaimResponse)", "The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.", 0, 1, claimResponse);
12100        case -1106507950: /*outcome*/  return new Property("outcome", "CodeableConcept", "Processing outcome errror, partial or complete processing.", 0, 1, outcome);
12101        case 583380919: /*disposition*/  return new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition);
12102        case 1090493483: /*related*/  return new Property("related", "", "Other claims which are related to this claim such as prior claim versions or for related services.", 0, java.lang.Integer.MAX_VALUE, related);
12103        case 460301338: /*prescription*/  return new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of Pharmacy or Vision products.", 0, 1, prescription);
12104        case -1814015861: /*originalPrescription*/  return new Property("originalPrescription", "Reference(MedicationRequest)", "Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.", 0, 1, originalPrescription);
12105        case 106443592: /*payee*/  return new Property("payee", "", "The party to be reimbursed for the services.", 0, 1, payee);
12106        case 1968600364: /*information*/  return new Property("information", "", "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required.", 0, java.lang.Integer.MAX_VALUE, information);
12107        case -7323378: /*careTeam*/  return new Property("careTeam", "", "The members of the team who provided the overall service as well as their role and whether responsible and qualifications.", 0, java.lang.Integer.MAX_VALUE, careTeam);
12108        case 1196993265: /*diagnosis*/  return new Property("diagnosis", "", "Ordered list of patient diagnosis for which care is sought.", 0, java.lang.Integer.MAX_VALUE, diagnosis);
12109        case -1095204141: /*procedure*/  return new Property("procedure", "", "Ordered list of patient procedures performed to support the adjudication.", 0, java.lang.Integer.MAX_VALUE, procedure);
12110        case 159695370: /*precedence*/  return new Property("precedence", "positiveInt", "Precedence (primary, secondary, etc.).", 0, 1, precedence);
12111        case 73049818: /*insurance*/  return new Property("insurance", "", "Financial instrument by which payment information for health care.", 0, 1, insurance);
12112        case -2143202801: /*accident*/  return new Property("accident", "", "An accident which resulted in the need for healthcare services.", 0, 1, accident);
12113        case 1051487345: /*employmentImpacted*/  return new Property("employmentImpacted", "Period", "The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).", 0, 1, employmentImpacted);
12114        case 1057894634: /*hospitalization*/  return new Property("hospitalization", "Period", "The start and optional end dates of when the patient was confined to a treatment center.", 0, 1, hospitalization);
12115        case 3242771: /*item*/  return new Property("item", "", "First tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, item);
12116        case -1148899500: /*addItem*/  return new Property("addItem", "", "The first tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, addItem);
12117        case -577782479: /*totalCost*/  return new Property("totalCost", "Money", "The total cost of the services reported.", 0, 1, totalCost);
12118        case 2096309753: /*unallocDeductable*/  return new Property("unallocDeductable", "Money", "The amount of deductable applied which was not allocated to any particular service line.", 0, 1, unallocDeductable);
12119        case 332332211: /*totalBenefit*/  return new Property("totalBenefit", "Money", "Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable).", 0, 1, totalBenefit);
12120        case -786681338: /*payment*/  return new Property("payment", "", "Payment details for the claim if the claim has been paid.", 0, 1, payment);
12121        case 3148996: /*form*/  return new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, 1, form);
12122        case 202339073: /*processNote*/  return new Property("processNote", "", "Note text.", 0, java.lang.Integer.MAX_VALUE, processNote);
12123        case 596003397: /*benefitBalance*/  return new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance);
12124        default: return super.getNamedProperty(_hash, _name, _checkValid);
12125        }
12126
12127      }
12128
12129      @Override
12130      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
12131        switch (hash) {
12132        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
12133        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ExplanationOfBenefitStatus>
12134        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
12135        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : this.subType.toArray(new Base[this.subType.size()]); // CodeableConcept
12136        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
12137        case -332066046: /*billablePeriod*/ return this.billablePeriod == null ? new Base[0] : new Base[] {this.billablePeriod}; // Period
12138        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
12139        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
12140        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
12141        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
12142        case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : new Base[] {this.organization}; // Reference
12143        case -722568291: /*referral*/ return this.referral == null ? new Base[0] : new Base[] {this.referral}; // Reference
12144        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
12145        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
12146        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Reference
12147        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // CodeableConcept
12148        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
12149        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
12150        case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Reference
12151        case -1814015861: /*originalPrescription*/ return this.originalPrescription == null ? new Base[0] : new Base[] {this.originalPrescription}; // Reference
12152        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // PayeeComponent
12153        case 1968600364: /*information*/ return this.information == null ? new Base[0] : this.information.toArray(new Base[this.information.size()]); // SupportingInformationComponent
12154        case -7323378: /*careTeam*/ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
12155        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
12156        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
12157        case 159695370: /*precedence*/ return this.precedence == null ? new Base[0] : new Base[] {this.precedence}; // PositiveIntType
12158        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : new Base[] {this.insurance}; // InsuranceComponent
12159        case -2143202801: /*accident*/ return this.accident == null ? new Base[0] : new Base[] {this.accident}; // AccidentComponent
12160        case 1051487345: /*employmentImpacted*/ return this.employmentImpacted == null ? new Base[0] : new Base[] {this.employmentImpacted}; // Period
12161        case 1057894634: /*hospitalization*/ return this.hospitalization == null ? new Base[0] : new Base[] {this.hospitalization}; // Period
12162        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
12163        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
12164        case -577782479: /*totalCost*/ return this.totalCost == null ? new Base[0] : new Base[] {this.totalCost}; // Money
12165        case 2096309753: /*unallocDeductable*/ return this.unallocDeductable == null ? new Base[0] : new Base[] {this.unallocDeductable}; // Money
12166        case 332332211: /*totalBenefit*/ return this.totalBenefit == null ? new Base[0] : new Base[] {this.totalBenefit}; // Money
12167        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // PaymentComponent
12168        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // CodeableConcept
12169        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
12170        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
12171        default: return super.getProperty(hash, name, checkValid);
12172        }
12173
12174      }
12175
12176      @Override
12177      public Base setProperty(int hash, String name, Base value) throws FHIRException {
12178        switch (hash) {
12179        case -1618432855: // identifier
12180          this.getIdentifier().add(castToIdentifier(value)); // Identifier
12181          return value;
12182        case -892481550: // status
12183          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
12184          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
12185          return value;
12186        case 3575610: // type
12187          this.type = castToCodeableConcept(value); // CodeableConcept
12188          return value;
12189        case -1868521062: // subType
12190          this.getSubType().add(castToCodeableConcept(value)); // CodeableConcept
12191          return value;
12192        case -791418107: // patient
12193          this.patient = castToReference(value); // Reference
12194          return value;
12195        case -332066046: // billablePeriod
12196          this.billablePeriod = castToPeriod(value); // Period
12197          return value;
12198        case 1028554472: // created
12199          this.created = castToDateTime(value); // DateTimeType
12200          return value;
12201        case -1591951995: // enterer
12202          this.enterer = castToReference(value); // Reference
12203          return value;
12204        case 1957615864: // insurer
12205          this.insurer = castToReference(value); // Reference
12206          return value;
12207        case -987494927: // provider
12208          this.provider = castToReference(value); // Reference
12209          return value;
12210        case 1178922291: // organization
12211          this.organization = castToReference(value); // Reference
12212          return value;
12213        case -722568291: // referral
12214          this.referral = castToReference(value); // Reference
12215          return value;
12216        case 501116579: // facility
12217          this.facility = castToReference(value); // Reference
12218          return value;
12219        case 94742588: // claim
12220          this.claim = castToReference(value); // Reference
12221          return value;
12222        case 689513629: // claimResponse
12223          this.claimResponse = castToReference(value); // Reference
12224          return value;
12225        case -1106507950: // outcome
12226          this.outcome = castToCodeableConcept(value); // CodeableConcept
12227          return value;
12228        case 583380919: // disposition
12229          this.disposition = castToString(value); // StringType
12230          return value;
12231        case 1090493483: // related
12232          this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
12233          return value;
12234        case 460301338: // prescription
12235          this.prescription = castToReference(value); // Reference
12236          return value;
12237        case -1814015861: // originalPrescription
12238          this.originalPrescription = castToReference(value); // Reference
12239          return value;
12240        case 106443592: // payee
12241          this.payee = (PayeeComponent) value; // PayeeComponent
12242          return value;
12243        case 1968600364: // information
12244          this.getInformation().add((SupportingInformationComponent) value); // SupportingInformationComponent
12245          return value;
12246        case -7323378: // careTeam
12247          this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
12248          return value;
12249        case 1196993265: // diagnosis
12250          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
12251          return value;
12252        case -1095204141: // procedure
12253          this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
12254          return value;
12255        case 159695370: // precedence
12256          this.precedence = castToPositiveInt(value); // PositiveIntType
12257          return value;
12258        case 73049818: // insurance
12259          this.insurance = (InsuranceComponent) value; // InsuranceComponent
12260          return value;
12261        case -2143202801: // accident
12262          this.accident = (AccidentComponent) value; // AccidentComponent
12263          return value;
12264        case 1051487345: // employmentImpacted
12265          this.employmentImpacted = castToPeriod(value); // Period
12266          return value;
12267        case 1057894634: // hospitalization
12268          this.hospitalization = castToPeriod(value); // Period
12269          return value;
12270        case 3242771: // item
12271          this.getItem().add((ItemComponent) value); // ItemComponent
12272          return value;
12273        case -1148899500: // addItem
12274          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
12275          return value;
12276        case -577782479: // totalCost
12277          this.totalCost = castToMoney(value); // Money
12278          return value;
12279        case 2096309753: // unallocDeductable
12280          this.unallocDeductable = castToMoney(value); // Money
12281          return value;
12282        case 332332211: // totalBenefit
12283          this.totalBenefit = castToMoney(value); // Money
12284          return value;
12285        case -786681338: // payment
12286          this.payment = (PaymentComponent) value; // PaymentComponent
12287          return value;
12288        case 3148996: // form
12289          this.form = castToCodeableConcept(value); // CodeableConcept
12290          return value;
12291        case 202339073: // processNote
12292          this.getProcessNote().add((NoteComponent) value); // NoteComponent
12293          return value;
12294        case 596003397: // benefitBalance
12295          this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
12296          return value;
12297        default: return super.setProperty(hash, name, value);
12298        }
12299
12300      }
12301
12302      @Override
12303      public Base setProperty(String name, Base value) throws FHIRException {
12304        if (name.equals("identifier")) {
12305          this.getIdentifier().add(castToIdentifier(value));
12306        } else if (name.equals("status")) {
12307          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
12308          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
12309        } else if (name.equals("type")) {
12310          this.type = castToCodeableConcept(value); // CodeableConcept
12311        } else if (name.equals("subType")) {
12312          this.getSubType().add(castToCodeableConcept(value));
12313        } else if (name.equals("patient")) {
12314          this.patient = castToReference(value); // Reference
12315        } else if (name.equals("billablePeriod")) {
12316          this.billablePeriod = castToPeriod(value); // Period
12317        } else if (name.equals("created")) {
12318          this.created = castToDateTime(value); // DateTimeType
12319        } else if (name.equals("enterer")) {
12320          this.enterer = castToReference(value); // Reference
12321        } else if (name.equals("insurer")) {
12322          this.insurer = castToReference(value); // Reference
12323        } else if (name.equals("provider")) {
12324          this.provider = castToReference(value); // Reference
12325        } else if (name.equals("organization")) {
12326          this.organization = castToReference(value); // Reference
12327        } else if (name.equals("referral")) {
12328          this.referral = castToReference(value); // Reference
12329        } else if (name.equals("facility")) {
12330          this.facility = castToReference(value); // Reference
12331        } else if (name.equals("claim")) {
12332          this.claim = castToReference(value); // Reference
12333        } else if (name.equals("claimResponse")) {
12334          this.claimResponse = castToReference(value); // Reference
12335        } else if (name.equals("outcome")) {
12336          this.outcome = castToCodeableConcept(value); // CodeableConcept
12337        } else if (name.equals("disposition")) {
12338          this.disposition = castToString(value); // StringType
12339        } else if (name.equals("related")) {
12340          this.getRelated().add((RelatedClaimComponent) value);
12341        } else if (name.equals("prescription")) {
12342          this.prescription = castToReference(value); // Reference
12343        } else if (name.equals("originalPrescription")) {
12344          this.originalPrescription = castToReference(value); // Reference
12345        } else if (name.equals("payee")) {
12346          this.payee = (PayeeComponent) value; // PayeeComponent
12347        } else if (name.equals("information")) {
12348          this.getInformation().add((SupportingInformationComponent) value);
12349        } else if (name.equals("careTeam")) {
12350          this.getCareTeam().add((CareTeamComponent) value);
12351        } else if (name.equals("diagnosis")) {
12352          this.getDiagnosis().add((DiagnosisComponent) value);
12353        } else if (name.equals("procedure")) {
12354          this.getProcedure().add((ProcedureComponent) value);
12355        } else if (name.equals("precedence")) {
12356          this.precedence = castToPositiveInt(value); // PositiveIntType
12357        } else if (name.equals("insurance")) {
12358          this.insurance = (InsuranceComponent) value; // InsuranceComponent
12359        } else if (name.equals("accident")) {
12360          this.accident = (AccidentComponent) value; // AccidentComponent
12361        } else if (name.equals("employmentImpacted")) {
12362          this.employmentImpacted = castToPeriod(value); // Period
12363        } else if (name.equals("hospitalization")) {
12364          this.hospitalization = castToPeriod(value); // Period
12365        } else if (name.equals("item")) {
12366          this.getItem().add((ItemComponent) value);
12367        } else if (name.equals("addItem")) {
12368          this.getAddItem().add((AddedItemComponent) value);
12369        } else if (name.equals("totalCost")) {
12370          this.totalCost = castToMoney(value); // Money
12371        } else if (name.equals("unallocDeductable")) {
12372          this.unallocDeductable = castToMoney(value); // Money
12373        } else if (name.equals("totalBenefit")) {
12374          this.totalBenefit = castToMoney(value); // Money
12375        } else if (name.equals("payment")) {
12376          this.payment = (PaymentComponent) value; // PaymentComponent
12377        } else if (name.equals("form")) {
12378          this.form = castToCodeableConcept(value); // CodeableConcept
12379        } else if (name.equals("processNote")) {
12380          this.getProcessNote().add((NoteComponent) value);
12381        } else if (name.equals("benefitBalance")) {
12382          this.getBenefitBalance().add((BenefitBalanceComponent) value);
12383        } else
12384          return super.setProperty(name, value);
12385        return value;
12386      }
12387
12388      @Override
12389      public Base makeProperty(int hash, String name) throws FHIRException {
12390        switch (hash) {
12391        case -1618432855:  return addIdentifier(); 
12392        case -892481550:  return getStatusElement();
12393        case 3575610:  return getType(); 
12394        case -1868521062:  return addSubType(); 
12395        case -791418107:  return getPatient(); 
12396        case -332066046:  return getBillablePeriod(); 
12397        case 1028554472:  return getCreatedElement();
12398        case -1591951995:  return getEnterer(); 
12399        case 1957615864:  return getInsurer(); 
12400        case -987494927:  return getProvider(); 
12401        case 1178922291:  return getOrganization(); 
12402        case -722568291:  return getReferral(); 
12403        case 501116579:  return getFacility(); 
12404        case 94742588:  return getClaim(); 
12405        case 689513629:  return getClaimResponse(); 
12406        case -1106507950:  return getOutcome(); 
12407        case 583380919:  return getDispositionElement();
12408        case 1090493483:  return addRelated(); 
12409        case 460301338:  return getPrescription(); 
12410        case -1814015861:  return getOriginalPrescription(); 
12411        case 106443592:  return getPayee(); 
12412        case 1968600364:  return addInformation(); 
12413        case -7323378:  return addCareTeam(); 
12414        case 1196993265:  return addDiagnosis(); 
12415        case -1095204141:  return addProcedure(); 
12416        case 159695370:  return getPrecedenceElement();
12417        case 73049818:  return getInsurance(); 
12418        case -2143202801:  return getAccident(); 
12419        case 1051487345:  return getEmploymentImpacted(); 
12420        case 1057894634:  return getHospitalization(); 
12421        case 3242771:  return addItem(); 
12422        case -1148899500:  return addAddItem(); 
12423        case -577782479:  return getTotalCost(); 
12424        case 2096309753:  return getUnallocDeductable(); 
12425        case 332332211:  return getTotalBenefit(); 
12426        case -786681338:  return getPayment(); 
12427        case 3148996:  return getForm(); 
12428        case 202339073:  return addProcessNote(); 
12429        case 596003397:  return addBenefitBalance(); 
12430        default: return super.makeProperty(hash, name);
12431        }
12432
12433      }
12434
12435      @Override
12436      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12437        switch (hash) {
12438        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
12439        case -892481550: /*status*/ return new String[] {"code"};
12440        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
12441        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
12442        case -791418107: /*patient*/ return new String[] {"Reference"};
12443        case -332066046: /*billablePeriod*/ return new String[] {"Period"};
12444        case 1028554472: /*created*/ return new String[] {"dateTime"};
12445        case -1591951995: /*enterer*/ return new String[] {"Reference"};
12446        case 1957615864: /*insurer*/ return new String[] {"Reference"};
12447        case -987494927: /*provider*/ return new String[] {"Reference"};
12448        case 1178922291: /*organization*/ return new String[] {"Reference"};
12449        case -722568291: /*referral*/ return new String[] {"Reference"};
12450        case 501116579: /*facility*/ return new String[] {"Reference"};
12451        case 94742588: /*claim*/ return new String[] {"Reference"};
12452        case 689513629: /*claimResponse*/ return new String[] {"Reference"};
12453        case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
12454        case 583380919: /*disposition*/ return new String[] {"string"};
12455        case 1090493483: /*related*/ return new String[] {};
12456        case 460301338: /*prescription*/ return new String[] {"Reference"};
12457        case -1814015861: /*originalPrescription*/ return new String[] {"Reference"};
12458        case 106443592: /*payee*/ return new String[] {};
12459        case 1968600364: /*information*/ return new String[] {};
12460        case -7323378: /*careTeam*/ return new String[] {};
12461        case 1196993265: /*diagnosis*/ return new String[] {};
12462        case -1095204141: /*procedure*/ return new String[] {};
12463        case 159695370: /*precedence*/ return new String[] {"positiveInt"};
12464        case 73049818: /*insurance*/ return new String[] {};
12465        case -2143202801: /*accident*/ return new String[] {};
12466        case 1051487345: /*employmentImpacted*/ return new String[] {"Period"};
12467        case 1057894634: /*hospitalization*/ return new String[] {"Period"};
12468        case 3242771: /*item*/ return new String[] {};
12469        case -1148899500: /*addItem*/ return new String[] {};
12470        case -577782479: /*totalCost*/ return new String[] {"Money"};
12471        case 2096309753: /*unallocDeductable*/ return new String[] {"Money"};
12472        case 332332211: /*totalBenefit*/ return new String[] {"Money"};
12473        case -786681338: /*payment*/ return new String[] {};
12474        case 3148996: /*form*/ return new String[] {"CodeableConcept"};
12475        case 202339073: /*processNote*/ return new String[] {};
12476        case 596003397: /*benefitBalance*/ return new String[] {};
12477        default: return super.getTypesForProperty(hash, name);
12478        }
12479
12480      }
12481
12482      @Override
12483      public Base addChild(String name) throws FHIRException {
12484        if (name.equals("identifier")) {
12485          return addIdentifier();
12486        }
12487        else if (name.equals("status")) {
12488          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.status");
12489        }
12490        else if (name.equals("type")) {
12491          this.type = new CodeableConcept();
12492          return this.type;
12493        }
12494        else if (name.equals("subType")) {
12495          return addSubType();
12496        }
12497        else if (name.equals("patient")) {
12498          this.patient = new Reference();
12499          return this.patient;
12500        }
12501        else if (name.equals("billablePeriod")) {
12502          this.billablePeriod = new Period();
12503          return this.billablePeriod;
12504        }
12505        else if (name.equals("created")) {
12506          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.created");
12507        }
12508        else if (name.equals("enterer")) {
12509          this.enterer = new Reference();
12510          return this.enterer;
12511        }
12512        else if (name.equals("insurer")) {
12513          this.insurer = new Reference();
12514          return this.insurer;
12515        }
12516        else if (name.equals("provider")) {
12517          this.provider = new Reference();
12518          return this.provider;
12519        }
12520        else if (name.equals("organization")) {
12521          this.organization = new Reference();
12522          return this.organization;
12523        }
12524        else if (name.equals("referral")) {
12525          this.referral = new Reference();
12526          return this.referral;
12527        }
12528        else if (name.equals("facility")) {
12529          this.facility = new Reference();
12530          return this.facility;
12531        }
12532        else if (name.equals("claim")) {
12533          this.claim = new Reference();
12534          return this.claim;
12535        }
12536        else if (name.equals("claimResponse")) {
12537          this.claimResponse = new Reference();
12538          return this.claimResponse;
12539        }
12540        else if (name.equals("outcome")) {
12541          this.outcome = new CodeableConcept();
12542          return this.outcome;
12543        }
12544        else if (name.equals("disposition")) {
12545          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.disposition");
12546        }
12547        else if (name.equals("related")) {
12548          return addRelated();
12549        }
12550        else if (name.equals("prescription")) {
12551          this.prescription = new Reference();
12552          return this.prescription;
12553        }
12554        else if (name.equals("originalPrescription")) {
12555          this.originalPrescription = new Reference();
12556          return this.originalPrescription;
12557        }
12558        else if (name.equals("payee")) {
12559          this.payee = new PayeeComponent();
12560          return this.payee;
12561        }
12562        else if (name.equals("information")) {
12563          return addInformation();
12564        }
12565        else if (name.equals("careTeam")) {
12566          return addCareTeam();
12567        }
12568        else if (name.equals("diagnosis")) {
12569          return addDiagnosis();
12570        }
12571        else if (name.equals("procedure")) {
12572          return addProcedure();
12573        }
12574        else if (name.equals("precedence")) {
12575          throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.precedence");
12576        }
12577        else if (name.equals("insurance")) {
12578          this.insurance = new InsuranceComponent();
12579          return this.insurance;
12580        }
12581        else if (name.equals("accident")) {
12582          this.accident = new AccidentComponent();
12583          return this.accident;
12584        }
12585        else if (name.equals("employmentImpacted")) {
12586          this.employmentImpacted = new Period();
12587          return this.employmentImpacted;
12588        }
12589        else if (name.equals("hospitalization")) {
12590          this.hospitalization = new Period();
12591          return this.hospitalization;
12592        }
12593        else if (name.equals("item")) {
12594          return addItem();
12595        }
12596        else if (name.equals("addItem")) {
12597          return addAddItem();
12598        }
12599        else if (name.equals("totalCost")) {
12600          this.totalCost = new Money();
12601          return this.totalCost;
12602        }
12603        else if (name.equals("unallocDeductable")) {
12604          this.unallocDeductable = new Money();
12605          return this.unallocDeductable;
12606        }
12607        else if (name.equals("totalBenefit")) {
12608          this.totalBenefit = new Money();
12609          return this.totalBenefit;
12610        }
12611        else if (name.equals("payment")) {
12612          this.payment = new PaymentComponent();
12613          return this.payment;
12614        }
12615        else if (name.equals("form")) {
12616          this.form = new CodeableConcept();
12617          return this.form;
12618        }
12619        else if (name.equals("processNote")) {
12620          return addProcessNote();
12621        }
12622        else if (name.equals("benefitBalance")) {
12623          return addBenefitBalance();
12624        }
12625        else
12626          return super.addChild(name);
12627      }
12628
12629  public String fhirType() {
12630    return "ExplanationOfBenefit";
12631
12632  }
12633
12634      public ExplanationOfBenefit copy() {
12635        ExplanationOfBenefit dst = new ExplanationOfBenefit();
12636        copyValues(dst);
12637        if (identifier != null) {
12638          dst.identifier = new ArrayList<Identifier>();
12639          for (Identifier i : identifier)
12640            dst.identifier.add(i.copy());
12641        };
12642        dst.status = status == null ? null : status.copy();
12643        dst.type = type == null ? null : type.copy();
12644        if (subType != null) {
12645          dst.subType = new ArrayList<CodeableConcept>();
12646          for (CodeableConcept i : subType)
12647            dst.subType.add(i.copy());
12648        };
12649        dst.patient = patient == null ? null : patient.copy();
12650        dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
12651        dst.created = created == null ? null : created.copy();
12652        dst.enterer = enterer == null ? null : enterer.copy();
12653        dst.insurer = insurer == null ? null : insurer.copy();
12654        dst.provider = provider == null ? null : provider.copy();
12655        dst.organization = organization == null ? null : organization.copy();
12656        dst.referral = referral == null ? null : referral.copy();
12657        dst.facility = facility == null ? null : facility.copy();
12658        dst.claim = claim == null ? null : claim.copy();
12659        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
12660        dst.outcome = outcome == null ? null : outcome.copy();
12661        dst.disposition = disposition == null ? null : disposition.copy();
12662        if (related != null) {
12663          dst.related = new ArrayList<RelatedClaimComponent>();
12664          for (RelatedClaimComponent i : related)
12665            dst.related.add(i.copy());
12666        };
12667        dst.prescription = prescription == null ? null : prescription.copy();
12668        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
12669        dst.payee = payee == null ? null : payee.copy();
12670        if (information != null) {
12671          dst.information = new ArrayList<SupportingInformationComponent>();
12672          for (SupportingInformationComponent i : information)
12673            dst.information.add(i.copy());
12674        };
12675        if (careTeam != null) {
12676          dst.careTeam = new ArrayList<CareTeamComponent>();
12677          for (CareTeamComponent i : careTeam)
12678            dst.careTeam.add(i.copy());
12679        };
12680        if (diagnosis != null) {
12681          dst.diagnosis = new ArrayList<DiagnosisComponent>();
12682          for (DiagnosisComponent i : diagnosis)
12683            dst.diagnosis.add(i.copy());
12684        };
12685        if (procedure != null) {
12686          dst.procedure = new ArrayList<ProcedureComponent>();
12687          for (ProcedureComponent i : procedure)
12688            dst.procedure.add(i.copy());
12689        };
12690        dst.precedence = precedence == null ? null : precedence.copy();
12691        dst.insurance = insurance == null ? null : insurance.copy();
12692        dst.accident = accident == null ? null : accident.copy();
12693        dst.employmentImpacted = employmentImpacted == null ? null : employmentImpacted.copy();
12694        dst.hospitalization = hospitalization == null ? null : hospitalization.copy();
12695        if (item != null) {
12696          dst.item = new ArrayList<ItemComponent>();
12697          for (ItemComponent i : item)
12698            dst.item.add(i.copy());
12699        };
12700        if (addItem != null) {
12701          dst.addItem = new ArrayList<AddedItemComponent>();
12702          for (AddedItemComponent i : addItem)
12703            dst.addItem.add(i.copy());
12704        };
12705        dst.totalCost = totalCost == null ? null : totalCost.copy();
12706        dst.unallocDeductable = unallocDeductable == null ? null : unallocDeductable.copy();
12707        dst.totalBenefit = totalBenefit == null ? null : totalBenefit.copy();
12708        dst.payment = payment == null ? null : payment.copy();
12709        dst.form = form == null ? null : form.copy();
12710        if (processNote != null) {
12711          dst.processNote = new ArrayList<NoteComponent>();
12712          for (NoteComponent i : processNote)
12713            dst.processNote.add(i.copy());
12714        };
12715        if (benefitBalance != null) {
12716          dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
12717          for (BenefitBalanceComponent i : benefitBalance)
12718            dst.benefitBalance.add(i.copy());
12719        };
12720        return dst;
12721      }
12722
12723      protected ExplanationOfBenefit typedCopy() {
12724        return copy();
12725      }
12726
12727      @Override
12728      public boolean equalsDeep(Base other_) {
12729        if (!super.equalsDeep(other_))
12730          return false;
12731        if (!(other_ instanceof ExplanationOfBenefit))
12732          return false;
12733        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
12734        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
12735           && compareDeep(subType, o.subType, true) && compareDeep(patient, o.patient, true) && compareDeep(billablePeriod, o.billablePeriod, true)
12736           && compareDeep(created, o.created, true) && compareDeep(enterer, o.enterer, true) && compareDeep(insurer, o.insurer, true)
12737           && compareDeep(provider, o.provider, true) && compareDeep(organization, o.organization, true) && compareDeep(referral, o.referral, true)
12738           && compareDeep(facility, o.facility, true) && compareDeep(claim, o.claim, true) && compareDeep(claimResponse, o.claimResponse, true)
12739           && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true) && compareDeep(related, o.related, true)
12740           && compareDeep(prescription, o.prescription, true) && compareDeep(originalPrescription, o.originalPrescription, true)
12741           && compareDeep(payee, o.payee, true) && compareDeep(information, o.information, true) && compareDeep(careTeam, o.careTeam, true)
12742           && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true) && compareDeep(precedence, o.precedence, true)
12743           && compareDeep(insurance, o.insurance, true) && compareDeep(accident, o.accident, true) && compareDeep(employmentImpacted, o.employmentImpacted, true)
12744           && compareDeep(hospitalization, o.hospitalization, true) && compareDeep(item, o.item, true) && compareDeep(addItem, o.addItem, true)
12745           && compareDeep(totalCost, o.totalCost, true) && compareDeep(unallocDeductable, o.unallocDeductable, true)
12746           && compareDeep(totalBenefit, o.totalBenefit, true) && compareDeep(payment, o.payment, true) && compareDeep(form, o.form, true)
12747           && compareDeep(processNote, o.processNote, true) && compareDeep(benefitBalance, o.benefitBalance, true)
12748          ;
12749      }
12750
12751      @Override
12752      public boolean equalsShallow(Base other_) {
12753        if (!super.equalsShallow(other_))
12754          return false;
12755        if (!(other_ instanceof ExplanationOfBenefit))
12756          return false;
12757        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
12758        return compareValues(status, o.status, true) && compareValues(created, o.created, true) && compareValues(disposition, o.disposition, true)
12759           && compareValues(precedence, o.precedence, true);
12760      }
12761
12762      public boolean isEmpty() {
12763        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
12764          , subType, patient, billablePeriod, created, enterer, insurer, provider, organization
12765          , referral, facility, claim, claimResponse, outcome, disposition, related, prescription
12766          , originalPrescription, payee, information, careTeam, diagnosis, procedure, precedence
12767          , insurance, accident, employmentImpacted, hospitalization, item, addItem, totalCost
12768          , unallocDeductable, totalBenefit, payment, form, processNote, benefitBalance);
12769      }
12770
12771  @Override
12772  public ResourceType getResourceType() {
12773    return ResourceType.ExplanationOfBenefit;
12774   }
12775
12776 /**
12777   * Search parameter: <b>coverage</b>
12778   * <p>
12779   * Description: <b>The plan under which the claim was adjudicated</b><br>
12780   * Type: <b>reference</b><br>
12781   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
12782   * </p>
12783   */
12784  @SearchParamDefinition(name="coverage", path="ExplanationOfBenefit.insurance.coverage", description="The plan under which the claim was adjudicated", type="reference", target={Coverage.class } )
12785  public static final String SP_COVERAGE = "coverage";
12786 /**
12787   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
12788   * <p>
12789   * Description: <b>The plan under which the claim was adjudicated</b><br>
12790   * Type: <b>reference</b><br>
12791   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
12792   * </p>
12793   */
12794  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COVERAGE);
12795
12796/**
12797   * Constant for fluent queries to be used to add include statements. Specifies
12798   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
12799   */
12800  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:coverage").toLocked();
12801
12802 /**
12803   * Search parameter: <b>care-team</b>
12804   * <p>
12805   * Description: <b>Member of the CareTeam</b><br>
12806   * Type: <b>reference</b><br>
12807   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
12808   * </p>
12809   */
12810  @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 } )
12811  public static final String SP_CARE_TEAM = "care-team";
12812 /**
12813   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
12814   * <p>
12815   * Description: <b>Member of the CareTeam</b><br>
12816   * Type: <b>reference</b><br>
12817   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
12818   * </p>
12819   */
12820  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_TEAM);
12821
12822/**
12823   * Constant for fluent queries to be used to add include statements. Specifies
12824   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
12825   */
12826  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:care-team").toLocked();
12827
12828 /**
12829   * Search parameter: <b>identifier</b>
12830   * <p>
12831   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
12832   * Type: <b>token</b><br>
12833   * Path: <b>ExplanationOfBenefit.identifier</b><br>
12834   * </p>
12835   */
12836  @SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
12837  public static final String SP_IDENTIFIER = "identifier";
12838 /**
12839   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
12840   * <p>
12841   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
12842   * Type: <b>token</b><br>
12843   * Path: <b>ExplanationOfBenefit.identifier</b><br>
12844   * </p>
12845   */
12846  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
12847
12848 /**
12849   * Search parameter: <b>created</b>
12850   * <p>
12851   * Description: <b>The creation date for the EOB</b><br>
12852   * Type: <b>date</b><br>
12853   * Path: <b>ExplanationOfBenefit.created</b><br>
12854   * </p>
12855   */
12856  @SearchParamDefinition(name="created", path="ExplanationOfBenefit.created", description="The creation date for the EOB", type="date" )
12857  public static final String SP_CREATED = "created";
12858 /**
12859   * <b>Fluent Client</b> search parameter constant for <b>created</b>
12860   * <p>
12861   * Description: <b>The creation date for the EOB</b><br>
12862   * Type: <b>date</b><br>
12863   * Path: <b>ExplanationOfBenefit.created</b><br>
12864   * </p>
12865   */
12866  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
12867
12868 /**
12869   * Search parameter: <b>encounter</b>
12870   * <p>
12871   * Description: <b>Encounters associated with a billed line item</b><br>
12872   * Type: <b>reference</b><br>
12873   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
12874   * </p>
12875   */
12876  @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 } )
12877  public static final String SP_ENCOUNTER = "encounter";
12878 /**
12879   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
12880   * <p>
12881   * Description: <b>Encounters associated with a billed line item</b><br>
12882   * Type: <b>reference</b><br>
12883   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
12884   * </p>
12885   */
12886  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
12887
12888/**
12889   * Constant for fluent queries to be used to add include statements. Specifies
12890   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
12891   */
12892  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:encounter").toLocked();
12893
12894 /**
12895   * Search parameter: <b>payee</b>
12896   * <p>
12897   * Description: <b>The party receiving any payment for the Claim</b><br>
12898   * Type: <b>reference</b><br>
12899   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
12900   * </p>
12901   */
12902  @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 } )
12903  public static final String SP_PAYEE = "payee";
12904 /**
12905   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
12906   * <p>
12907   * Description: <b>The party receiving any payment for the Claim</b><br>
12908   * Type: <b>reference</b><br>
12909   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
12910   * </p>
12911   */
12912  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PAYEE);
12913
12914/**
12915   * Constant for fluent queries to be used to add include statements. Specifies
12916   * the path value of "<b>ExplanationOfBenefit:payee</b>".
12917   */
12918  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:payee").toLocked();
12919
12920 /**
12921   * Search parameter: <b>disposition</b>
12922   * <p>
12923   * Description: <b>The contents of the disposition message</b><br>
12924   * Type: <b>string</b><br>
12925   * Path: <b>ExplanationOfBenefit.disposition</b><br>
12926   * </p>
12927   */
12928  @SearchParamDefinition(name="disposition", path="ExplanationOfBenefit.disposition", description="The contents of the disposition message", type="string" )
12929  public static final String SP_DISPOSITION = "disposition";
12930 /**
12931   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
12932   * <p>
12933   * Description: <b>The contents of the disposition message</b><br>
12934   * Type: <b>string</b><br>
12935   * Path: <b>ExplanationOfBenefit.disposition</b><br>
12936   * </p>
12937   */
12938  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
12939
12940 /**
12941   * Search parameter: <b>provider</b>
12942   * <p>
12943   * Description: <b>The reference to the provider</b><br>
12944   * Type: <b>reference</b><br>
12945   * Path: <b>ExplanationOfBenefit.provider</b><br>
12946   * </p>
12947   */
12948  @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 } )
12949  public static final String SP_PROVIDER = "provider";
12950 /**
12951   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
12952   * <p>
12953   * Description: <b>The reference to the provider</b><br>
12954   * Type: <b>reference</b><br>
12955   * Path: <b>ExplanationOfBenefit.provider</b><br>
12956   * </p>
12957   */
12958  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
12959
12960/**
12961   * Constant for fluent queries to be used to add include statements. Specifies
12962   * the path value of "<b>ExplanationOfBenefit:provider</b>".
12963   */
12964  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:provider").toLocked();
12965
12966 /**
12967   * Search parameter: <b>patient</b>
12968   * <p>
12969   * Description: <b>The reference to the patient</b><br>
12970   * Type: <b>reference</b><br>
12971   * Path: <b>ExplanationOfBenefit.patient</b><br>
12972   * </p>
12973   */
12974  @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 } )
12975  public static final String SP_PATIENT = "patient";
12976 /**
12977   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
12978   * <p>
12979   * Description: <b>The reference to the patient</b><br>
12980   * Type: <b>reference</b><br>
12981   * Path: <b>ExplanationOfBenefit.patient</b><br>
12982   * </p>
12983   */
12984  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
12985
12986/**
12987   * Constant for fluent queries to be used to add include statements. Specifies
12988   * the path value of "<b>ExplanationOfBenefit:patient</b>".
12989   */
12990  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:patient").toLocked();
12991
12992 /**
12993   * Search parameter: <b>organization</b>
12994   * <p>
12995   * Description: <b>The reference to the providing organization</b><br>
12996   * Type: <b>reference</b><br>
12997   * Path: <b>ExplanationOfBenefit.organization</b><br>
12998   * </p>
12999   */
13000  @SearchParamDefinition(name="organization", path="ExplanationOfBenefit.organization", description="The reference to the providing organization", type="reference", target={Organization.class } )
13001  public static final String SP_ORGANIZATION = "organization";
13002 /**
13003   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
13004   * <p>
13005   * Description: <b>The reference to the providing organization</b><br>
13006   * Type: <b>reference</b><br>
13007   * Path: <b>ExplanationOfBenefit.organization</b><br>
13008   * </p>
13009   */
13010  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
13011
13012/**
13013   * Constant for fluent queries to be used to add include statements. Specifies
13014   * the path value of "<b>ExplanationOfBenefit:organization</b>".
13015   */
13016  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:organization").toLocked();
13017
13018 /**
13019   * Search parameter: <b>claim</b>
13020   * <p>
13021   * Description: <b>The reference to the claim</b><br>
13022   * Type: <b>reference</b><br>
13023   * Path: <b>ExplanationOfBenefit.claim</b><br>
13024   * </p>
13025   */
13026  @SearchParamDefinition(name="claim", path="ExplanationOfBenefit.claim", description="The reference to the claim", type="reference", target={Claim.class } )
13027  public static final String SP_CLAIM = "claim";
13028 /**
13029   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
13030   * <p>
13031   * Description: <b>The reference to the claim</b><br>
13032   * Type: <b>reference</b><br>
13033   * Path: <b>ExplanationOfBenefit.claim</b><br>
13034   * </p>
13035   */
13036  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CLAIM);
13037
13038/**
13039   * Constant for fluent queries to be used to add include statements. Specifies
13040   * the path value of "<b>ExplanationOfBenefit:claim</b>".
13041   */
13042  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:claim").toLocked();
13043
13044 /**
13045   * Search parameter: <b>enterer</b>
13046   * <p>
13047   * Description: <b>The party responsible for the entry of the Claim</b><br>
13048   * Type: <b>reference</b><br>
13049   * Path: <b>ExplanationOfBenefit.enterer</b><br>
13050   * </p>
13051   */
13052  @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 } )
13053  public static final String SP_ENTERER = "enterer";
13054 /**
13055   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
13056   * <p>
13057   * Description: <b>The party responsible for the entry of the Claim</b><br>
13058   * Type: <b>reference</b><br>
13059   * Path: <b>ExplanationOfBenefit.enterer</b><br>
13060   * </p>
13061   */
13062  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
13063
13064/**
13065   * Constant for fluent queries to be used to add include statements. Specifies
13066   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
13067   */
13068  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:enterer").toLocked();
13069
13070 /**
13071   * Search parameter: <b>facility</b>
13072   * <p>
13073   * Description: <b>Facility responsible for the goods and services</b><br>
13074   * Type: <b>reference</b><br>
13075   * Path: <b>ExplanationOfBenefit.facility</b><br>
13076   * </p>
13077   */
13078  @SearchParamDefinition(name="facility", path="ExplanationOfBenefit.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class } )
13079  public static final String SP_FACILITY = "facility";
13080 /**
13081   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
13082   * <p>
13083   * Description: <b>Facility responsible for the goods and services</b><br>
13084   * Type: <b>reference</b><br>
13085   * Path: <b>ExplanationOfBenefit.facility</b><br>
13086   * </p>
13087   */
13088  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
13089
13090/**
13091   * Constant for fluent queries to be used to add include statements. Specifies
13092   * the path value of "<b>ExplanationOfBenefit:facility</b>".
13093   */
13094  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:facility").toLocked();
13095
13096
13097}