001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Sat, Nov 5, 2022 10:47+1100 for FHIR v5.0.0-ballot
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import java.math.*;
038import org.hl7.fhir.utilities.Utilities;
039import org.hl7.fhir.r5.model.Enumerations.*;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.exceptions.FHIRException;
042import org.hl7.fhir.instance.model.api.ICompositeType;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
046import ca.uhn.fhir.model.api.annotation.Child;
047import ca.uhn.fhir.model.api.annotation.ChildOrder;
048import ca.uhn.fhir.model.api.annotation.Description;
049import ca.uhn.fhir.model.api.annotation.Block;
050
051/**
052 * 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.
053 */
054@ResourceDef(name="ExplanationOfBenefit", profile="http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit")
055public class ExplanationOfBenefit extends DomainResource {
056
057    public enum ExplanationOfBenefitStatus {
058        /**
059         * The resource instance is currently in-force.
060         */
061        ACTIVE, 
062        /**
063         * The resource instance is withdrawn, rescinded or reversed.
064         */
065        CANCELLED, 
066        /**
067         * A new resource instance the contents of which is not complete.
068         */
069        DRAFT, 
070        /**
071         * The resource instance was entered in error.
072         */
073        ENTEREDINERROR, 
074        /**
075         * added to help the parsers with the generic types
076         */
077        NULL;
078        public static ExplanationOfBenefitStatus fromCode(String codeString) throws FHIRException {
079            if (codeString == null || "".equals(codeString))
080                return null;
081        if ("active".equals(codeString))
082          return ACTIVE;
083        if ("cancelled".equals(codeString))
084          return CANCELLED;
085        if ("draft".equals(codeString))
086          return DRAFT;
087        if ("entered-in-error".equals(codeString))
088          return ENTEREDINERROR;
089        if (Configuration.isAcceptInvalidEnums())
090          return null;
091        else
092          throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
093        }
094        public String toCode() {
095          switch (this) {
096            case ACTIVE: return "active";
097            case CANCELLED: return "cancelled";
098            case DRAFT: return "draft";
099            case ENTEREDINERROR: return "entered-in-error";
100            case NULL: return null;
101            default: return "?";
102          }
103        }
104        public String getSystem() {
105          switch (this) {
106            case ACTIVE: return "http://hl7.org/fhir/explanationofbenefit-status";
107            case CANCELLED: return "http://hl7.org/fhir/explanationofbenefit-status";
108            case DRAFT: return "http://hl7.org/fhir/explanationofbenefit-status";
109            case ENTEREDINERROR: return "http://hl7.org/fhir/explanationofbenefit-status";
110            case NULL: return null;
111            default: return "?";
112          }
113        }
114        public String getDefinition() {
115          switch (this) {
116            case ACTIVE: return "The resource instance is currently in-force.";
117            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
118            case DRAFT: return "A new resource instance the contents of which is not complete.";
119            case ENTEREDINERROR: return "The resource instance was entered in error.";
120            case NULL: return null;
121            default: return "?";
122          }
123        }
124        public String getDisplay() {
125          switch (this) {
126            case ACTIVE: return "Active";
127            case CANCELLED: return "Cancelled";
128            case DRAFT: return "Draft";
129            case ENTEREDINERROR: return "Entered In Error";
130            case NULL: return null;
131            default: return "?";
132          }
133        }
134    }
135
136  public static class ExplanationOfBenefitStatusEnumFactory implements EnumFactory<ExplanationOfBenefitStatus> {
137    public ExplanationOfBenefitStatus fromCode(String codeString) throws IllegalArgumentException {
138      if (codeString == null || "".equals(codeString))
139            if (codeString == null || "".equals(codeString))
140                return null;
141        if ("active".equals(codeString))
142          return ExplanationOfBenefitStatus.ACTIVE;
143        if ("cancelled".equals(codeString))
144          return ExplanationOfBenefitStatus.CANCELLED;
145        if ("draft".equals(codeString))
146          return ExplanationOfBenefitStatus.DRAFT;
147        if ("entered-in-error".equals(codeString))
148          return ExplanationOfBenefitStatus.ENTEREDINERROR;
149        throw new IllegalArgumentException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
150        }
151        public Enumeration<ExplanationOfBenefitStatus> fromType(Base code) throws FHIRException {
152          if (code == null)
153            return null;
154          if (code.isEmpty())
155            return new Enumeration<ExplanationOfBenefitStatus>(this);
156          String codeString = ((PrimitiveType) code).asStringValue();
157          if (codeString == null || "".equals(codeString))
158            return null;
159        if ("active".equals(codeString))
160          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ACTIVE);
161        if ("cancelled".equals(codeString))
162          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.CANCELLED);
163        if ("draft".equals(codeString))
164          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.DRAFT);
165        if ("entered-in-error".equals(codeString))
166          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ENTEREDINERROR);
167        throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
168        }
169    public String toCode(ExplanationOfBenefitStatus code) {
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         * Reference to a related claim.
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="Reference to a related claim." )
192        protected Reference claim;
193
194        /**
195         * A code to convey how the claims are related.
196         */
197        @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
198        @Description(shortDefinition="How the reference claim is related", formalDefinition="A code to convey how the claims are related." )
199        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-claim-relationship")
200        protected CodeableConcept relationship;
201
202        /**
203         * An alternate organizational reference to the case or file to which this particular claim pertains.
204         */
205        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=false)
206        @Description(shortDefinition="File or case reference", formalDefinition="An alternate organizational reference to the case or file to which this particular claim pertains." )
207        protected Identifier reference;
208
209        private static final long serialVersionUID = 1047077926L;
210
211    /**
212     * Constructor
213     */
214      public RelatedClaimComponent() {
215        super();
216      }
217
218        /**
219         * @return {@link #claim} (Reference to a related claim.)
220         */
221        public Reference getClaim() { 
222          if (this.claim == null)
223            if (Configuration.errorOnAutoCreate())
224              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
225            else if (Configuration.doAutoCreate())
226              this.claim = new Reference(); // cc
227          return this.claim;
228        }
229
230        public boolean hasClaim() { 
231          return this.claim != null && !this.claim.isEmpty();
232        }
233
234        /**
235         * @param value {@link #claim} (Reference to a related claim.)
236         */
237        public RelatedClaimComponent setClaim(Reference value) { 
238          this.claim = value;
239          return this;
240        }
241
242        /**
243         * @return {@link #relationship} (A code to convey how the claims are related.)
244         */
245        public CodeableConcept getRelationship() { 
246          if (this.relationship == null)
247            if (Configuration.errorOnAutoCreate())
248              throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
249            else if (Configuration.doAutoCreate())
250              this.relationship = new CodeableConcept(); // cc
251          return this.relationship;
252        }
253
254        public boolean hasRelationship() { 
255          return this.relationship != null && !this.relationship.isEmpty();
256        }
257
258        /**
259         * @param value {@link #relationship} (A code to convey how the claims are related.)
260         */
261        public RelatedClaimComponent setRelationship(CodeableConcept value) { 
262          this.relationship = value;
263          return this;
264        }
265
266        /**
267         * @return {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
268         */
269        public Identifier getReference() { 
270          if (this.reference == null)
271            if (Configuration.errorOnAutoCreate())
272              throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
273            else if (Configuration.doAutoCreate())
274              this.reference = new Identifier(); // cc
275          return this.reference;
276        }
277
278        public boolean hasReference() { 
279          return this.reference != null && !this.reference.isEmpty();
280        }
281
282        /**
283         * @param value {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
284         */
285        public RelatedClaimComponent setReference(Identifier value) { 
286          this.reference = value;
287          return this;
288        }
289
290        protected void listChildren(List<Property> children) {
291          super.listChildren(children);
292          children.add(new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim));
293          children.add(new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship));
294          children.add(new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1, reference));
295        }
296
297        @Override
298        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
299          switch (_hash) {
300          case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim);
301          case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship);
302          case -925155509: /*reference*/  return new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1, reference);
303          default: return super.getNamedProperty(_hash, _name, _checkValid);
304          }
305
306        }
307
308      @Override
309      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
310        switch (hash) {
311        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
312        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
313        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
314        default: return super.getProperty(hash, name, checkValid);
315        }
316
317      }
318
319      @Override
320      public Base setProperty(int hash, String name, Base value) throws FHIRException {
321        switch (hash) {
322        case 94742588: // claim
323          this.claim = TypeConvertor.castToReference(value); // Reference
324          return value;
325        case -261851592: // relationship
326          this.relationship = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
327          return value;
328        case -925155509: // reference
329          this.reference = TypeConvertor.castToIdentifier(value); // Identifier
330          return value;
331        default: return super.setProperty(hash, name, value);
332        }
333
334      }
335
336      @Override
337      public Base setProperty(String name, Base value) throws FHIRException {
338        if (name.equals("claim")) {
339          this.claim = TypeConvertor.castToReference(value); // Reference
340        } else if (name.equals("relationship")) {
341          this.relationship = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
342        } else if (name.equals("reference")) {
343          this.reference = TypeConvertor.castToIdentifier(value); // Identifier
344        } else
345          return super.setProperty(name, value);
346        return value;
347      }
348
349      @Override
350      public Base makeProperty(int hash, String name) throws FHIRException {
351        switch (hash) {
352        case 94742588:  return getClaim();
353        case -261851592:  return getRelationship();
354        case -925155509:  return getReference();
355        default: return super.makeProperty(hash, name);
356        }
357
358      }
359
360      @Override
361      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
362        switch (hash) {
363        case 94742588: /*claim*/ return new String[] {"Reference"};
364        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
365        case -925155509: /*reference*/ return new String[] {"Identifier"};
366        default: return super.getTypesForProperty(hash, name);
367        }
368
369      }
370
371      @Override
372      public Base addChild(String name) throws FHIRException {
373        if (name.equals("claim")) {
374          this.claim = new Reference();
375          return this.claim;
376        }
377        else if (name.equals("relationship")) {
378          this.relationship = new CodeableConcept();
379          return this.relationship;
380        }
381        else if (name.equals("reference")) {
382          this.reference = new Identifier();
383          return this.reference;
384        }
385        else
386          return super.addChild(name);
387      }
388
389      public RelatedClaimComponent copy() {
390        RelatedClaimComponent dst = new RelatedClaimComponent();
391        copyValues(dst);
392        return dst;
393      }
394
395      public void copyValues(RelatedClaimComponent dst) {
396        super.copyValues(dst);
397        dst.claim = claim == null ? null : claim.copy();
398        dst.relationship = relationship == null ? null : relationship.copy();
399        dst.reference = reference == null ? null : reference.copy();
400      }
401
402      @Override
403      public boolean equalsDeep(Base other_) {
404        if (!super.equalsDeep(other_))
405          return false;
406        if (!(other_ instanceof RelatedClaimComponent))
407          return false;
408        RelatedClaimComponent o = (RelatedClaimComponent) other_;
409        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
410          ;
411      }
412
413      @Override
414      public boolean equalsShallow(Base other_) {
415        if (!super.equalsShallow(other_))
416          return false;
417        if (!(other_ instanceof RelatedClaimComponent))
418          return false;
419        RelatedClaimComponent o = (RelatedClaimComponent) other_;
420        return true;
421      }
422
423      public boolean isEmpty() {
424        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference
425          );
426      }
427
428  public String fhirType() {
429    return "ExplanationOfBenefit.related";
430
431  }
432
433  }
434
435    @Block()
436    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
437        /**
438         * Type of Party to be reimbursed: Subscriber, provider, other.
439         */
440        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
441        @Description(shortDefinition="Category of recipient", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
442        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payeetype")
443        protected CodeableConcept type;
444
445        /**
446         * Reference to the individual or organization to whom any payment will be made.
447         */
448        @Child(name = "party", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, RelatedPerson.class}, order=2, min=0, max=1, modifier=false, summary=false)
449        @Description(shortDefinition="Recipient reference", formalDefinition="Reference to the individual or organization to whom any payment will be made." )
450        protected Reference party;
451
452        private static final long serialVersionUID = -1948897146L;
453
454    /**
455     * Constructor
456     */
457      public PayeeComponent() {
458        super();
459      }
460
461        /**
462         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
463         */
464        public CodeableConcept getType() { 
465          if (this.type == null)
466            if (Configuration.errorOnAutoCreate())
467              throw new Error("Attempt to auto-create PayeeComponent.type");
468            else if (Configuration.doAutoCreate())
469              this.type = new CodeableConcept(); // cc
470          return this.type;
471        }
472
473        public boolean hasType() { 
474          return this.type != null && !this.type.isEmpty();
475        }
476
477        /**
478         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
479         */
480        public PayeeComponent setType(CodeableConcept value) { 
481          this.type = value;
482          return this;
483        }
484
485        /**
486         * @return {@link #party} (Reference to the individual or organization to whom any payment will be made.)
487         */
488        public Reference getParty() { 
489          if (this.party == null)
490            if (Configuration.errorOnAutoCreate())
491              throw new Error("Attempt to auto-create PayeeComponent.party");
492            else if (Configuration.doAutoCreate())
493              this.party = new Reference(); // cc
494          return this.party;
495        }
496
497        public boolean hasParty() { 
498          return this.party != null && !this.party.isEmpty();
499        }
500
501        /**
502         * @param value {@link #party} (Reference to the individual or organization to whom any payment will be made.)
503         */
504        public PayeeComponent setParty(Reference value) { 
505          this.party = value;
506          return this;
507        }
508
509        protected void listChildren(List<Property> children) {
510          super.listChildren(children);
511          children.add(new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
512          children.add(new Property("party", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)", "Reference to the individual or organization to whom any payment will be made.", 0, 1, party));
513        }
514
515        @Override
516        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
517          switch (_hash) {
518          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
519          case 106437350: /*party*/  return new Property("party", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)", "Reference to the individual or organization to whom any payment will be made.", 0, 1, party);
520          default: return super.getNamedProperty(_hash, _name, _checkValid);
521          }
522
523        }
524
525      @Override
526      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
527        switch (hash) {
528        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
529        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
530        default: return super.getProperty(hash, name, checkValid);
531        }
532
533      }
534
535      @Override
536      public Base setProperty(int hash, String name, Base value) throws FHIRException {
537        switch (hash) {
538        case 3575610: // type
539          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
540          return value;
541        case 106437350: // party
542          this.party = TypeConvertor.castToReference(value); // Reference
543          return value;
544        default: return super.setProperty(hash, name, value);
545        }
546
547      }
548
549      @Override
550      public Base setProperty(String name, Base value) throws FHIRException {
551        if (name.equals("type")) {
552          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
553        } else if (name.equals("party")) {
554          this.party = TypeConvertor.castToReference(value); // Reference
555        } else
556          return super.setProperty(name, value);
557        return value;
558      }
559
560      @Override
561      public Base makeProperty(int hash, String name) throws FHIRException {
562        switch (hash) {
563        case 3575610:  return getType();
564        case 106437350:  return getParty();
565        default: return super.makeProperty(hash, name);
566        }
567
568      }
569
570      @Override
571      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
572        switch (hash) {
573        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
574        case 106437350: /*party*/ return new String[] {"Reference"};
575        default: return super.getTypesForProperty(hash, name);
576        }
577
578      }
579
580      @Override
581      public Base addChild(String name) throws FHIRException {
582        if (name.equals("type")) {
583          this.type = new CodeableConcept();
584          return this.type;
585        }
586        else if (name.equals("party")) {
587          this.party = new Reference();
588          return this.party;
589        }
590        else
591          return super.addChild(name);
592      }
593
594      public PayeeComponent copy() {
595        PayeeComponent dst = new PayeeComponent();
596        copyValues(dst);
597        return dst;
598      }
599
600      public void copyValues(PayeeComponent dst) {
601        super.copyValues(dst);
602        dst.type = type == null ? null : type.copy();
603        dst.party = party == null ? null : party.copy();
604      }
605
606      @Override
607      public boolean equalsDeep(Base other_) {
608        if (!super.equalsDeep(other_))
609          return false;
610        if (!(other_ instanceof PayeeComponent))
611          return false;
612        PayeeComponent o = (PayeeComponent) other_;
613        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true);
614      }
615
616      @Override
617      public boolean equalsShallow(Base other_) {
618        if (!super.equalsShallow(other_))
619          return false;
620        if (!(other_ instanceof PayeeComponent))
621          return false;
622        PayeeComponent o = (PayeeComponent) other_;
623        return true;
624      }
625
626      public boolean isEmpty() {
627        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party);
628      }
629
630  public String fhirType() {
631    return "ExplanationOfBenefit.payee";
632
633  }
634
635  }
636
637    @Block()
638    public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
639        /**
640         * A number to uniquely identify care team entries.
641         */
642        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
643        @Description(shortDefinition="Order of care team", formalDefinition="A number to uniquely identify care team entries." )
644        protected PositiveIntType sequence;
645
646        /**
647         * Member of the team who provided the product or service.
648         */
649        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=false)
650        @Description(shortDefinition="Practitioner or organization", formalDefinition="Member of the team who provided the product or service." )
651        protected Reference provider;
652
653        /**
654         * The party who is billing and/or responsible for the claimed products or services.
655         */
656        @Child(name = "responsible", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
657        @Description(shortDefinition="Indicator of the lead practitioner", formalDefinition="The party who is billing and/or responsible for the claimed products or services." )
658        protected BooleanType responsible;
659
660        /**
661         * The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.
662         */
663        @Child(name = "role", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
664        @Description(shortDefinition="Function within the team", formalDefinition="The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team." )
665        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-careteamrole")
666        protected CodeableConcept role;
667
668        /**
669         * The specialization of the practitioner or provider which is applicable for this service.
670         */
671        @Child(name = "specialty", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
672        @Description(shortDefinition="Practitioner or provider specialization", formalDefinition="The specialization of the practitioner or provider which is applicable for this service." )
673        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provider-qualification")
674        protected CodeableConcept specialty;
675
676        private static final long serialVersionUID = 1238813503L;
677
678    /**
679     * Constructor
680     */
681      public CareTeamComponent() {
682        super();
683      }
684
685    /**
686     * Constructor
687     */
688      public CareTeamComponent(int sequence, Reference provider) {
689        super();
690        this.setSequence(sequence);
691        this.setProvider(provider);
692      }
693
694        /**
695         * @return {@link #sequence} (A number to uniquely identify care team entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
696         */
697        public PositiveIntType getSequenceElement() { 
698          if (this.sequence == null)
699            if (Configuration.errorOnAutoCreate())
700              throw new Error("Attempt to auto-create CareTeamComponent.sequence");
701            else if (Configuration.doAutoCreate())
702              this.sequence = new PositiveIntType(); // bb
703          return this.sequence;
704        }
705
706        public boolean hasSequenceElement() { 
707          return this.sequence != null && !this.sequence.isEmpty();
708        }
709
710        public boolean hasSequence() { 
711          return this.sequence != null && !this.sequence.isEmpty();
712        }
713
714        /**
715         * @param value {@link #sequence} (A number to uniquely identify care team entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
716         */
717        public CareTeamComponent setSequenceElement(PositiveIntType value) { 
718          this.sequence = value;
719          return this;
720        }
721
722        /**
723         * @return A number to uniquely identify care team entries.
724         */
725        public int getSequence() { 
726          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
727        }
728
729        /**
730         * @param value A number to uniquely identify care team entries.
731         */
732        public CareTeamComponent setSequence(int value) { 
733            if (this.sequence == null)
734              this.sequence = new PositiveIntType();
735            this.sequence.setValue(value);
736          return this;
737        }
738
739        /**
740         * @return {@link #provider} (Member of the team who provided the product or service.)
741         */
742        public Reference getProvider() { 
743          if (this.provider == null)
744            if (Configuration.errorOnAutoCreate())
745              throw new Error("Attempt to auto-create CareTeamComponent.provider");
746            else if (Configuration.doAutoCreate())
747              this.provider = new Reference(); // cc
748          return this.provider;
749        }
750
751        public boolean hasProvider() { 
752          return this.provider != null && !this.provider.isEmpty();
753        }
754
755        /**
756         * @param value {@link #provider} (Member of the team who provided the product or service.)
757         */
758        public CareTeamComponent setProvider(Reference value) { 
759          this.provider = value;
760          return this;
761        }
762
763        /**
764         * @return {@link #responsible} (The party who is billing and/or responsible for the claimed products or services.). This is the underlying object with id, value and extensions. The accessor "getResponsible" gives direct access to the value
765         */
766        public BooleanType getResponsibleElement() { 
767          if (this.responsible == null)
768            if (Configuration.errorOnAutoCreate())
769              throw new Error("Attempt to auto-create CareTeamComponent.responsible");
770            else if (Configuration.doAutoCreate())
771              this.responsible = new BooleanType(); // bb
772          return this.responsible;
773        }
774
775        public boolean hasResponsibleElement() { 
776          return this.responsible != null && !this.responsible.isEmpty();
777        }
778
779        public boolean hasResponsible() { 
780          return this.responsible != null && !this.responsible.isEmpty();
781        }
782
783        /**
784         * @param value {@link #responsible} (The party who is billing and/or responsible for the claimed products or services.). This is the underlying object with id, value and extensions. The accessor "getResponsible" gives direct access to the value
785         */
786        public CareTeamComponent setResponsibleElement(BooleanType value) { 
787          this.responsible = value;
788          return this;
789        }
790
791        /**
792         * @return The party who is billing and/or responsible for the claimed products or services.
793         */
794        public boolean getResponsible() { 
795          return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
796        }
797
798        /**
799         * @param value The party who is billing and/or responsible for the claimed products or services.
800         */
801        public CareTeamComponent setResponsible(boolean value) { 
802            if (this.responsible == null)
803              this.responsible = new BooleanType();
804            this.responsible.setValue(value);
805          return this;
806        }
807
808        /**
809         * @return {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
810         */
811        public CodeableConcept getRole() { 
812          if (this.role == null)
813            if (Configuration.errorOnAutoCreate())
814              throw new Error("Attempt to auto-create CareTeamComponent.role");
815            else if (Configuration.doAutoCreate())
816              this.role = new CodeableConcept(); // cc
817          return this.role;
818        }
819
820        public boolean hasRole() { 
821          return this.role != null && !this.role.isEmpty();
822        }
823
824        /**
825         * @param value {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
826         */
827        public CareTeamComponent setRole(CodeableConcept value) { 
828          this.role = value;
829          return this;
830        }
831
832        /**
833         * @return {@link #specialty} (The specialization of the practitioner or provider which is applicable for this service.)
834         */
835        public CodeableConcept getSpecialty() { 
836          if (this.specialty == null)
837            if (Configuration.errorOnAutoCreate())
838              throw new Error("Attempt to auto-create CareTeamComponent.specialty");
839            else if (Configuration.doAutoCreate())
840              this.specialty = new CodeableConcept(); // cc
841          return this.specialty;
842        }
843
844        public boolean hasSpecialty() { 
845          return this.specialty != null && !this.specialty.isEmpty();
846        }
847
848        /**
849         * @param value {@link #specialty} (The specialization of the practitioner or provider which is applicable for this service.)
850         */
851        public CareTeamComponent setSpecialty(CodeableConcept value) { 
852          this.specialty = value;
853          return this;
854        }
855
856        protected void listChildren(List<Property> children) {
857          super.listChildren(children);
858          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence));
859          children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider));
860          children.add(new Property("responsible", "boolean", "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible));
861          children.add(new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role));
862          children.add(new Property("specialty", "CodeableConcept", "The specialization of the practitioner or provider which is applicable for this service.", 0, 1, specialty));
863        }
864
865        @Override
866        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
867          switch (_hash) {
868          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence);
869          case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider);
870          case 1847674614: /*responsible*/  return new Property("responsible", "boolean", "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible);
871          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role);
872          case -1694759682: /*specialty*/  return new Property("specialty", "CodeableConcept", "The specialization of the practitioner or provider which is applicable for this service.", 0, 1, specialty);
873          default: return super.getNamedProperty(_hash, _name, _checkValid);
874          }
875
876        }
877
878      @Override
879      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
880        switch (hash) {
881        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
882        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
883        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // BooleanType
884        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
885        case -1694759682: /*specialty*/ return this.specialty == null ? new Base[0] : new Base[] {this.specialty}; // CodeableConcept
886        default: return super.getProperty(hash, name, checkValid);
887        }
888
889      }
890
891      @Override
892      public Base setProperty(int hash, String name, Base value) throws FHIRException {
893        switch (hash) {
894        case 1349547969: // sequence
895          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
896          return value;
897        case -987494927: // provider
898          this.provider = TypeConvertor.castToReference(value); // Reference
899          return value;
900        case 1847674614: // responsible
901          this.responsible = TypeConvertor.castToBoolean(value); // BooleanType
902          return value;
903        case 3506294: // role
904          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
905          return value;
906        case -1694759682: // specialty
907          this.specialty = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
908          return value;
909        default: return super.setProperty(hash, name, value);
910        }
911
912      }
913
914      @Override
915      public Base setProperty(String name, Base value) throws FHIRException {
916        if (name.equals("sequence")) {
917          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
918        } else if (name.equals("provider")) {
919          this.provider = TypeConvertor.castToReference(value); // Reference
920        } else if (name.equals("responsible")) {
921          this.responsible = TypeConvertor.castToBoolean(value); // BooleanType
922        } else if (name.equals("role")) {
923          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
924        } else if (name.equals("specialty")) {
925          this.specialty = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
926        } else
927          return super.setProperty(name, value);
928        return value;
929      }
930
931      @Override
932      public Base makeProperty(int hash, String name) throws FHIRException {
933        switch (hash) {
934        case 1349547969:  return getSequenceElement();
935        case -987494927:  return getProvider();
936        case 1847674614:  return getResponsibleElement();
937        case 3506294:  return getRole();
938        case -1694759682:  return getSpecialty();
939        default: return super.makeProperty(hash, name);
940        }
941
942      }
943
944      @Override
945      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
946        switch (hash) {
947        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
948        case -987494927: /*provider*/ return new String[] {"Reference"};
949        case 1847674614: /*responsible*/ return new String[] {"boolean"};
950        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
951        case -1694759682: /*specialty*/ return new String[] {"CodeableConcept"};
952        default: return super.getTypesForProperty(hash, name);
953        }
954
955      }
956
957      @Override
958      public Base addChild(String name) throws FHIRException {
959        if (name.equals("sequence")) {
960          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeam.sequence");
961        }
962        else if (name.equals("provider")) {
963          this.provider = new Reference();
964          return this.provider;
965        }
966        else if (name.equals("responsible")) {
967          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeam.responsible");
968        }
969        else if (name.equals("role")) {
970          this.role = new CodeableConcept();
971          return this.role;
972        }
973        else if (name.equals("specialty")) {
974          this.specialty = new CodeableConcept();
975          return this.specialty;
976        }
977        else
978          return super.addChild(name);
979      }
980
981      public CareTeamComponent copy() {
982        CareTeamComponent dst = new CareTeamComponent();
983        copyValues(dst);
984        return dst;
985      }
986
987      public void copyValues(CareTeamComponent dst) {
988        super.copyValues(dst);
989        dst.sequence = sequence == null ? null : sequence.copy();
990        dst.provider = provider == null ? null : provider.copy();
991        dst.responsible = responsible == null ? null : responsible.copy();
992        dst.role = role == null ? null : role.copy();
993        dst.specialty = specialty == null ? null : specialty.copy();
994      }
995
996      @Override
997      public boolean equalsDeep(Base other_) {
998        if (!super.equalsDeep(other_))
999          return false;
1000        if (!(other_ instanceof CareTeamComponent))
1001          return false;
1002        CareTeamComponent o = (CareTeamComponent) other_;
1003        return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true) && compareDeep(responsible, o.responsible, true)
1004           && compareDeep(role, o.role, true) && compareDeep(specialty, o.specialty, true);
1005      }
1006
1007      @Override
1008      public boolean equalsShallow(Base other_) {
1009        if (!super.equalsShallow(other_))
1010          return false;
1011        if (!(other_ instanceof CareTeamComponent))
1012          return false;
1013        CareTeamComponent o = (CareTeamComponent) other_;
1014        return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true)
1015          ;
1016      }
1017
1018      public boolean isEmpty() {
1019        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible
1020          , role, specialty);
1021      }
1022
1023  public String fhirType() {
1024    return "ExplanationOfBenefit.careTeam";
1025
1026  }
1027
1028  }
1029
1030    @Block()
1031    public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
1032        /**
1033         * A number to uniquely identify supporting information entries.
1034         */
1035        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1036        @Description(shortDefinition="Information instance identifier", formalDefinition="A number to uniquely identify supporting information entries." )
1037        protected PositiveIntType sequence;
1038
1039        /**
1040         * The general class of the information supplied: information; exception; accident, employment; onset, etc.
1041         */
1042        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
1043        @Description(shortDefinition="Classification of the supplied information", formalDefinition="The general class of the information supplied: information; exception; accident, employment; onset, etc." )
1044        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-informationcategory")
1045        protected CodeableConcept category;
1046
1047        /**
1048         * System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.
1049         */
1050        @Child(name = "code", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1051        @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." )
1052        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-exception")
1053        protected CodeableConcept code;
1054
1055        /**
1056         * The date when or period to which this information refers.
1057         */
1058        @Child(name = "timing", type = {DateType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
1059        @Description(shortDefinition="When it occurred", formalDefinition="The date when or period to which this information refers." )
1060        protected DataType timing;
1061
1062        /**
1063         * Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.
1064         */
1065        @Child(name = "value", type = {BooleanType.class, StringType.class, Quantity.class, Attachment.class, Reference.class, Identifier.class}, order=5, min=0, max=1, modifier=false, summary=false)
1066        @Description(shortDefinition="Data to be provided", formalDefinition="Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data." )
1067        protected DataType value;
1068
1069        /**
1070         * Provides the reason in the situation where a reason code is required in addition to the content.
1071         */
1072        @Child(name = "reason", type = {Coding.class}, order=6, min=0, max=1, modifier=false, summary=false)
1073        @Description(shortDefinition="Explanation for the information", formalDefinition="Provides the reason in the situation where a reason code is required in addition to the content." )
1074        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/missing-tooth-reason")
1075        protected Coding reason;
1076
1077        private static final long serialVersionUID = 1577205655L;
1078
1079    /**
1080     * Constructor
1081     */
1082      public SupportingInformationComponent() {
1083        super();
1084      }
1085
1086    /**
1087     * Constructor
1088     */
1089      public SupportingInformationComponent(int sequence, CodeableConcept category) {
1090        super();
1091        this.setSequence(sequence);
1092        this.setCategory(category);
1093      }
1094
1095        /**
1096         * @return {@link #sequence} (A number to uniquely identify supporting information entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1097         */
1098        public PositiveIntType getSequenceElement() { 
1099          if (this.sequence == null)
1100            if (Configuration.errorOnAutoCreate())
1101              throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
1102            else if (Configuration.doAutoCreate())
1103              this.sequence = new PositiveIntType(); // bb
1104          return this.sequence;
1105        }
1106
1107        public boolean hasSequenceElement() { 
1108          return this.sequence != null && !this.sequence.isEmpty();
1109        }
1110
1111        public boolean hasSequence() { 
1112          return this.sequence != null && !this.sequence.isEmpty();
1113        }
1114
1115        /**
1116         * @param value {@link #sequence} (A number to uniquely identify supporting information entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1117         */
1118        public SupportingInformationComponent setSequenceElement(PositiveIntType value) { 
1119          this.sequence = value;
1120          return this;
1121        }
1122
1123        /**
1124         * @return A number to uniquely identify supporting information entries.
1125         */
1126        public int getSequence() { 
1127          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1128        }
1129
1130        /**
1131         * @param value A number to uniquely identify supporting information entries.
1132         */
1133        public SupportingInformationComponent setSequence(int value) { 
1134            if (this.sequence == null)
1135              this.sequence = new PositiveIntType();
1136            this.sequence.setValue(value);
1137          return this;
1138        }
1139
1140        /**
1141         * @return {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1142         */
1143        public CodeableConcept getCategory() { 
1144          if (this.category == null)
1145            if (Configuration.errorOnAutoCreate())
1146              throw new Error("Attempt to auto-create SupportingInformationComponent.category");
1147            else if (Configuration.doAutoCreate())
1148              this.category = new CodeableConcept(); // cc
1149          return this.category;
1150        }
1151
1152        public boolean hasCategory() { 
1153          return this.category != null && !this.category.isEmpty();
1154        }
1155
1156        /**
1157         * @param value {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1158         */
1159        public SupportingInformationComponent setCategory(CodeableConcept value) { 
1160          this.category = value;
1161          return this;
1162        }
1163
1164        /**
1165         * @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.)
1166         */
1167        public CodeableConcept getCode() { 
1168          if (this.code == null)
1169            if (Configuration.errorOnAutoCreate())
1170              throw new Error("Attempt to auto-create SupportingInformationComponent.code");
1171            else if (Configuration.doAutoCreate())
1172              this.code = new CodeableConcept(); // cc
1173          return this.code;
1174        }
1175
1176        public boolean hasCode() { 
1177          return this.code != null && !this.code.isEmpty();
1178        }
1179
1180        /**
1181         * @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.)
1182         */
1183        public SupportingInformationComponent setCode(CodeableConcept value) { 
1184          this.code = value;
1185          return this;
1186        }
1187
1188        /**
1189         * @return {@link #timing} (The date when or period to which this information refers.)
1190         */
1191        public DataType getTiming() { 
1192          return this.timing;
1193        }
1194
1195        /**
1196         * @return {@link #timing} (The date when or period to which this information refers.)
1197         */
1198        public DateType getTimingDateType() throws FHIRException { 
1199          if (this.timing == null)
1200            this.timing = new DateType();
1201          if (!(this.timing instanceof DateType))
1202            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.timing.getClass().getName()+" was encountered");
1203          return (DateType) this.timing;
1204        }
1205
1206        public boolean hasTimingDateType() { 
1207          return this != null && this.timing instanceof DateType;
1208        }
1209
1210        /**
1211         * @return {@link #timing} (The date when or period to which this information refers.)
1212         */
1213        public Period getTimingPeriod() throws FHIRException { 
1214          if (this.timing == null)
1215            this.timing = new Period();
1216          if (!(this.timing instanceof Period))
1217            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
1218          return (Period) this.timing;
1219        }
1220
1221        public boolean hasTimingPeriod() { 
1222          return this != null && this.timing instanceof Period;
1223        }
1224
1225        public boolean hasTiming() { 
1226          return this.timing != null && !this.timing.isEmpty();
1227        }
1228
1229        /**
1230         * @param value {@link #timing} (The date when or period to which this information refers.)
1231         */
1232        public SupportingInformationComponent setTiming(DataType value) { 
1233          if (value != null && !(value instanceof DateType || value instanceof Period))
1234            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.timing[x]: "+value.fhirType());
1235          this.timing = value;
1236          return this;
1237        }
1238
1239        /**
1240         * @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.)
1241         */
1242        public DataType getValue() { 
1243          return this.value;
1244        }
1245
1246        /**
1247         * @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.)
1248         */
1249        public BooleanType getValueBooleanType() throws FHIRException { 
1250          if (this.value == null)
1251            this.value = new BooleanType();
1252          if (!(this.value instanceof BooleanType))
1253            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
1254          return (BooleanType) this.value;
1255        }
1256
1257        public boolean hasValueBooleanType() { 
1258          return this != null && this.value instanceof BooleanType;
1259        }
1260
1261        /**
1262         * @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.)
1263         */
1264        public StringType getValueStringType() throws FHIRException { 
1265          if (this.value == null)
1266            this.value = new StringType();
1267          if (!(this.value instanceof StringType))
1268            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
1269          return (StringType) this.value;
1270        }
1271
1272        public boolean hasValueStringType() { 
1273          return this != null && this.value instanceof StringType;
1274        }
1275
1276        /**
1277         * @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.)
1278         */
1279        public Quantity getValueQuantity() throws FHIRException { 
1280          if (this.value == null)
1281            this.value = new Quantity();
1282          if (!(this.value instanceof Quantity))
1283            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
1284          return (Quantity) this.value;
1285        }
1286
1287        public boolean hasValueQuantity() { 
1288          return this != null && this.value instanceof Quantity;
1289        }
1290
1291        /**
1292         * @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.)
1293         */
1294        public Attachment getValueAttachment() throws FHIRException { 
1295          if (this.value == null)
1296            this.value = new Attachment();
1297          if (!(this.value instanceof Attachment))
1298            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
1299          return (Attachment) this.value;
1300        }
1301
1302        public boolean hasValueAttachment() { 
1303          return this != null && this.value instanceof Attachment;
1304        }
1305
1306        /**
1307         * @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.)
1308         */
1309        public Reference getValueReference() throws FHIRException { 
1310          if (this.value == null)
1311            this.value = new Reference();
1312          if (!(this.value instanceof Reference))
1313            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
1314          return (Reference) this.value;
1315        }
1316
1317        public boolean hasValueReference() { 
1318          return this != null && this.value instanceof Reference;
1319        }
1320
1321        /**
1322         * @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.)
1323         */
1324        public Identifier getValueIdentifier() throws FHIRException { 
1325          if (this.value == null)
1326            this.value = new Identifier();
1327          if (!(this.value instanceof Identifier))
1328            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.value.getClass().getName()+" was encountered");
1329          return (Identifier) this.value;
1330        }
1331
1332        public boolean hasValueIdentifier() { 
1333          return this != null && this.value instanceof Identifier;
1334        }
1335
1336        public boolean hasValue() { 
1337          return this.value != null && !this.value.isEmpty();
1338        }
1339
1340        /**
1341         * @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.)
1342         */
1343        public SupportingInformationComponent setValue(DataType value) { 
1344          if (value != null && !(value instanceof BooleanType || value instanceof StringType || value instanceof Quantity || value instanceof Attachment || value instanceof Reference || value instanceof Identifier))
1345            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.value[x]: "+value.fhirType());
1346          this.value = value;
1347          return this;
1348        }
1349
1350        /**
1351         * @return {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1352         */
1353        public Coding getReason() { 
1354          if (this.reason == null)
1355            if (Configuration.errorOnAutoCreate())
1356              throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1357            else if (Configuration.doAutoCreate())
1358              this.reason = new Coding(); // cc
1359          return this.reason;
1360        }
1361
1362        public boolean hasReason() { 
1363          return this.reason != null && !this.reason.isEmpty();
1364        }
1365
1366        /**
1367         * @param value {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1368         */
1369        public SupportingInformationComponent setReason(Coding value) { 
1370          this.reason = value;
1371          return this;
1372        }
1373
1374        protected void listChildren(List<Property> children) {
1375          super.listChildren(children);
1376          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence));
1377          children.add(new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category));
1378          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.", 0, 1, code));
1379          children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing));
1380          children.add(new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)|Identifier", "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));
1381          children.add(new Property("reason", "Coding", "Provides the reason in the situation where a reason code is required in addition to the content.", 0, 1, reason));
1382        }
1383
1384        @Override
1385        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1386          switch (_hash) {
1387          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence);
1388          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category);
1389          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.", 0, 1, code);
1390          case 164632566: /*timing[x]*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1391          case -873664438: /*timing*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1392          case 807935768: /*timingDate*/  return new Property("timing[x]", "date", "The date when or period to which this information refers.", 0, 1, timing);
1393          case -615615829: /*timingPeriod*/  return new Property("timing[x]", "Period", "The date when or period to which this information refers.", 0, 1, timing);
1394          case -1410166417: /*value[x]*/  return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)|Identifier", "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);
1395          case 111972721: /*value*/  return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)|Identifier", "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);
1396          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean", "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);
1397          case -1424603934: /*valueString*/  return new Property("value[x]", "string", "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);
1398          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "Quantity", "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);
1399          case -475566732: /*valueAttachment*/  return new Property("value[x]", "Attachment", "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);
1400          case 1755241690: /*valueReference*/  return new Property("value[x]", "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);
1401          case -130498310: /*valueIdentifier*/  return new Property("value[x]", "Identifier", "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);
1402          case -934964668: /*reason*/  return new Property("reason", "Coding", "Provides the reason in the situation where a reason code is required in addition to the content.", 0, 1, reason);
1403          default: return super.getNamedProperty(_hash, _name, _checkValid);
1404          }
1405
1406        }
1407
1408      @Override
1409      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1410        switch (hash) {
1411        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1412        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1413        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1414        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // DataType
1415        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
1416        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
1417        default: return super.getProperty(hash, name, checkValid);
1418        }
1419
1420      }
1421
1422      @Override
1423      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1424        switch (hash) {
1425        case 1349547969: // sequence
1426          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1427          return value;
1428        case 50511102: // category
1429          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1430          return value;
1431        case 3059181: // code
1432          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1433          return value;
1434        case -873664438: // timing
1435          this.timing = TypeConvertor.castToType(value); // DataType
1436          return value;
1437        case 111972721: // value
1438          this.value = TypeConvertor.castToType(value); // DataType
1439          return value;
1440        case -934964668: // reason
1441          this.reason = TypeConvertor.castToCoding(value); // Coding
1442          return value;
1443        default: return super.setProperty(hash, name, value);
1444        }
1445
1446      }
1447
1448      @Override
1449      public Base setProperty(String name, Base value) throws FHIRException {
1450        if (name.equals("sequence")) {
1451          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1452        } else if (name.equals("category")) {
1453          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1454        } else if (name.equals("code")) {
1455          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1456        } else if (name.equals("timing[x]")) {
1457          this.timing = TypeConvertor.castToType(value); // DataType
1458        } else if (name.equals("value[x]")) {
1459          this.value = TypeConvertor.castToType(value); // DataType
1460        } else if (name.equals("reason")) {
1461          this.reason = TypeConvertor.castToCoding(value); // Coding
1462        } else
1463          return super.setProperty(name, value);
1464        return value;
1465      }
1466
1467      @Override
1468      public Base makeProperty(int hash, String name) throws FHIRException {
1469        switch (hash) {
1470        case 1349547969:  return getSequenceElement();
1471        case 50511102:  return getCategory();
1472        case 3059181:  return getCode();
1473        case 164632566:  return getTiming();
1474        case -873664438:  return getTiming();
1475        case -1410166417:  return getValue();
1476        case 111972721:  return getValue();
1477        case -934964668:  return getReason();
1478        default: return super.makeProperty(hash, name);
1479        }
1480
1481      }
1482
1483      @Override
1484      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1485        switch (hash) {
1486        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1487        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1488        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1489        case -873664438: /*timing*/ return new String[] {"date", "Period"};
1490        case 111972721: /*value*/ return new String[] {"boolean", "string", "Quantity", "Attachment", "Reference", "Identifier"};
1491        case -934964668: /*reason*/ return new String[] {"Coding"};
1492        default: return super.getTypesForProperty(hash, name);
1493        }
1494
1495      }
1496
1497      @Override
1498      public Base addChild(String name) throws FHIRException {
1499        if (name.equals("sequence")) {
1500          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.supportingInfo.sequence");
1501        }
1502        else if (name.equals("category")) {
1503          this.category = new CodeableConcept();
1504          return this.category;
1505        }
1506        else if (name.equals("code")) {
1507          this.code = new CodeableConcept();
1508          return this.code;
1509        }
1510        else if (name.equals("timingDate")) {
1511          this.timing = new DateType();
1512          return this.timing;
1513        }
1514        else if (name.equals("timingPeriod")) {
1515          this.timing = new Period();
1516          return this.timing;
1517        }
1518        else if (name.equals("valueBoolean")) {
1519          this.value = new BooleanType();
1520          return this.value;
1521        }
1522        else if (name.equals("valueString")) {
1523          this.value = new StringType();
1524          return this.value;
1525        }
1526        else if (name.equals("valueQuantity")) {
1527          this.value = new Quantity();
1528          return this.value;
1529        }
1530        else if (name.equals("valueAttachment")) {
1531          this.value = new Attachment();
1532          return this.value;
1533        }
1534        else if (name.equals("valueReference")) {
1535          this.value = new Reference();
1536          return this.value;
1537        }
1538        else if (name.equals("valueIdentifier")) {
1539          this.value = new Identifier();
1540          return this.value;
1541        }
1542        else if (name.equals("reason")) {
1543          this.reason = new Coding();
1544          return this.reason;
1545        }
1546        else
1547          return super.addChild(name);
1548      }
1549
1550      public SupportingInformationComponent copy() {
1551        SupportingInformationComponent dst = new SupportingInformationComponent();
1552        copyValues(dst);
1553        return dst;
1554      }
1555
1556      public void copyValues(SupportingInformationComponent dst) {
1557        super.copyValues(dst);
1558        dst.sequence = sequence == null ? null : sequence.copy();
1559        dst.category = category == null ? null : category.copy();
1560        dst.code = code == null ? null : code.copy();
1561        dst.timing = timing == null ? null : timing.copy();
1562        dst.value = value == null ? null : value.copy();
1563        dst.reason = reason == null ? null : reason.copy();
1564      }
1565
1566      @Override
1567      public boolean equalsDeep(Base other_) {
1568        if (!super.equalsDeep(other_))
1569          return false;
1570        if (!(other_ instanceof SupportingInformationComponent))
1571          return false;
1572        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1573        return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true) && compareDeep(code, o.code, true)
1574           && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true) && compareDeep(reason, o.reason, true)
1575          ;
1576      }
1577
1578      @Override
1579      public boolean equalsShallow(Base other_) {
1580        if (!super.equalsShallow(other_))
1581          return false;
1582        if (!(other_ instanceof SupportingInformationComponent))
1583          return false;
1584        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1585        return compareValues(sequence, o.sequence, true);
1586      }
1587
1588      public boolean isEmpty() {
1589        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code
1590          , timing, value, reason);
1591      }
1592
1593  public String fhirType() {
1594    return "ExplanationOfBenefit.supportingInfo";
1595
1596  }
1597
1598  }
1599
1600    @Block()
1601    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1602        /**
1603         * A number to uniquely identify diagnosis entries.
1604         */
1605        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1606        @Description(shortDefinition="Diagnosis instance identifier", formalDefinition="A number to uniquely identify diagnosis entries." )
1607        protected PositiveIntType sequence;
1608
1609        /**
1610         * The nature of illness or problem in a coded form or as a reference to an external defined Condition.
1611         */
1612        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=2, min=1, max=1, modifier=false, summary=false)
1613        @Description(shortDefinition="Nature of illness or problem", formalDefinition="The nature of illness or problem in a coded form or as a reference to an external defined Condition." )
1614        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
1615        protected DataType diagnosis;
1616
1617        /**
1618         * When the condition was observed or the relative ranking.
1619         */
1620        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1621        @Description(shortDefinition="Timing or nature of the diagnosis", formalDefinition="When the condition was observed or the relative ranking." )
1622        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosistype")
1623        protected List<CodeableConcept> type;
1624
1625        /**
1626         * Indication of whether the diagnosis was present on admission to a facility.
1627         */
1628        @Child(name = "onAdmission", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1629        @Description(shortDefinition="Present on admission", formalDefinition="Indication of whether the diagnosis was present on admission to a facility." )
1630        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission")
1631        protected CodeableConcept onAdmission;
1632
1633        private static final long serialVersionUID = -320261526L;
1634
1635    /**
1636     * Constructor
1637     */
1638      public DiagnosisComponent() {
1639        super();
1640      }
1641
1642    /**
1643     * Constructor
1644     */
1645      public DiagnosisComponent(int sequence, DataType diagnosis) {
1646        super();
1647        this.setSequence(sequence);
1648        this.setDiagnosis(diagnosis);
1649      }
1650
1651        /**
1652         * @return {@link #sequence} (A number to uniquely identify diagnosis entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1653         */
1654        public PositiveIntType getSequenceElement() { 
1655          if (this.sequence == null)
1656            if (Configuration.errorOnAutoCreate())
1657              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
1658            else if (Configuration.doAutoCreate())
1659              this.sequence = new PositiveIntType(); // bb
1660          return this.sequence;
1661        }
1662
1663        public boolean hasSequenceElement() { 
1664          return this.sequence != null && !this.sequence.isEmpty();
1665        }
1666
1667        public boolean hasSequence() { 
1668          return this.sequence != null && !this.sequence.isEmpty();
1669        }
1670
1671        /**
1672         * @param value {@link #sequence} (A number to uniquely identify diagnosis entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1673         */
1674        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
1675          this.sequence = value;
1676          return this;
1677        }
1678
1679        /**
1680         * @return A number to uniquely identify diagnosis entries.
1681         */
1682        public int getSequence() { 
1683          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1684        }
1685
1686        /**
1687         * @param value A number to uniquely identify diagnosis entries.
1688         */
1689        public DiagnosisComponent setSequence(int value) { 
1690            if (this.sequence == null)
1691              this.sequence = new PositiveIntType();
1692            this.sequence.setValue(value);
1693          return this;
1694        }
1695
1696        /**
1697         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1698         */
1699        public DataType getDiagnosis() { 
1700          return this.diagnosis;
1701        }
1702
1703        /**
1704         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1705         */
1706        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
1707          if (this.diagnosis == null)
1708            this.diagnosis = new CodeableConcept();
1709          if (!(this.diagnosis instanceof CodeableConcept))
1710            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1711          return (CodeableConcept) this.diagnosis;
1712        }
1713
1714        public boolean hasDiagnosisCodeableConcept() { 
1715          return this != null && this.diagnosis instanceof CodeableConcept;
1716        }
1717
1718        /**
1719         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1720         */
1721        public Reference getDiagnosisReference() throws FHIRException { 
1722          if (this.diagnosis == null)
1723            this.diagnosis = new Reference();
1724          if (!(this.diagnosis instanceof Reference))
1725            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1726          return (Reference) this.diagnosis;
1727        }
1728
1729        public boolean hasDiagnosisReference() { 
1730          return this != null && this.diagnosis instanceof Reference;
1731        }
1732
1733        public boolean hasDiagnosis() { 
1734          return this.diagnosis != null && !this.diagnosis.isEmpty();
1735        }
1736
1737        /**
1738         * @param value {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1739         */
1740        public DiagnosisComponent setDiagnosis(DataType value) { 
1741          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1742            throw new Error("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: "+value.fhirType());
1743          this.diagnosis = value;
1744          return this;
1745        }
1746
1747        /**
1748         * @return {@link #type} (When the condition was observed or the relative ranking.)
1749         */
1750        public List<CodeableConcept> getType() { 
1751          if (this.type == null)
1752            this.type = new ArrayList<CodeableConcept>();
1753          return this.type;
1754        }
1755
1756        /**
1757         * @return Returns a reference to <code>this</code> for easy method chaining
1758         */
1759        public DiagnosisComponent setType(List<CodeableConcept> theType) { 
1760          this.type = theType;
1761          return this;
1762        }
1763
1764        public boolean hasType() { 
1765          if (this.type == null)
1766            return false;
1767          for (CodeableConcept item : this.type)
1768            if (!item.isEmpty())
1769              return true;
1770          return false;
1771        }
1772
1773        public CodeableConcept addType() { //3
1774          CodeableConcept t = new CodeableConcept();
1775          if (this.type == null)
1776            this.type = new ArrayList<CodeableConcept>();
1777          this.type.add(t);
1778          return t;
1779        }
1780
1781        public DiagnosisComponent addType(CodeableConcept t) { //3
1782          if (t == null)
1783            return this;
1784          if (this.type == null)
1785            this.type = new ArrayList<CodeableConcept>();
1786          this.type.add(t);
1787          return this;
1788        }
1789
1790        /**
1791         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
1792         */
1793        public CodeableConcept getTypeFirstRep() { 
1794          if (getType().isEmpty()) {
1795            addType();
1796          }
1797          return getType().get(0);
1798        }
1799
1800        /**
1801         * @return {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
1802         */
1803        public CodeableConcept getOnAdmission() { 
1804          if (this.onAdmission == null)
1805            if (Configuration.errorOnAutoCreate())
1806              throw new Error("Attempt to auto-create DiagnosisComponent.onAdmission");
1807            else if (Configuration.doAutoCreate())
1808              this.onAdmission = new CodeableConcept(); // cc
1809          return this.onAdmission;
1810        }
1811
1812        public boolean hasOnAdmission() { 
1813          return this.onAdmission != null && !this.onAdmission.isEmpty();
1814        }
1815
1816        /**
1817         * @param value {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
1818         */
1819        public DiagnosisComponent setOnAdmission(CodeableConcept value) { 
1820          this.onAdmission = value;
1821          return this;
1822        }
1823
1824        protected void listChildren(List<Property> children) {
1825          super.listChildren(children);
1826          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence));
1827          children.add(new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis));
1828          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
1829          children.add(new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission));
1830        }
1831
1832        @Override
1833        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1834          switch (_hash) {
1835          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence);
1836          case -1487009809: /*diagnosis[x]*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
1837          case 1196993265: /*diagnosis*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
1838          case 277781616: /*diagnosisCodeableConcept*/  return new Property("diagnosis[x]", "CodeableConcept", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
1839          case 2050454362: /*diagnosisReference*/  return new Property("diagnosis[x]", "Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
1840          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
1841          case -3386134: /*onAdmission*/  return new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission);
1842          default: return super.getNamedProperty(_hash, _name, _checkValid);
1843          }
1844
1845        }
1846
1847      @Override
1848      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1849        switch (hash) {
1850        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1851        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // DataType
1852        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
1853        case -3386134: /*onAdmission*/ return this.onAdmission == null ? new Base[0] : new Base[] {this.onAdmission}; // CodeableConcept
1854        default: return super.getProperty(hash, name, checkValid);
1855        }
1856
1857      }
1858
1859      @Override
1860      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1861        switch (hash) {
1862        case 1349547969: // sequence
1863          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1864          return value;
1865        case 1196993265: // diagnosis
1866          this.diagnosis = TypeConvertor.castToType(value); // DataType
1867          return value;
1868        case 3575610: // type
1869          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1870          return value;
1871        case -3386134: // onAdmission
1872          this.onAdmission = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1873          return value;
1874        default: return super.setProperty(hash, name, value);
1875        }
1876
1877      }
1878
1879      @Override
1880      public Base setProperty(String name, Base value) throws FHIRException {
1881        if (name.equals("sequence")) {
1882          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1883        } else if (name.equals("diagnosis[x]")) {
1884          this.diagnosis = TypeConvertor.castToType(value); // DataType
1885        } else if (name.equals("type")) {
1886          this.getType().add(TypeConvertor.castToCodeableConcept(value));
1887        } else if (name.equals("onAdmission")) {
1888          this.onAdmission = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1889        } else
1890          return super.setProperty(name, value);
1891        return value;
1892      }
1893
1894      @Override
1895      public Base makeProperty(int hash, String name) throws FHIRException {
1896        switch (hash) {
1897        case 1349547969:  return getSequenceElement();
1898        case -1487009809:  return getDiagnosis();
1899        case 1196993265:  return getDiagnosis();
1900        case 3575610:  return addType(); 
1901        case -3386134:  return getOnAdmission();
1902        default: return super.makeProperty(hash, name);
1903        }
1904
1905      }
1906
1907      @Override
1908      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1909        switch (hash) {
1910        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1911        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
1912        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1913        case -3386134: /*onAdmission*/ return new String[] {"CodeableConcept"};
1914        default: return super.getTypesForProperty(hash, name);
1915        }
1916
1917      }
1918
1919      @Override
1920      public Base addChild(String name) throws FHIRException {
1921        if (name.equals("sequence")) {
1922          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.diagnosis.sequence");
1923        }
1924        else if (name.equals("diagnosisCodeableConcept")) {
1925          this.diagnosis = new CodeableConcept();
1926          return this.diagnosis;
1927        }
1928        else if (name.equals("diagnosisReference")) {
1929          this.diagnosis = new Reference();
1930          return this.diagnosis;
1931        }
1932        else if (name.equals("type")) {
1933          return addType();
1934        }
1935        else if (name.equals("onAdmission")) {
1936          this.onAdmission = new CodeableConcept();
1937          return this.onAdmission;
1938        }
1939        else
1940          return super.addChild(name);
1941      }
1942
1943      public DiagnosisComponent copy() {
1944        DiagnosisComponent dst = new DiagnosisComponent();
1945        copyValues(dst);
1946        return dst;
1947      }
1948
1949      public void copyValues(DiagnosisComponent dst) {
1950        super.copyValues(dst);
1951        dst.sequence = sequence == null ? null : sequence.copy();
1952        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
1953        if (type != null) {
1954          dst.type = new ArrayList<CodeableConcept>();
1955          for (CodeableConcept i : type)
1956            dst.type.add(i.copy());
1957        };
1958        dst.onAdmission = onAdmission == null ? null : onAdmission.copy();
1959      }
1960
1961      @Override
1962      public boolean equalsDeep(Base other_) {
1963        if (!super.equalsDeep(other_))
1964          return false;
1965        if (!(other_ instanceof DiagnosisComponent))
1966          return false;
1967        DiagnosisComponent o = (DiagnosisComponent) other_;
1968        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(type, o.type, true)
1969           && compareDeep(onAdmission, o.onAdmission, true);
1970      }
1971
1972      @Override
1973      public boolean equalsShallow(Base other_) {
1974        if (!super.equalsShallow(other_))
1975          return false;
1976        if (!(other_ instanceof DiagnosisComponent))
1977          return false;
1978        DiagnosisComponent o = (DiagnosisComponent) other_;
1979        return compareValues(sequence, o.sequence, true);
1980      }
1981
1982      public boolean isEmpty() {
1983        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type
1984          , onAdmission);
1985      }
1986
1987  public String fhirType() {
1988    return "ExplanationOfBenefit.diagnosis";
1989
1990  }
1991
1992  }
1993
1994    @Block()
1995    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
1996        /**
1997         * A number to uniquely identify procedure entries.
1998         */
1999        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2000        @Description(shortDefinition="Procedure instance identifier", formalDefinition="A number to uniquely identify procedure entries." )
2001        protected PositiveIntType sequence;
2002
2003        /**
2004         * When the condition was observed or the relative ranking.
2005         */
2006        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2007        @Description(shortDefinition="Category of Procedure", formalDefinition="When the condition was observed or the relative ranking." )
2008        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-procedure-type")
2009        protected List<CodeableConcept> type;
2010
2011        /**
2012         * Date and optionally time the procedure was performed.
2013         */
2014        @Child(name = "date", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2015        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed." )
2016        protected DateTimeType date;
2017
2018        /**
2019         * The code or reference to a Procedure resource which identifies the clinical intervention performed.
2020         */
2021        @Child(name = "procedure", type = {CodeableConcept.class, Procedure.class}, order=4, min=1, max=1, modifier=false, summary=false)
2022        @Description(shortDefinition="Specific clinical procedure", formalDefinition="The code or reference to a Procedure resource which identifies the clinical intervention performed." )
2023        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10-procedures")
2024        protected DataType procedure;
2025
2026        /**
2027         * Unique Device Identifiers associated with this line item.
2028         */
2029        @Child(name = "udi", type = {Device.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2030        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
2031        protected List<Reference> udi;
2032
2033        private static final long serialVersionUID = 1165684715L;
2034
2035    /**
2036     * Constructor
2037     */
2038      public ProcedureComponent() {
2039        super();
2040      }
2041
2042    /**
2043     * Constructor
2044     */
2045      public ProcedureComponent(int sequence, DataType procedure) {
2046        super();
2047        this.setSequence(sequence);
2048        this.setProcedure(procedure);
2049      }
2050
2051        /**
2052         * @return {@link #sequence} (A number to uniquely identify procedure entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
2053         */
2054        public PositiveIntType getSequenceElement() { 
2055          if (this.sequence == null)
2056            if (Configuration.errorOnAutoCreate())
2057              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2058            else if (Configuration.doAutoCreate())
2059              this.sequence = new PositiveIntType(); // bb
2060          return this.sequence;
2061        }
2062
2063        public boolean hasSequenceElement() { 
2064          return this.sequence != null && !this.sequence.isEmpty();
2065        }
2066
2067        public boolean hasSequence() { 
2068          return this.sequence != null && !this.sequence.isEmpty();
2069        }
2070
2071        /**
2072         * @param value {@link #sequence} (A number to uniquely identify procedure entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
2073         */
2074        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
2075          this.sequence = value;
2076          return this;
2077        }
2078
2079        /**
2080         * @return A number to uniquely identify procedure entries.
2081         */
2082        public int getSequence() { 
2083          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2084        }
2085
2086        /**
2087         * @param value A number to uniquely identify procedure entries.
2088         */
2089        public ProcedureComponent setSequence(int value) { 
2090            if (this.sequence == null)
2091              this.sequence = new PositiveIntType();
2092            this.sequence.setValue(value);
2093          return this;
2094        }
2095
2096        /**
2097         * @return {@link #type} (When the condition was observed or the relative ranking.)
2098         */
2099        public List<CodeableConcept> getType() { 
2100          if (this.type == null)
2101            this.type = new ArrayList<CodeableConcept>();
2102          return this.type;
2103        }
2104
2105        /**
2106         * @return Returns a reference to <code>this</code> for easy method chaining
2107         */
2108        public ProcedureComponent setType(List<CodeableConcept> theType) { 
2109          this.type = theType;
2110          return this;
2111        }
2112
2113        public boolean hasType() { 
2114          if (this.type == null)
2115            return false;
2116          for (CodeableConcept item : this.type)
2117            if (!item.isEmpty())
2118              return true;
2119          return false;
2120        }
2121
2122        public CodeableConcept addType() { //3
2123          CodeableConcept t = new CodeableConcept();
2124          if (this.type == null)
2125            this.type = new ArrayList<CodeableConcept>();
2126          this.type.add(t);
2127          return t;
2128        }
2129
2130        public ProcedureComponent addType(CodeableConcept t) { //3
2131          if (t == null)
2132            return this;
2133          if (this.type == null)
2134            this.type = new ArrayList<CodeableConcept>();
2135          this.type.add(t);
2136          return this;
2137        }
2138
2139        /**
2140         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
2141         */
2142        public CodeableConcept getTypeFirstRep() { 
2143          if (getType().isEmpty()) {
2144            addType();
2145          }
2146          return getType().get(0);
2147        }
2148
2149        /**
2150         * @return {@link #date} (Date and optionally time the procedure was performed.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2151         */
2152        public DateTimeType getDateElement() { 
2153          if (this.date == null)
2154            if (Configuration.errorOnAutoCreate())
2155              throw new Error("Attempt to auto-create ProcedureComponent.date");
2156            else if (Configuration.doAutoCreate())
2157              this.date = new DateTimeType(); // bb
2158          return this.date;
2159        }
2160
2161        public boolean hasDateElement() { 
2162          return this.date != null && !this.date.isEmpty();
2163        }
2164
2165        public boolean hasDate() { 
2166          return this.date != null && !this.date.isEmpty();
2167        }
2168
2169        /**
2170         * @param value {@link #date} (Date and optionally time the procedure was performed.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2171         */
2172        public ProcedureComponent setDateElement(DateTimeType value) { 
2173          this.date = value;
2174          return this;
2175        }
2176
2177        /**
2178         * @return Date and optionally time the procedure was performed.
2179         */
2180        public Date getDate() { 
2181          return this.date == null ? null : this.date.getValue();
2182        }
2183
2184        /**
2185         * @param value Date and optionally time the procedure was performed.
2186         */
2187        public ProcedureComponent setDate(Date value) { 
2188          if (value == null)
2189            this.date = null;
2190          else {
2191            if (this.date == null)
2192              this.date = new DateTimeType();
2193            this.date.setValue(value);
2194          }
2195          return this;
2196        }
2197
2198        /**
2199         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2200         */
2201        public DataType getProcedure() { 
2202          return this.procedure;
2203        }
2204
2205        /**
2206         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2207         */
2208        public CodeableConcept getProcedureCodeableConcept() throws FHIRException { 
2209          if (this.procedure == null)
2210            this.procedure = new CodeableConcept();
2211          if (!(this.procedure instanceof CodeableConcept))
2212            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.procedure.getClass().getName()+" was encountered");
2213          return (CodeableConcept) this.procedure;
2214        }
2215
2216        public boolean hasProcedureCodeableConcept() { 
2217          return this != null && this.procedure instanceof CodeableConcept;
2218        }
2219
2220        /**
2221         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2222         */
2223        public Reference getProcedureReference() throws FHIRException { 
2224          if (this.procedure == null)
2225            this.procedure = new Reference();
2226          if (!(this.procedure instanceof Reference))
2227            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
2228          return (Reference) this.procedure;
2229        }
2230
2231        public boolean hasProcedureReference() { 
2232          return this != null && this.procedure instanceof Reference;
2233        }
2234
2235        public boolean hasProcedure() { 
2236          return this.procedure != null && !this.procedure.isEmpty();
2237        }
2238
2239        /**
2240         * @param value {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2241         */
2242        public ProcedureComponent setProcedure(DataType value) { 
2243          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2244            throw new Error("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: "+value.fhirType());
2245          this.procedure = value;
2246          return this;
2247        }
2248
2249        /**
2250         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
2251         */
2252        public List<Reference> getUdi() { 
2253          if (this.udi == null)
2254            this.udi = new ArrayList<Reference>();
2255          return this.udi;
2256        }
2257
2258        /**
2259         * @return Returns a reference to <code>this</code> for easy method chaining
2260         */
2261        public ProcedureComponent setUdi(List<Reference> theUdi) { 
2262          this.udi = theUdi;
2263          return this;
2264        }
2265
2266        public boolean hasUdi() { 
2267          if (this.udi == null)
2268            return false;
2269          for (Reference item : this.udi)
2270            if (!item.isEmpty())
2271              return true;
2272          return false;
2273        }
2274
2275        public Reference addUdi() { //3
2276          Reference t = new Reference();
2277          if (this.udi == null)
2278            this.udi = new ArrayList<Reference>();
2279          this.udi.add(t);
2280          return t;
2281        }
2282
2283        public ProcedureComponent addUdi(Reference t) { //3
2284          if (t == null)
2285            return this;
2286          if (this.udi == null)
2287            this.udi = new ArrayList<Reference>();
2288          this.udi.add(t);
2289          return this;
2290        }
2291
2292        /**
2293         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
2294         */
2295        public Reference getUdiFirstRep() { 
2296          if (getUdi().isEmpty()) {
2297            addUdi();
2298          }
2299          return getUdi().get(0);
2300        }
2301
2302        protected void listChildren(List<Property> children) {
2303          super.listChildren(children);
2304          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence));
2305          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
2306          children.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date));
2307          children.add(new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure));
2308          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
2309        }
2310
2311        @Override
2312        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2313          switch (_hash) {
2314          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence);
2315          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2316          case 3076014: /*date*/  return new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date);
2317          case 1640074445: /*procedure[x]*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure);
2318          case -1095204141: /*procedure*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure);
2319          case -1284783026: /*procedureCodeableConcept*/  return new Property("procedure[x]", "CodeableConcept", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure);
2320          case 881809848: /*procedureReference*/  return new Property("procedure[x]", "Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure);
2321          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
2322          default: return super.getNamedProperty(_hash, _name, _checkValid);
2323          }
2324
2325        }
2326
2327      @Override
2328      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2329        switch (hash) {
2330        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2331        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2332        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2333        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // DataType
2334        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
2335        default: return super.getProperty(hash, name, checkValid);
2336        }
2337
2338      }
2339
2340      @Override
2341      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2342        switch (hash) {
2343        case 1349547969: // sequence
2344          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
2345          return value;
2346        case 3575610: // type
2347          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2348          return value;
2349        case 3076014: // date
2350          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
2351          return value;
2352        case -1095204141: // procedure
2353          this.procedure = TypeConvertor.castToType(value); // DataType
2354          return value;
2355        case 115642: // udi
2356          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
2357          return value;
2358        default: return super.setProperty(hash, name, value);
2359        }
2360
2361      }
2362
2363      @Override
2364      public Base setProperty(String name, Base value) throws FHIRException {
2365        if (name.equals("sequence")) {
2366          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
2367        } else if (name.equals("type")) {
2368          this.getType().add(TypeConvertor.castToCodeableConcept(value));
2369        } else if (name.equals("date")) {
2370          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
2371        } else if (name.equals("procedure[x]")) {
2372          this.procedure = TypeConvertor.castToType(value); // DataType
2373        } else if (name.equals("udi")) {
2374          this.getUdi().add(TypeConvertor.castToReference(value));
2375        } else
2376          return super.setProperty(name, value);
2377        return value;
2378      }
2379
2380      @Override
2381      public Base makeProperty(int hash, String name) throws FHIRException {
2382        switch (hash) {
2383        case 1349547969:  return getSequenceElement();
2384        case 3575610:  return addType(); 
2385        case 3076014:  return getDateElement();
2386        case 1640074445:  return getProcedure();
2387        case -1095204141:  return getProcedure();
2388        case 115642:  return addUdi(); 
2389        default: return super.makeProperty(hash, name);
2390        }
2391
2392      }
2393
2394      @Override
2395      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2396        switch (hash) {
2397        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2398        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2399        case 3076014: /*date*/ return new String[] {"dateTime"};
2400        case -1095204141: /*procedure*/ return new String[] {"CodeableConcept", "Reference"};
2401        case 115642: /*udi*/ return new String[] {"Reference"};
2402        default: return super.getTypesForProperty(hash, name);
2403        }
2404
2405      }
2406
2407      @Override
2408      public Base addChild(String name) throws FHIRException {
2409        if (name.equals("sequence")) {
2410          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedure.sequence");
2411        }
2412        else if (name.equals("type")) {
2413          return addType();
2414        }
2415        else if (name.equals("date")) {
2416          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedure.date");
2417        }
2418        else if (name.equals("procedureCodeableConcept")) {
2419          this.procedure = new CodeableConcept();
2420          return this.procedure;
2421        }
2422        else if (name.equals("procedureReference")) {
2423          this.procedure = new Reference();
2424          return this.procedure;
2425        }
2426        else if (name.equals("udi")) {
2427          return addUdi();
2428        }
2429        else
2430          return super.addChild(name);
2431      }
2432
2433      public ProcedureComponent copy() {
2434        ProcedureComponent dst = new ProcedureComponent();
2435        copyValues(dst);
2436        return dst;
2437      }
2438
2439      public void copyValues(ProcedureComponent dst) {
2440        super.copyValues(dst);
2441        dst.sequence = sequence == null ? null : sequence.copy();
2442        if (type != null) {
2443          dst.type = new ArrayList<CodeableConcept>();
2444          for (CodeableConcept i : type)
2445            dst.type.add(i.copy());
2446        };
2447        dst.date = date == null ? null : date.copy();
2448        dst.procedure = procedure == null ? null : procedure.copy();
2449        if (udi != null) {
2450          dst.udi = new ArrayList<Reference>();
2451          for (Reference i : udi)
2452            dst.udi.add(i.copy());
2453        };
2454      }
2455
2456      @Override
2457      public boolean equalsDeep(Base other_) {
2458        if (!super.equalsDeep(other_))
2459          return false;
2460        if (!(other_ instanceof ProcedureComponent))
2461          return false;
2462        ProcedureComponent o = (ProcedureComponent) other_;
2463        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(date, o.date, true)
2464           && compareDeep(procedure, o.procedure, true) && compareDeep(udi, o.udi, true);
2465      }
2466
2467      @Override
2468      public boolean equalsShallow(Base other_) {
2469        if (!super.equalsShallow(other_))
2470          return false;
2471        if (!(other_ instanceof ProcedureComponent))
2472          return false;
2473        ProcedureComponent o = (ProcedureComponent) other_;
2474        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
2475      }
2476
2477      public boolean isEmpty() {
2478        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, date, procedure
2479          , udi);
2480      }
2481
2482  public String fhirType() {
2483    return "ExplanationOfBenefit.procedure";
2484
2485  }
2486
2487  }
2488
2489    @Block()
2490    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
2491        /**
2492         * A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2493         */
2494        @Child(name = "focal", type = {BooleanType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2495        @Description(shortDefinition="Coverage to be used for adjudication", formalDefinition="A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true." )
2496        protected BooleanType focal;
2497
2498        /**
2499         * Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.
2500         */
2501        @Child(name = "coverage", type = {Coverage.class}, order=2, min=1, max=1, modifier=false, summary=true)
2502        @Description(shortDefinition="Insurance information", formalDefinition="Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system." )
2503        protected Reference coverage;
2504
2505        /**
2506         * Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.
2507         */
2508        @Child(name = "preAuthRef", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2509        @Description(shortDefinition="Prior authorization reference number", formalDefinition="Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization." )
2510        protected List<StringType> preAuthRef;
2511
2512        private static final long serialVersionUID = 1519900285L;
2513
2514    /**
2515     * Constructor
2516     */
2517      public InsuranceComponent() {
2518        super();
2519      }
2520
2521    /**
2522     * Constructor
2523     */
2524      public InsuranceComponent(boolean focal, Reference coverage) {
2525        super();
2526        this.setFocal(focal);
2527        this.setCoverage(coverage);
2528      }
2529
2530        /**
2531         * @return {@link #focal} (A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.). This is the underlying object with id, value and extensions. The accessor "getFocal" gives direct access to the value
2532         */
2533        public BooleanType getFocalElement() { 
2534          if (this.focal == null)
2535            if (Configuration.errorOnAutoCreate())
2536              throw new Error("Attempt to auto-create InsuranceComponent.focal");
2537            else if (Configuration.doAutoCreate())
2538              this.focal = new BooleanType(); // bb
2539          return this.focal;
2540        }
2541
2542        public boolean hasFocalElement() { 
2543          return this.focal != null && !this.focal.isEmpty();
2544        }
2545
2546        public boolean hasFocal() { 
2547          return this.focal != null && !this.focal.isEmpty();
2548        }
2549
2550        /**
2551         * @param value {@link #focal} (A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.). This is the underlying object with id, value and extensions. The accessor "getFocal" gives direct access to the value
2552         */
2553        public InsuranceComponent setFocalElement(BooleanType value) { 
2554          this.focal = value;
2555          return this;
2556        }
2557
2558        /**
2559         * @return A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2560         */
2561        public boolean getFocal() { 
2562          return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
2563        }
2564
2565        /**
2566         * @param value A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2567         */
2568        public InsuranceComponent setFocal(boolean value) { 
2569            if (this.focal == null)
2570              this.focal = new BooleanType();
2571            this.focal.setValue(value);
2572          return this;
2573        }
2574
2575        /**
2576         * @return {@link #coverage} (Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.)
2577         */
2578        public Reference getCoverage() { 
2579          if (this.coverage == null)
2580            if (Configuration.errorOnAutoCreate())
2581              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2582            else if (Configuration.doAutoCreate())
2583              this.coverage = new Reference(); // cc
2584          return this.coverage;
2585        }
2586
2587        public boolean hasCoverage() { 
2588          return this.coverage != null && !this.coverage.isEmpty();
2589        }
2590
2591        /**
2592         * @param value {@link #coverage} (Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.)
2593         */
2594        public InsuranceComponent setCoverage(Reference value) { 
2595          this.coverage = value;
2596          return this;
2597        }
2598
2599        /**
2600         * @return {@link #preAuthRef} (Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.)
2601         */
2602        public List<StringType> getPreAuthRef() { 
2603          if (this.preAuthRef == null)
2604            this.preAuthRef = new ArrayList<StringType>();
2605          return this.preAuthRef;
2606        }
2607
2608        /**
2609         * @return Returns a reference to <code>this</code> for easy method chaining
2610         */
2611        public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) { 
2612          this.preAuthRef = thePreAuthRef;
2613          return this;
2614        }
2615
2616        public boolean hasPreAuthRef() { 
2617          if (this.preAuthRef == null)
2618            return false;
2619          for (StringType item : this.preAuthRef)
2620            if (!item.isEmpty())
2621              return true;
2622          return false;
2623        }
2624
2625        /**
2626         * @return {@link #preAuthRef} (Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.)
2627         */
2628        public StringType addPreAuthRefElement() {//2 
2629          StringType t = new StringType();
2630          if (this.preAuthRef == null)
2631            this.preAuthRef = new ArrayList<StringType>();
2632          this.preAuthRef.add(t);
2633          return t;
2634        }
2635
2636        /**
2637         * @param value {@link #preAuthRef} (Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.)
2638         */
2639        public InsuranceComponent addPreAuthRef(String value) { //1
2640          StringType t = new StringType();
2641          t.setValue(value);
2642          if (this.preAuthRef == null)
2643            this.preAuthRef = new ArrayList<StringType>();
2644          this.preAuthRef.add(t);
2645          return this;
2646        }
2647
2648        /**
2649         * @param value {@link #preAuthRef} (Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.)
2650         */
2651        public boolean hasPreAuthRef(String value) { 
2652          if (this.preAuthRef == null)
2653            return false;
2654          for (StringType v : this.preAuthRef)
2655            if (v.getValue().equals(value)) // string
2656              return true;
2657          return false;
2658        }
2659
2660        protected void listChildren(List<Property> children) {
2661          super.listChildren(children);
2662          children.add(new Property("focal", "boolean", "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0, 1, focal));
2663          children.add(new Property("coverage", "Reference(Coverage)", "Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.", 0, 1, coverage));
2664          children.add(new Property("preAuthRef", "string", "Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.", 0, java.lang.Integer.MAX_VALUE, preAuthRef));
2665        }
2666
2667        @Override
2668        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2669          switch (_hash) {
2670          case 97604197: /*focal*/  return new Property("focal", "boolean", "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0, 1, focal);
2671          case -351767064: /*coverage*/  return new Property("coverage", "Reference(Coverage)", "Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.", 0, 1, coverage);
2672          case 522246568: /*preAuthRef*/  return new Property("preAuthRef", "string", "Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.", 0, java.lang.Integer.MAX_VALUE, preAuthRef);
2673          default: return super.getNamedProperty(_hash, _name, _checkValid);
2674          }
2675
2676        }
2677
2678      @Override
2679      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2680        switch (hash) {
2681        case 97604197: /*focal*/ return this.focal == null ? new Base[0] : new Base[] {this.focal}; // BooleanType
2682        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
2683        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
2684        default: return super.getProperty(hash, name, checkValid);
2685        }
2686
2687      }
2688
2689      @Override
2690      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2691        switch (hash) {
2692        case 97604197: // focal
2693          this.focal = TypeConvertor.castToBoolean(value); // BooleanType
2694          return value;
2695        case -351767064: // coverage
2696          this.coverage = TypeConvertor.castToReference(value); // Reference
2697          return value;
2698        case 522246568: // preAuthRef
2699          this.getPreAuthRef().add(TypeConvertor.castToString(value)); // StringType
2700          return value;
2701        default: return super.setProperty(hash, name, value);
2702        }
2703
2704      }
2705
2706      @Override
2707      public Base setProperty(String name, Base value) throws FHIRException {
2708        if (name.equals("focal")) {
2709          this.focal = TypeConvertor.castToBoolean(value); // BooleanType
2710        } else if (name.equals("coverage")) {
2711          this.coverage = TypeConvertor.castToReference(value); // Reference
2712        } else if (name.equals("preAuthRef")) {
2713          this.getPreAuthRef().add(TypeConvertor.castToString(value));
2714        } else
2715          return super.setProperty(name, value);
2716        return value;
2717      }
2718
2719      @Override
2720      public Base makeProperty(int hash, String name) throws FHIRException {
2721        switch (hash) {
2722        case 97604197:  return getFocalElement();
2723        case -351767064:  return getCoverage();
2724        case 522246568:  return addPreAuthRefElement();
2725        default: return super.makeProperty(hash, name);
2726        }
2727
2728      }
2729
2730      @Override
2731      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2732        switch (hash) {
2733        case 97604197: /*focal*/ return new String[] {"boolean"};
2734        case -351767064: /*coverage*/ return new String[] {"Reference"};
2735        case 522246568: /*preAuthRef*/ return new String[] {"string"};
2736        default: return super.getTypesForProperty(hash, name);
2737        }
2738
2739      }
2740
2741      @Override
2742      public Base addChild(String name) throws FHIRException {
2743        if (name.equals("focal")) {
2744          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.insurance.focal");
2745        }
2746        else if (name.equals("coverage")) {
2747          this.coverage = new Reference();
2748          return this.coverage;
2749        }
2750        else if (name.equals("preAuthRef")) {
2751          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.insurance.preAuthRef");
2752        }
2753        else
2754          return super.addChild(name);
2755      }
2756
2757      public InsuranceComponent copy() {
2758        InsuranceComponent dst = new InsuranceComponent();
2759        copyValues(dst);
2760        return dst;
2761      }
2762
2763      public void copyValues(InsuranceComponent dst) {
2764        super.copyValues(dst);
2765        dst.focal = focal == null ? null : focal.copy();
2766        dst.coverage = coverage == null ? null : coverage.copy();
2767        if (preAuthRef != null) {
2768          dst.preAuthRef = new ArrayList<StringType>();
2769          for (StringType i : preAuthRef)
2770            dst.preAuthRef.add(i.copy());
2771        };
2772      }
2773
2774      @Override
2775      public boolean equalsDeep(Base other_) {
2776        if (!super.equalsDeep(other_))
2777          return false;
2778        if (!(other_ instanceof InsuranceComponent))
2779          return false;
2780        InsuranceComponent o = (InsuranceComponent) other_;
2781        return compareDeep(focal, o.focal, true) && compareDeep(coverage, o.coverage, true) && compareDeep(preAuthRef, o.preAuthRef, true)
2782          ;
2783      }
2784
2785      @Override
2786      public boolean equalsShallow(Base other_) {
2787        if (!super.equalsShallow(other_))
2788          return false;
2789        if (!(other_ instanceof InsuranceComponent))
2790          return false;
2791        InsuranceComponent o = (InsuranceComponent) other_;
2792        return compareValues(focal, o.focal, true) && compareValues(preAuthRef, o.preAuthRef, true);
2793      }
2794
2795      public boolean isEmpty() {
2796        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(focal, coverage, preAuthRef
2797          );
2798      }
2799
2800  public String fhirType() {
2801    return "ExplanationOfBenefit.insurance";
2802
2803  }
2804
2805  }
2806
2807    @Block()
2808    public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
2809        /**
2810         * Date of an accident event  related to the products and services contained in the claim.
2811         */
2812        @Child(name = "date", type = {DateType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2813        @Description(shortDefinition="When the incident occurred", formalDefinition="Date of an accident event  related to the products and services contained in the claim." )
2814        protected DateType date;
2815
2816        /**
2817         * The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.
2818         */
2819        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
2820        @Description(shortDefinition="The nature of the accident", formalDefinition="The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers." )
2821        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActIncidentCode")
2822        protected CodeableConcept type;
2823
2824        /**
2825         * The physical location of the accident event.
2826         */
2827        @Child(name = "location", type = {Address.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=false)
2828        @Description(shortDefinition="Where the event occurred", formalDefinition="The physical location of the accident event." )
2829        protected DataType location;
2830
2831        private static final long serialVersionUID = 11882722L;
2832
2833    /**
2834     * Constructor
2835     */
2836      public AccidentComponent() {
2837        super();
2838      }
2839
2840        /**
2841         * @return {@link #date} (Date of an accident event  related to the products and services contained in the claim.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2842         */
2843        public DateType getDateElement() { 
2844          if (this.date == null)
2845            if (Configuration.errorOnAutoCreate())
2846              throw new Error("Attempt to auto-create AccidentComponent.date");
2847            else if (Configuration.doAutoCreate())
2848              this.date = new DateType(); // bb
2849          return this.date;
2850        }
2851
2852        public boolean hasDateElement() { 
2853          return this.date != null && !this.date.isEmpty();
2854        }
2855
2856        public boolean hasDate() { 
2857          return this.date != null && !this.date.isEmpty();
2858        }
2859
2860        /**
2861         * @param value {@link #date} (Date of an accident event  related to the products and services contained in the claim.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2862         */
2863        public AccidentComponent setDateElement(DateType value) { 
2864          this.date = value;
2865          return this;
2866        }
2867
2868        /**
2869         * @return Date of an accident event  related to the products and services contained in the claim.
2870         */
2871        public Date getDate() { 
2872          return this.date == null ? null : this.date.getValue();
2873        }
2874
2875        /**
2876         * @param value Date of an accident event  related to the products and services contained in the claim.
2877         */
2878        public AccidentComponent setDate(Date value) { 
2879          if (value == null)
2880            this.date = null;
2881          else {
2882            if (this.date == null)
2883              this.date = new DateType();
2884            this.date.setValue(value);
2885          }
2886          return this;
2887        }
2888
2889        /**
2890         * @return {@link #type} (The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.)
2891         */
2892        public CodeableConcept getType() { 
2893          if (this.type == null)
2894            if (Configuration.errorOnAutoCreate())
2895              throw new Error("Attempt to auto-create AccidentComponent.type");
2896            else if (Configuration.doAutoCreate())
2897              this.type = new CodeableConcept(); // cc
2898          return this.type;
2899        }
2900
2901        public boolean hasType() { 
2902          return this.type != null && !this.type.isEmpty();
2903        }
2904
2905        /**
2906         * @param value {@link #type} (The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.)
2907         */
2908        public AccidentComponent setType(CodeableConcept value) { 
2909          this.type = value;
2910          return this;
2911        }
2912
2913        /**
2914         * @return {@link #location} (The physical location of the accident event.)
2915         */
2916        public DataType getLocation() { 
2917          return this.location;
2918        }
2919
2920        /**
2921         * @return {@link #location} (The physical location of the accident event.)
2922         */
2923        public Address getLocationAddress() throws FHIRException { 
2924          if (this.location == null)
2925            this.location = new Address();
2926          if (!(this.location instanceof Address))
2927            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
2928          return (Address) this.location;
2929        }
2930
2931        public boolean hasLocationAddress() { 
2932          return this != null && this.location instanceof Address;
2933        }
2934
2935        /**
2936         * @return {@link #location} (The physical location of the accident event.)
2937         */
2938        public Reference getLocationReference() throws FHIRException { 
2939          if (this.location == null)
2940            this.location = new Reference();
2941          if (!(this.location instanceof Reference))
2942            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
2943          return (Reference) this.location;
2944        }
2945
2946        public boolean hasLocationReference() { 
2947          return this != null && this.location instanceof Reference;
2948        }
2949
2950        public boolean hasLocation() { 
2951          return this.location != null && !this.location.isEmpty();
2952        }
2953
2954        /**
2955         * @param value {@link #location} (The physical location of the accident event.)
2956         */
2957        public AccidentComponent setLocation(DataType value) { 
2958          if (value != null && !(value instanceof Address || value instanceof Reference))
2959            throw new Error("Not the right type for ExplanationOfBenefit.accident.location[x]: "+value.fhirType());
2960          this.location = value;
2961          return this;
2962        }
2963
2964        protected void listChildren(List<Property> children) {
2965          super.listChildren(children);
2966          children.add(new Property("date", "date", "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date));
2967          children.add(new Property("type", "CodeableConcept", "The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.", 0, 1, type));
2968          children.add(new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location));
2969        }
2970
2971        @Override
2972        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2973          switch (_hash) {
2974          case 3076014: /*date*/  return new Property("date", "date", "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date);
2975          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.", 0, 1, type);
2976          case 552316075: /*location[x]*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
2977          case 1901043637: /*location*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
2978          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address", "The physical location of the accident event.", 0, 1, location);
2979          case 755866390: /*locationReference*/  return new Property("location[x]", "Reference(Location)", "The physical location of the accident event.", 0, 1, location);
2980          default: return super.getNamedProperty(_hash, _name, _checkValid);
2981          }
2982
2983        }
2984
2985      @Override
2986      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2987        switch (hash) {
2988        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
2989        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2990        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // DataType
2991        default: return super.getProperty(hash, name, checkValid);
2992        }
2993
2994      }
2995
2996      @Override
2997      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2998        switch (hash) {
2999        case 3076014: // date
3000          this.date = TypeConvertor.castToDate(value); // DateType
3001          return value;
3002        case 3575610: // type
3003          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3004          return value;
3005        case 1901043637: // location
3006          this.location = TypeConvertor.castToType(value); // DataType
3007          return value;
3008        default: return super.setProperty(hash, name, value);
3009        }
3010
3011      }
3012
3013      @Override
3014      public Base setProperty(String name, Base value) throws FHIRException {
3015        if (name.equals("date")) {
3016          this.date = TypeConvertor.castToDate(value); // DateType
3017        } else if (name.equals("type")) {
3018          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3019        } else if (name.equals("location[x]")) {
3020          this.location = TypeConvertor.castToType(value); // DataType
3021        } else
3022          return super.setProperty(name, value);
3023        return value;
3024      }
3025
3026      @Override
3027      public Base makeProperty(int hash, String name) throws FHIRException {
3028        switch (hash) {
3029        case 3076014:  return getDateElement();
3030        case 3575610:  return getType();
3031        case 552316075:  return getLocation();
3032        case 1901043637:  return getLocation();
3033        default: return super.makeProperty(hash, name);
3034        }
3035
3036      }
3037
3038      @Override
3039      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3040        switch (hash) {
3041        case 3076014: /*date*/ return new String[] {"date"};
3042        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3043        case 1901043637: /*location*/ return new String[] {"Address", "Reference"};
3044        default: return super.getTypesForProperty(hash, name);
3045        }
3046
3047      }
3048
3049      @Override
3050      public Base addChild(String name) throws FHIRException {
3051        if (name.equals("date")) {
3052          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.accident.date");
3053        }
3054        else if (name.equals("type")) {
3055          this.type = new CodeableConcept();
3056          return this.type;
3057        }
3058        else if (name.equals("locationAddress")) {
3059          this.location = new Address();
3060          return this.location;
3061        }
3062        else if (name.equals("locationReference")) {
3063          this.location = new Reference();
3064          return this.location;
3065        }
3066        else
3067          return super.addChild(name);
3068      }
3069
3070      public AccidentComponent copy() {
3071        AccidentComponent dst = new AccidentComponent();
3072        copyValues(dst);
3073        return dst;
3074      }
3075
3076      public void copyValues(AccidentComponent dst) {
3077        super.copyValues(dst);
3078        dst.date = date == null ? null : date.copy();
3079        dst.type = type == null ? null : type.copy();
3080        dst.location = location == null ? null : location.copy();
3081      }
3082
3083      @Override
3084      public boolean equalsDeep(Base other_) {
3085        if (!super.equalsDeep(other_))
3086          return false;
3087        if (!(other_ instanceof AccidentComponent))
3088          return false;
3089        AccidentComponent o = (AccidentComponent) other_;
3090        return compareDeep(date, o.date, true) && compareDeep(type, o.type, true) && compareDeep(location, o.location, true)
3091          ;
3092      }
3093
3094      @Override
3095      public boolean equalsShallow(Base other_) {
3096        if (!super.equalsShallow(other_))
3097          return false;
3098        if (!(other_ instanceof AccidentComponent))
3099          return false;
3100        AccidentComponent o = (AccidentComponent) other_;
3101        return compareValues(date, o.date, true);
3102      }
3103
3104      public boolean isEmpty() {
3105        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
3106      }
3107
3108  public String fhirType() {
3109    return "ExplanationOfBenefit.accident";
3110
3111  }
3112
3113  }
3114
3115    @Block()
3116    public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
3117        /**
3118         * A number to uniquely identify item entries.
3119         */
3120        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
3121        @Description(shortDefinition="Item instance identifier", formalDefinition="A number to uniquely identify item entries." )
3122        protected PositiveIntType sequence;
3123
3124        /**
3125         * Care team members related to this service or product.
3126         */
3127        @Child(name = "careTeamSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3128        @Description(shortDefinition="Applicable care team members", formalDefinition="Care team members related to this service or product." )
3129        protected List<PositiveIntType> careTeamSequence;
3130
3131        /**
3132         * Diagnoses applicable for this service or product.
3133         */
3134        @Child(name = "diagnosisSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3135        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnoses applicable for this service or product." )
3136        protected List<PositiveIntType> diagnosisSequence;
3137
3138        /**
3139         * Procedures applicable for this service or product.
3140         */
3141        @Child(name = "procedureSequence", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3142        @Description(shortDefinition="Applicable procedures", formalDefinition="Procedures applicable for this service or product." )
3143        protected List<PositiveIntType> procedureSequence;
3144
3145        /**
3146         * Exceptions, special conditions and supporting information applicable for this service or product.
3147         */
3148        @Child(name = "informationSequence", type = {PositiveIntType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3149        @Description(shortDefinition="Applicable exception and supporting information", formalDefinition="Exceptions, special conditions and supporting information applicable for this service or product." )
3150        protected List<PositiveIntType> informationSequence;
3151
3152        /**
3153         * The type of revenue or cost center providing the product and/or service.
3154         */
3155        @Child(name = "revenue", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
3156        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
3157        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
3158        protected CodeableConcept revenue;
3159
3160        /**
3161         * Code to identify the general type of benefits under which products and services are provided.
3162         */
3163        @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
3164        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
3165        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
3166        protected CodeableConcept category;
3167
3168        /**
3169         * When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.
3170         */
3171        @Child(name = "productOrService", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
3172        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used." )
3173        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
3174        protected CodeableConcept productOrService;
3175
3176        /**
3177         * This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.
3178         */
3179        @Child(name = "productOrServiceEnd", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=false)
3180        @Description(shortDefinition="End of a range of codes", formalDefinition="This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims." )
3181        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
3182        protected CodeableConcept productOrServiceEnd;
3183
3184        /**
3185         * Item typification or modifiers codes to convey additional context for the product or service.
3186         */
3187        @Child(name = "modifier", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3188        @Description(shortDefinition="Product or service billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
3189        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
3190        protected List<CodeableConcept> modifier;
3191
3192        /**
3193         * Identifies the program under which this may be recovered.
3194         */
3195        @Child(name = "programCode", type = {CodeableConcept.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3196        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
3197        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
3198        protected List<CodeableConcept> programCode;
3199
3200        /**
3201         * The date or dates when the service or product was supplied, performed or completed.
3202         */
3203        @Child(name = "serviced", type = {DateType.class, Period.class}, order=12, min=0, max=1, modifier=false, summary=false)
3204        @Description(shortDefinition="Date or dates of service or product delivery", formalDefinition="The date or dates when the service or product was supplied, performed or completed." )
3205        protected DataType serviced;
3206
3207        /**
3208         * Where the product or service was provided.
3209         */
3210        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=13, min=0, max=1, modifier=false, summary=false)
3211        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
3212        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
3213        protected DataType location;
3214
3215        /**
3216         * The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.
3217         */
3218        @Child(name = "patientPaid", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
3219        @Description(shortDefinition="Paid by the patient", formalDefinition="The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services." )
3220        protected Money patientPaid;
3221
3222        /**
3223         * The number of repetitions of a service or product.
3224         */
3225        @Child(name = "quantity", type = {Quantity.class}, order=15, min=0, max=1, modifier=false, summary=false)
3226        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
3227        protected Quantity quantity;
3228
3229        /**
3230         * If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.
3231         */
3232        @Child(name = "unitPrice", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
3233        @Description(shortDefinition="Fee, charge or cost per item", formalDefinition="If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group." )
3234        protected Money unitPrice;
3235
3236        /**
3237         * 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.
3238         */
3239        @Child(name = "factor", type = {DecimalType.class}, order=17, min=0, max=1, modifier=false, summary=false)
3240        @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." )
3241        protected DecimalType factor;
3242
3243        /**
3244         * The total of taxes applicable for this product or service.
3245         */
3246        @Child(name = "tax", type = {Money.class}, order=18, min=0, max=1, modifier=false, summary=false)
3247        @Description(shortDefinition="Total tax", formalDefinition="The total of taxes applicable for this product or service." )
3248        protected Money tax;
3249
3250        /**
3251         * The quantity times the unit price for an additional service or product or charge.
3252         */
3253        @Child(name = "net", type = {Money.class}, order=19, min=0, max=1, modifier=false, summary=false)
3254        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
3255        protected Money net;
3256
3257        /**
3258         * Unique Device Identifiers associated with this line item.
3259         */
3260        @Child(name = "udi", type = {Device.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3261        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
3262        protected List<Reference> udi;
3263
3264        /**
3265         * Physical location where the service is performed or applies.
3266         */
3267        @Child(name = "bodySite", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3268        @Description(shortDefinition="Anatomical location", formalDefinition="Physical location where the service is performed or applies." )
3269        protected List<BodySiteComponent> bodySite;
3270
3271        /**
3272         * A billed item may include goods or services provided in multiple encounters.
3273         */
3274        @Child(name = "encounter", type = {Encounter.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3275        @Description(shortDefinition="Encounters related to this billed item", formalDefinition="A billed item may include goods or services provided in multiple encounters." )
3276        protected List<Reference> encounter;
3277
3278        /**
3279         * The numbers associated with notes below which apply to the adjudication of this item.
3280         */
3281        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3282        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
3283        protected List<PositiveIntType> noteNumber;
3284
3285        /**
3286         * The result of the claim, predetermination, or preauthorization adjudication.
3287         */
3288        @Child(name = "decision", type = {CodeableConcept.class}, order=24, min=0, max=1, modifier=false, summary=false)
3289        @Description(shortDefinition="Result of the adjudication", formalDefinition="The result of the claim, predetermination, or preauthorization adjudication." )
3290        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-decision")
3291        protected CodeableConcept decision;
3292
3293        /**
3294         * If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.
3295         */
3296        @Child(name = "adjudication", type = {}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3297        @Description(shortDefinition="Adjudication details", formalDefinition="If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item." )
3298        protected List<AdjudicationComponent> adjudication;
3299
3300        /**
3301         * Second-tier of goods and services.
3302         */
3303        @Child(name = "detail", type = {}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3304        @Description(shortDefinition="Additional items", formalDefinition="Second-tier of goods and services." )
3305        protected List<DetailComponent> detail;
3306
3307        private static final long serialVersionUID = -1358223284L;
3308
3309    /**
3310     * Constructor
3311     */
3312      public ItemComponent() {
3313        super();
3314      }
3315
3316    /**
3317     * Constructor
3318     */
3319      public ItemComponent(int sequence) {
3320        super();
3321        this.setSequence(sequence);
3322      }
3323
3324        /**
3325         * @return {@link #sequence} (A number to uniquely identify item entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
3326         */
3327        public PositiveIntType getSequenceElement() { 
3328          if (this.sequence == null)
3329            if (Configuration.errorOnAutoCreate())
3330              throw new Error("Attempt to auto-create ItemComponent.sequence");
3331            else if (Configuration.doAutoCreate())
3332              this.sequence = new PositiveIntType(); // bb
3333          return this.sequence;
3334        }
3335
3336        public boolean hasSequenceElement() { 
3337          return this.sequence != null && !this.sequence.isEmpty();
3338        }
3339
3340        public boolean hasSequence() { 
3341          return this.sequence != null && !this.sequence.isEmpty();
3342        }
3343
3344        /**
3345         * @param value {@link #sequence} (A number to uniquely identify item entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
3346         */
3347        public ItemComponent setSequenceElement(PositiveIntType value) { 
3348          this.sequence = value;
3349          return this;
3350        }
3351
3352        /**
3353         * @return A number to uniquely identify item entries.
3354         */
3355        public int getSequence() { 
3356          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3357        }
3358
3359        /**
3360         * @param value A number to uniquely identify item entries.
3361         */
3362        public ItemComponent setSequence(int value) { 
3363            if (this.sequence == null)
3364              this.sequence = new PositiveIntType();
3365            this.sequence.setValue(value);
3366          return this;
3367        }
3368
3369        /**
3370         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3371         */
3372        public List<PositiveIntType> getCareTeamSequence() { 
3373          if (this.careTeamSequence == null)
3374            this.careTeamSequence = new ArrayList<PositiveIntType>();
3375          return this.careTeamSequence;
3376        }
3377
3378        /**
3379         * @return Returns a reference to <code>this</code> for easy method chaining
3380         */
3381        public ItemComponent setCareTeamSequence(List<PositiveIntType> theCareTeamSequence) { 
3382          this.careTeamSequence = theCareTeamSequence;
3383          return this;
3384        }
3385
3386        public boolean hasCareTeamSequence() { 
3387          if (this.careTeamSequence == null)
3388            return false;
3389          for (PositiveIntType item : this.careTeamSequence)
3390            if (!item.isEmpty())
3391              return true;
3392          return false;
3393        }
3394
3395        /**
3396         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3397         */
3398        public PositiveIntType addCareTeamSequenceElement() {//2 
3399          PositiveIntType t = new PositiveIntType();
3400          if (this.careTeamSequence == null)
3401            this.careTeamSequence = new ArrayList<PositiveIntType>();
3402          this.careTeamSequence.add(t);
3403          return t;
3404        }
3405
3406        /**
3407         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3408         */
3409        public ItemComponent addCareTeamSequence(int value) { //1
3410          PositiveIntType t = new PositiveIntType();
3411          t.setValue(value);
3412          if (this.careTeamSequence == null)
3413            this.careTeamSequence = new ArrayList<PositiveIntType>();
3414          this.careTeamSequence.add(t);
3415          return this;
3416        }
3417
3418        /**
3419         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3420         */
3421        public boolean hasCareTeamSequence(int value) { 
3422          if (this.careTeamSequence == null)
3423            return false;
3424          for (PositiveIntType v : this.careTeamSequence)
3425            if (v.getValue().equals(value)) // positiveInt
3426              return true;
3427          return false;
3428        }
3429
3430        /**
3431         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3432         */
3433        public List<PositiveIntType> getDiagnosisSequence() { 
3434          if (this.diagnosisSequence == null)
3435            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3436          return this.diagnosisSequence;
3437        }
3438
3439        /**
3440         * @return Returns a reference to <code>this</code> for easy method chaining
3441         */
3442        public ItemComponent setDiagnosisSequence(List<PositiveIntType> theDiagnosisSequence) { 
3443          this.diagnosisSequence = theDiagnosisSequence;
3444          return this;
3445        }
3446
3447        public boolean hasDiagnosisSequence() { 
3448          if (this.diagnosisSequence == null)
3449            return false;
3450          for (PositiveIntType item : this.diagnosisSequence)
3451            if (!item.isEmpty())
3452              return true;
3453          return false;
3454        }
3455
3456        /**
3457         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3458         */
3459        public PositiveIntType addDiagnosisSequenceElement() {//2 
3460          PositiveIntType t = new PositiveIntType();
3461          if (this.diagnosisSequence == null)
3462            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3463          this.diagnosisSequence.add(t);
3464          return t;
3465        }
3466
3467        /**
3468         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3469         */
3470        public ItemComponent addDiagnosisSequence(int value) { //1
3471          PositiveIntType t = new PositiveIntType();
3472          t.setValue(value);
3473          if (this.diagnosisSequence == null)
3474            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3475          this.diagnosisSequence.add(t);
3476          return this;
3477        }
3478
3479        /**
3480         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3481         */
3482        public boolean hasDiagnosisSequence(int value) { 
3483          if (this.diagnosisSequence == null)
3484            return false;
3485          for (PositiveIntType v : this.diagnosisSequence)
3486            if (v.getValue().equals(value)) // positiveInt
3487              return true;
3488          return false;
3489        }
3490
3491        /**
3492         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3493         */
3494        public List<PositiveIntType> getProcedureSequence() { 
3495          if (this.procedureSequence == null)
3496            this.procedureSequence = new ArrayList<PositiveIntType>();
3497          return this.procedureSequence;
3498        }
3499
3500        /**
3501         * @return Returns a reference to <code>this</code> for easy method chaining
3502         */
3503        public ItemComponent setProcedureSequence(List<PositiveIntType> theProcedureSequence) { 
3504          this.procedureSequence = theProcedureSequence;
3505          return this;
3506        }
3507
3508        public boolean hasProcedureSequence() { 
3509          if (this.procedureSequence == null)
3510            return false;
3511          for (PositiveIntType item : this.procedureSequence)
3512            if (!item.isEmpty())
3513              return true;
3514          return false;
3515        }
3516
3517        /**
3518         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3519         */
3520        public PositiveIntType addProcedureSequenceElement() {//2 
3521          PositiveIntType t = new PositiveIntType();
3522          if (this.procedureSequence == null)
3523            this.procedureSequence = new ArrayList<PositiveIntType>();
3524          this.procedureSequence.add(t);
3525          return t;
3526        }
3527
3528        /**
3529         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3530         */
3531        public ItemComponent addProcedureSequence(int value) { //1
3532          PositiveIntType t = new PositiveIntType();
3533          t.setValue(value);
3534          if (this.procedureSequence == null)
3535            this.procedureSequence = new ArrayList<PositiveIntType>();
3536          this.procedureSequence.add(t);
3537          return this;
3538        }
3539
3540        /**
3541         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3542         */
3543        public boolean hasProcedureSequence(int value) { 
3544          if (this.procedureSequence == null)
3545            return false;
3546          for (PositiveIntType v : this.procedureSequence)
3547            if (v.getValue().equals(value)) // positiveInt
3548              return true;
3549          return false;
3550        }
3551
3552        /**
3553         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3554         */
3555        public List<PositiveIntType> getInformationSequence() { 
3556          if (this.informationSequence == null)
3557            this.informationSequence = new ArrayList<PositiveIntType>();
3558          return this.informationSequence;
3559        }
3560
3561        /**
3562         * @return Returns a reference to <code>this</code> for easy method chaining
3563         */
3564        public ItemComponent setInformationSequence(List<PositiveIntType> theInformationSequence) { 
3565          this.informationSequence = theInformationSequence;
3566          return this;
3567        }
3568
3569        public boolean hasInformationSequence() { 
3570          if (this.informationSequence == null)
3571            return false;
3572          for (PositiveIntType item : this.informationSequence)
3573            if (!item.isEmpty())
3574              return true;
3575          return false;
3576        }
3577
3578        /**
3579         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3580         */
3581        public PositiveIntType addInformationSequenceElement() {//2 
3582          PositiveIntType t = new PositiveIntType();
3583          if (this.informationSequence == null)
3584            this.informationSequence = new ArrayList<PositiveIntType>();
3585          this.informationSequence.add(t);
3586          return t;
3587        }
3588
3589        /**
3590         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3591         */
3592        public ItemComponent addInformationSequence(int value) { //1
3593          PositiveIntType t = new PositiveIntType();
3594          t.setValue(value);
3595          if (this.informationSequence == null)
3596            this.informationSequence = new ArrayList<PositiveIntType>();
3597          this.informationSequence.add(t);
3598          return this;
3599        }
3600
3601        /**
3602         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3603         */
3604        public boolean hasInformationSequence(int value) { 
3605          if (this.informationSequence == null)
3606            return false;
3607          for (PositiveIntType v : this.informationSequence)
3608            if (v.getValue().equals(value)) // positiveInt
3609              return true;
3610          return false;
3611        }
3612
3613        /**
3614         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3615         */
3616        public CodeableConcept getRevenue() { 
3617          if (this.revenue == null)
3618            if (Configuration.errorOnAutoCreate())
3619              throw new Error("Attempt to auto-create ItemComponent.revenue");
3620            else if (Configuration.doAutoCreate())
3621              this.revenue = new CodeableConcept(); // cc
3622          return this.revenue;
3623        }
3624
3625        public boolean hasRevenue() { 
3626          return this.revenue != null && !this.revenue.isEmpty();
3627        }
3628
3629        /**
3630         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3631         */
3632        public ItemComponent setRevenue(CodeableConcept value) { 
3633          this.revenue = value;
3634          return this;
3635        }
3636
3637        /**
3638         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
3639         */
3640        public CodeableConcept getCategory() { 
3641          if (this.category == null)
3642            if (Configuration.errorOnAutoCreate())
3643              throw new Error("Attempt to auto-create ItemComponent.category");
3644            else if (Configuration.doAutoCreate())
3645              this.category = new CodeableConcept(); // cc
3646          return this.category;
3647        }
3648
3649        public boolean hasCategory() { 
3650          return this.category != null && !this.category.isEmpty();
3651        }
3652
3653        /**
3654         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
3655         */
3656        public ItemComponent setCategory(CodeableConcept value) { 
3657          this.category = value;
3658          return this;
3659        }
3660
3661        /**
3662         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.)
3663         */
3664        public CodeableConcept getProductOrService() { 
3665          if (this.productOrService == null)
3666            if (Configuration.errorOnAutoCreate())
3667              throw new Error("Attempt to auto-create ItemComponent.productOrService");
3668            else if (Configuration.doAutoCreate())
3669              this.productOrService = new CodeableConcept(); // cc
3670          return this.productOrService;
3671        }
3672
3673        public boolean hasProductOrService() { 
3674          return this.productOrService != null && !this.productOrService.isEmpty();
3675        }
3676
3677        /**
3678         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.)
3679         */
3680        public ItemComponent setProductOrService(CodeableConcept value) { 
3681          this.productOrService = value;
3682          return this;
3683        }
3684
3685        /**
3686         * @return {@link #productOrServiceEnd} (This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.)
3687         */
3688        public CodeableConcept getProductOrServiceEnd() { 
3689          if (this.productOrServiceEnd == null)
3690            if (Configuration.errorOnAutoCreate())
3691              throw new Error("Attempt to auto-create ItemComponent.productOrServiceEnd");
3692            else if (Configuration.doAutoCreate())
3693              this.productOrServiceEnd = new CodeableConcept(); // cc
3694          return this.productOrServiceEnd;
3695        }
3696
3697        public boolean hasProductOrServiceEnd() { 
3698          return this.productOrServiceEnd != null && !this.productOrServiceEnd.isEmpty();
3699        }
3700
3701        /**
3702         * @param value {@link #productOrServiceEnd} (This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.)
3703         */
3704        public ItemComponent setProductOrServiceEnd(CodeableConcept value) { 
3705          this.productOrServiceEnd = value;
3706          return this;
3707        }
3708
3709        /**
3710         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
3711         */
3712        public List<CodeableConcept> getModifier() { 
3713          if (this.modifier == null)
3714            this.modifier = new ArrayList<CodeableConcept>();
3715          return this.modifier;
3716        }
3717
3718        /**
3719         * @return Returns a reference to <code>this</code> for easy method chaining
3720         */
3721        public ItemComponent setModifier(List<CodeableConcept> theModifier) { 
3722          this.modifier = theModifier;
3723          return this;
3724        }
3725
3726        public boolean hasModifier() { 
3727          if (this.modifier == null)
3728            return false;
3729          for (CodeableConcept item : this.modifier)
3730            if (!item.isEmpty())
3731              return true;
3732          return false;
3733        }
3734
3735        public CodeableConcept addModifier() { //3
3736          CodeableConcept t = new CodeableConcept();
3737          if (this.modifier == null)
3738            this.modifier = new ArrayList<CodeableConcept>();
3739          this.modifier.add(t);
3740          return t;
3741        }
3742
3743        public ItemComponent addModifier(CodeableConcept t) { //3
3744          if (t == null)
3745            return this;
3746          if (this.modifier == null)
3747            this.modifier = new ArrayList<CodeableConcept>();
3748          this.modifier.add(t);
3749          return this;
3750        }
3751
3752        /**
3753         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
3754         */
3755        public CodeableConcept getModifierFirstRep() { 
3756          if (getModifier().isEmpty()) {
3757            addModifier();
3758          }
3759          return getModifier().get(0);
3760        }
3761
3762        /**
3763         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
3764         */
3765        public List<CodeableConcept> getProgramCode() { 
3766          if (this.programCode == null)
3767            this.programCode = new ArrayList<CodeableConcept>();
3768          return this.programCode;
3769        }
3770
3771        /**
3772         * @return Returns a reference to <code>this</code> for easy method chaining
3773         */
3774        public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
3775          this.programCode = theProgramCode;
3776          return this;
3777        }
3778
3779        public boolean hasProgramCode() { 
3780          if (this.programCode == null)
3781            return false;
3782          for (CodeableConcept item : this.programCode)
3783            if (!item.isEmpty())
3784              return true;
3785          return false;
3786        }
3787
3788        public CodeableConcept addProgramCode() { //3
3789          CodeableConcept t = new CodeableConcept();
3790          if (this.programCode == null)
3791            this.programCode = new ArrayList<CodeableConcept>();
3792          this.programCode.add(t);
3793          return t;
3794        }
3795
3796        public ItemComponent addProgramCode(CodeableConcept t) { //3
3797          if (t == null)
3798            return this;
3799          if (this.programCode == null)
3800            this.programCode = new ArrayList<CodeableConcept>();
3801          this.programCode.add(t);
3802          return this;
3803        }
3804
3805        /**
3806         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
3807         */
3808        public CodeableConcept getProgramCodeFirstRep() { 
3809          if (getProgramCode().isEmpty()) {
3810            addProgramCode();
3811          }
3812          return getProgramCode().get(0);
3813        }
3814
3815        /**
3816         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3817         */
3818        public DataType getServiced() { 
3819          return this.serviced;
3820        }
3821
3822        /**
3823         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3824         */
3825        public DateType getServicedDateType() throws FHIRException { 
3826          if (this.serviced == null)
3827            this.serviced = new DateType();
3828          if (!(this.serviced instanceof DateType))
3829            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
3830          return (DateType) this.serviced;
3831        }
3832
3833        public boolean hasServicedDateType() { 
3834          return this != null && this.serviced instanceof DateType;
3835        }
3836
3837        /**
3838         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3839         */
3840        public Period getServicedPeriod() throws FHIRException { 
3841          if (this.serviced == null)
3842            this.serviced = new Period();
3843          if (!(this.serviced instanceof Period))
3844            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
3845          return (Period) this.serviced;
3846        }
3847
3848        public boolean hasServicedPeriod() { 
3849          return this != null && this.serviced instanceof Period;
3850        }
3851
3852        public boolean hasServiced() { 
3853          return this.serviced != null && !this.serviced.isEmpty();
3854        }
3855
3856        /**
3857         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3858         */
3859        public ItemComponent setServiced(DataType value) { 
3860          if (value != null && !(value instanceof DateType || value instanceof Period))
3861            throw new Error("Not the right type for ExplanationOfBenefit.item.serviced[x]: "+value.fhirType());
3862          this.serviced = value;
3863          return this;
3864        }
3865
3866        /**
3867         * @return {@link #location} (Where the product or service was provided.)
3868         */
3869        public DataType getLocation() { 
3870          return this.location;
3871        }
3872
3873        /**
3874         * @return {@link #location} (Where the product or service was provided.)
3875         */
3876        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
3877          if (this.location == null)
3878            this.location = new CodeableConcept();
3879          if (!(this.location instanceof CodeableConcept))
3880            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
3881          return (CodeableConcept) this.location;
3882        }
3883
3884        public boolean hasLocationCodeableConcept() { 
3885          return this != null && this.location instanceof CodeableConcept;
3886        }
3887
3888        /**
3889         * @return {@link #location} (Where the product or service was provided.)
3890         */
3891        public Address getLocationAddress() throws FHIRException { 
3892          if (this.location == null)
3893            this.location = new Address();
3894          if (!(this.location instanceof Address))
3895            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3896          return (Address) this.location;
3897        }
3898
3899        public boolean hasLocationAddress() { 
3900          return this != null && this.location instanceof Address;
3901        }
3902
3903        /**
3904         * @return {@link #location} (Where the product or service was provided.)
3905         */
3906        public Reference getLocationReference() throws FHIRException { 
3907          if (this.location == null)
3908            this.location = new Reference();
3909          if (!(this.location instanceof Reference))
3910            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3911          return (Reference) this.location;
3912        }
3913
3914        public boolean hasLocationReference() { 
3915          return this != null && this.location instanceof Reference;
3916        }
3917
3918        public boolean hasLocation() { 
3919          return this.location != null && !this.location.isEmpty();
3920        }
3921
3922        /**
3923         * @param value {@link #location} (Where the product or service was provided.)
3924         */
3925        public ItemComponent setLocation(DataType value) { 
3926          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
3927            throw new Error("Not the right type for ExplanationOfBenefit.item.location[x]: "+value.fhirType());
3928          this.location = value;
3929          return this;
3930        }
3931
3932        /**
3933         * @return {@link #patientPaid} (The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.)
3934         */
3935        public Money getPatientPaid() { 
3936          if (this.patientPaid == null)
3937            if (Configuration.errorOnAutoCreate())
3938              throw new Error("Attempt to auto-create ItemComponent.patientPaid");
3939            else if (Configuration.doAutoCreate())
3940              this.patientPaid = new Money(); // cc
3941          return this.patientPaid;
3942        }
3943
3944        public boolean hasPatientPaid() { 
3945          return this.patientPaid != null && !this.patientPaid.isEmpty();
3946        }
3947
3948        /**
3949         * @param value {@link #patientPaid} (The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.)
3950         */
3951        public ItemComponent setPatientPaid(Money value) { 
3952          this.patientPaid = value;
3953          return this;
3954        }
3955
3956        /**
3957         * @return {@link #quantity} (The number of repetitions of a service or product.)
3958         */
3959        public Quantity getQuantity() { 
3960          if (this.quantity == null)
3961            if (Configuration.errorOnAutoCreate())
3962              throw new Error("Attempt to auto-create ItemComponent.quantity");
3963            else if (Configuration.doAutoCreate())
3964              this.quantity = new Quantity(); // cc
3965          return this.quantity;
3966        }
3967
3968        public boolean hasQuantity() { 
3969          return this.quantity != null && !this.quantity.isEmpty();
3970        }
3971
3972        /**
3973         * @param value {@link #quantity} (The number of repetitions of a service or product.)
3974         */
3975        public ItemComponent setQuantity(Quantity value) { 
3976          this.quantity = value;
3977          return this;
3978        }
3979
3980        /**
3981         * @return {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
3982         */
3983        public Money getUnitPrice() { 
3984          if (this.unitPrice == null)
3985            if (Configuration.errorOnAutoCreate())
3986              throw new Error("Attempt to auto-create ItemComponent.unitPrice");
3987            else if (Configuration.doAutoCreate())
3988              this.unitPrice = new Money(); // cc
3989          return this.unitPrice;
3990        }
3991
3992        public boolean hasUnitPrice() { 
3993          return this.unitPrice != null && !this.unitPrice.isEmpty();
3994        }
3995
3996        /**
3997         * @param value {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
3998         */
3999        public ItemComponent setUnitPrice(Money value) { 
4000          this.unitPrice = value;
4001          return this;
4002        }
4003
4004        /**
4005         * @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
4006         */
4007        public DecimalType getFactorElement() { 
4008          if (this.factor == null)
4009            if (Configuration.errorOnAutoCreate())
4010              throw new Error("Attempt to auto-create ItemComponent.factor");
4011            else if (Configuration.doAutoCreate())
4012              this.factor = new DecimalType(); // bb
4013          return this.factor;
4014        }
4015
4016        public boolean hasFactorElement() { 
4017          return this.factor != null && !this.factor.isEmpty();
4018        }
4019
4020        public boolean hasFactor() { 
4021          return this.factor != null && !this.factor.isEmpty();
4022        }
4023
4024        /**
4025         * @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
4026         */
4027        public ItemComponent setFactorElement(DecimalType value) { 
4028          this.factor = value;
4029          return this;
4030        }
4031
4032        /**
4033         * @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.
4034         */
4035        public BigDecimal getFactor() { 
4036          return this.factor == null ? null : this.factor.getValue();
4037        }
4038
4039        /**
4040         * @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.
4041         */
4042        public ItemComponent setFactor(BigDecimal value) { 
4043          if (value == null)
4044            this.factor = null;
4045          else {
4046            if (this.factor == null)
4047              this.factor = new DecimalType();
4048            this.factor.setValue(value);
4049          }
4050          return this;
4051        }
4052
4053        /**
4054         * @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.
4055         */
4056        public ItemComponent setFactor(long value) { 
4057              this.factor = new DecimalType();
4058            this.factor.setValue(value);
4059          return this;
4060        }
4061
4062        /**
4063         * @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.
4064         */
4065        public ItemComponent setFactor(double value) { 
4066              this.factor = new DecimalType();
4067            this.factor.setValue(value);
4068          return this;
4069        }
4070
4071        /**
4072         * @return {@link #tax} (The total of taxes applicable for this product or service.)
4073         */
4074        public Money getTax() { 
4075          if (this.tax == null)
4076            if (Configuration.errorOnAutoCreate())
4077              throw new Error("Attempt to auto-create ItemComponent.tax");
4078            else if (Configuration.doAutoCreate())
4079              this.tax = new Money(); // cc
4080          return this.tax;
4081        }
4082
4083        public boolean hasTax() { 
4084          return this.tax != null && !this.tax.isEmpty();
4085        }
4086
4087        /**
4088         * @param value {@link #tax} (The total of taxes applicable for this product or service.)
4089         */
4090        public ItemComponent setTax(Money value) { 
4091          this.tax = value;
4092          return this;
4093        }
4094
4095        /**
4096         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4097         */
4098        public Money getNet() { 
4099          if (this.net == null)
4100            if (Configuration.errorOnAutoCreate())
4101              throw new Error("Attempt to auto-create ItemComponent.net");
4102            else if (Configuration.doAutoCreate())
4103              this.net = new Money(); // cc
4104          return this.net;
4105        }
4106
4107        public boolean hasNet() { 
4108          return this.net != null && !this.net.isEmpty();
4109        }
4110
4111        /**
4112         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4113         */
4114        public ItemComponent setNet(Money value) { 
4115          this.net = value;
4116          return this;
4117        }
4118
4119        /**
4120         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
4121         */
4122        public List<Reference> getUdi() { 
4123          if (this.udi == null)
4124            this.udi = new ArrayList<Reference>();
4125          return this.udi;
4126        }
4127
4128        /**
4129         * @return Returns a reference to <code>this</code> for easy method chaining
4130         */
4131        public ItemComponent setUdi(List<Reference> theUdi) { 
4132          this.udi = theUdi;
4133          return this;
4134        }
4135
4136        public boolean hasUdi() { 
4137          if (this.udi == null)
4138            return false;
4139          for (Reference item : this.udi)
4140            if (!item.isEmpty())
4141              return true;
4142          return false;
4143        }
4144
4145        public Reference addUdi() { //3
4146          Reference t = new Reference();
4147          if (this.udi == null)
4148            this.udi = new ArrayList<Reference>();
4149          this.udi.add(t);
4150          return t;
4151        }
4152
4153        public ItemComponent addUdi(Reference t) { //3
4154          if (t == null)
4155            return this;
4156          if (this.udi == null)
4157            this.udi = new ArrayList<Reference>();
4158          this.udi.add(t);
4159          return this;
4160        }
4161
4162        /**
4163         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
4164         */
4165        public Reference getUdiFirstRep() { 
4166          if (getUdi().isEmpty()) {
4167            addUdi();
4168          }
4169          return getUdi().get(0);
4170        }
4171
4172        /**
4173         * @return {@link #bodySite} (Physical location where the service is performed or applies.)
4174         */
4175        public List<BodySiteComponent> getBodySite() { 
4176          if (this.bodySite == null)
4177            this.bodySite = new ArrayList<BodySiteComponent>();
4178          return this.bodySite;
4179        }
4180
4181        /**
4182         * @return Returns a reference to <code>this</code> for easy method chaining
4183         */
4184        public ItemComponent setBodySite(List<BodySiteComponent> theBodySite) { 
4185          this.bodySite = theBodySite;
4186          return this;
4187        }
4188
4189        public boolean hasBodySite() { 
4190          if (this.bodySite == null)
4191            return false;
4192          for (BodySiteComponent item : this.bodySite)
4193            if (!item.isEmpty())
4194              return true;
4195          return false;
4196        }
4197
4198        public BodySiteComponent addBodySite() { //3
4199          BodySiteComponent t = new BodySiteComponent();
4200          if (this.bodySite == null)
4201            this.bodySite = new ArrayList<BodySiteComponent>();
4202          this.bodySite.add(t);
4203          return t;
4204        }
4205
4206        public ItemComponent addBodySite(BodySiteComponent t) { //3
4207          if (t == null)
4208            return this;
4209          if (this.bodySite == null)
4210            this.bodySite = new ArrayList<BodySiteComponent>();
4211          this.bodySite.add(t);
4212          return this;
4213        }
4214
4215        /**
4216         * @return The first repetition of repeating field {@link #bodySite}, creating it if it does not already exist {3}
4217         */
4218        public BodySiteComponent getBodySiteFirstRep() { 
4219          if (getBodySite().isEmpty()) {
4220            addBodySite();
4221          }
4222          return getBodySite().get(0);
4223        }
4224
4225        /**
4226         * @return {@link #encounter} (A billed item may include goods or services provided in multiple encounters.)
4227         */
4228        public List<Reference> getEncounter() { 
4229          if (this.encounter == null)
4230            this.encounter = new ArrayList<Reference>();
4231          return this.encounter;
4232        }
4233
4234        /**
4235         * @return Returns a reference to <code>this</code> for easy method chaining
4236         */
4237        public ItemComponent setEncounter(List<Reference> theEncounter) { 
4238          this.encounter = theEncounter;
4239          return this;
4240        }
4241
4242        public boolean hasEncounter() { 
4243          if (this.encounter == null)
4244            return false;
4245          for (Reference item : this.encounter)
4246            if (!item.isEmpty())
4247              return true;
4248          return false;
4249        }
4250
4251        public Reference addEncounter() { //3
4252          Reference t = new Reference();
4253          if (this.encounter == null)
4254            this.encounter = new ArrayList<Reference>();
4255          this.encounter.add(t);
4256          return t;
4257        }
4258
4259        public ItemComponent addEncounter(Reference t) { //3
4260          if (t == null)
4261            return this;
4262          if (this.encounter == null)
4263            this.encounter = new ArrayList<Reference>();
4264          this.encounter.add(t);
4265          return this;
4266        }
4267
4268        /**
4269         * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist {3}
4270         */
4271        public Reference getEncounterFirstRep() { 
4272          if (getEncounter().isEmpty()) {
4273            addEncounter();
4274          }
4275          return getEncounter().get(0);
4276        }
4277
4278        /**
4279         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4280         */
4281        public List<PositiveIntType> getNoteNumber() { 
4282          if (this.noteNumber == null)
4283            this.noteNumber = new ArrayList<PositiveIntType>();
4284          return this.noteNumber;
4285        }
4286
4287        /**
4288         * @return Returns a reference to <code>this</code> for easy method chaining
4289         */
4290        public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
4291          this.noteNumber = theNoteNumber;
4292          return this;
4293        }
4294
4295        public boolean hasNoteNumber() { 
4296          if (this.noteNumber == null)
4297            return false;
4298          for (PositiveIntType item : this.noteNumber)
4299            if (!item.isEmpty())
4300              return true;
4301          return false;
4302        }
4303
4304        /**
4305         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4306         */
4307        public PositiveIntType addNoteNumberElement() {//2 
4308          PositiveIntType t = new PositiveIntType();
4309          if (this.noteNumber == null)
4310            this.noteNumber = new ArrayList<PositiveIntType>();
4311          this.noteNumber.add(t);
4312          return t;
4313        }
4314
4315        /**
4316         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4317         */
4318        public ItemComponent addNoteNumber(int value) { //1
4319          PositiveIntType t = new PositiveIntType();
4320          t.setValue(value);
4321          if (this.noteNumber == null)
4322            this.noteNumber = new ArrayList<PositiveIntType>();
4323          this.noteNumber.add(t);
4324          return this;
4325        }
4326
4327        /**
4328         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4329         */
4330        public boolean hasNoteNumber(int value) { 
4331          if (this.noteNumber == null)
4332            return false;
4333          for (PositiveIntType v : this.noteNumber)
4334            if (v.getValue().equals(value)) // positiveInt
4335              return true;
4336          return false;
4337        }
4338
4339        /**
4340         * @return {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
4341         */
4342        public CodeableConcept getDecision() { 
4343          if (this.decision == null)
4344            if (Configuration.errorOnAutoCreate())
4345              throw new Error("Attempt to auto-create ItemComponent.decision");
4346            else if (Configuration.doAutoCreate())
4347              this.decision = new CodeableConcept(); // cc
4348          return this.decision;
4349        }
4350
4351        public boolean hasDecision() { 
4352          return this.decision != null && !this.decision.isEmpty();
4353        }
4354
4355        /**
4356         * @param value {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
4357         */
4358        public ItemComponent setDecision(CodeableConcept value) { 
4359          this.decision = value;
4360          return this;
4361        }
4362
4363        /**
4364         * @return {@link #adjudication} (If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.)
4365         */
4366        public List<AdjudicationComponent> getAdjudication() { 
4367          if (this.adjudication == null)
4368            this.adjudication = new ArrayList<AdjudicationComponent>();
4369          return this.adjudication;
4370        }
4371
4372        /**
4373         * @return Returns a reference to <code>this</code> for easy method chaining
4374         */
4375        public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
4376          this.adjudication = theAdjudication;
4377          return this;
4378        }
4379
4380        public boolean hasAdjudication() { 
4381          if (this.adjudication == null)
4382            return false;
4383          for (AdjudicationComponent item : this.adjudication)
4384            if (!item.isEmpty())
4385              return true;
4386          return false;
4387        }
4388
4389        public AdjudicationComponent addAdjudication() { //3
4390          AdjudicationComponent t = new AdjudicationComponent();
4391          if (this.adjudication == null)
4392            this.adjudication = new ArrayList<AdjudicationComponent>();
4393          this.adjudication.add(t);
4394          return t;
4395        }
4396
4397        public ItemComponent addAdjudication(AdjudicationComponent t) { //3
4398          if (t == null)
4399            return this;
4400          if (this.adjudication == null)
4401            this.adjudication = new ArrayList<AdjudicationComponent>();
4402          this.adjudication.add(t);
4403          return this;
4404        }
4405
4406        /**
4407         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
4408         */
4409        public AdjudicationComponent getAdjudicationFirstRep() { 
4410          if (getAdjudication().isEmpty()) {
4411            addAdjudication();
4412          }
4413          return getAdjudication().get(0);
4414        }
4415
4416        /**
4417         * @return {@link #detail} (Second-tier of goods and services.)
4418         */
4419        public List<DetailComponent> getDetail() { 
4420          if (this.detail == null)
4421            this.detail = new ArrayList<DetailComponent>();
4422          return this.detail;
4423        }
4424
4425        /**
4426         * @return Returns a reference to <code>this</code> for easy method chaining
4427         */
4428        public ItemComponent setDetail(List<DetailComponent> theDetail) { 
4429          this.detail = theDetail;
4430          return this;
4431        }
4432
4433        public boolean hasDetail() { 
4434          if (this.detail == null)
4435            return false;
4436          for (DetailComponent item : this.detail)
4437            if (!item.isEmpty())
4438              return true;
4439          return false;
4440        }
4441
4442        public DetailComponent addDetail() { //3
4443          DetailComponent t = new DetailComponent();
4444          if (this.detail == null)
4445            this.detail = new ArrayList<DetailComponent>();
4446          this.detail.add(t);
4447          return t;
4448        }
4449
4450        public ItemComponent addDetail(DetailComponent t) { //3
4451          if (t == null)
4452            return this;
4453          if (this.detail == null)
4454            this.detail = new ArrayList<DetailComponent>();
4455          this.detail.add(t);
4456          return this;
4457        }
4458
4459        /**
4460         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist {3}
4461         */
4462        public DetailComponent getDetailFirstRep() { 
4463          if (getDetail().isEmpty()) {
4464            addDetail();
4465          }
4466          return getDetail().get(0);
4467        }
4468
4469        protected void listChildren(List<Property> children) {
4470          super.listChildren(children);
4471          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
4472          children.add(new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence));
4473          children.add(new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence));
4474          children.add(new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence));
4475          children.add(new Property("informationSequence", "positiveInt", "Exceptions, special conditions and supporting information applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, informationSequence));
4476          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
4477          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
4478          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.", 0, 1, productOrService));
4479          children.add(new Property("productOrServiceEnd", "CodeableConcept", "This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.", 0, 1, productOrServiceEnd));
4480          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier));
4481          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
4482          children.add(new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced));
4483          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
4484          children.add(new Property("patientPaid", "Money", "The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.", 0, 1, patientPaid));
4485          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
4486          children.add(new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice));
4487          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));
4488          children.add(new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax));
4489          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
4490          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
4491          children.add(new Property("bodySite", "", "Physical location where the service is performed or applies.", 0, java.lang.Integer.MAX_VALUE, bodySite));
4492          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));
4493          children.add(new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
4494          children.add(new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision));
4495          children.add(new Property("adjudication", "", "If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, adjudication));
4496          children.add(new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
4497        }
4498
4499        @Override
4500        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4501          switch (_hash) {
4502          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence);
4503          case 1070083823: /*careTeamSequence*/  return new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence);
4504          case -909769262: /*diagnosisSequence*/  return new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence);
4505          case -808920140: /*procedureSequence*/  return new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence);
4506          case -702585587: /*informationSequence*/  return new Property("informationSequence", "positiveInt", "Exceptions, special conditions and supporting information applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, informationSequence);
4507          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
4508          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category);
4509          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.", 0, 1, productOrService);
4510          case -717476168: /*productOrServiceEnd*/  return new Property("productOrServiceEnd", "CodeableConcept", "This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.", 0, 1, productOrServiceEnd);
4511          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier);
4512          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
4513          case -1927922223: /*serviced[x]*/  return new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
4514          case 1379209295: /*serviced*/  return new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
4515          case 363246749: /*servicedDate*/  return new Property("serviced[x]", "date", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
4516          case 1534966512: /*servicedPeriod*/  return new Property("serviced[x]", "Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
4517          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4518          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4519          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept", "Where the product or service was provided.", 0, 1, location);
4520          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address", "Where the product or service was provided.", 0, 1, location);
4521          case 755866390: /*locationReference*/  return new Property("location[x]", "Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4522          case 525514609: /*patientPaid*/  return new Property("patientPaid", "Money", "The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.", 0, 1, patientPaid);
4523          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
4524          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice);
4525          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);
4526          case 114603: /*tax*/  return new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax);
4527          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
4528          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
4529          case 1702620169: /*bodySite*/  return new Property("bodySite", "", "Physical location where the service is performed or applies.", 0, java.lang.Integer.MAX_VALUE, bodySite);
4530          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);
4531          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
4532          case 565719004: /*decision*/  return new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision);
4533          case -231349275: /*adjudication*/  return new Property("adjudication", "", "If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, adjudication);
4534          case -1335224239: /*detail*/  return new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail);
4535          default: return super.getNamedProperty(_hash, _name, _checkValid);
4536          }
4537
4538        }
4539
4540      @Override
4541      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4542        switch (hash) {
4543        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
4544        case 1070083823: /*careTeamSequence*/ return this.careTeamSequence == null ? new Base[0] : this.careTeamSequence.toArray(new Base[this.careTeamSequence.size()]); // PositiveIntType
4545        case -909769262: /*diagnosisSequence*/ return this.diagnosisSequence == null ? new Base[0] : this.diagnosisSequence.toArray(new Base[this.diagnosisSequence.size()]); // PositiveIntType
4546        case -808920140: /*procedureSequence*/ return this.procedureSequence == null ? new Base[0] : this.procedureSequence.toArray(new Base[this.procedureSequence.size()]); // PositiveIntType
4547        case -702585587: /*informationSequence*/ return this.informationSequence == null ? new Base[0] : this.informationSequence.toArray(new Base[this.informationSequence.size()]); // PositiveIntType
4548        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
4549        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4550        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
4551        case -717476168: /*productOrServiceEnd*/ return this.productOrServiceEnd == null ? new Base[0] : new Base[] {this.productOrServiceEnd}; // CodeableConcept
4552        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
4553        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
4554        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // DataType
4555        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // DataType
4556        case 525514609: /*patientPaid*/ return this.patientPaid == null ? new Base[0] : new Base[] {this.patientPaid}; // Money
4557        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
4558        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
4559        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
4560        case 114603: /*tax*/ return this.tax == null ? new Base[0] : new Base[] {this.tax}; // Money
4561        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
4562        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
4563        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : this.bodySite.toArray(new Base[this.bodySite.size()]); // BodySiteComponent
4564        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
4565        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
4566        case 565719004: /*decision*/ return this.decision == null ? new Base[0] : new Base[] {this.decision}; // CodeableConcept
4567        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
4568        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
4569        default: return super.getProperty(hash, name, checkValid);
4570        }
4571
4572      }
4573
4574      @Override
4575      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4576        switch (hash) {
4577        case 1349547969: // sequence
4578          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
4579          return value;
4580        case 1070083823: // careTeamSequence
4581          this.getCareTeamSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4582          return value;
4583        case -909769262: // diagnosisSequence
4584          this.getDiagnosisSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4585          return value;
4586        case -808920140: // procedureSequence
4587          this.getProcedureSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4588          return value;
4589        case -702585587: // informationSequence
4590          this.getInformationSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4591          return value;
4592        case 1099842588: // revenue
4593          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4594          return value;
4595        case 50511102: // category
4596          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4597          return value;
4598        case 1957227299: // productOrService
4599          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4600          return value;
4601        case -717476168: // productOrServiceEnd
4602          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4603          return value;
4604        case -615513385: // modifier
4605          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4606          return value;
4607        case 1010065041: // programCode
4608          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4609          return value;
4610        case 1379209295: // serviced
4611          this.serviced = TypeConvertor.castToType(value); // DataType
4612          return value;
4613        case 1901043637: // location
4614          this.location = TypeConvertor.castToType(value); // DataType
4615          return value;
4616        case 525514609: // patientPaid
4617          this.patientPaid = TypeConvertor.castToMoney(value); // Money
4618          return value;
4619        case -1285004149: // quantity
4620          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
4621          return value;
4622        case -486196699: // unitPrice
4623          this.unitPrice = TypeConvertor.castToMoney(value); // Money
4624          return value;
4625        case -1282148017: // factor
4626          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
4627          return value;
4628        case 114603: // tax
4629          this.tax = TypeConvertor.castToMoney(value); // Money
4630          return value;
4631        case 108957: // net
4632          this.net = TypeConvertor.castToMoney(value); // Money
4633          return value;
4634        case 115642: // udi
4635          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
4636          return value;
4637        case 1702620169: // bodySite
4638          this.getBodySite().add((BodySiteComponent) value); // BodySiteComponent
4639          return value;
4640        case 1524132147: // encounter
4641          this.getEncounter().add(TypeConvertor.castToReference(value)); // Reference
4642          return value;
4643        case -1110033957: // noteNumber
4644          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4645          return value;
4646        case 565719004: // decision
4647          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4648          return value;
4649        case -231349275: // adjudication
4650          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
4651          return value;
4652        case -1335224239: // detail
4653          this.getDetail().add((DetailComponent) value); // DetailComponent
4654          return value;
4655        default: return super.setProperty(hash, name, value);
4656        }
4657
4658      }
4659
4660      @Override
4661      public Base setProperty(String name, Base value) throws FHIRException {
4662        if (name.equals("sequence")) {
4663          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
4664        } else if (name.equals("careTeamSequence")) {
4665          this.getCareTeamSequence().add(TypeConvertor.castToPositiveInt(value));
4666        } else if (name.equals("diagnosisSequence")) {
4667          this.getDiagnosisSequence().add(TypeConvertor.castToPositiveInt(value));
4668        } else if (name.equals("procedureSequence")) {
4669          this.getProcedureSequence().add(TypeConvertor.castToPositiveInt(value));
4670        } else if (name.equals("informationSequence")) {
4671          this.getInformationSequence().add(TypeConvertor.castToPositiveInt(value));
4672        } else if (name.equals("revenue")) {
4673          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4674        } else if (name.equals("category")) {
4675          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4676        } else if (name.equals("productOrService")) {
4677          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4678        } else if (name.equals("productOrServiceEnd")) {
4679          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4680        } else if (name.equals("modifier")) {
4681          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
4682        } else if (name.equals("programCode")) {
4683          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
4684        } else if (name.equals("serviced[x]")) {
4685          this.serviced = TypeConvertor.castToType(value); // DataType
4686        } else if (name.equals("location[x]")) {
4687          this.location = TypeConvertor.castToType(value); // DataType
4688        } else if (name.equals("patientPaid")) {
4689          this.patientPaid = TypeConvertor.castToMoney(value); // Money
4690        } else if (name.equals("quantity")) {
4691          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
4692        } else if (name.equals("unitPrice")) {
4693          this.unitPrice = TypeConvertor.castToMoney(value); // Money
4694        } else if (name.equals("factor")) {
4695          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
4696        } else if (name.equals("tax")) {
4697          this.tax = TypeConvertor.castToMoney(value); // Money
4698        } else if (name.equals("net")) {
4699          this.net = TypeConvertor.castToMoney(value); // Money
4700        } else if (name.equals("udi")) {
4701          this.getUdi().add(TypeConvertor.castToReference(value));
4702        } else if (name.equals("bodySite")) {
4703          this.getBodySite().add((BodySiteComponent) value);
4704        } else if (name.equals("encounter")) {
4705          this.getEncounter().add(TypeConvertor.castToReference(value));
4706        } else if (name.equals("noteNumber")) {
4707          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
4708        } else if (name.equals("decision")) {
4709          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4710        } else if (name.equals("adjudication")) {
4711          this.getAdjudication().add((AdjudicationComponent) value);
4712        } else if (name.equals("detail")) {
4713          this.getDetail().add((DetailComponent) value);
4714        } else
4715          return super.setProperty(name, value);
4716        return value;
4717      }
4718
4719      @Override
4720      public Base makeProperty(int hash, String name) throws FHIRException {
4721        switch (hash) {
4722        case 1349547969:  return getSequenceElement();
4723        case 1070083823:  return addCareTeamSequenceElement();
4724        case -909769262:  return addDiagnosisSequenceElement();
4725        case -808920140:  return addProcedureSequenceElement();
4726        case -702585587:  return addInformationSequenceElement();
4727        case 1099842588:  return getRevenue();
4728        case 50511102:  return getCategory();
4729        case 1957227299:  return getProductOrService();
4730        case -717476168:  return getProductOrServiceEnd();
4731        case -615513385:  return addModifier(); 
4732        case 1010065041:  return addProgramCode(); 
4733        case -1927922223:  return getServiced();
4734        case 1379209295:  return getServiced();
4735        case 552316075:  return getLocation();
4736        case 1901043637:  return getLocation();
4737        case 525514609:  return getPatientPaid();
4738        case -1285004149:  return getQuantity();
4739        case -486196699:  return getUnitPrice();
4740        case -1282148017:  return getFactorElement();
4741        case 114603:  return getTax();
4742        case 108957:  return getNet();
4743        case 115642:  return addUdi(); 
4744        case 1702620169:  return addBodySite(); 
4745        case 1524132147:  return addEncounter(); 
4746        case -1110033957:  return addNoteNumberElement();
4747        case 565719004:  return getDecision();
4748        case -231349275:  return addAdjudication(); 
4749        case -1335224239:  return addDetail(); 
4750        default: return super.makeProperty(hash, name);
4751        }
4752
4753      }
4754
4755      @Override
4756      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4757        switch (hash) {
4758        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
4759        case 1070083823: /*careTeamSequence*/ return new String[] {"positiveInt"};
4760        case -909769262: /*diagnosisSequence*/ return new String[] {"positiveInt"};
4761        case -808920140: /*procedureSequence*/ return new String[] {"positiveInt"};
4762        case -702585587: /*informationSequence*/ return new String[] {"positiveInt"};
4763        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
4764        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4765        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
4766        case -717476168: /*productOrServiceEnd*/ return new String[] {"CodeableConcept"};
4767        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
4768        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
4769        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
4770        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
4771        case 525514609: /*patientPaid*/ return new String[] {"Money"};
4772        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
4773        case -486196699: /*unitPrice*/ return new String[] {"Money"};
4774        case -1282148017: /*factor*/ return new String[] {"decimal"};
4775        case 114603: /*tax*/ return new String[] {"Money"};
4776        case 108957: /*net*/ return new String[] {"Money"};
4777        case 115642: /*udi*/ return new String[] {"Reference"};
4778        case 1702620169: /*bodySite*/ return new String[] {};
4779        case 1524132147: /*encounter*/ return new String[] {"Reference"};
4780        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
4781        case 565719004: /*decision*/ return new String[] {"CodeableConcept"};
4782        case -231349275: /*adjudication*/ return new String[] {};
4783        case -1335224239: /*detail*/ return new String[] {};
4784        default: return super.getTypesForProperty(hash, name);
4785        }
4786
4787      }
4788
4789      @Override
4790      public Base addChild(String name) throws FHIRException {
4791        if (name.equals("sequence")) {
4792          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.sequence");
4793        }
4794        else if (name.equals("careTeamSequence")) {
4795          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.careTeamSequence");
4796        }
4797        else if (name.equals("diagnosisSequence")) {
4798          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.diagnosisSequence");
4799        }
4800        else if (name.equals("procedureSequence")) {
4801          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.procedureSequence");
4802        }
4803        else if (name.equals("informationSequence")) {
4804          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.informationSequence");
4805        }
4806        else if (name.equals("revenue")) {
4807          this.revenue = new CodeableConcept();
4808          return this.revenue;
4809        }
4810        else if (name.equals("category")) {
4811          this.category = new CodeableConcept();
4812          return this.category;
4813        }
4814        else if (name.equals("productOrService")) {
4815          this.productOrService = new CodeableConcept();
4816          return this.productOrService;
4817        }
4818        else if (name.equals("productOrServiceEnd")) {
4819          this.productOrServiceEnd = new CodeableConcept();
4820          return this.productOrServiceEnd;
4821        }
4822        else if (name.equals("modifier")) {
4823          return addModifier();
4824        }
4825        else if (name.equals("programCode")) {
4826          return addProgramCode();
4827        }
4828        else if (name.equals("servicedDate")) {
4829          this.serviced = new DateType();
4830          return this.serviced;
4831        }
4832        else if (name.equals("servicedPeriod")) {
4833          this.serviced = new Period();
4834          return this.serviced;
4835        }
4836        else if (name.equals("locationCodeableConcept")) {
4837          this.location = new CodeableConcept();
4838          return this.location;
4839        }
4840        else if (name.equals("locationAddress")) {
4841          this.location = new Address();
4842          return this.location;
4843        }
4844        else if (name.equals("locationReference")) {
4845          this.location = new Reference();
4846          return this.location;
4847        }
4848        else if (name.equals("patientPaid")) {
4849          this.patientPaid = new Money();
4850          return this.patientPaid;
4851        }
4852        else if (name.equals("quantity")) {
4853          this.quantity = new Quantity();
4854          return this.quantity;
4855        }
4856        else if (name.equals("unitPrice")) {
4857          this.unitPrice = new Money();
4858          return this.unitPrice;
4859        }
4860        else if (name.equals("factor")) {
4861          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.factor");
4862        }
4863        else if (name.equals("tax")) {
4864          this.tax = new Money();
4865          return this.tax;
4866        }
4867        else if (name.equals("net")) {
4868          this.net = new Money();
4869          return this.net;
4870        }
4871        else if (name.equals("udi")) {
4872          return addUdi();
4873        }
4874        else if (name.equals("bodySite")) {
4875          return addBodySite();
4876        }
4877        else if (name.equals("encounter")) {
4878          return addEncounter();
4879        }
4880        else if (name.equals("noteNumber")) {
4881          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.noteNumber");
4882        }
4883        else if (name.equals("decision")) {
4884          this.decision = new CodeableConcept();
4885          return this.decision;
4886        }
4887        else if (name.equals("adjudication")) {
4888          return addAdjudication();
4889        }
4890        else if (name.equals("detail")) {
4891          return addDetail();
4892        }
4893        else
4894          return super.addChild(name);
4895      }
4896
4897      public ItemComponent copy() {
4898        ItemComponent dst = new ItemComponent();
4899        copyValues(dst);
4900        return dst;
4901      }
4902
4903      public void copyValues(ItemComponent dst) {
4904        super.copyValues(dst);
4905        dst.sequence = sequence == null ? null : sequence.copy();
4906        if (careTeamSequence != null) {
4907          dst.careTeamSequence = new ArrayList<PositiveIntType>();
4908          for (PositiveIntType i : careTeamSequence)
4909            dst.careTeamSequence.add(i.copy());
4910        };
4911        if (diagnosisSequence != null) {
4912          dst.diagnosisSequence = new ArrayList<PositiveIntType>();
4913          for (PositiveIntType i : diagnosisSequence)
4914            dst.diagnosisSequence.add(i.copy());
4915        };
4916        if (procedureSequence != null) {
4917          dst.procedureSequence = new ArrayList<PositiveIntType>();
4918          for (PositiveIntType i : procedureSequence)
4919            dst.procedureSequence.add(i.copy());
4920        };
4921        if (informationSequence != null) {
4922          dst.informationSequence = new ArrayList<PositiveIntType>();
4923          for (PositiveIntType i : informationSequence)
4924            dst.informationSequence.add(i.copy());
4925        };
4926        dst.revenue = revenue == null ? null : revenue.copy();
4927        dst.category = category == null ? null : category.copy();
4928        dst.productOrService = productOrService == null ? null : productOrService.copy();
4929        dst.productOrServiceEnd = productOrServiceEnd == null ? null : productOrServiceEnd.copy();
4930        if (modifier != null) {
4931          dst.modifier = new ArrayList<CodeableConcept>();
4932          for (CodeableConcept i : modifier)
4933            dst.modifier.add(i.copy());
4934        };
4935        if (programCode != null) {
4936          dst.programCode = new ArrayList<CodeableConcept>();
4937          for (CodeableConcept i : programCode)
4938            dst.programCode.add(i.copy());
4939        };
4940        dst.serviced = serviced == null ? null : serviced.copy();
4941        dst.location = location == null ? null : location.copy();
4942        dst.patientPaid = patientPaid == null ? null : patientPaid.copy();
4943        dst.quantity = quantity == null ? null : quantity.copy();
4944        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
4945        dst.factor = factor == null ? null : factor.copy();
4946        dst.tax = tax == null ? null : tax.copy();
4947        dst.net = net == null ? null : net.copy();
4948        if (udi != null) {
4949          dst.udi = new ArrayList<Reference>();
4950          for (Reference i : udi)
4951            dst.udi.add(i.copy());
4952        };
4953        if (bodySite != null) {
4954          dst.bodySite = new ArrayList<BodySiteComponent>();
4955          for (BodySiteComponent i : bodySite)
4956            dst.bodySite.add(i.copy());
4957        };
4958        if (encounter != null) {
4959          dst.encounter = new ArrayList<Reference>();
4960          for (Reference i : encounter)
4961            dst.encounter.add(i.copy());
4962        };
4963        if (noteNumber != null) {
4964          dst.noteNumber = new ArrayList<PositiveIntType>();
4965          for (PositiveIntType i : noteNumber)
4966            dst.noteNumber.add(i.copy());
4967        };
4968        dst.decision = decision == null ? null : decision.copy();
4969        if (adjudication != null) {
4970          dst.adjudication = new ArrayList<AdjudicationComponent>();
4971          for (AdjudicationComponent i : adjudication)
4972            dst.adjudication.add(i.copy());
4973        };
4974        if (detail != null) {
4975          dst.detail = new ArrayList<DetailComponent>();
4976          for (DetailComponent i : detail)
4977            dst.detail.add(i.copy());
4978        };
4979      }
4980
4981      @Override
4982      public boolean equalsDeep(Base other_) {
4983        if (!super.equalsDeep(other_))
4984          return false;
4985        if (!(other_ instanceof ItemComponent))
4986          return false;
4987        ItemComponent o = (ItemComponent) other_;
4988        return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamSequence, o.careTeamSequence, true)
4989           && compareDeep(diagnosisSequence, o.diagnosisSequence, true) && compareDeep(procedureSequence, o.procedureSequence, true)
4990           && compareDeep(informationSequence, o.informationSequence, true) && compareDeep(revenue, o.revenue, true)
4991           && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
4992           && compareDeep(productOrServiceEnd, o.productOrServiceEnd, true) && compareDeep(modifier, o.modifier, true)
4993           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
4994           && compareDeep(patientPaid, o.patientPaid, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
4995           && compareDeep(factor, o.factor, true) && compareDeep(tax, o.tax, true) && compareDeep(net, o.net, true)
4996           && compareDeep(udi, o.udi, true) && compareDeep(bodySite, o.bodySite, true) && compareDeep(encounter, o.encounter, true)
4997           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(decision, o.decision, true) && compareDeep(adjudication, o.adjudication, true)
4998           && compareDeep(detail, o.detail, true);
4999      }
5000
5001      @Override
5002      public boolean equalsShallow(Base other_) {
5003        if (!super.equalsShallow(other_))
5004          return false;
5005        if (!(other_ instanceof ItemComponent))
5006          return false;
5007        ItemComponent o = (ItemComponent) other_;
5008        return compareValues(sequence, o.sequence, true) && compareValues(careTeamSequence, o.careTeamSequence, true)
5009           && compareValues(diagnosisSequence, o.diagnosisSequence, true) && compareValues(procedureSequence, o.procedureSequence, true)
5010           && compareValues(informationSequence, o.informationSequence, true) && compareValues(factor, o.factor, true)
5011           && compareValues(noteNumber, o.noteNumber, true);
5012      }
5013
5014      public boolean isEmpty() {
5015        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamSequence
5016          , diagnosisSequence, procedureSequence, informationSequence, revenue, category, productOrService
5017          , productOrServiceEnd, modifier, programCode, serviced, location, patientPaid, quantity
5018          , unitPrice, factor, tax, net, udi, bodySite, encounter, noteNumber, decision
5019          , adjudication, detail);
5020      }
5021
5022  public String fhirType() {
5023    return "ExplanationOfBenefit.item";
5024
5025  }
5026
5027  }
5028
5029    @Block()
5030    public static class BodySiteComponent extends BackboneElement implements IBaseBackboneElement {
5031        /**
5032         * Physical service site on the patient (limb, tooth, etc.).
5033         */
5034        @Child(name = "site", type = {CodeableReference.class}, order=1, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5035        @Description(shortDefinition="Location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
5036        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
5037        protected List<CodeableReference> site;
5038
5039        /**
5040         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
5041         */
5042        @Child(name = "subSite", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5043        @Description(shortDefinition="Sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
5044        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
5045        protected List<CodeableConcept> subSite;
5046
5047        private static final long serialVersionUID = 1190632415L;
5048
5049    /**
5050     * Constructor
5051     */
5052      public BodySiteComponent() {
5053        super();
5054      }
5055
5056    /**
5057     * Constructor
5058     */
5059      public BodySiteComponent(CodeableReference site) {
5060        super();
5061        this.addSite(site);
5062      }
5063
5064        /**
5065         * @return {@link #site} (Physical service site on the patient (limb, tooth, etc.).)
5066         */
5067        public List<CodeableReference> getSite() { 
5068          if (this.site == null)
5069            this.site = new ArrayList<CodeableReference>();
5070          return this.site;
5071        }
5072
5073        /**
5074         * @return Returns a reference to <code>this</code> for easy method chaining
5075         */
5076        public BodySiteComponent setSite(List<CodeableReference> theSite) { 
5077          this.site = theSite;
5078          return this;
5079        }
5080
5081        public boolean hasSite() { 
5082          if (this.site == null)
5083            return false;
5084          for (CodeableReference item : this.site)
5085            if (!item.isEmpty())
5086              return true;
5087          return false;
5088        }
5089
5090        public CodeableReference addSite() { //3
5091          CodeableReference t = new CodeableReference();
5092          if (this.site == null)
5093            this.site = new ArrayList<CodeableReference>();
5094          this.site.add(t);
5095          return t;
5096        }
5097
5098        public BodySiteComponent addSite(CodeableReference t) { //3
5099          if (t == null)
5100            return this;
5101          if (this.site == null)
5102            this.site = new ArrayList<CodeableReference>();
5103          this.site.add(t);
5104          return this;
5105        }
5106
5107        /**
5108         * @return The first repetition of repeating field {@link #site}, creating it if it does not already exist {3}
5109         */
5110        public CodeableReference getSiteFirstRep() { 
5111          if (getSite().isEmpty()) {
5112            addSite();
5113          }
5114          return getSite().get(0);
5115        }
5116
5117        /**
5118         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
5119         */
5120        public List<CodeableConcept> getSubSite() { 
5121          if (this.subSite == null)
5122            this.subSite = new ArrayList<CodeableConcept>();
5123          return this.subSite;
5124        }
5125
5126        /**
5127         * @return Returns a reference to <code>this</code> for easy method chaining
5128         */
5129        public BodySiteComponent setSubSite(List<CodeableConcept> theSubSite) { 
5130          this.subSite = theSubSite;
5131          return this;
5132        }
5133
5134        public boolean hasSubSite() { 
5135          if (this.subSite == null)
5136            return false;
5137          for (CodeableConcept item : this.subSite)
5138            if (!item.isEmpty())
5139              return true;
5140          return false;
5141        }
5142
5143        public CodeableConcept addSubSite() { //3
5144          CodeableConcept t = new CodeableConcept();
5145          if (this.subSite == null)
5146            this.subSite = new ArrayList<CodeableConcept>();
5147          this.subSite.add(t);
5148          return t;
5149        }
5150
5151        public BodySiteComponent addSubSite(CodeableConcept t) { //3
5152          if (t == null)
5153            return this;
5154          if (this.subSite == null)
5155            this.subSite = new ArrayList<CodeableConcept>();
5156          this.subSite.add(t);
5157          return this;
5158        }
5159
5160        /**
5161         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist {3}
5162         */
5163        public CodeableConcept getSubSiteFirstRep() { 
5164          if (getSubSite().isEmpty()) {
5165            addSubSite();
5166          }
5167          return getSubSite().get(0);
5168        }
5169
5170        protected void listChildren(List<Property> children) {
5171          super.listChildren(children);
5172          children.add(new Property("site", "CodeableReference(BodyStructure)", "Physical service site on the patient (limb, tooth, etc.).", 0, java.lang.Integer.MAX_VALUE, site));
5173          children.add(new Property("subSite", "CodeableConcept", "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite));
5174        }
5175
5176        @Override
5177        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5178          switch (_hash) {
5179          case 3530567: /*site*/  return new Property("site", "CodeableReference(BodyStructure)", "Physical service site on the patient (limb, tooth, etc.).", 0, java.lang.Integer.MAX_VALUE, site);
5180          case -1868566105: /*subSite*/  return new Property("subSite", "CodeableConcept", "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite);
5181          default: return super.getNamedProperty(_hash, _name, _checkValid);
5182          }
5183
5184        }
5185
5186      @Override
5187      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5188        switch (hash) {
5189        case 3530567: /*site*/ return this.site == null ? new Base[0] : this.site.toArray(new Base[this.site.size()]); // CodeableReference
5190        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
5191        default: return super.getProperty(hash, name, checkValid);
5192        }
5193
5194      }
5195
5196      @Override
5197      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5198        switch (hash) {
5199        case 3530567: // site
5200          this.getSite().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
5201          return value;
5202        case -1868566105: // subSite
5203          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
5204          return value;
5205        default: return super.setProperty(hash, name, value);
5206        }
5207
5208      }
5209
5210      @Override
5211      public Base setProperty(String name, Base value) throws FHIRException {
5212        if (name.equals("site")) {
5213          this.getSite().add(TypeConvertor.castToCodeableReference(value));
5214        } else if (name.equals("subSite")) {
5215          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value));
5216        } else
5217          return super.setProperty(name, value);
5218        return value;
5219      }
5220
5221      @Override
5222      public Base makeProperty(int hash, String name) throws FHIRException {
5223        switch (hash) {
5224        case 3530567:  return addSite(); 
5225        case -1868566105:  return addSubSite(); 
5226        default: return super.makeProperty(hash, name);
5227        }
5228
5229      }
5230
5231      @Override
5232      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5233        switch (hash) {
5234        case 3530567: /*site*/ return new String[] {"CodeableReference"};
5235        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
5236        default: return super.getTypesForProperty(hash, name);
5237        }
5238
5239      }
5240
5241      @Override
5242      public Base addChild(String name) throws FHIRException {
5243        if (name.equals("site")) {
5244          return addSite();
5245        }
5246        else if (name.equals("subSite")) {
5247          return addSubSite();
5248        }
5249        else
5250          return super.addChild(name);
5251      }
5252
5253      public BodySiteComponent copy() {
5254        BodySiteComponent dst = new BodySiteComponent();
5255        copyValues(dst);
5256        return dst;
5257      }
5258
5259      public void copyValues(BodySiteComponent dst) {
5260        super.copyValues(dst);
5261        if (site != null) {
5262          dst.site = new ArrayList<CodeableReference>();
5263          for (CodeableReference i : site)
5264            dst.site.add(i.copy());
5265        };
5266        if (subSite != null) {
5267          dst.subSite = new ArrayList<CodeableConcept>();
5268          for (CodeableConcept i : subSite)
5269            dst.subSite.add(i.copy());
5270        };
5271      }
5272
5273      @Override
5274      public boolean equalsDeep(Base other_) {
5275        if (!super.equalsDeep(other_))
5276          return false;
5277        if (!(other_ instanceof BodySiteComponent))
5278          return false;
5279        BodySiteComponent o = (BodySiteComponent) other_;
5280        return compareDeep(site, o.site, true) && compareDeep(subSite, o.subSite, true);
5281      }
5282
5283      @Override
5284      public boolean equalsShallow(Base other_) {
5285        if (!super.equalsShallow(other_))
5286          return false;
5287        if (!(other_ instanceof BodySiteComponent))
5288          return false;
5289        BodySiteComponent o = (BodySiteComponent) other_;
5290        return true;
5291      }
5292
5293      public boolean isEmpty() {
5294        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(site, subSite);
5295      }
5296
5297  public String fhirType() {
5298    return "ExplanationOfBenefit.item.bodySite";
5299
5300  }
5301
5302  }
5303
5304    @Block()
5305    public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
5306        /**
5307         * A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.
5308         */
5309        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
5310        @Description(shortDefinition="Type of adjudication information", formalDefinition="A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item." )
5311        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
5312        protected CodeableConcept category;
5313
5314        /**
5315         * A code supporting the understanding of the adjudication result and explaining variance from expected amount.
5316         */
5317        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5318        @Description(shortDefinition="Explanation of adjudication outcome", formalDefinition="A code supporting the understanding of the adjudication result and explaining variance from expected amount." )
5319        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-reason")
5320        protected CodeableConcept reason;
5321
5322        /**
5323         * Monetary amount associated with the category.
5324         */
5325        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
5326        @Description(shortDefinition="Monetary amount", formalDefinition="Monetary amount associated with the category." )
5327        protected Money amount;
5328
5329        /**
5330         * A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5331         */
5332        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
5333        @Description(shortDefinition="Non-monitary value", formalDefinition="A non-monetary value associated with the category. Mutually exclusive to the amount element above." )
5334        protected DecimalType value;
5335
5336        private static final long serialVersionUID = 1559898786L;
5337
5338    /**
5339     * Constructor
5340     */
5341      public AdjudicationComponent() {
5342        super();
5343      }
5344
5345    /**
5346     * Constructor
5347     */
5348      public AdjudicationComponent(CodeableConcept category) {
5349        super();
5350        this.setCategory(category);
5351      }
5352
5353        /**
5354         * @return {@link #category} (A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.)
5355         */
5356        public CodeableConcept getCategory() { 
5357          if (this.category == null)
5358            if (Configuration.errorOnAutoCreate())
5359              throw new Error("Attempt to auto-create AdjudicationComponent.category");
5360            else if (Configuration.doAutoCreate())
5361              this.category = new CodeableConcept(); // cc
5362          return this.category;
5363        }
5364
5365        public boolean hasCategory() { 
5366          return this.category != null && !this.category.isEmpty();
5367        }
5368
5369        /**
5370         * @param value {@link #category} (A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.)
5371         */
5372        public AdjudicationComponent setCategory(CodeableConcept value) { 
5373          this.category = value;
5374          return this;
5375        }
5376
5377        /**
5378         * @return {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5379         */
5380        public CodeableConcept getReason() { 
5381          if (this.reason == null)
5382            if (Configuration.errorOnAutoCreate())
5383              throw new Error("Attempt to auto-create AdjudicationComponent.reason");
5384            else if (Configuration.doAutoCreate())
5385              this.reason = new CodeableConcept(); // cc
5386          return this.reason;
5387        }
5388
5389        public boolean hasReason() { 
5390          return this.reason != null && !this.reason.isEmpty();
5391        }
5392
5393        /**
5394         * @param value {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5395         */
5396        public AdjudicationComponent setReason(CodeableConcept value) { 
5397          this.reason = value;
5398          return this;
5399        }
5400
5401        /**
5402         * @return {@link #amount} (Monetary amount associated with the category.)
5403         */
5404        public Money getAmount() { 
5405          if (this.amount == null)
5406            if (Configuration.errorOnAutoCreate())
5407              throw new Error("Attempt to auto-create AdjudicationComponent.amount");
5408            else if (Configuration.doAutoCreate())
5409              this.amount = new Money(); // cc
5410          return this.amount;
5411        }
5412
5413        public boolean hasAmount() { 
5414          return this.amount != null && !this.amount.isEmpty();
5415        }
5416
5417        /**
5418         * @param value {@link #amount} (Monetary amount associated with the category.)
5419         */
5420        public AdjudicationComponent setAmount(Money value) { 
5421          this.amount = value;
5422          return this;
5423        }
5424
5425        /**
5426         * @return {@link #value} (A non-monetary value associated with the category. 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
5427         */
5428        public DecimalType getValueElement() { 
5429          if (this.value == null)
5430            if (Configuration.errorOnAutoCreate())
5431              throw new Error("Attempt to auto-create AdjudicationComponent.value");
5432            else if (Configuration.doAutoCreate())
5433              this.value = new DecimalType(); // bb
5434          return this.value;
5435        }
5436
5437        public boolean hasValueElement() { 
5438          return this.value != null && !this.value.isEmpty();
5439        }
5440
5441        public boolean hasValue() { 
5442          return this.value != null && !this.value.isEmpty();
5443        }
5444
5445        /**
5446         * @param value {@link #value} (A non-monetary value associated with the category. 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
5447         */
5448        public AdjudicationComponent setValueElement(DecimalType value) { 
5449          this.value = value;
5450          return this;
5451        }
5452
5453        /**
5454         * @return A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5455         */
5456        public BigDecimal getValue() { 
5457          return this.value == null ? null : this.value.getValue();
5458        }
5459
5460        /**
5461         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5462         */
5463        public AdjudicationComponent setValue(BigDecimal value) { 
5464          if (value == null)
5465            this.value = null;
5466          else {
5467            if (this.value == null)
5468              this.value = new DecimalType();
5469            this.value.setValue(value);
5470          }
5471          return this;
5472        }
5473
5474        /**
5475         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5476         */
5477        public AdjudicationComponent setValue(long value) { 
5478              this.value = new DecimalType();
5479            this.value.setValue(value);
5480          return this;
5481        }
5482
5483        /**
5484         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5485         */
5486        public AdjudicationComponent setValue(double value) { 
5487              this.value = new DecimalType();
5488            this.value.setValue(value);
5489          return this;
5490        }
5491
5492        protected void listChildren(List<Property> children) {
5493          super.listChildren(children);
5494          children.add(new Property("category", "CodeableConcept", "A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.", 0, 1, category));
5495          children.add(new Property("reason", "CodeableConcept", "A code supporting the understanding of the adjudication result and explaining variance from expected amount.", 0, 1, reason));
5496          children.add(new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount));
5497          children.add(new Property("value", "decimal", "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1, value));
5498        }
5499
5500        @Override
5501        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5502          switch (_hash) {
5503          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.", 0, 1, category);
5504          case -934964668: /*reason*/  return new Property("reason", "CodeableConcept", "A code supporting the understanding of the adjudication result and explaining variance from expected amount.", 0, 1, reason);
5505          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount);
5506          case 111972721: /*value*/  return new Property("value", "decimal", "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1, value);
5507          default: return super.getNamedProperty(_hash, _name, _checkValid);
5508          }
5509
5510        }
5511
5512      @Override
5513      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5514        switch (hash) {
5515        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
5516        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
5517        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
5518        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
5519        default: return super.getProperty(hash, name, checkValid);
5520        }
5521
5522      }
5523
5524      @Override
5525      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5526        switch (hash) {
5527        case 50511102: // category
5528          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5529          return value;
5530        case -934964668: // reason
5531          this.reason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5532          return value;
5533        case -1413853096: // amount
5534          this.amount = TypeConvertor.castToMoney(value); // Money
5535          return value;
5536        case 111972721: // value
5537          this.value = TypeConvertor.castToDecimal(value); // DecimalType
5538          return value;
5539        default: return super.setProperty(hash, name, value);
5540        }
5541
5542      }
5543
5544      @Override
5545      public Base setProperty(String name, Base value) throws FHIRException {
5546        if (name.equals("category")) {
5547          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5548        } else if (name.equals("reason")) {
5549          this.reason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5550        } else if (name.equals("amount")) {
5551          this.amount = TypeConvertor.castToMoney(value); // Money
5552        } else if (name.equals("value")) {
5553          this.value = TypeConvertor.castToDecimal(value); // DecimalType
5554        } else
5555          return super.setProperty(name, value);
5556        return value;
5557      }
5558
5559      @Override
5560      public Base makeProperty(int hash, String name) throws FHIRException {
5561        switch (hash) {
5562        case 50511102:  return getCategory();
5563        case -934964668:  return getReason();
5564        case -1413853096:  return getAmount();
5565        case 111972721:  return getValueElement();
5566        default: return super.makeProperty(hash, name);
5567        }
5568
5569      }
5570
5571      @Override
5572      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5573        switch (hash) {
5574        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5575        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
5576        case -1413853096: /*amount*/ return new String[] {"Money"};
5577        case 111972721: /*value*/ return new String[] {"decimal"};
5578        default: return super.getTypesForProperty(hash, name);
5579        }
5580
5581      }
5582
5583      @Override
5584      public Base addChild(String name) throws FHIRException {
5585        if (name.equals("category")) {
5586          this.category = new CodeableConcept();
5587          return this.category;
5588        }
5589        else if (name.equals("reason")) {
5590          this.reason = new CodeableConcept();
5591          return this.reason;
5592        }
5593        else if (name.equals("amount")) {
5594          this.amount = new Money();
5595          return this.amount;
5596        }
5597        else if (name.equals("value")) {
5598          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.adjudication.value");
5599        }
5600        else
5601          return super.addChild(name);
5602      }
5603
5604      public AdjudicationComponent copy() {
5605        AdjudicationComponent dst = new AdjudicationComponent();
5606        copyValues(dst);
5607        return dst;
5608      }
5609
5610      public void copyValues(AdjudicationComponent dst) {
5611        super.copyValues(dst);
5612        dst.category = category == null ? null : category.copy();
5613        dst.reason = reason == null ? null : reason.copy();
5614        dst.amount = amount == null ? null : amount.copy();
5615        dst.value = value == null ? null : value.copy();
5616      }
5617
5618      @Override
5619      public boolean equalsDeep(Base other_) {
5620        if (!super.equalsDeep(other_))
5621          return false;
5622        if (!(other_ instanceof AdjudicationComponent))
5623          return false;
5624        AdjudicationComponent o = (AdjudicationComponent) other_;
5625        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
5626           && compareDeep(value, o.value, true);
5627      }
5628
5629      @Override
5630      public boolean equalsShallow(Base other_) {
5631        if (!super.equalsShallow(other_))
5632          return false;
5633        if (!(other_ instanceof AdjudicationComponent))
5634          return false;
5635        AdjudicationComponent o = (AdjudicationComponent) other_;
5636        return compareValues(value, o.value, true);
5637      }
5638
5639      public boolean isEmpty() {
5640        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount
5641          , value);
5642      }
5643
5644  public String fhirType() {
5645    return "ExplanationOfBenefit.item.adjudication";
5646
5647  }
5648
5649  }
5650
5651    @Block()
5652    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
5653        /**
5654         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5655         */
5656        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
5657        @Description(shortDefinition="Product or service provided", formalDefinition="A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items." )
5658        protected PositiveIntType sequence;
5659
5660        /**
5661         * The type of revenue or cost center providing the product and/or service.
5662         */
5663        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5664        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
5665        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
5666        protected CodeableConcept revenue;
5667
5668        /**
5669         * Code to identify the general type of benefits under which products and services are provided.
5670         */
5671        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
5672        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
5673        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
5674        protected CodeableConcept category;
5675
5676        /**
5677         * When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.
5678         */
5679        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
5680        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used." )
5681        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
5682        protected CodeableConcept productOrService;
5683
5684        /**
5685         * This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.
5686         */
5687        @Child(name = "productOrServiceEnd", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
5688        @Description(shortDefinition="End of a range of codes", formalDefinition="This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims." )
5689        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
5690        protected CodeableConcept productOrServiceEnd;
5691
5692        /**
5693         * Item typification or modifiers codes to convey additional context for the product or service.
5694         */
5695        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5696        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
5697        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
5698        protected List<CodeableConcept> modifier;
5699
5700        /**
5701         * Identifies the program under which this may be recovered.
5702         */
5703        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5704        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
5705        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
5706        protected List<CodeableConcept> programCode;
5707
5708        /**
5709         * The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.
5710         */
5711        @Child(name = "patientPaid", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
5712        @Description(shortDefinition="Paid by the patient", formalDefinition="The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services." )
5713        protected Money patientPaid;
5714
5715        /**
5716         * The number of repetitions of a service or product.
5717         */
5718        @Child(name = "quantity", type = {Quantity.class}, order=9, min=0, max=1, modifier=false, summary=false)
5719        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
5720        protected Quantity quantity;
5721
5722        /**
5723         * If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.
5724         */
5725        @Child(name = "unitPrice", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
5726        @Description(shortDefinition="Fee, charge or cost per item", formalDefinition="If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group." )
5727        protected Money unitPrice;
5728
5729        /**
5730         * 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.
5731         */
5732        @Child(name = "factor", type = {DecimalType.class}, order=11, min=0, max=1, modifier=false, summary=false)
5733        @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." )
5734        protected DecimalType factor;
5735
5736        /**
5737         * The total of taxes applicable for this product or service.
5738         */
5739        @Child(name = "tax", type = {Money.class}, order=12, min=0, max=1, modifier=false, summary=false)
5740        @Description(shortDefinition="Total tax", formalDefinition="The total of taxes applicable for this product or service." )
5741        protected Money tax;
5742
5743        /**
5744         * The quantity times the unit price for an additional service or product or charge.
5745         */
5746        @Child(name = "net", type = {Money.class}, order=13, min=0, max=1, modifier=false, summary=false)
5747        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
5748        protected Money net;
5749
5750        /**
5751         * Unique Device Identifiers associated with this line item.
5752         */
5753        @Child(name = "udi", type = {Device.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5754        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
5755        protected List<Reference> udi;
5756
5757        /**
5758         * The numbers associated with notes below which apply to the adjudication of this item.
5759         */
5760        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5761        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
5762        protected List<PositiveIntType> noteNumber;
5763
5764        /**
5765         * The result of the claim, predetermination, or preauthorization adjudication.
5766         */
5767        @Child(name = "decision", type = {CodeableConcept.class}, order=16, min=0, max=1, modifier=false, summary=false)
5768        @Description(shortDefinition="Result of the adjudication", formalDefinition="The result of the claim, predetermination, or preauthorization adjudication." )
5769        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-decision")
5770        protected CodeableConcept decision;
5771
5772        /**
5773         * The adjudication results.
5774         */
5775        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5776        @Description(shortDefinition="Detail level adjudication details", formalDefinition="The adjudication results." )
5777        protected List<AdjudicationComponent> adjudication;
5778
5779        /**
5780         * Third-tier of goods and services.
5781         */
5782        @Child(name = "subDetail", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5783        @Description(shortDefinition="Additional items", formalDefinition="Third-tier of goods and services." )
5784        protected List<SubDetailComponent> subDetail;
5785
5786        private static final long serialVersionUID = -1135131173L;
5787
5788    /**
5789     * Constructor
5790     */
5791      public DetailComponent() {
5792        super();
5793      }
5794
5795    /**
5796     * Constructor
5797     */
5798      public DetailComponent(int sequence) {
5799        super();
5800        this.setSequence(sequence);
5801      }
5802
5803        /**
5804         * @return {@link #sequence} (A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
5805         */
5806        public PositiveIntType getSequenceElement() { 
5807          if (this.sequence == null)
5808            if (Configuration.errorOnAutoCreate())
5809              throw new Error("Attempt to auto-create DetailComponent.sequence");
5810            else if (Configuration.doAutoCreate())
5811              this.sequence = new PositiveIntType(); // bb
5812          return this.sequence;
5813        }
5814
5815        public boolean hasSequenceElement() { 
5816          return this.sequence != null && !this.sequence.isEmpty();
5817        }
5818
5819        public boolean hasSequence() { 
5820          return this.sequence != null && !this.sequence.isEmpty();
5821        }
5822
5823        /**
5824         * @param value {@link #sequence} (A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
5825         */
5826        public DetailComponent setSequenceElement(PositiveIntType value) { 
5827          this.sequence = value;
5828          return this;
5829        }
5830
5831        /**
5832         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5833         */
5834        public int getSequence() { 
5835          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
5836        }
5837
5838        /**
5839         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5840         */
5841        public DetailComponent setSequence(int value) { 
5842            if (this.sequence == null)
5843              this.sequence = new PositiveIntType();
5844            this.sequence.setValue(value);
5845          return this;
5846        }
5847
5848        /**
5849         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5850         */
5851        public CodeableConcept getRevenue() { 
5852          if (this.revenue == null)
5853            if (Configuration.errorOnAutoCreate())
5854              throw new Error("Attempt to auto-create DetailComponent.revenue");
5855            else if (Configuration.doAutoCreate())
5856              this.revenue = new CodeableConcept(); // cc
5857          return this.revenue;
5858        }
5859
5860        public boolean hasRevenue() { 
5861          return this.revenue != null && !this.revenue.isEmpty();
5862        }
5863
5864        /**
5865         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5866         */
5867        public DetailComponent setRevenue(CodeableConcept value) { 
5868          this.revenue = value;
5869          return this;
5870        }
5871
5872        /**
5873         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5874         */
5875        public CodeableConcept getCategory() { 
5876          if (this.category == null)
5877            if (Configuration.errorOnAutoCreate())
5878              throw new Error("Attempt to auto-create DetailComponent.category");
5879            else if (Configuration.doAutoCreate())
5880              this.category = new CodeableConcept(); // cc
5881          return this.category;
5882        }
5883
5884        public boolean hasCategory() { 
5885          return this.category != null && !this.category.isEmpty();
5886        }
5887
5888        /**
5889         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5890         */
5891        public DetailComponent setCategory(CodeableConcept value) { 
5892          this.category = value;
5893          return this;
5894        }
5895
5896        /**
5897         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.)
5898         */
5899        public CodeableConcept getProductOrService() { 
5900          if (this.productOrService == null)
5901            if (Configuration.errorOnAutoCreate())
5902              throw new Error("Attempt to auto-create DetailComponent.productOrService");
5903            else if (Configuration.doAutoCreate())
5904              this.productOrService = new CodeableConcept(); // cc
5905          return this.productOrService;
5906        }
5907
5908        public boolean hasProductOrService() { 
5909          return this.productOrService != null && !this.productOrService.isEmpty();
5910        }
5911
5912        /**
5913         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.)
5914         */
5915        public DetailComponent setProductOrService(CodeableConcept value) { 
5916          this.productOrService = value;
5917          return this;
5918        }
5919
5920        /**
5921         * @return {@link #productOrServiceEnd} (This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.)
5922         */
5923        public CodeableConcept getProductOrServiceEnd() { 
5924          if (this.productOrServiceEnd == null)
5925            if (Configuration.errorOnAutoCreate())
5926              throw new Error("Attempt to auto-create DetailComponent.productOrServiceEnd");
5927            else if (Configuration.doAutoCreate())
5928              this.productOrServiceEnd = new CodeableConcept(); // cc
5929          return this.productOrServiceEnd;
5930        }
5931
5932        public boolean hasProductOrServiceEnd() { 
5933          return this.productOrServiceEnd != null && !this.productOrServiceEnd.isEmpty();
5934        }
5935
5936        /**
5937         * @param value {@link #productOrServiceEnd} (This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.)
5938         */
5939        public DetailComponent setProductOrServiceEnd(CodeableConcept value) { 
5940          this.productOrServiceEnd = value;
5941          return this;
5942        }
5943
5944        /**
5945         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
5946         */
5947        public List<CodeableConcept> getModifier() { 
5948          if (this.modifier == null)
5949            this.modifier = new ArrayList<CodeableConcept>();
5950          return this.modifier;
5951        }
5952
5953        /**
5954         * @return Returns a reference to <code>this</code> for easy method chaining
5955         */
5956        public DetailComponent setModifier(List<CodeableConcept> theModifier) { 
5957          this.modifier = theModifier;
5958          return this;
5959        }
5960
5961        public boolean hasModifier() { 
5962          if (this.modifier == null)
5963            return false;
5964          for (CodeableConcept item : this.modifier)
5965            if (!item.isEmpty())
5966              return true;
5967          return false;
5968        }
5969
5970        public CodeableConcept addModifier() { //3
5971          CodeableConcept t = new CodeableConcept();
5972          if (this.modifier == null)
5973            this.modifier = new ArrayList<CodeableConcept>();
5974          this.modifier.add(t);
5975          return t;
5976        }
5977
5978        public DetailComponent addModifier(CodeableConcept t) { //3
5979          if (t == null)
5980            return this;
5981          if (this.modifier == null)
5982            this.modifier = new ArrayList<CodeableConcept>();
5983          this.modifier.add(t);
5984          return this;
5985        }
5986
5987        /**
5988         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
5989         */
5990        public CodeableConcept getModifierFirstRep() { 
5991          if (getModifier().isEmpty()) {
5992            addModifier();
5993          }
5994          return getModifier().get(0);
5995        }
5996
5997        /**
5998         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
5999         */
6000        public List<CodeableConcept> getProgramCode() { 
6001          if (this.programCode == null)
6002            this.programCode = new ArrayList<CodeableConcept>();
6003          return this.programCode;
6004        }
6005
6006        /**
6007         * @return Returns a reference to <code>this</code> for easy method chaining
6008         */
6009        public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
6010          this.programCode = theProgramCode;
6011          return this;
6012        }
6013
6014        public boolean hasProgramCode() { 
6015          if (this.programCode == null)
6016            return false;
6017          for (CodeableConcept item : this.programCode)
6018            if (!item.isEmpty())
6019              return true;
6020          return false;
6021        }
6022
6023        public CodeableConcept addProgramCode() { //3
6024          CodeableConcept t = new CodeableConcept();
6025          if (this.programCode == null)
6026            this.programCode = new ArrayList<CodeableConcept>();
6027          this.programCode.add(t);
6028          return t;
6029        }
6030
6031        public DetailComponent addProgramCode(CodeableConcept t) { //3
6032          if (t == null)
6033            return this;
6034          if (this.programCode == null)
6035            this.programCode = new ArrayList<CodeableConcept>();
6036          this.programCode.add(t);
6037          return this;
6038        }
6039
6040        /**
6041         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
6042         */
6043        public CodeableConcept getProgramCodeFirstRep() { 
6044          if (getProgramCode().isEmpty()) {
6045            addProgramCode();
6046          }
6047          return getProgramCode().get(0);
6048        }
6049
6050        /**
6051         * @return {@link #patientPaid} (The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.)
6052         */
6053        public Money getPatientPaid() { 
6054          if (this.patientPaid == null)
6055            if (Configuration.errorOnAutoCreate())
6056              throw new Error("Attempt to auto-create DetailComponent.patientPaid");
6057            else if (Configuration.doAutoCreate())
6058              this.patientPaid = new Money(); // cc
6059          return this.patientPaid;
6060        }
6061
6062        public boolean hasPatientPaid() { 
6063          return this.patientPaid != null && !this.patientPaid.isEmpty();
6064        }
6065
6066        /**
6067         * @param value {@link #patientPaid} (The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.)
6068         */
6069        public DetailComponent setPatientPaid(Money value) { 
6070          this.patientPaid = value;
6071          return this;
6072        }
6073
6074        /**
6075         * @return {@link #quantity} (The number of repetitions of a service or product.)
6076         */
6077        public Quantity getQuantity() { 
6078          if (this.quantity == null)
6079            if (Configuration.errorOnAutoCreate())
6080              throw new Error("Attempt to auto-create DetailComponent.quantity");
6081            else if (Configuration.doAutoCreate())
6082              this.quantity = new Quantity(); // cc
6083          return this.quantity;
6084        }
6085
6086        public boolean hasQuantity() { 
6087          return this.quantity != null && !this.quantity.isEmpty();
6088        }
6089
6090        /**
6091         * @param value {@link #quantity} (The number of repetitions of a service or product.)
6092         */
6093        public DetailComponent setQuantity(Quantity value) { 
6094          this.quantity = value;
6095          return this;
6096        }
6097
6098        /**
6099         * @return {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
6100         */
6101        public Money getUnitPrice() { 
6102          if (this.unitPrice == null)
6103            if (Configuration.errorOnAutoCreate())
6104              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
6105            else if (Configuration.doAutoCreate())
6106              this.unitPrice = new Money(); // cc
6107          return this.unitPrice;
6108        }
6109
6110        public boolean hasUnitPrice() { 
6111          return this.unitPrice != null && !this.unitPrice.isEmpty();
6112        }
6113
6114        /**
6115         * @param value {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
6116         */
6117        public DetailComponent setUnitPrice(Money value) { 
6118          this.unitPrice = value;
6119          return this;
6120        }
6121
6122        /**
6123         * @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
6124         */
6125        public DecimalType getFactorElement() { 
6126          if (this.factor == null)
6127            if (Configuration.errorOnAutoCreate())
6128              throw new Error("Attempt to auto-create DetailComponent.factor");
6129            else if (Configuration.doAutoCreate())
6130              this.factor = new DecimalType(); // bb
6131          return this.factor;
6132        }
6133
6134        public boolean hasFactorElement() { 
6135          return this.factor != null && !this.factor.isEmpty();
6136        }
6137
6138        public boolean hasFactor() { 
6139          return this.factor != null && !this.factor.isEmpty();
6140        }
6141
6142        /**
6143         * @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
6144         */
6145        public DetailComponent setFactorElement(DecimalType value) { 
6146          this.factor = value;
6147          return this;
6148        }
6149
6150        /**
6151         * @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.
6152         */
6153        public BigDecimal getFactor() { 
6154          return this.factor == null ? null : this.factor.getValue();
6155        }
6156
6157        /**
6158         * @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.
6159         */
6160        public DetailComponent setFactor(BigDecimal value) { 
6161          if (value == null)
6162            this.factor = null;
6163          else {
6164            if (this.factor == null)
6165              this.factor = new DecimalType();
6166            this.factor.setValue(value);
6167          }
6168          return this;
6169        }
6170
6171        /**
6172         * @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.
6173         */
6174        public DetailComponent setFactor(long value) { 
6175              this.factor = new DecimalType();
6176            this.factor.setValue(value);
6177          return this;
6178        }
6179
6180        /**
6181         * @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.
6182         */
6183        public DetailComponent setFactor(double value) { 
6184              this.factor = new DecimalType();
6185            this.factor.setValue(value);
6186          return this;
6187        }
6188
6189        /**
6190         * @return {@link #tax} (The total of taxes applicable for this product or service.)
6191         */
6192        public Money getTax() { 
6193          if (this.tax == null)
6194            if (Configuration.errorOnAutoCreate())
6195              throw new Error("Attempt to auto-create DetailComponent.tax");
6196            else if (Configuration.doAutoCreate())
6197              this.tax = new Money(); // cc
6198          return this.tax;
6199        }
6200
6201        public boolean hasTax() { 
6202          return this.tax != null && !this.tax.isEmpty();
6203        }
6204
6205        /**
6206         * @param value {@link #tax} (The total of taxes applicable for this product or service.)
6207         */
6208        public DetailComponent setTax(Money value) { 
6209          this.tax = value;
6210          return this;
6211        }
6212
6213        /**
6214         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6215         */
6216        public Money getNet() { 
6217          if (this.net == null)
6218            if (Configuration.errorOnAutoCreate())
6219              throw new Error("Attempt to auto-create DetailComponent.net");
6220            else if (Configuration.doAutoCreate())
6221              this.net = new Money(); // cc
6222          return this.net;
6223        }
6224
6225        public boolean hasNet() { 
6226          return this.net != null && !this.net.isEmpty();
6227        }
6228
6229        /**
6230         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6231         */
6232        public DetailComponent setNet(Money value) { 
6233          this.net = value;
6234          return this;
6235        }
6236
6237        /**
6238         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
6239         */
6240        public List<Reference> getUdi() { 
6241          if (this.udi == null)
6242            this.udi = new ArrayList<Reference>();
6243          return this.udi;
6244        }
6245
6246        /**
6247         * @return Returns a reference to <code>this</code> for easy method chaining
6248         */
6249        public DetailComponent setUdi(List<Reference> theUdi) { 
6250          this.udi = theUdi;
6251          return this;
6252        }
6253
6254        public boolean hasUdi() { 
6255          if (this.udi == null)
6256            return false;
6257          for (Reference item : this.udi)
6258            if (!item.isEmpty())
6259              return true;
6260          return false;
6261        }
6262
6263        public Reference addUdi() { //3
6264          Reference t = new Reference();
6265          if (this.udi == null)
6266            this.udi = new ArrayList<Reference>();
6267          this.udi.add(t);
6268          return t;
6269        }
6270
6271        public DetailComponent addUdi(Reference t) { //3
6272          if (t == null)
6273            return this;
6274          if (this.udi == null)
6275            this.udi = new ArrayList<Reference>();
6276          this.udi.add(t);
6277          return this;
6278        }
6279
6280        /**
6281         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
6282         */
6283        public Reference getUdiFirstRep() { 
6284          if (getUdi().isEmpty()) {
6285            addUdi();
6286          }
6287          return getUdi().get(0);
6288        }
6289
6290        /**
6291         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6292         */
6293        public List<PositiveIntType> getNoteNumber() { 
6294          if (this.noteNumber == null)
6295            this.noteNumber = new ArrayList<PositiveIntType>();
6296          return this.noteNumber;
6297        }
6298
6299        /**
6300         * @return Returns a reference to <code>this</code> for easy method chaining
6301         */
6302        public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
6303          this.noteNumber = theNoteNumber;
6304          return this;
6305        }
6306
6307        public boolean hasNoteNumber() { 
6308          if (this.noteNumber == null)
6309            return false;
6310          for (PositiveIntType item : this.noteNumber)
6311            if (!item.isEmpty())
6312              return true;
6313          return false;
6314        }
6315
6316        /**
6317         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6318         */
6319        public PositiveIntType addNoteNumberElement() {//2 
6320          PositiveIntType t = new PositiveIntType();
6321          if (this.noteNumber == null)
6322            this.noteNumber = new ArrayList<PositiveIntType>();
6323          this.noteNumber.add(t);
6324          return t;
6325        }
6326
6327        /**
6328         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6329         */
6330        public DetailComponent addNoteNumber(int value) { //1
6331          PositiveIntType t = new PositiveIntType();
6332          t.setValue(value);
6333          if (this.noteNumber == null)
6334            this.noteNumber = new ArrayList<PositiveIntType>();
6335          this.noteNumber.add(t);
6336          return this;
6337        }
6338
6339        /**
6340         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6341         */
6342        public boolean hasNoteNumber(int value) { 
6343          if (this.noteNumber == null)
6344            return false;
6345          for (PositiveIntType v : this.noteNumber)
6346            if (v.getValue().equals(value)) // positiveInt
6347              return true;
6348          return false;
6349        }
6350
6351        /**
6352         * @return {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
6353         */
6354        public CodeableConcept getDecision() { 
6355          if (this.decision == null)
6356            if (Configuration.errorOnAutoCreate())
6357              throw new Error("Attempt to auto-create DetailComponent.decision");
6358            else if (Configuration.doAutoCreate())
6359              this.decision = new CodeableConcept(); // cc
6360          return this.decision;
6361        }
6362
6363        public boolean hasDecision() { 
6364          return this.decision != null && !this.decision.isEmpty();
6365        }
6366
6367        /**
6368         * @param value {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
6369         */
6370        public DetailComponent setDecision(CodeableConcept value) { 
6371          this.decision = value;
6372          return this;
6373        }
6374
6375        /**
6376         * @return {@link #adjudication} (The adjudication results.)
6377         */
6378        public List<AdjudicationComponent> getAdjudication() { 
6379          if (this.adjudication == null)
6380            this.adjudication = new ArrayList<AdjudicationComponent>();
6381          return this.adjudication;
6382        }
6383
6384        /**
6385         * @return Returns a reference to <code>this</code> for easy method chaining
6386         */
6387        public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
6388          this.adjudication = theAdjudication;
6389          return this;
6390        }
6391
6392        public boolean hasAdjudication() { 
6393          if (this.adjudication == null)
6394            return false;
6395          for (AdjudicationComponent item : this.adjudication)
6396            if (!item.isEmpty())
6397              return true;
6398          return false;
6399        }
6400
6401        public AdjudicationComponent addAdjudication() { //3
6402          AdjudicationComponent t = new AdjudicationComponent();
6403          if (this.adjudication == null)
6404            this.adjudication = new ArrayList<AdjudicationComponent>();
6405          this.adjudication.add(t);
6406          return t;
6407        }
6408
6409        public DetailComponent addAdjudication(AdjudicationComponent t) { //3
6410          if (t == null)
6411            return this;
6412          if (this.adjudication == null)
6413            this.adjudication = new ArrayList<AdjudicationComponent>();
6414          this.adjudication.add(t);
6415          return this;
6416        }
6417
6418        /**
6419         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
6420         */
6421        public AdjudicationComponent getAdjudicationFirstRep() { 
6422          if (getAdjudication().isEmpty()) {
6423            addAdjudication();
6424          }
6425          return getAdjudication().get(0);
6426        }
6427
6428        /**
6429         * @return {@link #subDetail} (Third-tier of goods and services.)
6430         */
6431        public List<SubDetailComponent> getSubDetail() { 
6432          if (this.subDetail == null)
6433            this.subDetail = new ArrayList<SubDetailComponent>();
6434          return this.subDetail;
6435        }
6436
6437        /**
6438         * @return Returns a reference to <code>this</code> for easy method chaining
6439         */
6440        public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) { 
6441          this.subDetail = theSubDetail;
6442          return this;
6443        }
6444
6445        public boolean hasSubDetail() { 
6446          if (this.subDetail == null)
6447            return false;
6448          for (SubDetailComponent item : this.subDetail)
6449            if (!item.isEmpty())
6450              return true;
6451          return false;
6452        }
6453
6454        public SubDetailComponent addSubDetail() { //3
6455          SubDetailComponent t = new SubDetailComponent();
6456          if (this.subDetail == null)
6457            this.subDetail = new ArrayList<SubDetailComponent>();
6458          this.subDetail.add(t);
6459          return t;
6460        }
6461
6462        public DetailComponent addSubDetail(SubDetailComponent t) { //3
6463          if (t == null)
6464            return this;
6465          if (this.subDetail == null)
6466            this.subDetail = new ArrayList<SubDetailComponent>();
6467          this.subDetail.add(t);
6468          return this;
6469        }
6470
6471        /**
6472         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist {3}
6473         */
6474        public SubDetailComponent getSubDetailFirstRep() { 
6475          if (getSubDetail().isEmpty()) {
6476            addSubDetail();
6477          }
6478          return getSubDetail().get(0);
6479        }
6480
6481        protected void listChildren(List<Property> children) {
6482          super.listChildren(children);
6483          children.add(new Property("sequence", "positiveInt", "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.", 0, 1, sequence));
6484          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
6485          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
6486          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.", 0, 1, productOrService));
6487          children.add(new Property("productOrServiceEnd", "CodeableConcept", "This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.", 0, 1, productOrServiceEnd));
6488          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier));
6489          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
6490          children.add(new Property("patientPaid", "Money", "The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.", 0, 1, patientPaid));
6491          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
6492          children.add(new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice));
6493          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));
6494          children.add(new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax));
6495          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
6496          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
6497          children.add(new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
6498          children.add(new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision));
6499          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6500          children.add(new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
6501        }
6502
6503        @Override
6504        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6505          switch (_hash) {
6506          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.", 0, 1, sequence);
6507          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
6508          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category);
6509          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.", 0, 1, productOrService);
6510          case -717476168: /*productOrServiceEnd*/  return new Property("productOrServiceEnd", "CodeableConcept", "This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.", 0, 1, productOrServiceEnd);
6511          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier);
6512          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
6513          case 525514609: /*patientPaid*/  return new Property("patientPaid", "Money", "The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.", 0, 1, patientPaid);
6514          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
6515          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice);
6516          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);
6517          case 114603: /*tax*/  return new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax);
6518          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
6519          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
6520          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
6521          case 565719004: /*decision*/  return new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision);
6522          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6523          case -828829007: /*subDetail*/  return new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
6524          default: return super.getNamedProperty(_hash, _name, _checkValid);
6525          }
6526
6527        }
6528
6529      @Override
6530      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6531        switch (hash) {
6532        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6533        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6534        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6535        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
6536        case -717476168: /*productOrServiceEnd*/ return this.productOrServiceEnd == null ? new Base[0] : new Base[] {this.productOrServiceEnd}; // CodeableConcept
6537        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6538        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6539        case 525514609: /*patientPaid*/ return this.patientPaid == null ? new Base[0] : new Base[] {this.patientPaid}; // Money
6540        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
6541        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6542        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6543        case 114603: /*tax*/ return this.tax == null ? new Base[0] : new Base[] {this.tax}; // Money
6544        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6545        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6546        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
6547        case 565719004: /*decision*/ return this.decision == null ? new Base[0] : new Base[] {this.decision}; // CodeableConcept
6548        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
6549        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
6550        default: return super.getProperty(hash, name, checkValid);
6551        }
6552
6553      }
6554
6555      @Override
6556      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6557        switch (hash) {
6558        case 1349547969: // sequence
6559          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
6560          return value;
6561        case 1099842588: // revenue
6562          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6563          return value;
6564        case 50511102: // category
6565          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6566          return value;
6567        case 1957227299: // productOrService
6568          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6569          return value;
6570        case -717476168: // productOrServiceEnd
6571          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6572          return value;
6573        case -615513385: // modifier
6574          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
6575          return value;
6576        case 1010065041: // programCode
6577          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
6578          return value;
6579        case 525514609: // patientPaid
6580          this.patientPaid = TypeConvertor.castToMoney(value); // Money
6581          return value;
6582        case -1285004149: // quantity
6583          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
6584          return value;
6585        case -486196699: // unitPrice
6586          this.unitPrice = TypeConvertor.castToMoney(value); // Money
6587          return value;
6588        case -1282148017: // factor
6589          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
6590          return value;
6591        case 114603: // tax
6592          this.tax = TypeConvertor.castToMoney(value); // Money
6593          return value;
6594        case 108957: // net
6595          this.net = TypeConvertor.castToMoney(value); // Money
6596          return value;
6597        case 115642: // udi
6598          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
6599          return value;
6600        case -1110033957: // noteNumber
6601          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
6602          return value;
6603        case 565719004: // decision
6604          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6605          return value;
6606        case -231349275: // adjudication
6607          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
6608          return value;
6609        case -828829007: // subDetail
6610          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
6611          return value;
6612        default: return super.setProperty(hash, name, value);
6613        }
6614
6615      }
6616
6617      @Override
6618      public Base setProperty(String name, Base value) throws FHIRException {
6619        if (name.equals("sequence")) {
6620          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
6621        } else if (name.equals("revenue")) {
6622          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6623        } else if (name.equals("category")) {
6624          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6625        } else if (name.equals("productOrService")) {
6626          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6627        } else if (name.equals("productOrServiceEnd")) {
6628          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6629        } else if (name.equals("modifier")) {
6630          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
6631        } else if (name.equals("programCode")) {
6632          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
6633        } else if (name.equals("patientPaid")) {
6634          this.patientPaid = TypeConvertor.castToMoney(value); // Money
6635        } else if (name.equals("quantity")) {
6636          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
6637        } else if (name.equals("unitPrice")) {
6638          this.unitPrice = TypeConvertor.castToMoney(value); // Money
6639        } else if (name.equals("factor")) {
6640          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
6641        } else if (name.equals("tax")) {
6642          this.tax = TypeConvertor.castToMoney(value); // Money
6643        } else if (name.equals("net")) {
6644          this.net = TypeConvertor.castToMoney(value); // Money
6645        } else if (name.equals("udi")) {
6646          this.getUdi().add(TypeConvertor.castToReference(value));
6647        } else if (name.equals("noteNumber")) {
6648          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
6649        } else if (name.equals("decision")) {
6650          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6651        } else if (name.equals("adjudication")) {
6652          this.getAdjudication().add((AdjudicationComponent) value);
6653        } else if (name.equals("subDetail")) {
6654          this.getSubDetail().add((SubDetailComponent) value);
6655        } else
6656          return super.setProperty(name, value);
6657        return value;
6658      }
6659
6660      @Override
6661      public Base makeProperty(int hash, String name) throws FHIRException {
6662        switch (hash) {
6663        case 1349547969:  return getSequenceElement();
6664        case 1099842588:  return getRevenue();
6665        case 50511102:  return getCategory();
6666        case 1957227299:  return getProductOrService();
6667        case -717476168:  return getProductOrServiceEnd();
6668        case -615513385:  return addModifier(); 
6669        case 1010065041:  return addProgramCode(); 
6670        case 525514609:  return getPatientPaid();
6671        case -1285004149:  return getQuantity();
6672        case -486196699:  return getUnitPrice();
6673        case -1282148017:  return getFactorElement();
6674        case 114603:  return getTax();
6675        case 108957:  return getNet();
6676        case 115642:  return addUdi(); 
6677        case -1110033957:  return addNoteNumberElement();
6678        case 565719004:  return getDecision();
6679        case -231349275:  return addAdjudication(); 
6680        case -828829007:  return addSubDetail(); 
6681        default: return super.makeProperty(hash, name);
6682        }
6683
6684      }
6685
6686      @Override
6687      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6688        switch (hash) {
6689        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
6690        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
6691        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
6692        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
6693        case -717476168: /*productOrServiceEnd*/ return new String[] {"CodeableConcept"};
6694        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
6695        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
6696        case 525514609: /*patientPaid*/ return new String[] {"Money"};
6697        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
6698        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6699        case -1282148017: /*factor*/ return new String[] {"decimal"};
6700        case 114603: /*tax*/ return new String[] {"Money"};
6701        case 108957: /*net*/ return new String[] {"Money"};
6702        case 115642: /*udi*/ return new String[] {"Reference"};
6703        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
6704        case 565719004: /*decision*/ return new String[] {"CodeableConcept"};
6705        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
6706        case -828829007: /*subDetail*/ return new String[] {};
6707        default: return super.getTypesForProperty(hash, name);
6708        }
6709
6710      }
6711
6712      @Override
6713      public Base addChild(String name) throws FHIRException {
6714        if (name.equals("sequence")) {
6715          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.sequence");
6716        }
6717        else if (name.equals("revenue")) {
6718          this.revenue = new CodeableConcept();
6719          return this.revenue;
6720        }
6721        else if (name.equals("category")) {
6722          this.category = new CodeableConcept();
6723          return this.category;
6724        }
6725        else if (name.equals("productOrService")) {
6726          this.productOrService = new CodeableConcept();
6727          return this.productOrService;
6728        }
6729        else if (name.equals("productOrServiceEnd")) {
6730          this.productOrServiceEnd = new CodeableConcept();
6731          return this.productOrServiceEnd;
6732        }
6733        else if (name.equals("modifier")) {
6734          return addModifier();
6735        }
6736        else if (name.equals("programCode")) {
6737          return addProgramCode();
6738        }
6739        else if (name.equals("patientPaid")) {
6740          this.patientPaid = new Money();
6741          return this.patientPaid;
6742        }
6743        else if (name.equals("quantity")) {
6744          this.quantity = new Quantity();
6745          return this.quantity;
6746        }
6747        else if (name.equals("unitPrice")) {
6748          this.unitPrice = new Money();
6749          return this.unitPrice;
6750        }
6751        else if (name.equals("factor")) {
6752          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.factor");
6753        }
6754        else if (name.equals("tax")) {
6755          this.tax = new Money();
6756          return this.tax;
6757        }
6758        else if (name.equals("net")) {
6759          this.net = new Money();
6760          return this.net;
6761        }
6762        else if (name.equals("udi")) {
6763          return addUdi();
6764        }
6765        else if (name.equals("noteNumber")) {
6766          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.noteNumber");
6767        }
6768        else if (name.equals("decision")) {
6769          this.decision = new CodeableConcept();
6770          return this.decision;
6771        }
6772        else if (name.equals("adjudication")) {
6773          return addAdjudication();
6774        }
6775        else if (name.equals("subDetail")) {
6776          return addSubDetail();
6777        }
6778        else
6779          return super.addChild(name);
6780      }
6781
6782      public DetailComponent copy() {
6783        DetailComponent dst = new DetailComponent();
6784        copyValues(dst);
6785        return dst;
6786      }
6787
6788      public void copyValues(DetailComponent dst) {
6789        super.copyValues(dst);
6790        dst.sequence = sequence == null ? null : sequence.copy();
6791        dst.revenue = revenue == null ? null : revenue.copy();
6792        dst.category = category == null ? null : category.copy();
6793        dst.productOrService = productOrService == null ? null : productOrService.copy();
6794        dst.productOrServiceEnd = productOrServiceEnd == null ? null : productOrServiceEnd.copy();
6795        if (modifier != null) {
6796          dst.modifier = new ArrayList<CodeableConcept>();
6797          for (CodeableConcept i : modifier)
6798            dst.modifier.add(i.copy());
6799        };
6800        if (programCode != null) {
6801          dst.programCode = new ArrayList<CodeableConcept>();
6802          for (CodeableConcept i : programCode)
6803            dst.programCode.add(i.copy());
6804        };
6805        dst.patientPaid = patientPaid == null ? null : patientPaid.copy();
6806        dst.quantity = quantity == null ? null : quantity.copy();
6807        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6808        dst.factor = factor == null ? null : factor.copy();
6809        dst.tax = tax == null ? null : tax.copy();
6810        dst.net = net == null ? null : net.copy();
6811        if (udi != null) {
6812          dst.udi = new ArrayList<Reference>();
6813          for (Reference i : udi)
6814            dst.udi.add(i.copy());
6815        };
6816        if (noteNumber != null) {
6817          dst.noteNumber = new ArrayList<PositiveIntType>();
6818          for (PositiveIntType i : noteNumber)
6819            dst.noteNumber.add(i.copy());
6820        };
6821        dst.decision = decision == null ? null : decision.copy();
6822        if (adjudication != null) {
6823          dst.adjudication = new ArrayList<AdjudicationComponent>();
6824          for (AdjudicationComponent i : adjudication)
6825            dst.adjudication.add(i.copy());
6826        };
6827        if (subDetail != null) {
6828          dst.subDetail = new ArrayList<SubDetailComponent>();
6829          for (SubDetailComponent i : subDetail)
6830            dst.subDetail.add(i.copy());
6831        };
6832      }
6833
6834      @Override
6835      public boolean equalsDeep(Base other_) {
6836        if (!super.equalsDeep(other_))
6837          return false;
6838        if (!(other_ instanceof DetailComponent))
6839          return false;
6840        DetailComponent o = (DetailComponent) other_;
6841        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
6842           && compareDeep(productOrService, o.productOrService, true) && compareDeep(productOrServiceEnd, o.productOrServiceEnd, true)
6843           && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true) && compareDeep(patientPaid, o.patientPaid, true)
6844           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
6845           && compareDeep(tax, o.tax, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6846           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(decision, o.decision, true) && compareDeep(adjudication, o.adjudication, true)
6847           && compareDeep(subDetail, o.subDetail, true);
6848      }
6849
6850      @Override
6851      public boolean equalsShallow(Base other_) {
6852        if (!super.equalsShallow(other_))
6853          return false;
6854        if (!(other_ instanceof DetailComponent))
6855          return false;
6856        DetailComponent o = (DetailComponent) other_;
6857        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
6858          ;
6859      }
6860
6861      public boolean isEmpty() {
6862        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
6863          , productOrService, productOrServiceEnd, modifier, programCode, patientPaid, quantity
6864          , unitPrice, factor, tax, net, udi, noteNumber, decision, adjudication, subDetail
6865          );
6866      }
6867
6868  public String fhirType() {
6869    return "ExplanationOfBenefit.item.detail";
6870
6871  }
6872
6873  }
6874
6875    @Block()
6876    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
6877        /**
6878         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6879         */
6880        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
6881        @Description(shortDefinition="Product or service provided", formalDefinition="A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items." )
6882        protected PositiveIntType sequence;
6883
6884        /**
6885         * The type of revenue or cost center providing the product and/or service.
6886         */
6887        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
6888        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
6889        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
6890        protected CodeableConcept revenue;
6891
6892        /**
6893         * Code to identify the general type of benefits under which products and services are provided.
6894         */
6895        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
6896        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
6897        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
6898        protected CodeableConcept category;
6899
6900        /**
6901         * When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.
6902         */
6903        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
6904        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used." )
6905        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6906        protected CodeableConcept productOrService;
6907
6908        /**
6909         * This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.
6910         */
6911        @Child(name = "productOrServiceEnd", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
6912        @Description(shortDefinition="End of a range of codes", formalDefinition="This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims." )
6913        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6914        protected CodeableConcept productOrServiceEnd;
6915
6916        /**
6917         * Item typification or modifiers codes to convey additional context for the product or service.
6918         */
6919        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6920        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
6921        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
6922        protected List<CodeableConcept> modifier;
6923
6924        /**
6925         * Identifies the program under which this may be recovered.
6926         */
6927        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6928        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
6929        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
6930        protected List<CodeableConcept> programCode;
6931
6932        /**
6933         * The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.
6934         */
6935        @Child(name = "patientPaid", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
6936        @Description(shortDefinition="Paid by the patient", formalDefinition="The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services." )
6937        protected Money patientPaid;
6938
6939        /**
6940         * The number of repetitions of a service or product.
6941         */
6942        @Child(name = "quantity", type = {Quantity.class}, order=9, min=0, max=1, modifier=false, summary=false)
6943        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
6944        protected Quantity quantity;
6945
6946        /**
6947         * If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.
6948         */
6949        @Child(name = "unitPrice", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
6950        @Description(shortDefinition="Fee, charge or cost per item", formalDefinition="If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group." )
6951        protected Money unitPrice;
6952
6953        /**
6954         * 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.
6955         */
6956        @Child(name = "factor", type = {DecimalType.class}, order=11, min=0, max=1, modifier=false, summary=false)
6957        @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." )
6958        protected DecimalType factor;
6959
6960        /**
6961         * The total of taxes applicable for this product or service.
6962         */
6963        @Child(name = "tax", type = {Money.class}, order=12, min=0, max=1, modifier=false, summary=false)
6964        @Description(shortDefinition="Total tax", formalDefinition="The total of taxes applicable for this product or service." )
6965        protected Money tax;
6966
6967        /**
6968         * The quantity times the unit price for an additional service or product or charge.
6969         */
6970        @Child(name = "net", type = {Money.class}, order=13, min=0, max=1, modifier=false, summary=false)
6971        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
6972        protected Money net;
6973
6974        /**
6975         * Unique Device Identifiers associated with this line item.
6976         */
6977        @Child(name = "udi", type = {Device.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6978        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
6979        protected List<Reference> udi;
6980
6981        /**
6982         * The numbers associated with notes below which apply to the adjudication of this item.
6983         */
6984        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6985        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
6986        protected List<PositiveIntType> noteNumber;
6987
6988        /**
6989         * The result of the claim, predetermination, or preauthorization adjudication.
6990         */
6991        @Child(name = "decision", type = {CodeableConcept.class}, order=16, min=0, max=1, modifier=false, summary=false)
6992        @Description(shortDefinition="Result of the adjudication", formalDefinition="The result of the claim, predetermination, or preauthorization adjudication." )
6993        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-decision")
6994        protected CodeableConcept decision;
6995
6996        /**
6997         * The adjudication results.
6998         */
6999        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7000        @Description(shortDefinition="Subdetail level adjudication details", formalDefinition="The adjudication results." )
7001        protected List<AdjudicationComponent> adjudication;
7002
7003        private static final long serialVersionUID = 971869062L;
7004
7005    /**
7006     * Constructor
7007     */
7008      public SubDetailComponent() {
7009        super();
7010      }
7011
7012    /**
7013     * Constructor
7014     */
7015      public SubDetailComponent(int sequence) {
7016        super();
7017        this.setSequence(sequence);
7018      }
7019
7020        /**
7021         * @return {@link #sequence} (A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
7022         */
7023        public PositiveIntType getSequenceElement() { 
7024          if (this.sequence == null)
7025            if (Configuration.errorOnAutoCreate())
7026              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
7027            else if (Configuration.doAutoCreate())
7028              this.sequence = new PositiveIntType(); // bb
7029          return this.sequence;
7030        }
7031
7032        public boolean hasSequenceElement() { 
7033          return this.sequence != null && !this.sequence.isEmpty();
7034        }
7035
7036        public boolean hasSequence() { 
7037          return this.sequence != null && !this.sequence.isEmpty();
7038        }
7039
7040        /**
7041         * @param value {@link #sequence} (A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
7042         */
7043        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
7044          this.sequence = value;
7045          return this;
7046        }
7047
7048        /**
7049         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
7050         */
7051        public int getSequence() { 
7052          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
7053        }
7054
7055        /**
7056         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
7057         */
7058        public SubDetailComponent setSequence(int value) { 
7059            if (this.sequence == null)
7060              this.sequence = new PositiveIntType();
7061            this.sequence.setValue(value);
7062          return this;
7063        }
7064
7065        /**
7066         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
7067         */
7068        public CodeableConcept getRevenue() { 
7069          if (this.revenue == null)
7070            if (Configuration.errorOnAutoCreate())
7071              throw new Error("Attempt to auto-create SubDetailComponent.revenue");
7072            else if (Configuration.doAutoCreate())
7073              this.revenue = new CodeableConcept(); // cc
7074          return this.revenue;
7075        }
7076
7077        public boolean hasRevenue() { 
7078          return this.revenue != null && !this.revenue.isEmpty();
7079        }
7080
7081        /**
7082         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
7083         */
7084        public SubDetailComponent setRevenue(CodeableConcept value) { 
7085          this.revenue = value;
7086          return this;
7087        }
7088
7089        /**
7090         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
7091         */
7092        public CodeableConcept getCategory() { 
7093          if (this.category == null)
7094            if (Configuration.errorOnAutoCreate())
7095              throw new Error("Attempt to auto-create SubDetailComponent.category");
7096            else if (Configuration.doAutoCreate())
7097              this.category = new CodeableConcept(); // cc
7098          return this.category;
7099        }
7100
7101        public boolean hasCategory() { 
7102          return this.category != null && !this.category.isEmpty();
7103        }
7104
7105        /**
7106         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
7107         */
7108        public SubDetailComponent setCategory(CodeableConcept value) { 
7109          this.category = value;
7110          return this;
7111        }
7112
7113        /**
7114         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.)
7115         */
7116        public CodeableConcept getProductOrService() { 
7117          if (this.productOrService == null)
7118            if (Configuration.errorOnAutoCreate())
7119              throw new Error("Attempt to auto-create SubDetailComponent.productOrService");
7120            else if (Configuration.doAutoCreate())
7121              this.productOrService = new CodeableConcept(); // cc
7122          return this.productOrService;
7123        }
7124
7125        public boolean hasProductOrService() { 
7126          return this.productOrService != null && !this.productOrService.isEmpty();
7127        }
7128
7129        /**
7130         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.)
7131         */
7132        public SubDetailComponent setProductOrService(CodeableConcept value) { 
7133          this.productOrService = value;
7134          return this;
7135        }
7136
7137        /**
7138         * @return {@link #productOrServiceEnd} (This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.)
7139         */
7140        public CodeableConcept getProductOrServiceEnd() { 
7141          if (this.productOrServiceEnd == null)
7142            if (Configuration.errorOnAutoCreate())
7143              throw new Error("Attempt to auto-create SubDetailComponent.productOrServiceEnd");
7144            else if (Configuration.doAutoCreate())
7145              this.productOrServiceEnd = new CodeableConcept(); // cc
7146          return this.productOrServiceEnd;
7147        }
7148
7149        public boolean hasProductOrServiceEnd() { 
7150          return this.productOrServiceEnd != null && !this.productOrServiceEnd.isEmpty();
7151        }
7152
7153        /**
7154         * @param value {@link #productOrServiceEnd} (This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.)
7155         */
7156        public SubDetailComponent setProductOrServiceEnd(CodeableConcept value) { 
7157          this.productOrServiceEnd = value;
7158          return this;
7159        }
7160
7161        /**
7162         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
7163         */
7164        public List<CodeableConcept> getModifier() { 
7165          if (this.modifier == null)
7166            this.modifier = new ArrayList<CodeableConcept>();
7167          return this.modifier;
7168        }
7169
7170        /**
7171         * @return Returns a reference to <code>this</code> for easy method chaining
7172         */
7173        public SubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
7174          this.modifier = theModifier;
7175          return this;
7176        }
7177
7178        public boolean hasModifier() { 
7179          if (this.modifier == null)
7180            return false;
7181          for (CodeableConcept item : this.modifier)
7182            if (!item.isEmpty())
7183              return true;
7184          return false;
7185        }
7186
7187        public CodeableConcept addModifier() { //3
7188          CodeableConcept t = new CodeableConcept();
7189          if (this.modifier == null)
7190            this.modifier = new ArrayList<CodeableConcept>();
7191          this.modifier.add(t);
7192          return t;
7193        }
7194
7195        public SubDetailComponent addModifier(CodeableConcept t) { //3
7196          if (t == null)
7197            return this;
7198          if (this.modifier == null)
7199            this.modifier = new ArrayList<CodeableConcept>();
7200          this.modifier.add(t);
7201          return this;
7202        }
7203
7204        /**
7205         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
7206         */
7207        public CodeableConcept getModifierFirstRep() { 
7208          if (getModifier().isEmpty()) {
7209            addModifier();
7210          }
7211          return getModifier().get(0);
7212        }
7213
7214        /**
7215         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
7216         */
7217        public List<CodeableConcept> getProgramCode() { 
7218          if (this.programCode == null)
7219            this.programCode = new ArrayList<CodeableConcept>();
7220          return this.programCode;
7221        }
7222
7223        /**
7224         * @return Returns a reference to <code>this</code> for easy method chaining
7225         */
7226        public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
7227          this.programCode = theProgramCode;
7228          return this;
7229        }
7230
7231        public boolean hasProgramCode() { 
7232          if (this.programCode == null)
7233            return false;
7234          for (CodeableConcept item : this.programCode)
7235            if (!item.isEmpty())
7236              return true;
7237          return false;
7238        }
7239
7240        public CodeableConcept addProgramCode() { //3
7241          CodeableConcept t = new CodeableConcept();
7242          if (this.programCode == null)
7243            this.programCode = new ArrayList<CodeableConcept>();
7244          this.programCode.add(t);
7245          return t;
7246        }
7247
7248        public SubDetailComponent addProgramCode(CodeableConcept t) { //3
7249          if (t == null)
7250            return this;
7251          if (this.programCode == null)
7252            this.programCode = new ArrayList<CodeableConcept>();
7253          this.programCode.add(t);
7254          return this;
7255        }
7256
7257        /**
7258         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
7259         */
7260        public CodeableConcept getProgramCodeFirstRep() { 
7261          if (getProgramCode().isEmpty()) {
7262            addProgramCode();
7263          }
7264          return getProgramCode().get(0);
7265        }
7266
7267        /**
7268         * @return {@link #patientPaid} (The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.)
7269         */
7270        public Money getPatientPaid() { 
7271          if (this.patientPaid == null)
7272            if (Configuration.errorOnAutoCreate())
7273              throw new Error("Attempt to auto-create SubDetailComponent.patientPaid");
7274            else if (Configuration.doAutoCreate())
7275              this.patientPaid = new Money(); // cc
7276          return this.patientPaid;
7277        }
7278
7279        public boolean hasPatientPaid() { 
7280          return this.patientPaid != null && !this.patientPaid.isEmpty();
7281        }
7282
7283        /**
7284         * @param value {@link #patientPaid} (The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.)
7285         */
7286        public SubDetailComponent setPatientPaid(Money value) { 
7287          this.patientPaid = value;
7288          return this;
7289        }
7290
7291        /**
7292         * @return {@link #quantity} (The number of repetitions of a service or product.)
7293         */
7294        public Quantity getQuantity() { 
7295          if (this.quantity == null)
7296            if (Configuration.errorOnAutoCreate())
7297              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
7298            else if (Configuration.doAutoCreate())
7299              this.quantity = new Quantity(); // cc
7300          return this.quantity;
7301        }
7302
7303        public boolean hasQuantity() { 
7304          return this.quantity != null && !this.quantity.isEmpty();
7305        }
7306
7307        /**
7308         * @param value {@link #quantity} (The number of repetitions of a service or product.)
7309         */
7310        public SubDetailComponent setQuantity(Quantity value) { 
7311          this.quantity = value;
7312          return this;
7313        }
7314
7315        /**
7316         * @return {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
7317         */
7318        public Money getUnitPrice() { 
7319          if (this.unitPrice == null)
7320            if (Configuration.errorOnAutoCreate())
7321              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
7322            else if (Configuration.doAutoCreate())
7323              this.unitPrice = new Money(); // cc
7324          return this.unitPrice;
7325        }
7326
7327        public boolean hasUnitPrice() { 
7328          return this.unitPrice != null && !this.unitPrice.isEmpty();
7329        }
7330
7331        /**
7332         * @param value {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
7333         */
7334        public SubDetailComponent setUnitPrice(Money value) { 
7335          this.unitPrice = value;
7336          return this;
7337        }
7338
7339        /**
7340         * @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
7341         */
7342        public DecimalType getFactorElement() { 
7343          if (this.factor == null)
7344            if (Configuration.errorOnAutoCreate())
7345              throw new Error("Attempt to auto-create SubDetailComponent.factor");
7346            else if (Configuration.doAutoCreate())
7347              this.factor = new DecimalType(); // bb
7348          return this.factor;
7349        }
7350
7351        public boolean hasFactorElement() { 
7352          return this.factor != null && !this.factor.isEmpty();
7353        }
7354
7355        public boolean hasFactor() { 
7356          return this.factor != null && !this.factor.isEmpty();
7357        }
7358
7359        /**
7360         * @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
7361         */
7362        public SubDetailComponent setFactorElement(DecimalType value) { 
7363          this.factor = value;
7364          return this;
7365        }
7366
7367        /**
7368         * @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.
7369         */
7370        public BigDecimal getFactor() { 
7371          return this.factor == null ? null : this.factor.getValue();
7372        }
7373
7374        /**
7375         * @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.
7376         */
7377        public SubDetailComponent setFactor(BigDecimal value) { 
7378          if (value == null)
7379            this.factor = null;
7380          else {
7381            if (this.factor == null)
7382              this.factor = new DecimalType();
7383            this.factor.setValue(value);
7384          }
7385          return this;
7386        }
7387
7388        /**
7389         * @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.
7390         */
7391        public SubDetailComponent setFactor(long value) { 
7392              this.factor = new DecimalType();
7393            this.factor.setValue(value);
7394          return this;
7395        }
7396
7397        /**
7398         * @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.
7399         */
7400        public SubDetailComponent setFactor(double value) { 
7401              this.factor = new DecimalType();
7402            this.factor.setValue(value);
7403          return this;
7404        }
7405
7406        /**
7407         * @return {@link #tax} (The total of taxes applicable for this product or service.)
7408         */
7409        public Money getTax() { 
7410          if (this.tax == null)
7411            if (Configuration.errorOnAutoCreate())
7412              throw new Error("Attempt to auto-create SubDetailComponent.tax");
7413            else if (Configuration.doAutoCreate())
7414              this.tax = new Money(); // cc
7415          return this.tax;
7416        }
7417
7418        public boolean hasTax() { 
7419          return this.tax != null && !this.tax.isEmpty();
7420        }
7421
7422        /**
7423         * @param value {@link #tax} (The total of taxes applicable for this product or service.)
7424         */
7425        public SubDetailComponent setTax(Money value) { 
7426          this.tax = value;
7427          return this;
7428        }
7429
7430        /**
7431         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
7432         */
7433        public Money getNet() { 
7434          if (this.net == null)
7435            if (Configuration.errorOnAutoCreate())
7436              throw new Error("Attempt to auto-create SubDetailComponent.net");
7437            else if (Configuration.doAutoCreate())
7438              this.net = new Money(); // cc
7439          return this.net;
7440        }
7441
7442        public boolean hasNet() { 
7443          return this.net != null && !this.net.isEmpty();
7444        }
7445
7446        /**
7447         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
7448         */
7449        public SubDetailComponent setNet(Money value) { 
7450          this.net = value;
7451          return this;
7452        }
7453
7454        /**
7455         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
7456         */
7457        public List<Reference> getUdi() { 
7458          if (this.udi == null)
7459            this.udi = new ArrayList<Reference>();
7460          return this.udi;
7461        }
7462
7463        /**
7464         * @return Returns a reference to <code>this</code> for easy method chaining
7465         */
7466        public SubDetailComponent setUdi(List<Reference> theUdi) { 
7467          this.udi = theUdi;
7468          return this;
7469        }
7470
7471        public boolean hasUdi() { 
7472          if (this.udi == null)
7473            return false;
7474          for (Reference item : this.udi)
7475            if (!item.isEmpty())
7476              return true;
7477          return false;
7478        }
7479
7480        public Reference addUdi() { //3
7481          Reference t = new Reference();
7482          if (this.udi == null)
7483            this.udi = new ArrayList<Reference>();
7484          this.udi.add(t);
7485          return t;
7486        }
7487
7488        public SubDetailComponent addUdi(Reference t) { //3
7489          if (t == null)
7490            return this;
7491          if (this.udi == null)
7492            this.udi = new ArrayList<Reference>();
7493          this.udi.add(t);
7494          return this;
7495        }
7496
7497        /**
7498         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
7499         */
7500        public Reference getUdiFirstRep() { 
7501          if (getUdi().isEmpty()) {
7502            addUdi();
7503          }
7504          return getUdi().get(0);
7505        }
7506
7507        /**
7508         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7509         */
7510        public List<PositiveIntType> getNoteNumber() { 
7511          if (this.noteNumber == null)
7512            this.noteNumber = new ArrayList<PositiveIntType>();
7513          return this.noteNumber;
7514        }
7515
7516        /**
7517         * @return Returns a reference to <code>this</code> for easy method chaining
7518         */
7519        public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
7520          this.noteNumber = theNoteNumber;
7521          return this;
7522        }
7523
7524        public boolean hasNoteNumber() { 
7525          if (this.noteNumber == null)
7526            return false;
7527          for (PositiveIntType item : this.noteNumber)
7528            if (!item.isEmpty())
7529              return true;
7530          return false;
7531        }
7532
7533        /**
7534         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7535         */
7536        public PositiveIntType addNoteNumberElement() {//2 
7537          PositiveIntType t = new PositiveIntType();
7538          if (this.noteNumber == null)
7539            this.noteNumber = new ArrayList<PositiveIntType>();
7540          this.noteNumber.add(t);
7541          return t;
7542        }
7543
7544        /**
7545         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7546         */
7547        public SubDetailComponent addNoteNumber(int value) { //1
7548          PositiveIntType t = new PositiveIntType();
7549          t.setValue(value);
7550          if (this.noteNumber == null)
7551            this.noteNumber = new ArrayList<PositiveIntType>();
7552          this.noteNumber.add(t);
7553          return this;
7554        }
7555
7556        /**
7557         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7558         */
7559        public boolean hasNoteNumber(int value) { 
7560          if (this.noteNumber == null)
7561            return false;
7562          for (PositiveIntType v : this.noteNumber)
7563            if (v.getValue().equals(value)) // positiveInt
7564              return true;
7565          return false;
7566        }
7567
7568        /**
7569         * @return {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
7570         */
7571        public CodeableConcept getDecision() { 
7572          if (this.decision == null)
7573            if (Configuration.errorOnAutoCreate())
7574              throw new Error("Attempt to auto-create SubDetailComponent.decision");
7575            else if (Configuration.doAutoCreate())
7576              this.decision = new CodeableConcept(); // cc
7577          return this.decision;
7578        }
7579
7580        public boolean hasDecision() { 
7581          return this.decision != null && !this.decision.isEmpty();
7582        }
7583
7584        /**
7585         * @param value {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
7586         */
7587        public SubDetailComponent setDecision(CodeableConcept value) { 
7588          this.decision = value;
7589          return this;
7590        }
7591
7592        /**
7593         * @return {@link #adjudication} (The adjudication results.)
7594         */
7595        public List<AdjudicationComponent> getAdjudication() { 
7596          if (this.adjudication == null)
7597            this.adjudication = new ArrayList<AdjudicationComponent>();
7598          return this.adjudication;
7599        }
7600
7601        /**
7602         * @return Returns a reference to <code>this</code> for easy method chaining
7603         */
7604        public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
7605          this.adjudication = theAdjudication;
7606          return this;
7607        }
7608
7609        public boolean hasAdjudication() { 
7610          if (this.adjudication == null)
7611            return false;
7612          for (AdjudicationComponent item : this.adjudication)
7613            if (!item.isEmpty())
7614              return true;
7615          return false;
7616        }
7617
7618        public AdjudicationComponent addAdjudication() { //3
7619          AdjudicationComponent t = new AdjudicationComponent();
7620          if (this.adjudication == null)
7621            this.adjudication = new ArrayList<AdjudicationComponent>();
7622          this.adjudication.add(t);
7623          return t;
7624        }
7625
7626        public SubDetailComponent addAdjudication(AdjudicationComponent t) { //3
7627          if (t == null)
7628            return this;
7629          if (this.adjudication == null)
7630            this.adjudication = new ArrayList<AdjudicationComponent>();
7631          this.adjudication.add(t);
7632          return this;
7633        }
7634
7635        /**
7636         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
7637         */
7638        public AdjudicationComponent getAdjudicationFirstRep() { 
7639          if (getAdjudication().isEmpty()) {
7640            addAdjudication();
7641          }
7642          return getAdjudication().get(0);
7643        }
7644
7645        protected void listChildren(List<Property> children) {
7646          super.listChildren(children);
7647          children.add(new Property("sequence", "positiveInt", "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.", 0, 1, sequence));
7648          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
7649          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
7650          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.", 0, 1, productOrService));
7651          children.add(new Property("productOrServiceEnd", "CodeableConcept", "This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.", 0, 1, productOrServiceEnd));
7652          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier));
7653          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
7654          children.add(new Property("patientPaid", "Money", "The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.", 0, 1, patientPaid));
7655          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
7656          children.add(new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice));
7657          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));
7658          children.add(new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax));
7659          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
7660          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
7661          children.add(new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
7662          children.add(new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision));
7663          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
7664        }
7665
7666        @Override
7667        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7668          switch (_hash) {
7669          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.", 0, 1, sequence);
7670          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
7671          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category);
7672          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.", 0, 1, productOrService);
7673          case -717476168: /*productOrServiceEnd*/  return new Property("productOrServiceEnd", "CodeableConcept", "This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.", 0, 1, productOrServiceEnd);
7674          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier);
7675          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
7676          case 525514609: /*patientPaid*/  return new Property("patientPaid", "Money", "The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.", 0, 1, patientPaid);
7677          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
7678          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice);
7679          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);
7680          case 114603: /*tax*/  return new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax);
7681          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
7682          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
7683          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
7684          case 565719004: /*decision*/  return new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision);
7685          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
7686          default: return super.getNamedProperty(_hash, _name, _checkValid);
7687          }
7688
7689        }
7690
7691      @Override
7692      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7693        switch (hash) {
7694        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
7695        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
7696        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
7697        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
7698        case -717476168: /*productOrServiceEnd*/ return this.productOrServiceEnd == null ? new Base[0] : new Base[] {this.productOrServiceEnd}; // CodeableConcept
7699        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7700        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
7701        case 525514609: /*patientPaid*/ return this.patientPaid == null ? new Base[0] : new Base[] {this.patientPaid}; // Money
7702        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
7703        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
7704        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
7705        case 114603: /*tax*/ return this.tax == null ? new Base[0] : new Base[] {this.tax}; // Money
7706        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
7707        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
7708        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7709        case 565719004: /*decision*/ return this.decision == null ? new Base[0] : new Base[] {this.decision}; // CodeableConcept
7710        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7711        default: return super.getProperty(hash, name, checkValid);
7712        }
7713
7714      }
7715
7716      @Override
7717      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7718        switch (hash) {
7719        case 1349547969: // sequence
7720          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
7721          return value;
7722        case 1099842588: // revenue
7723          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7724          return value;
7725        case 50511102: // category
7726          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7727          return value;
7728        case 1957227299: // productOrService
7729          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7730          return value;
7731        case -717476168: // productOrServiceEnd
7732          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7733          return value;
7734        case -615513385: // modifier
7735          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
7736          return value;
7737        case 1010065041: // programCode
7738          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
7739          return value;
7740        case 525514609: // patientPaid
7741          this.patientPaid = TypeConvertor.castToMoney(value); // Money
7742          return value;
7743        case -1285004149: // quantity
7744          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
7745          return value;
7746        case -486196699: // unitPrice
7747          this.unitPrice = TypeConvertor.castToMoney(value); // Money
7748          return value;
7749        case -1282148017: // factor
7750          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
7751          return value;
7752        case 114603: // tax
7753          this.tax = TypeConvertor.castToMoney(value); // Money
7754          return value;
7755        case 108957: // net
7756          this.net = TypeConvertor.castToMoney(value); // Money
7757          return value;
7758        case 115642: // udi
7759          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
7760          return value;
7761        case -1110033957: // noteNumber
7762          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
7763          return value;
7764        case 565719004: // decision
7765          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7766          return value;
7767        case -231349275: // adjudication
7768          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7769          return value;
7770        default: return super.setProperty(hash, name, value);
7771        }
7772
7773      }
7774
7775      @Override
7776      public Base setProperty(String name, Base value) throws FHIRException {
7777        if (name.equals("sequence")) {
7778          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
7779        } else if (name.equals("revenue")) {
7780          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7781        } else if (name.equals("category")) {
7782          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7783        } else if (name.equals("productOrService")) {
7784          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7785        } else if (name.equals("productOrServiceEnd")) {
7786          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7787        } else if (name.equals("modifier")) {
7788          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
7789        } else if (name.equals("programCode")) {
7790          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
7791        } else if (name.equals("patientPaid")) {
7792          this.patientPaid = TypeConvertor.castToMoney(value); // Money
7793        } else if (name.equals("quantity")) {
7794          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
7795        } else if (name.equals("unitPrice")) {
7796          this.unitPrice = TypeConvertor.castToMoney(value); // Money
7797        } else if (name.equals("factor")) {
7798          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
7799        } else if (name.equals("tax")) {
7800          this.tax = TypeConvertor.castToMoney(value); // Money
7801        } else if (name.equals("net")) {
7802          this.net = TypeConvertor.castToMoney(value); // Money
7803        } else if (name.equals("udi")) {
7804          this.getUdi().add(TypeConvertor.castToReference(value));
7805        } else if (name.equals("noteNumber")) {
7806          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
7807        } else if (name.equals("decision")) {
7808          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7809        } else if (name.equals("adjudication")) {
7810          this.getAdjudication().add((AdjudicationComponent) value);
7811        } else
7812          return super.setProperty(name, value);
7813        return value;
7814      }
7815
7816      @Override
7817      public Base makeProperty(int hash, String name) throws FHIRException {
7818        switch (hash) {
7819        case 1349547969:  return getSequenceElement();
7820        case 1099842588:  return getRevenue();
7821        case 50511102:  return getCategory();
7822        case 1957227299:  return getProductOrService();
7823        case -717476168:  return getProductOrServiceEnd();
7824        case -615513385:  return addModifier(); 
7825        case 1010065041:  return addProgramCode(); 
7826        case 525514609:  return getPatientPaid();
7827        case -1285004149:  return getQuantity();
7828        case -486196699:  return getUnitPrice();
7829        case -1282148017:  return getFactorElement();
7830        case 114603:  return getTax();
7831        case 108957:  return getNet();
7832        case 115642:  return addUdi(); 
7833        case -1110033957:  return addNoteNumberElement();
7834        case 565719004:  return getDecision();
7835        case -231349275:  return addAdjudication(); 
7836        default: return super.makeProperty(hash, name);
7837        }
7838
7839      }
7840
7841      @Override
7842      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7843        switch (hash) {
7844        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
7845        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7846        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7847        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
7848        case -717476168: /*productOrServiceEnd*/ return new String[] {"CodeableConcept"};
7849        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7850        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
7851        case 525514609: /*patientPaid*/ return new String[] {"Money"};
7852        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
7853        case -486196699: /*unitPrice*/ return new String[] {"Money"};
7854        case -1282148017: /*factor*/ return new String[] {"decimal"};
7855        case 114603: /*tax*/ return new String[] {"Money"};
7856        case 108957: /*net*/ return new String[] {"Money"};
7857        case 115642: /*udi*/ return new String[] {"Reference"};
7858        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7859        case 565719004: /*decision*/ return new String[] {"CodeableConcept"};
7860        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7861        default: return super.getTypesForProperty(hash, name);
7862        }
7863
7864      }
7865
7866      @Override
7867      public Base addChild(String name) throws FHIRException {
7868        if (name.equals("sequence")) {
7869          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.subDetail.sequence");
7870        }
7871        else if (name.equals("revenue")) {
7872          this.revenue = new CodeableConcept();
7873          return this.revenue;
7874        }
7875        else if (name.equals("category")) {
7876          this.category = new CodeableConcept();
7877          return this.category;
7878        }
7879        else if (name.equals("productOrService")) {
7880          this.productOrService = new CodeableConcept();
7881          return this.productOrService;
7882        }
7883        else if (name.equals("productOrServiceEnd")) {
7884          this.productOrServiceEnd = new CodeableConcept();
7885          return this.productOrServiceEnd;
7886        }
7887        else if (name.equals("modifier")) {
7888          return addModifier();
7889        }
7890        else if (name.equals("programCode")) {
7891          return addProgramCode();
7892        }
7893        else if (name.equals("patientPaid")) {
7894          this.patientPaid = new Money();
7895          return this.patientPaid;
7896        }
7897        else if (name.equals("quantity")) {
7898          this.quantity = new Quantity();
7899          return this.quantity;
7900        }
7901        else if (name.equals("unitPrice")) {
7902          this.unitPrice = new Money();
7903          return this.unitPrice;
7904        }
7905        else if (name.equals("factor")) {
7906          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.subDetail.factor");
7907        }
7908        else if (name.equals("tax")) {
7909          this.tax = new Money();
7910          return this.tax;
7911        }
7912        else if (name.equals("net")) {
7913          this.net = new Money();
7914          return this.net;
7915        }
7916        else if (name.equals("udi")) {
7917          return addUdi();
7918        }
7919        else if (name.equals("noteNumber")) {
7920          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.subDetail.noteNumber");
7921        }
7922        else if (name.equals("decision")) {
7923          this.decision = new CodeableConcept();
7924          return this.decision;
7925        }
7926        else if (name.equals("adjudication")) {
7927          return addAdjudication();
7928        }
7929        else
7930          return super.addChild(name);
7931      }
7932
7933      public SubDetailComponent copy() {
7934        SubDetailComponent dst = new SubDetailComponent();
7935        copyValues(dst);
7936        return dst;
7937      }
7938
7939      public void copyValues(SubDetailComponent dst) {
7940        super.copyValues(dst);
7941        dst.sequence = sequence == null ? null : sequence.copy();
7942        dst.revenue = revenue == null ? null : revenue.copy();
7943        dst.category = category == null ? null : category.copy();
7944        dst.productOrService = productOrService == null ? null : productOrService.copy();
7945        dst.productOrServiceEnd = productOrServiceEnd == null ? null : productOrServiceEnd.copy();
7946        if (modifier != null) {
7947          dst.modifier = new ArrayList<CodeableConcept>();
7948          for (CodeableConcept i : modifier)
7949            dst.modifier.add(i.copy());
7950        };
7951        if (programCode != null) {
7952          dst.programCode = new ArrayList<CodeableConcept>();
7953          for (CodeableConcept i : programCode)
7954            dst.programCode.add(i.copy());
7955        };
7956        dst.patientPaid = patientPaid == null ? null : patientPaid.copy();
7957        dst.quantity = quantity == null ? null : quantity.copy();
7958        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7959        dst.factor = factor == null ? null : factor.copy();
7960        dst.tax = tax == null ? null : tax.copy();
7961        dst.net = net == null ? null : net.copy();
7962        if (udi != null) {
7963          dst.udi = new ArrayList<Reference>();
7964          for (Reference i : udi)
7965            dst.udi.add(i.copy());
7966        };
7967        if (noteNumber != null) {
7968          dst.noteNumber = new ArrayList<PositiveIntType>();
7969          for (PositiveIntType i : noteNumber)
7970            dst.noteNumber.add(i.copy());
7971        };
7972        dst.decision = decision == null ? null : decision.copy();
7973        if (adjudication != null) {
7974          dst.adjudication = new ArrayList<AdjudicationComponent>();
7975          for (AdjudicationComponent i : adjudication)
7976            dst.adjudication.add(i.copy());
7977        };
7978      }
7979
7980      @Override
7981      public boolean equalsDeep(Base other_) {
7982        if (!super.equalsDeep(other_))
7983          return false;
7984        if (!(other_ instanceof SubDetailComponent))
7985          return false;
7986        SubDetailComponent o = (SubDetailComponent) other_;
7987        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
7988           && compareDeep(productOrService, o.productOrService, true) && compareDeep(productOrServiceEnd, o.productOrServiceEnd, true)
7989           && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true) && compareDeep(patientPaid, o.patientPaid, true)
7990           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
7991           && compareDeep(tax, o.tax, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
7992           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(decision, o.decision, true) && compareDeep(adjudication, o.adjudication, true)
7993          ;
7994      }
7995
7996      @Override
7997      public boolean equalsShallow(Base other_) {
7998        if (!super.equalsShallow(other_))
7999          return false;
8000        if (!(other_ instanceof SubDetailComponent))
8001          return false;
8002        SubDetailComponent o = (SubDetailComponent) other_;
8003        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
8004          ;
8005      }
8006
8007      public boolean isEmpty() {
8008        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
8009          , productOrService, productOrServiceEnd, modifier, programCode, patientPaid, quantity
8010          , unitPrice, factor, tax, net, udi, noteNumber, decision, adjudication);
8011      }
8012
8013  public String fhirType() {
8014    return "ExplanationOfBenefit.item.detail.subDetail";
8015
8016  }
8017
8018  }
8019
8020    @Block()
8021    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
8022        /**
8023         * Claim items which this service line is intended to replace.
8024         */
8025        @Child(name = "itemSequence", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8026        @Description(shortDefinition="Item sequence number", formalDefinition="Claim items which this service line is intended to replace." )
8027        protected List<PositiveIntType> itemSequence;
8028
8029        /**
8030         * The sequence number of the details within the claim item which this line is intended to replace.
8031         */
8032        @Child(name = "detailSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8033        @Description(shortDefinition="Detail sequence number", formalDefinition="The sequence number of the details within the claim item which this line is intended to replace." )
8034        protected List<PositiveIntType> detailSequence;
8035
8036        /**
8037         * The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.
8038         */
8039        @Child(name = "subDetailSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8040        @Description(shortDefinition="Subdetail sequence number", formalDefinition="The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace." )
8041        protected List<PositiveIntType> subDetailSequence;
8042
8043        /**
8044         * The providers who are authorized for the services rendered to the patient.
8045         */
8046        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8047        @Description(shortDefinition="Authorized providers", formalDefinition="The providers who are authorized for the services rendered to the patient." )
8048        protected List<Reference> provider;
8049
8050        /**
8051         * The type of revenue or cost center providing the product and/or service.
8052         */
8053        @Child(name = "revenue", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
8054        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
8055        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
8056        protected CodeableConcept revenue;
8057
8058        /**
8059         * When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.
8060         */
8061        @Child(name = "productOrService", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
8062        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used." )
8063        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
8064        protected CodeableConcept productOrService;
8065
8066        /**
8067         * This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.
8068         */
8069        @Child(name = "productOrServiceEnd", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
8070        @Description(shortDefinition="End of a range of codes", formalDefinition="This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims." )
8071        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
8072        protected CodeableConcept productOrServiceEnd;
8073
8074        /**
8075         * Item typification or modifiers codes to convey additional context for the product or service.
8076         */
8077        @Child(name = "modifier", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8078        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
8079        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
8080        protected List<CodeableConcept> modifier;
8081
8082        /**
8083         * Identifies the program under which this may be recovered.
8084         */
8085        @Child(name = "programCode", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8086        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
8087        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
8088        protected List<CodeableConcept> programCode;
8089
8090        /**
8091         * The date or dates when the service or product was supplied, performed or completed.
8092         */
8093        @Child(name = "serviced", type = {DateType.class, Period.class}, order=10, min=0, max=1, modifier=false, summary=false)
8094        @Description(shortDefinition="Date or dates of service or product delivery", formalDefinition="The date or dates when the service or product was supplied, performed or completed." )
8095        protected DataType serviced;
8096
8097        /**
8098         * Where the product or service was provided.
8099         */
8100        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=11, min=0, max=1, modifier=false, summary=false)
8101        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
8102        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
8103        protected DataType location;
8104
8105        /**
8106         * The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.
8107         */
8108        @Child(name = "patientPaid", type = {Money.class}, order=12, min=0, max=1, modifier=false, summary=false)
8109        @Description(shortDefinition="Paid by the patient", formalDefinition="The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services." )
8110        protected Money patientPaid;
8111
8112        /**
8113         * The number of repetitions of a service or product.
8114         */
8115        @Child(name = "quantity", type = {Quantity.class}, order=13, min=0, max=1, modifier=false, summary=false)
8116        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
8117        protected Quantity quantity;
8118
8119        /**
8120         * If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.
8121         */
8122        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
8123        @Description(shortDefinition="Fee, charge or cost per item", formalDefinition="If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group." )
8124        protected Money unitPrice;
8125
8126        /**
8127         * 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.
8128         */
8129        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=false)
8130        @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." )
8131        protected DecimalType factor;
8132
8133        /**
8134         * The total of taxes applicable for this product or service.
8135         */
8136        @Child(name = "tax", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
8137        @Description(shortDefinition="Total tax", formalDefinition="The total of taxes applicable for this product or service." )
8138        protected Money tax;
8139
8140        /**
8141         * The quantity times the unit price for an additional service or product or charge.
8142         */
8143        @Child(name = "net", type = {Money.class}, order=17, min=0, max=1, modifier=false, summary=false)
8144        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
8145        protected Money net;
8146
8147        /**
8148         * Physical location where the service is performed or applies.
8149         */
8150        @Child(name = "bodySite", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8151        @Description(shortDefinition="Anatomical location", formalDefinition="Physical location where the service is performed or applies." )
8152        protected List<BodySiteComponentA> bodySite;
8153
8154        /**
8155         * The numbers associated with notes below which apply to the adjudication of this item.
8156         */
8157        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8158        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
8159        protected List<PositiveIntType> noteNumber;
8160
8161        /**
8162         * The result of the claim, predetermination, or preauthorization adjudication.
8163         */
8164        @Child(name = "decision", type = {CodeableConcept.class}, order=20, min=0, max=1, modifier=false, summary=false)
8165        @Description(shortDefinition="Result of the adjudication", formalDefinition="The result of the claim, predetermination, or preauthorization adjudication." )
8166        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-decision")
8167        protected CodeableConcept decision;
8168
8169        /**
8170         * The adjudication results.
8171         */
8172        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8173        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
8174        protected List<AdjudicationComponent> adjudication;
8175
8176        /**
8177         * The second-tier service adjudications for payor added services.
8178         */
8179        @Child(name = "detail", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8180        @Description(shortDefinition="Insurer added line items", formalDefinition="The second-tier service adjudications for payor added services." )
8181        protected List<AddedItemDetailComponent> detail;
8182
8183        private static final long serialVersionUID = -256167577L;
8184
8185    /**
8186     * Constructor
8187     */
8188      public AddedItemComponent() {
8189        super();
8190      }
8191
8192        /**
8193         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
8194         */
8195        public List<PositiveIntType> getItemSequence() { 
8196          if (this.itemSequence == null)
8197            this.itemSequence = new ArrayList<PositiveIntType>();
8198          return this.itemSequence;
8199        }
8200
8201        /**
8202         * @return Returns a reference to <code>this</code> for easy method chaining
8203         */
8204        public AddedItemComponent setItemSequence(List<PositiveIntType> theItemSequence) { 
8205          this.itemSequence = theItemSequence;
8206          return this;
8207        }
8208
8209        public boolean hasItemSequence() { 
8210          if (this.itemSequence == null)
8211            return false;
8212          for (PositiveIntType item : this.itemSequence)
8213            if (!item.isEmpty())
8214              return true;
8215          return false;
8216        }
8217
8218        /**
8219         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
8220         */
8221        public PositiveIntType addItemSequenceElement() {//2 
8222          PositiveIntType t = new PositiveIntType();
8223          if (this.itemSequence == null)
8224            this.itemSequence = new ArrayList<PositiveIntType>();
8225          this.itemSequence.add(t);
8226          return t;
8227        }
8228
8229        /**
8230         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
8231         */
8232        public AddedItemComponent addItemSequence(int value) { //1
8233          PositiveIntType t = new PositiveIntType();
8234          t.setValue(value);
8235          if (this.itemSequence == null)
8236            this.itemSequence = new ArrayList<PositiveIntType>();
8237          this.itemSequence.add(t);
8238          return this;
8239        }
8240
8241        /**
8242         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
8243         */
8244        public boolean hasItemSequence(int value) { 
8245          if (this.itemSequence == null)
8246            return false;
8247          for (PositiveIntType v : this.itemSequence)
8248            if (v.getValue().equals(value)) // positiveInt
8249              return true;
8250          return false;
8251        }
8252
8253        /**
8254         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
8255         */
8256        public List<PositiveIntType> getDetailSequence() { 
8257          if (this.detailSequence == null)
8258            this.detailSequence = new ArrayList<PositiveIntType>();
8259          return this.detailSequence;
8260        }
8261
8262        /**
8263         * @return Returns a reference to <code>this</code> for easy method chaining
8264         */
8265        public AddedItemComponent setDetailSequence(List<PositiveIntType> theDetailSequence) { 
8266          this.detailSequence = theDetailSequence;
8267          return this;
8268        }
8269
8270        public boolean hasDetailSequence() { 
8271          if (this.detailSequence == null)
8272            return false;
8273          for (PositiveIntType item : this.detailSequence)
8274            if (!item.isEmpty())
8275              return true;
8276          return false;
8277        }
8278
8279        /**
8280         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
8281         */
8282        public PositiveIntType addDetailSequenceElement() {//2 
8283          PositiveIntType t = new PositiveIntType();
8284          if (this.detailSequence == null)
8285            this.detailSequence = new ArrayList<PositiveIntType>();
8286          this.detailSequence.add(t);
8287          return t;
8288        }
8289
8290        /**
8291         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
8292         */
8293        public AddedItemComponent addDetailSequence(int value) { //1
8294          PositiveIntType t = new PositiveIntType();
8295          t.setValue(value);
8296          if (this.detailSequence == null)
8297            this.detailSequence = new ArrayList<PositiveIntType>();
8298          this.detailSequence.add(t);
8299          return this;
8300        }
8301
8302        /**
8303         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
8304         */
8305        public boolean hasDetailSequence(int value) { 
8306          if (this.detailSequence == null)
8307            return false;
8308          for (PositiveIntType v : this.detailSequence)
8309            if (v.getValue().equals(value)) // positiveInt
8310              return true;
8311          return false;
8312        }
8313
8314        /**
8315         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
8316         */
8317        public List<PositiveIntType> getSubDetailSequence() { 
8318          if (this.subDetailSequence == null)
8319            this.subDetailSequence = new ArrayList<PositiveIntType>();
8320          return this.subDetailSequence;
8321        }
8322
8323        /**
8324         * @return Returns a reference to <code>this</code> for easy method chaining
8325         */
8326        public AddedItemComponent setSubDetailSequence(List<PositiveIntType> theSubDetailSequence) { 
8327          this.subDetailSequence = theSubDetailSequence;
8328          return this;
8329        }
8330
8331        public boolean hasSubDetailSequence() { 
8332          if (this.subDetailSequence == null)
8333            return false;
8334          for (PositiveIntType item : this.subDetailSequence)
8335            if (!item.isEmpty())
8336              return true;
8337          return false;
8338        }
8339
8340        /**
8341         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
8342         */
8343        public PositiveIntType addSubDetailSequenceElement() {//2 
8344          PositiveIntType t = new PositiveIntType();
8345          if (this.subDetailSequence == null)
8346            this.subDetailSequence = new ArrayList<PositiveIntType>();
8347          this.subDetailSequence.add(t);
8348          return t;
8349        }
8350
8351        /**
8352         * @param value {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
8353         */
8354        public AddedItemComponent addSubDetailSequence(int value) { //1
8355          PositiveIntType t = new PositiveIntType();
8356          t.setValue(value);
8357          if (this.subDetailSequence == null)
8358            this.subDetailSequence = new ArrayList<PositiveIntType>();
8359          this.subDetailSequence.add(t);
8360          return this;
8361        }
8362
8363        /**
8364         * @param value {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
8365         */
8366        public boolean hasSubDetailSequence(int value) { 
8367          if (this.subDetailSequence == null)
8368            return false;
8369          for (PositiveIntType v : this.subDetailSequence)
8370            if (v.getValue().equals(value)) // positiveInt
8371              return true;
8372          return false;
8373        }
8374
8375        /**
8376         * @return {@link #provider} (The providers who are authorized for the services rendered to the patient.)
8377         */
8378        public List<Reference> getProvider() { 
8379          if (this.provider == null)
8380            this.provider = new ArrayList<Reference>();
8381          return this.provider;
8382        }
8383
8384        /**
8385         * @return Returns a reference to <code>this</code> for easy method chaining
8386         */
8387        public AddedItemComponent setProvider(List<Reference> theProvider) { 
8388          this.provider = theProvider;
8389          return this;
8390        }
8391
8392        public boolean hasProvider() { 
8393          if (this.provider == null)
8394            return false;
8395          for (Reference item : this.provider)
8396            if (!item.isEmpty())
8397              return true;
8398          return false;
8399        }
8400
8401        public Reference addProvider() { //3
8402          Reference t = new Reference();
8403          if (this.provider == null)
8404            this.provider = new ArrayList<Reference>();
8405          this.provider.add(t);
8406          return t;
8407        }
8408
8409        public AddedItemComponent addProvider(Reference t) { //3
8410          if (t == null)
8411            return this;
8412          if (this.provider == null)
8413            this.provider = new ArrayList<Reference>();
8414          this.provider.add(t);
8415          return this;
8416        }
8417
8418        /**
8419         * @return The first repetition of repeating field {@link #provider}, creating it if it does not already exist {3}
8420         */
8421        public Reference getProviderFirstRep() { 
8422          if (getProvider().isEmpty()) {
8423            addProvider();
8424          }
8425          return getProvider().get(0);
8426        }
8427
8428        /**
8429         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
8430         */
8431        public CodeableConcept getRevenue() { 
8432          if (this.revenue == null)
8433            if (Configuration.errorOnAutoCreate())
8434              throw new Error("Attempt to auto-create AddedItemComponent.revenue");
8435            else if (Configuration.doAutoCreate())
8436              this.revenue = new CodeableConcept(); // cc
8437          return this.revenue;
8438        }
8439
8440        public boolean hasRevenue() { 
8441          return this.revenue != null && !this.revenue.isEmpty();
8442        }
8443
8444        /**
8445         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
8446         */
8447        public AddedItemComponent setRevenue(CodeableConcept value) { 
8448          this.revenue = value;
8449          return this;
8450        }
8451
8452        /**
8453         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.)
8454         */
8455        public CodeableConcept getProductOrService() { 
8456          if (this.productOrService == null)
8457            if (Configuration.errorOnAutoCreate())
8458              throw new Error("Attempt to auto-create AddedItemComponent.productOrService");
8459            else if (Configuration.doAutoCreate())
8460              this.productOrService = new CodeableConcept(); // cc
8461          return this.productOrService;
8462        }
8463
8464        public boolean hasProductOrService() { 
8465          return this.productOrService != null && !this.productOrService.isEmpty();
8466        }
8467
8468        /**
8469         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.)
8470         */
8471        public AddedItemComponent setProductOrService(CodeableConcept value) { 
8472          this.productOrService = value;
8473          return this;
8474        }
8475
8476        /**
8477         * @return {@link #productOrServiceEnd} (This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.)
8478         */
8479        public CodeableConcept getProductOrServiceEnd() { 
8480          if (this.productOrServiceEnd == null)
8481            if (Configuration.errorOnAutoCreate())
8482              throw new Error("Attempt to auto-create AddedItemComponent.productOrServiceEnd");
8483            else if (Configuration.doAutoCreate())
8484              this.productOrServiceEnd = new CodeableConcept(); // cc
8485          return this.productOrServiceEnd;
8486        }
8487
8488        public boolean hasProductOrServiceEnd() { 
8489          return this.productOrServiceEnd != null && !this.productOrServiceEnd.isEmpty();
8490        }
8491
8492        /**
8493         * @param value {@link #productOrServiceEnd} (This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.)
8494         */
8495        public AddedItemComponent setProductOrServiceEnd(CodeableConcept value) { 
8496          this.productOrServiceEnd = value;
8497          return this;
8498        }
8499
8500        /**
8501         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
8502         */
8503        public List<CodeableConcept> getModifier() { 
8504          if (this.modifier == null)
8505            this.modifier = new ArrayList<CodeableConcept>();
8506          return this.modifier;
8507        }
8508
8509        /**
8510         * @return Returns a reference to <code>this</code> for easy method chaining
8511         */
8512        public AddedItemComponent setModifier(List<CodeableConcept> theModifier) { 
8513          this.modifier = theModifier;
8514          return this;
8515        }
8516
8517        public boolean hasModifier() { 
8518          if (this.modifier == null)
8519            return false;
8520          for (CodeableConcept item : this.modifier)
8521            if (!item.isEmpty())
8522              return true;
8523          return false;
8524        }
8525
8526        public CodeableConcept addModifier() { //3
8527          CodeableConcept t = new CodeableConcept();
8528          if (this.modifier == null)
8529            this.modifier = new ArrayList<CodeableConcept>();
8530          this.modifier.add(t);
8531          return t;
8532        }
8533
8534        public AddedItemComponent addModifier(CodeableConcept t) { //3
8535          if (t == null)
8536            return this;
8537          if (this.modifier == null)
8538            this.modifier = new ArrayList<CodeableConcept>();
8539          this.modifier.add(t);
8540          return this;
8541        }
8542
8543        /**
8544         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
8545         */
8546        public CodeableConcept getModifierFirstRep() { 
8547          if (getModifier().isEmpty()) {
8548            addModifier();
8549          }
8550          return getModifier().get(0);
8551        }
8552
8553        /**
8554         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
8555         */
8556        public List<CodeableConcept> getProgramCode() { 
8557          if (this.programCode == null)
8558            this.programCode = new ArrayList<CodeableConcept>();
8559          return this.programCode;
8560        }
8561
8562        /**
8563         * @return Returns a reference to <code>this</code> for easy method chaining
8564         */
8565        public AddedItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
8566          this.programCode = theProgramCode;
8567          return this;
8568        }
8569
8570        public boolean hasProgramCode() { 
8571          if (this.programCode == null)
8572            return false;
8573          for (CodeableConcept item : this.programCode)
8574            if (!item.isEmpty())
8575              return true;
8576          return false;
8577        }
8578
8579        public CodeableConcept addProgramCode() { //3
8580          CodeableConcept t = new CodeableConcept();
8581          if (this.programCode == null)
8582            this.programCode = new ArrayList<CodeableConcept>();
8583          this.programCode.add(t);
8584          return t;
8585        }
8586
8587        public AddedItemComponent addProgramCode(CodeableConcept t) { //3
8588          if (t == null)
8589            return this;
8590          if (this.programCode == null)
8591            this.programCode = new ArrayList<CodeableConcept>();
8592          this.programCode.add(t);
8593          return this;
8594        }
8595
8596        /**
8597         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
8598         */
8599        public CodeableConcept getProgramCodeFirstRep() { 
8600          if (getProgramCode().isEmpty()) {
8601            addProgramCode();
8602          }
8603          return getProgramCode().get(0);
8604        }
8605
8606        /**
8607         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8608         */
8609        public DataType getServiced() { 
8610          return this.serviced;
8611        }
8612
8613        /**
8614         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8615         */
8616        public DateType getServicedDateType() throws FHIRException { 
8617          if (this.serviced == null)
8618            this.serviced = new DateType();
8619          if (!(this.serviced instanceof DateType))
8620            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
8621          return (DateType) this.serviced;
8622        }
8623
8624        public boolean hasServicedDateType() { 
8625          return this != null && this.serviced instanceof DateType;
8626        }
8627
8628        /**
8629         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8630         */
8631        public Period getServicedPeriod() throws FHIRException { 
8632          if (this.serviced == null)
8633            this.serviced = new Period();
8634          if (!(this.serviced instanceof Period))
8635            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
8636          return (Period) this.serviced;
8637        }
8638
8639        public boolean hasServicedPeriod() { 
8640          return this != null && this.serviced instanceof Period;
8641        }
8642
8643        public boolean hasServiced() { 
8644          return this.serviced != null && !this.serviced.isEmpty();
8645        }
8646
8647        /**
8648         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8649         */
8650        public AddedItemComponent setServiced(DataType value) { 
8651          if (value != null && !(value instanceof DateType || value instanceof Period))
8652            throw new Error("Not the right type for ExplanationOfBenefit.addItem.serviced[x]: "+value.fhirType());
8653          this.serviced = value;
8654          return this;
8655        }
8656
8657        /**
8658         * @return {@link #location} (Where the product or service was provided.)
8659         */
8660        public DataType getLocation() { 
8661          return this.location;
8662        }
8663
8664        /**
8665         * @return {@link #location} (Where the product or service was provided.)
8666         */
8667        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
8668          if (this.location == null)
8669            this.location = new CodeableConcept();
8670          if (!(this.location instanceof CodeableConcept))
8671            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
8672          return (CodeableConcept) this.location;
8673        }
8674
8675        public boolean hasLocationCodeableConcept() { 
8676          return this != null && this.location instanceof CodeableConcept;
8677        }
8678
8679        /**
8680         * @return {@link #location} (Where the product or service was provided.)
8681         */
8682        public Address getLocationAddress() throws FHIRException { 
8683          if (this.location == null)
8684            this.location = new Address();
8685          if (!(this.location instanceof Address))
8686            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
8687          return (Address) this.location;
8688        }
8689
8690        public boolean hasLocationAddress() { 
8691          return this != null && this.location instanceof Address;
8692        }
8693
8694        /**
8695         * @return {@link #location} (Where the product or service was provided.)
8696         */
8697        public Reference getLocationReference() throws FHIRException { 
8698          if (this.location == null)
8699            this.location = new Reference();
8700          if (!(this.location instanceof Reference))
8701            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
8702          return (Reference) this.location;
8703        }
8704
8705        public boolean hasLocationReference() { 
8706          return this != null && this.location instanceof Reference;
8707        }
8708
8709        public boolean hasLocation() { 
8710          return this.location != null && !this.location.isEmpty();
8711        }
8712
8713        /**
8714         * @param value {@link #location} (Where the product or service was provided.)
8715         */
8716        public AddedItemComponent setLocation(DataType value) { 
8717          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
8718            throw new Error("Not the right type for ExplanationOfBenefit.addItem.location[x]: "+value.fhirType());
8719          this.location = value;
8720          return this;
8721        }
8722
8723        /**
8724         * @return {@link #patientPaid} (The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.)
8725         */
8726        public Money getPatientPaid() { 
8727          if (this.patientPaid == null)
8728            if (Configuration.errorOnAutoCreate())
8729              throw new Error("Attempt to auto-create AddedItemComponent.patientPaid");
8730            else if (Configuration.doAutoCreate())
8731              this.patientPaid = new Money(); // cc
8732          return this.patientPaid;
8733        }
8734
8735        public boolean hasPatientPaid() { 
8736          return this.patientPaid != null && !this.patientPaid.isEmpty();
8737        }
8738
8739        /**
8740         * @param value {@link #patientPaid} (The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.)
8741         */
8742        public AddedItemComponent setPatientPaid(Money value) { 
8743          this.patientPaid = value;
8744          return this;
8745        }
8746
8747        /**
8748         * @return {@link #quantity} (The number of repetitions of a service or product.)
8749         */
8750        public Quantity getQuantity() { 
8751          if (this.quantity == null)
8752            if (Configuration.errorOnAutoCreate())
8753              throw new Error("Attempt to auto-create AddedItemComponent.quantity");
8754            else if (Configuration.doAutoCreate())
8755              this.quantity = new Quantity(); // cc
8756          return this.quantity;
8757        }
8758
8759        public boolean hasQuantity() { 
8760          return this.quantity != null && !this.quantity.isEmpty();
8761        }
8762
8763        /**
8764         * @param value {@link #quantity} (The number of repetitions of a service or product.)
8765         */
8766        public AddedItemComponent setQuantity(Quantity value) { 
8767          this.quantity = value;
8768          return this;
8769        }
8770
8771        /**
8772         * @return {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
8773         */
8774        public Money getUnitPrice() { 
8775          if (this.unitPrice == null)
8776            if (Configuration.errorOnAutoCreate())
8777              throw new Error("Attempt to auto-create AddedItemComponent.unitPrice");
8778            else if (Configuration.doAutoCreate())
8779              this.unitPrice = new Money(); // cc
8780          return this.unitPrice;
8781        }
8782
8783        public boolean hasUnitPrice() { 
8784          return this.unitPrice != null && !this.unitPrice.isEmpty();
8785        }
8786
8787        /**
8788         * @param value {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
8789         */
8790        public AddedItemComponent setUnitPrice(Money value) { 
8791          this.unitPrice = value;
8792          return this;
8793        }
8794
8795        /**
8796         * @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
8797         */
8798        public DecimalType getFactorElement() { 
8799          if (this.factor == null)
8800            if (Configuration.errorOnAutoCreate())
8801              throw new Error("Attempt to auto-create AddedItemComponent.factor");
8802            else if (Configuration.doAutoCreate())
8803              this.factor = new DecimalType(); // bb
8804          return this.factor;
8805        }
8806
8807        public boolean hasFactorElement() { 
8808          return this.factor != null && !this.factor.isEmpty();
8809        }
8810
8811        public boolean hasFactor() { 
8812          return this.factor != null && !this.factor.isEmpty();
8813        }
8814
8815        /**
8816         * @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
8817         */
8818        public AddedItemComponent setFactorElement(DecimalType value) { 
8819          this.factor = value;
8820          return this;
8821        }
8822
8823        /**
8824         * @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.
8825         */
8826        public BigDecimal getFactor() { 
8827          return this.factor == null ? null : this.factor.getValue();
8828        }
8829
8830        /**
8831         * @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.
8832         */
8833        public AddedItemComponent setFactor(BigDecimal value) { 
8834          if (value == null)
8835            this.factor = null;
8836          else {
8837            if (this.factor == null)
8838              this.factor = new DecimalType();
8839            this.factor.setValue(value);
8840          }
8841          return this;
8842        }
8843
8844        /**
8845         * @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.
8846         */
8847        public AddedItemComponent setFactor(long value) { 
8848              this.factor = new DecimalType();
8849            this.factor.setValue(value);
8850          return this;
8851        }
8852
8853        /**
8854         * @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.
8855         */
8856        public AddedItemComponent setFactor(double value) { 
8857              this.factor = new DecimalType();
8858            this.factor.setValue(value);
8859          return this;
8860        }
8861
8862        /**
8863         * @return {@link #tax} (The total of taxes applicable for this product or service.)
8864         */
8865        public Money getTax() { 
8866          if (this.tax == null)
8867            if (Configuration.errorOnAutoCreate())
8868              throw new Error("Attempt to auto-create AddedItemComponent.tax");
8869            else if (Configuration.doAutoCreate())
8870              this.tax = new Money(); // cc
8871          return this.tax;
8872        }
8873
8874        public boolean hasTax() { 
8875          return this.tax != null && !this.tax.isEmpty();
8876        }
8877
8878        /**
8879         * @param value {@link #tax} (The total of taxes applicable for this product or service.)
8880         */
8881        public AddedItemComponent setTax(Money value) { 
8882          this.tax = value;
8883          return this;
8884        }
8885
8886        /**
8887         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8888         */
8889        public Money getNet() { 
8890          if (this.net == null)
8891            if (Configuration.errorOnAutoCreate())
8892              throw new Error("Attempt to auto-create AddedItemComponent.net");
8893            else if (Configuration.doAutoCreate())
8894              this.net = new Money(); // cc
8895          return this.net;
8896        }
8897
8898        public boolean hasNet() { 
8899          return this.net != null && !this.net.isEmpty();
8900        }
8901
8902        /**
8903         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8904         */
8905        public AddedItemComponent setNet(Money value) { 
8906          this.net = value;
8907          return this;
8908        }
8909
8910        /**
8911         * @return {@link #bodySite} (Physical location where the service is performed or applies.)
8912         */
8913        public List<BodySiteComponentA> getBodySite() { 
8914          if (this.bodySite == null)
8915            this.bodySite = new ArrayList<BodySiteComponentA>();
8916          return this.bodySite;
8917        }
8918
8919        /**
8920         * @return Returns a reference to <code>this</code> for easy method chaining
8921         */
8922        public AddedItemComponent setBodySite(List<BodySiteComponentA> theBodySite) { 
8923          this.bodySite = theBodySite;
8924          return this;
8925        }
8926
8927        public boolean hasBodySite() { 
8928          if (this.bodySite == null)
8929            return false;
8930          for (BodySiteComponentA item : this.bodySite)
8931            if (!item.isEmpty())
8932              return true;
8933          return false;
8934        }
8935
8936        public BodySiteComponentA addBodySite() { //3
8937          BodySiteComponentA t = new BodySiteComponentA();
8938          if (this.bodySite == null)
8939            this.bodySite = new ArrayList<BodySiteComponentA>();
8940          this.bodySite.add(t);
8941          return t;
8942        }
8943
8944        public AddedItemComponent addBodySite(BodySiteComponentA t) { //3
8945          if (t == null)
8946            return this;
8947          if (this.bodySite == null)
8948            this.bodySite = new ArrayList<BodySiteComponentA>();
8949          this.bodySite.add(t);
8950          return this;
8951        }
8952
8953        /**
8954         * @return The first repetition of repeating field {@link #bodySite}, creating it if it does not already exist {3}
8955         */
8956        public BodySiteComponentA getBodySiteFirstRep() { 
8957          if (getBodySite().isEmpty()) {
8958            addBodySite();
8959          }
8960          return getBodySite().get(0);
8961        }
8962
8963        /**
8964         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8965         */
8966        public List<PositiveIntType> getNoteNumber() { 
8967          if (this.noteNumber == null)
8968            this.noteNumber = new ArrayList<PositiveIntType>();
8969          return this.noteNumber;
8970        }
8971
8972        /**
8973         * @return Returns a reference to <code>this</code> for easy method chaining
8974         */
8975        public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
8976          this.noteNumber = theNoteNumber;
8977          return this;
8978        }
8979
8980        public boolean hasNoteNumber() { 
8981          if (this.noteNumber == null)
8982            return false;
8983          for (PositiveIntType item : this.noteNumber)
8984            if (!item.isEmpty())
8985              return true;
8986          return false;
8987        }
8988
8989        /**
8990         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8991         */
8992        public PositiveIntType addNoteNumberElement() {//2 
8993          PositiveIntType t = new PositiveIntType();
8994          if (this.noteNumber == null)
8995            this.noteNumber = new ArrayList<PositiveIntType>();
8996          this.noteNumber.add(t);
8997          return t;
8998        }
8999
9000        /**
9001         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9002         */
9003        public AddedItemComponent addNoteNumber(int value) { //1
9004          PositiveIntType t = new PositiveIntType();
9005          t.setValue(value);
9006          if (this.noteNumber == null)
9007            this.noteNumber = new ArrayList<PositiveIntType>();
9008          this.noteNumber.add(t);
9009          return this;
9010        }
9011
9012        /**
9013         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9014         */
9015        public boolean hasNoteNumber(int va