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