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