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