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 Tue, Dec 13, 2022 17:53+1100 for FHIR vcurrent
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import java.math.*;
038import org.hl7.fhir.utilities.Utilities;
039import org.hl7.fhir.r5.model.Enumerations.*;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.exceptions.FHIRException;
042import org.hl7.fhir.instance.model.api.ICompositeType;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
046import ca.uhn.fhir.model.api.annotation.Child;
047import ca.uhn.fhir.model.api.annotation.ChildOrder;
048import ca.uhn.fhir.model.api.annotation.Description;
049import ca.uhn.fhir.model.api.annotation.Block;
050
051/**
052 * This resource provides: the claim details; adjudication details from the processing of a Claim; and optionally account balance information, for informing the subscriber of the benefits provided.
053 */
054@ResourceDef(name="ExplanationOfBenefit", profile="http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit")
055public class ExplanationOfBenefit extends DomainResource {
056
057    public enum ExplanationOfBenefitStatus {
058        /**
059         * The resource instance is currently in-force.
060         */
061        ACTIVE, 
062        /**
063         * The resource instance is withdrawn, rescinded or reversed.
064         */
065        CANCELLED, 
066        /**
067         * A new resource instance the contents of which is not complete.
068         */
069        DRAFT, 
070        /**
071         * The resource instance was entered in error.
072         */
073        ENTEREDINERROR, 
074        /**
075         * added to help the parsers with the generic types
076         */
077        NULL;
078        public static ExplanationOfBenefitStatus fromCode(String codeString) throws FHIRException {
079            if (codeString == null || "".equals(codeString))
080                return null;
081        if ("active".equals(codeString))
082          return ACTIVE;
083        if ("cancelled".equals(codeString))
084          return CANCELLED;
085        if ("draft".equals(codeString))
086          return DRAFT;
087        if ("entered-in-error".equals(codeString))
088          return ENTEREDINERROR;
089        if (Configuration.isAcceptInvalidEnums())
090          return null;
091        else
092          throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
093        }
094        public String toCode() {
095          switch (this) {
096            case ACTIVE: return "active";
097            case CANCELLED: return "cancelled";
098            case DRAFT: return "draft";
099            case ENTEREDINERROR: return "entered-in-error";
100            case NULL: return null;
101            default: return "?";
102          }
103        }
104        public String getSystem() {
105          switch (this) {
106            case ACTIVE: return "http://hl7.org/fhir/explanationofbenefit-status";
107            case CANCELLED: return "http://hl7.org/fhir/explanationofbenefit-status";
108            case DRAFT: return "http://hl7.org/fhir/explanationofbenefit-status";
109            case ENTEREDINERROR: return "http://hl7.org/fhir/explanationofbenefit-status";
110            case NULL: return null;
111            default: return "?";
112          }
113        }
114        public String getDefinition() {
115          switch (this) {
116            case ACTIVE: return "The resource instance is currently in-force.";
117            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
118            case DRAFT: return "A new resource instance the contents of which is not complete.";
119            case ENTEREDINERROR: return "The resource instance was entered in error.";
120            case NULL: return null;
121            default: return "?";
122          }
123        }
124        public String getDisplay() {
125          switch (this) {
126            case ACTIVE: return "Active";
127            case CANCELLED: return "Cancelled";
128            case DRAFT: return "Draft";
129            case ENTEREDINERROR: return "Entered In Error";
130            case NULL: return null;
131            default: return "?";
132          }
133        }
134    }
135
136  public static class ExplanationOfBenefitStatusEnumFactory implements EnumFactory<ExplanationOfBenefitStatus> {
137    public ExplanationOfBenefitStatus fromCode(String codeString) throws IllegalArgumentException {
138      if (codeString == null || "".equals(codeString))
139            if (codeString == null || "".equals(codeString))
140                return null;
141        if ("active".equals(codeString))
142          return ExplanationOfBenefitStatus.ACTIVE;
143        if ("cancelled".equals(codeString))
144          return ExplanationOfBenefitStatus.CANCELLED;
145        if ("draft".equals(codeString))
146          return ExplanationOfBenefitStatus.DRAFT;
147        if ("entered-in-error".equals(codeString))
148          return ExplanationOfBenefitStatus.ENTEREDINERROR;
149        throw new IllegalArgumentException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
150        }
151        public Enumeration<ExplanationOfBenefitStatus> fromType(PrimitiveType<?> code) throws FHIRException {
152          if (code == null)
153            return null;
154          if (code.isEmpty())
155            return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.NULL, code);
156          String codeString = ((PrimitiveType) code).asStringValue();
157          if (codeString == null || "".equals(codeString))
158            return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.NULL, code);
159        if ("active".equals(codeString))
160          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ACTIVE, code);
161        if ("cancelled".equals(codeString))
162          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.CANCELLED, code);
163        if ("draft".equals(codeString))
164          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.DRAFT, code);
165        if ("entered-in-error".equals(codeString))
166          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ENTEREDINERROR, code);
167        throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
168        }
169    public String toCode(ExplanationOfBenefitStatus code) {
170      if (code == ExplanationOfBenefitStatus.ACTIVE)
171        return "active";
172      if (code == ExplanationOfBenefitStatus.CANCELLED)
173        return "cancelled";
174      if (code == ExplanationOfBenefitStatus.DRAFT)
175        return "draft";
176      if (code == ExplanationOfBenefitStatus.ENTEREDINERROR)
177        return "entered-in-error";
178      return "?";
179      }
180    public String toSystem(ExplanationOfBenefitStatus code) {
181      return code.getSystem();
182      }
183    }
184
185    @Block()
186    public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
187        /**
188         * Reference to a related claim.
189         */
190        @Child(name = "claim", type = {Claim.class}, order=1, min=0, max=1, modifier=false, summary=false)
191        @Description(shortDefinition="Reference to the related claim", formalDefinition="Reference to a related claim." )
192        protected Reference claim;
193
194        /**
195         * A code to convey how the claims are related.
196         */
197        @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
198        @Description(shortDefinition="How the reference claim is related", formalDefinition="A code to convey how the claims are related." )
199        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-claim-relationship")
200        protected CodeableConcept relationship;
201
202        /**
203         * An alternate organizational reference to the case or file to which this particular claim pertains.
204         */
205        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=false)
206        @Description(shortDefinition="File or case reference", formalDefinition="An alternate organizational reference to the case or file to which this particular claim pertains." )
207        protected Identifier reference;
208
209        private static final long serialVersionUID = 1047077926L;
210
211    /**
212     * Constructor
213     */
214      public RelatedClaimComponent() {
215        super();
216      }
217
218        /**
219         * @return {@link #claim} (Reference to a related claim.)
220         */
221        public Reference getClaim() { 
222          if (this.claim == null)
223            if (Configuration.errorOnAutoCreate())
224              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
225            else if (Configuration.doAutoCreate())
226              this.claim = new Reference(); // cc
227          return this.claim;
228        }
229
230        public boolean hasClaim() { 
231          return this.claim != null && !this.claim.isEmpty();
232        }
233
234        /**
235         * @param value {@link #claim} (Reference to a related claim.)
236         */
237        public RelatedClaimComponent setClaim(Reference value) { 
238          this.claim = value;
239          return this;
240        }
241
242        /**
243         * @return {@link #relationship} (A code to convey how the claims are related.)
244         */
245        public CodeableConcept getRelationship() { 
246          if (this.relationship == null)
247            if (Configuration.errorOnAutoCreate())
248              throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
249            else if (Configuration.doAutoCreate())
250              this.relationship = new CodeableConcept(); // cc
251          return this.relationship;
252        }
253
254        public boolean hasRelationship() { 
255          return this.relationship != null && !this.relationship.isEmpty();
256        }
257
258        /**
259         * @param value {@link #relationship} (A code to convey how the claims are related.)
260         */
261        public RelatedClaimComponent setRelationship(CodeableConcept value) { 
262          this.relationship = value;
263          return this;
264        }
265
266        /**
267         * @return {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
268         */
269        public Identifier getReference() { 
270          if (this.reference == null)
271            if (Configuration.errorOnAutoCreate())
272              throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
273            else if (Configuration.doAutoCreate())
274              this.reference = new Identifier(); // cc
275          return this.reference;
276        }
277
278        public boolean hasReference() { 
279          return this.reference != null && !this.reference.isEmpty();
280        }
281
282        /**
283         * @param value {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
284         */
285        public RelatedClaimComponent setReference(Identifier value) { 
286          this.reference = value;
287          return this;
288        }
289
290        protected void listChildren(List<Property> children) {
291          super.listChildren(children);
292          children.add(new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim));
293          children.add(new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship));
294          children.add(new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1, reference));
295        }
296
297        @Override
298        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
299          switch (_hash) {
300          case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim);
301          case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship);
302          case -925155509: /*reference*/  return new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1, reference);
303          default: return super.getNamedProperty(_hash, _name, _checkValid);
304          }
305
306        }
307
308      @Override
309      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
310        switch (hash) {
311        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
312        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
313        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
314        default: return super.getProperty(hash, name, checkValid);
315        }
316
317      }
318
319      @Override
320      public Base setProperty(int hash, String name, Base value) throws FHIRException {
321        switch (hash) {
322        case 94742588: // claim
323          this.claim = TypeConvertor.castToReference(value); // Reference
324          return value;
325        case -261851592: // relationship
326          this.relationship = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
327          return value;
328        case -925155509: // reference
329          this.reference = TypeConvertor.castToIdentifier(value); // Identifier
330          return value;
331        default: return super.setProperty(hash, name, value);
332        }
333
334      }
335
336      @Override
337      public Base setProperty(String name, Base value) throws FHIRException {
338        if (name.equals("claim")) {
339          this.claim = TypeConvertor.castToReference(value); // Reference
340        } else if (name.equals("relationship")) {
341          this.relationship = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
342        } else if (name.equals("reference")) {
343          this.reference = TypeConvertor.castToIdentifier(value); // Identifier
344        } else
345          return super.setProperty(name, value);
346        return value;
347      }
348
349      @Override
350      public Base makeProperty(int hash, String name) throws FHIRException {
351        switch (hash) {
352        case 94742588:  return getClaim();
353        case -261851592:  return getRelationship();
354        case -925155509:  return getReference();
355        default: return super.makeProperty(hash, name);
356        }
357
358      }
359
360      @Override
361      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
362        switch (hash) {
363        case 94742588: /*claim*/ return new String[] {"Reference"};
364        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
365        case -925155509: /*reference*/ return new String[] {"Identifier"};
366        default: return super.getTypesForProperty(hash, name);
367        }
368
369      }
370
371      @Override
372      public Base addChild(String name) throws FHIRException {
373        if (name.equals("claim")) {
374          this.claim = new Reference();
375          return this.claim;
376        }
377        else if (name.equals("relationship")) {
378          this.relationship = new CodeableConcept();
379          return this.relationship;
380        }
381        else if (name.equals("reference")) {
382          this.reference = new Identifier();
383          return this.reference;
384        }
385        else
386          return super.addChild(name);
387      }
388
389      public RelatedClaimComponent copy() {
390        RelatedClaimComponent dst = new RelatedClaimComponent();
391        copyValues(dst);
392        return dst;
393      }
394
395      public void copyValues(RelatedClaimComponent dst) {
396        super.copyValues(dst);
397        dst.claim = claim == null ? null : claim.copy();
398        dst.relationship = relationship == null ? null : relationship.copy();
399        dst.reference = reference == null ? null : reference.copy();
400      }
401
402      @Override
403      public boolean equalsDeep(Base other_) {
404        if (!super.equalsDeep(other_))
405          return false;
406        if (!(other_ instanceof RelatedClaimComponent))
407          return false;
408        RelatedClaimComponent o = (RelatedClaimComponent) other_;
409        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
410          ;
411      }
412
413      @Override
414      public boolean equalsShallow(Base other_) {
415        if (!super.equalsShallow(other_))
416          return false;
417        if (!(other_ instanceof RelatedClaimComponent))
418          return false;
419        RelatedClaimComponent o = (RelatedClaimComponent) other_;
420        return true;
421      }
422
423      public boolean isEmpty() {
424        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference
425          );
426      }
427
428  public String fhirType() {
429    return "ExplanationOfBenefit.related";
430
431  }
432
433  }
434
435    @Block()
436    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
437        /**
438         * Type of Party to be reimbursed: Subscriber, provider, other.
439         */
440        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
441        @Description(shortDefinition="Category of recipient", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
442        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payeetype")
443        protected CodeableConcept type;
444
445        /**
446         * Reference to the individual or organization to whom any payment will be made.
447         */
448        @Child(name = "party", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, RelatedPerson.class}, order=2, min=0, max=1, modifier=false, summary=false)
449        @Description(shortDefinition="Recipient reference", formalDefinition="Reference to the individual or organization to whom any payment will be made." )
450        protected Reference party;
451
452        private static final long serialVersionUID = -1948897146L;
453
454    /**
455     * Constructor
456     */
457      public PayeeComponent() {
458        super();
459      }
460
461        /**
462         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
463         */
464        public CodeableConcept getType() { 
465          if (this.type == null)
466            if (Configuration.errorOnAutoCreate())
467              throw new Error("Attempt to auto-create PayeeComponent.type");
468            else if (Configuration.doAutoCreate())
469              this.type = new CodeableConcept(); // cc
470          return this.type;
471        }
472
473        public boolean hasType() { 
474          return this.type != null && !this.type.isEmpty();
475        }
476
477        /**
478         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
479         */
480        public PayeeComponent setType(CodeableConcept value) { 
481          this.type = value;
482          return this;
483        }
484
485        /**
486         * @return {@link #party} (Reference to the individual or organization to whom any payment will be made.)
487         */
488        public Reference getParty() { 
489          if (this.party == null)
490            if (Configuration.errorOnAutoCreate())
491              throw new Error("Attempt to auto-create PayeeComponent.party");
492            else if (Configuration.doAutoCreate())
493              this.party = new Reference(); // cc
494          return this.party;
495        }
496
497        public boolean hasParty() { 
498          return this.party != null && !this.party.isEmpty();
499        }
500
501        /**
502         * @param value {@link #party} (Reference to the individual or organization to whom any payment will be made.)
503         */
504        public PayeeComponent setParty(Reference value) { 
505          this.party = value;
506          return this;
507        }
508
509        protected void listChildren(List<Property> children) {
510          super.listChildren(children);
511          children.add(new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
512          children.add(new Property("party", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)", "Reference to the individual or organization to whom any payment will be made.", 0, 1, party));
513        }
514
515        @Override
516        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
517          switch (_hash) {
518          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
519          case 106437350: /*party*/  return new Property("party", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)", "Reference to the individual or organization to whom any payment will be made.", 0, 1, party);
520          default: return super.getNamedProperty(_hash, _name, _checkValid);
521          }
522
523        }
524
525      @Override
526      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
527        switch (hash) {
528        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
529        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
530        default: return super.getProperty(hash, name, checkValid);
531        }
532
533      }
534
535      @Override
536      public Base setProperty(int hash, String name, Base value) throws FHIRException {
537        switch (hash) {
538        case 3575610: // type
539          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
540          return value;
541        case 106437350: // party
542          this.party = TypeConvertor.castToReference(value); // Reference
543          return value;
544        default: return super.setProperty(hash, name, value);
545        }
546
547      }
548
549      @Override
550      public Base setProperty(String name, Base value) throws FHIRException {
551        if (name.equals("type")) {
552          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
553        } else if (name.equals("party")) {
554          this.party = TypeConvertor.castToReference(value); // Reference
555        } else
556          return super.setProperty(name, value);
557        return value;
558      }
559
560      @Override
561      public Base makeProperty(int hash, String name) throws FHIRException {
562        switch (hash) {
563        case 3575610:  return getType();
564        case 106437350:  return getParty();
565        default: return super.makeProperty(hash, name);
566        }
567
568      }
569
570      @Override
571      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
572        switch (hash) {
573        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
574        case 106437350: /*party*/ return new String[] {"Reference"};
575        default: return super.getTypesForProperty(hash, name);
576        }
577
578      }
579
580      @Override
581      public Base addChild(String name) throws FHIRException {
582        if (name.equals("type")) {
583          this.type = new CodeableConcept();
584          return this.type;
585        }
586        else if (name.equals("party")) {
587          this.party = new Reference();
588          return this.party;
589        }
590        else
591          return super.addChild(name);
592      }
593
594      public PayeeComponent copy() {
595        PayeeComponent dst = new PayeeComponent();
596        copyValues(dst);
597        return dst;
598      }
599
600      public void copyValues(PayeeComponent dst) {
601        super.copyValues(dst);
602        dst.type = type == null ? null : type.copy();
603        dst.party = party == null ? null : party.copy();
604      }
605
606      @Override
607      public boolean equalsDeep(Base other_) {
608        if (!super.equalsDeep(other_))
609          return false;
610        if (!(other_ instanceof PayeeComponent))
611          return false;
612        PayeeComponent o = (PayeeComponent) other_;
613        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true);
614      }
615
616      @Override
617      public boolean equalsShallow(Base other_) {
618        if (!super.equalsShallow(other_))
619          return false;
620        if (!(other_ instanceof PayeeComponent))
621          return false;
622        PayeeComponent o = (PayeeComponent) other_;
623        return true;
624      }
625
626      public boolean isEmpty() {
627        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party);
628      }
629
630  public String fhirType() {
631    return "ExplanationOfBenefit.payee";
632
633  }
634
635  }
636
637    @Block()
638    public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
639        /**
640         * A number to uniquely identify care team entries.
641         */
642        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
643        @Description(shortDefinition="Order of care team", formalDefinition="A number to uniquely identify care team entries." )
644        protected PositiveIntType sequence;
645
646        /**
647         * Member of the team who provided the product or service.
648         */
649        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=false)
650        @Description(shortDefinition="Practitioner or organization", formalDefinition="Member of the team who provided the product or service." )
651        protected Reference provider;
652
653        /**
654         * The party who is billing and/or responsible for the claimed products or services.
655         */
656        @Child(name = "responsible", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
657        @Description(shortDefinition="Indicator of the lead practitioner", formalDefinition="The party who is billing and/or responsible for the claimed products or services." )
658        protected BooleanType responsible;
659
660        /**
661         * The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.
662         */
663        @Child(name = "role", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
664        @Description(shortDefinition="Function within the team", formalDefinition="The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team." )
665        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-careteamrole")
666        protected CodeableConcept role;
667
668        /**
669         * The specialization of the practitioner or provider which is applicable for this service.
670         */
671        @Child(name = "specialty", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
672        @Description(shortDefinition="Practitioner or provider specialization", formalDefinition="The specialization of the practitioner or provider which is applicable for this service." )
673        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provider-qualification")
674        protected CodeableConcept specialty;
675
676        private static final long serialVersionUID = 1238813503L;
677
678    /**
679     * Constructor
680     */
681      public CareTeamComponent() {
682        super();
683      }
684
685    /**
686     * Constructor
687     */
688      public CareTeamComponent(int sequence, Reference provider) {
689        super();
690        this.setSequence(sequence);
691        this.setProvider(provider);
692      }
693
694        /**
695         * @return {@link #sequence} (A number to uniquely identify care team entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
696         */
697        public PositiveIntType getSequenceElement() { 
698          if (this.sequence == null)
699            if (Configuration.errorOnAutoCreate())
700              throw new Error("Attempt to auto-create CareTeamComponent.sequence");
701            else if (Configuration.doAutoCreate())
702              this.sequence = new PositiveIntType(); // bb
703          return this.sequence;
704        }
705
706        public boolean hasSequenceElement() { 
707          return this.sequence != null && !this.sequence.isEmpty();
708        }
709
710        public boolean hasSequence() { 
711          return this.sequence != null && !this.sequence.isEmpty();
712        }
713
714        /**
715         * @param value {@link #sequence} (A number to uniquely identify care team entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
716         */
717        public CareTeamComponent setSequenceElement(PositiveIntType value) { 
718          this.sequence = value;
719          return this;
720        }
721
722        /**
723         * @return A number to uniquely identify care team entries.
724         */
725        public int getSequence() { 
726          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
727        }
728
729        /**
730         * @param value A number to uniquely identify care team entries.
731         */
732        public CareTeamComponent setSequence(int value) { 
733            if (this.sequence == null)
734              this.sequence = new PositiveIntType();
735            this.sequence.setValue(value);
736          return this;
737        }
738
739        /**
740         * @return {@link #provider} (Member of the team who provided the product or service.)
741         */
742        public Reference getProvider() { 
743          if (this.provider == null)
744            if (Configuration.errorOnAutoCreate())
745              throw new Error("Attempt to auto-create CareTeamComponent.provider");
746            else if (Configuration.doAutoCreate())
747              this.provider = new Reference(); // cc
748          return this.provider;
749        }
750
751        public boolean hasProvider() { 
752          return this.provider != null && !this.provider.isEmpty();
753        }
754
755        /**
756         * @param value {@link #provider} (Member of the team who provided the product or service.)
757         */
758        public CareTeamComponent setProvider(Reference value) { 
759          this.provider = value;
760          return this;
761        }
762
763        /**
764         * @return {@link #responsible} (The party who is billing and/or responsible for the claimed products or services.). This is the underlying object with id, value and extensions. The accessor "getResponsible" gives direct access to the value
765         */
766        public BooleanType getResponsibleElement() { 
767          if (this.responsible == null)
768            if (Configuration.errorOnAutoCreate())
769              throw new Error("Attempt to auto-create CareTeamComponent.responsible");
770            else if (Configuration.doAutoCreate())
771              this.responsible = new BooleanType(); // bb
772          return this.responsible;
773        }
774
775        public boolean hasResponsibleElement() { 
776          return this.responsible != null && !this.responsible.isEmpty();
777        }
778
779        public boolean hasResponsible() { 
780          return this.responsible != null && !this.responsible.isEmpty();
781        }
782
783        /**
784         * @param value {@link #responsible} (The party who is billing and/or responsible for the claimed products or services.). This is the underlying object with id, value and extensions. The accessor "getResponsible" gives direct access to the value
785         */
786        public CareTeamComponent setResponsibleElement(BooleanType value) { 
787          this.responsible = value;
788          return this;
789        }
790
791        /**
792         * @return The party who is billing and/or responsible for the claimed products or services.
793         */
794        public boolean getResponsible() { 
795          return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
796        }
797
798        /**
799         * @param value The party who is billing and/or responsible for the claimed products or services.
800         */
801        public CareTeamComponent setResponsible(boolean value) { 
802            if (this.responsible == null)
803              this.responsible = new BooleanType();
804            this.responsible.setValue(value);
805          return this;
806        }
807
808        /**
809         * @return {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
810         */
811        public CodeableConcept getRole() { 
812          if (this.role == null)
813            if (Configuration.errorOnAutoCreate())
814              throw new Error("Attempt to auto-create CareTeamComponent.role");
815            else if (Configuration.doAutoCreate())
816              this.role = new CodeableConcept(); // cc
817          return this.role;
818        }
819
820        public boolean hasRole() { 
821          return this.role != null && !this.role.isEmpty();
822        }
823
824        /**
825         * @param value {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
826         */
827        public CareTeamComponent setRole(CodeableConcept value) { 
828          this.role = value;
829          return this;
830        }
831
832        /**
833         * @return {@link #specialty} (The specialization of the practitioner or provider which is applicable for this service.)
834         */
835        public CodeableConcept getSpecialty() { 
836          if (this.specialty == null)
837            if (Configuration.errorOnAutoCreate())
838              throw new Error("Attempt to auto-create CareTeamComponent.specialty");
839            else if (Configuration.doAutoCreate())
840              this.specialty = new CodeableConcept(); // cc
841          return this.specialty;
842        }
843
844        public boolean hasSpecialty() { 
845          return this.specialty != null && !this.specialty.isEmpty();
846        }
847
848        /**
849         * @param value {@link #specialty} (The specialization of the practitioner or provider which is applicable for this service.)
850         */
851        public CareTeamComponent setSpecialty(CodeableConcept value) { 
852          this.specialty = value;
853          return this;
854        }
855
856        protected void listChildren(List<Property> children) {
857          super.listChildren(children);
858          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence));
859          children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider));
860          children.add(new Property("responsible", "boolean", "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible));
861          children.add(new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role));
862          children.add(new Property("specialty", "CodeableConcept", "The specialization of the practitioner or provider which is applicable for this service.", 0, 1, specialty));
863        }
864
865        @Override
866        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
867          switch (_hash) {
868          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence);
869          case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider);
870          case 1847674614: /*responsible*/  return new Property("responsible", "boolean", "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible);
871          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role);
872          case -1694759682: /*specialty*/  return new Property("specialty", "CodeableConcept", "The specialization of the practitioner or provider which is applicable for this service.", 0, 1, specialty);
873          default: return super.getNamedProperty(_hash, _name, _checkValid);
874          }
875
876        }
877
878      @Override
879      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
880        switch (hash) {
881        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
882        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
883        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // BooleanType
884        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
885        case -1694759682: /*specialty*/ return this.specialty == null ? new Base[0] : new Base[] {this.specialty}; // CodeableConcept
886        default: return super.getProperty(hash, name, checkValid);
887        }
888
889      }
890
891      @Override
892      public Base setProperty(int hash, String name, Base value) throws FHIRException {
893        switch (hash) {
894        case 1349547969: // sequence
895          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
896          return value;
897        case -987494927: // provider
898          this.provider = TypeConvertor.castToReference(value); // Reference
899          return value;
900        case 1847674614: // responsible
901          this.responsible = TypeConvertor.castToBoolean(value); // BooleanType
902          return value;
903        case 3506294: // role
904          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
905          return value;
906        case -1694759682: // specialty
907          this.specialty = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
908          return value;
909        default: return super.setProperty(hash, name, value);
910        }
911
912      }
913
914      @Override
915      public Base setProperty(String name, Base value) throws FHIRException {
916        if (name.equals("sequence")) {
917          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
918        } else if (name.equals("provider")) {
919          this.provider = TypeConvertor.castToReference(value); // Reference
920        } else if (name.equals("responsible")) {
921          this.responsible = TypeConvertor.castToBoolean(value); // BooleanType
922        } else if (name.equals("role")) {
923          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
924        } else if (name.equals("specialty")) {
925          this.specialty = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
926        } else
927          return super.setProperty(name, value);
928        return value;
929      }
930
931      @Override
932      public Base makeProperty(int hash, String name) throws FHIRException {
933        switch (hash) {
934        case 1349547969:  return getSequenceElement();
935        case -987494927:  return getProvider();
936        case 1847674614:  return getResponsibleElement();
937        case 3506294:  return getRole();
938        case -1694759682:  return getSpecialty();
939        default: return super.makeProperty(hash, name);
940        }
941
942      }
943
944      @Override
945      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
946        switch (hash) {
947        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
948        case -987494927: /*provider*/ return new String[] {"Reference"};
949        case 1847674614: /*responsible*/ return new String[] {"boolean"};
950        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
951        case -1694759682: /*specialty*/ return new String[] {"CodeableConcept"};
952        default: return super.getTypesForProperty(hash, name);
953        }
954
955      }
956
957      @Override
958      public Base addChild(String name) throws FHIRException {
959        if (name.equals("sequence")) {
960          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeam.sequence");
961        }
962        else if (name.equals("provider")) {
963          this.provider = new Reference();
964          return this.provider;
965        }
966        else if (name.equals("responsible")) {
967          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeam.responsible");
968        }
969        else if (name.equals("role")) {
970          this.role = new CodeableConcept();
971          return this.role;
972        }
973        else if (name.equals("specialty")) {
974          this.specialty = new CodeableConcept();
975          return this.specialty;
976        }
977        else
978          return super.addChild(name);
979      }
980
981      public CareTeamComponent copy() {
982        CareTeamComponent dst = new CareTeamComponent();
983        copyValues(dst);
984        return dst;
985      }
986
987      public void copyValues(CareTeamComponent dst) {
988        super.copyValues(dst);
989        dst.sequence = sequence == null ? null : sequence.copy();
990        dst.provider = provider == null ? null : provider.copy();
991        dst.responsible = responsible == null ? null : responsible.copy();
992        dst.role = role == null ? null : role.copy();
993        dst.specialty = specialty == null ? null : specialty.copy();
994      }
995
996      @Override
997      public boolean equalsDeep(Base other_) {
998        if (!super.equalsDeep(other_))
999          return false;
1000        if (!(other_ instanceof CareTeamComponent))
1001          return false;
1002        CareTeamComponent o = (CareTeamComponent) other_;
1003        return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true) && compareDeep(responsible, o.responsible, true)
1004           && compareDeep(role, o.role, true) && compareDeep(specialty, o.specialty, true);
1005      }
1006
1007      @Override
1008      public boolean equalsShallow(Base other_) {
1009        if (!super.equalsShallow(other_))
1010          return false;
1011        if (!(other_ instanceof CareTeamComponent))
1012          return false;
1013        CareTeamComponent o = (CareTeamComponent) other_;
1014        return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true)
1015          ;
1016      }
1017
1018      public boolean isEmpty() {
1019        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible
1020          , role, specialty);
1021      }
1022
1023  public String fhirType() {
1024    return "ExplanationOfBenefit.careTeam";
1025
1026  }
1027
1028  }
1029
1030    @Block()
1031    public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
1032        /**
1033         * A number to uniquely identify supporting information entries.
1034         */
1035        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1036        @Description(shortDefinition="Information instance identifier", formalDefinition="A number to uniquely identify supporting information entries." )
1037        protected PositiveIntType sequence;
1038
1039        /**
1040         * The general class of the information supplied: information; exception; accident, employment; onset, etc.
1041         */
1042        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
1043        @Description(shortDefinition="Classification of the supplied information", formalDefinition="The general class of the information supplied: information; exception; accident, employment; onset, etc." )
1044        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-informationcategory")
1045        protected CodeableConcept category;
1046
1047        /**
1048         * System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.
1049         */
1050        @Child(name = "code", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1051        @Description(shortDefinition="Type of information", formalDefinition="System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought." )
1052        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-exception")
1053        protected CodeableConcept code;
1054
1055        /**
1056         * The date when or period to which this information refers.
1057         */
1058        @Child(name = "timing", type = {DateType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
1059        @Description(shortDefinition="When it occurred", formalDefinition="The date when or period to which this information refers." )
1060        protected DataType timing;
1061
1062        /**
1063         * Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.
1064         */
1065        @Child(name = "value", type = {BooleanType.class, StringType.class, Quantity.class, Attachment.class, Reference.class, Identifier.class}, order=5, min=0, max=1, modifier=false, summary=false)
1066        @Description(shortDefinition="Data to be provided", formalDefinition="Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data." )
1067        protected DataType value;
1068
1069        /**
1070         * Provides the reason in the situation where a reason code is required in addition to the content.
1071         */
1072        @Child(name = "reason", type = {Coding.class}, order=6, min=0, max=1, modifier=false, summary=false)
1073        @Description(shortDefinition="Explanation for the information", formalDefinition="Provides the reason in the situation where a reason code is required in addition to the content." )
1074        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/missing-tooth-reason")
1075        protected Coding reason;
1076
1077        private static final long serialVersionUID = 1577205655L;
1078
1079    /**
1080     * Constructor
1081     */
1082      public SupportingInformationComponent() {
1083        super();
1084      }
1085
1086    /**
1087     * Constructor
1088     */
1089      public SupportingInformationComponent(int sequence, CodeableConcept category) {
1090        super();
1091        this.setSequence(sequence);
1092        this.setCategory(category);
1093      }
1094
1095        /**
1096         * @return {@link #sequence} (A number to uniquely identify supporting information entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1097         */
1098        public PositiveIntType getSequenceElement() { 
1099          if (this.sequence == null)
1100            if (Configuration.errorOnAutoCreate())
1101              throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
1102            else if (Configuration.doAutoCreate())
1103              this.sequence = new PositiveIntType(); // bb
1104          return this.sequence;
1105        }
1106
1107        public boolean hasSequenceElement() { 
1108          return this.sequence != null && !this.sequence.isEmpty();
1109        }
1110
1111        public boolean hasSequence() { 
1112          return this.sequence != null && !this.sequence.isEmpty();
1113        }
1114
1115        /**
1116         * @param value {@link #sequence} (A number to uniquely identify supporting information entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1117         */
1118        public SupportingInformationComponent setSequenceElement(PositiveIntType value) { 
1119          this.sequence = value;
1120          return this;
1121        }
1122
1123        /**
1124         * @return A number to uniquely identify supporting information entries.
1125         */
1126        public int getSequence() { 
1127          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1128        }
1129
1130        /**
1131         * @param value A number to uniquely identify supporting information entries.
1132         */
1133        public SupportingInformationComponent setSequence(int value) { 
1134            if (this.sequence == null)
1135              this.sequence = new PositiveIntType();
1136            this.sequence.setValue(value);
1137          return this;
1138        }
1139
1140        /**
1141         * @return {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1142         */
1143        public CodeableConcept getCategory() { 
1144          if (this.category == null)
1145            if (Configuration.errorOnAutoCreate())
1146              throw new Error("Attempt to auto-create SupportingInformationComponent.category");
1147            else if (Configuration.doAutoCreate())
1148              this.category = new CodeableConcept(); // cc
1149          return this.category;
1150        }
1151
1152        public boolean hasCategory() { 
1153          return this.category != null && !this.category.isEmpty();
1154        }
1155
1156        /**
1157         * @param value {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1158         */
1159        public SupportingInformationComponent setCategory(CodeableConcept value) { 
1160          this.category = value;
1161          return this;
1162        }
1163
1164        /**
1165         * @return {@link #code} (System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.)
1166         */
1167        public CodeableConcept getCode() { 
1168          if (this.code == null)
1169            if (Configuration.errorOnAutoCreate())
1170              throw new Error("Attempt to auto-create SupportingInformationComponent.code");
1171            else if (Configuration.doAutoCreate())
1172              this.code = new CodeableConcept(); // cc
1173          return this.code;
1174        }
1175
1176        public boolean hasCode() { 
1177          return this.code != null && !this.code.isEmpty();
1178        }
1179
1180        /**
1181         * @param value {@link #code} (System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.)
1182         */
1183        public SupportingInformationComponent setCode(CodeableConcept value) { 
1184          this.code = value;
1185          return this;
1186        }
1187
1188        /**
1189         * @return {@link #timing} (The date when or period to which this information refers.)
1190         */
1191        public DataType getTiming() { 
1192          return this.timing;
1193        }
1194
1195        /**
1196         * @return {@link #timing} (The date when or period to which this information refers.)
1197         */
1198        public DateType getTimingDateType() throws FHIRException { 
1199          if (this.timing == null)
1200            this.timing = new DateType();
1201          if (!(this.timing instanceof DateType))
1202            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.timing.getClass().getName()+" was encountered");
1203          return (DateType) this.timing;
1204        }
1205
1206        public boolean hasTimingDateType() { 
1207          return this != null && this.timing instanceof DateType;
1208        }
1209
1210        /**
1211         * @return {@link #timing} (The date when or period to which this information refers.)
1212         */
1213        public Period getTimingPeriod() throws FHIRException { 
1214          if (this.timing == null)
1215            this.timing = new Period();
1216          if (!(this.timing instanceof Period))
1217            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
1218          return (Period) this.timing;
1219        }
1220
1221        public boolean hasTimingPeriod() { 
1222          return this != null && this.timing instanceof Period;
1223        }
1224
1225        public boolean hasTiming() { 
1226          return this.timing != null && !this.timing.isEmpty();
1227        }
1228
1229        /**
1230         * @param value {@link #timing} (The date when or period to which this information refers.)
1231         */
1232        public SupportingInformationComponent setTiming(DataType value) { 
1233          if (value != null && !(value instanceof DateType || value instanceof Period))
1234            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.timing[x]: "+value.fhirType());
1235          this.timing = value;
1236          return this;
1237        }
1238
1239        /**
1240         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
1241         */
1242        public DataType getValue() { 
1243          return this.value;
1244        }
1245
1246        /**
1247         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
1248         */
1249        public BooleanType getValueBooleanType() throws FHIRException { 
1250          if (this.value == null)
1251            this.value = new BooleanType();
1252          if (!(this.value instanceof BooleanType))
1253            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
1254          return (BooleanType) this.value;
1255        }
1256
1257        public boolean hasValueBooleanType() { 
1258          return this != null && this.value instanceof BooleanType;
1259        }
1260
1261        /**
1262         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
1263         */
1264        public StringType getValueStringType() throws FHIRException { 
1265          if (this.value == null)
1266            this.value = new StringType();
1267          if (!(this.value instanceof StringType))
1268            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
1269          return (StringType) this.value;
1270        }
1271
1272        public boolean hasValueStringType() { 
1273          return this != null && this.value instanceof StringType;
1274        }
1275
1276        /**
1277         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
1278         */
1279        public Quantity getValueQuantity() throws FHIRException { 
1280          if (this.value == null)
1281            this.value = new Quantity();
1282          if (!(this.value instanceof Quantity))
1283            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
1284          return (Quantity) this.value;
1285        }
1286
1287        public boolean hasValueQuantity() { 
1288          return this != null && this.value instanceof Quantity;
1289        }
1290
1291        /**
1292         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
1293         */
1294        public Attachment getValueAttachment() throws FHIRException { 
1295          if (this.value == null)
1296            this.value = new Attachment();
1297          if (!(this.value instanceof Attachment))
1298            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
1299          return (Attachment) this.value;
1300        }
1301
1302        public boolean hasValueAttachment() { 
1303          return this != null && this.value instanceof Attachment;
1304        }
1305
1306        /**
1307         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
1308         */
1309        public Reference getValueReference() throws FHIRException { 
1310          if (this.value == null)
1311            this.value = new Reference();
1312          if (!(this.value instanceof Reference))
1313            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
1314          return (Reference) this.value;
1315        }
1316
1317        public boolean hasValueReference() { 
1318          return this != null && this.value instanceof Reference;
1319        }
1320
1321        /**
1322         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
1323         */
1324        public Identifier getValueIdentifier() throws FHIRException { 
1325          if (this.value == null)
1326            this.value = new Identifier();
1327          if (!(this.value instanceof Identifier))
1328            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.value.getClass().getName()+" was encountered");
1329          return (Identifier) this.value;
1330        }
1331
1332        public boolean hasValueIdentifier() { 
1333          return this != null && this.value instanceof Identifier;
1334        }
1335
1336        public boolean hasValue() { 
1337          return this.value != null && !this.value.isEmpty();
1338        }
1339
1340        /**
1341         * @param value {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
1342         */
1343        public SupportingInformationComponent setValue(DataType value) { 
1344          if (value != null && !(value instanceof BooleanType || value instanceof StringType || value instanceof Quantity || value instanceof Attachment || value instanceof Reference || value instanceof Identifier))
1345            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.value[x]: "+value.fhirType());
1346          this.value = value;
1347          return this;
1348        }
1349
1350        /**
1351         * @return {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1352         */
1353        public Coding getReason() { 
1354          if (this.reason == null)
1355            if (Configuration.errorOnAutoCreate())
1356              throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1357            else if (Configuration.doAutoCreate())
1358              this.reason = new Coding(); // cc
1359          return this.reason;
1360        }
1361
1362        public boolean hasReason() { 
1363          return this.reason != null && !this.reason.isEmpty();
1364        }
1365
1366        /**
1367         * @param value {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1368         */
1369        public SupportingInformationComponent setReason(Coding value) { 
1370          this.reason = value;
1371          return this;
1372        }
1373
1374        protected void listChildren(List<Property> children) {
1375          super.listChildren(children);
1376          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence));
1377          children.add(new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category));
1378          children.add(new Property("code", "CodeableConcept", "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.", 0, 1, code));
1379          children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing));
1380          children.add(new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)|Identifier", "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.", 0, 1, value));
1381          children.add(new Property("reason", "Coding", "Provides the reason in the situation where a reason code is required in addition to the content.", 0, 1, reason));
1382        }
1383
1384        @Override
1385        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1386          switch (_hash) {
1387          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence);
1388          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category);
1389          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.", 0, 1, code);
1390          case 164632566: /*timing[x]*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1391          case -873664438: /*timing*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1392          case 807935768: /*timingDate*/  return new Property("timing[x]", "date", "The date when or period to which this information refers.", 0, 1, timing);
1393          case -615615829: /*timingPeriod*/  return new Property("timing[x]", "Period", "The date when or period to which this information refers.", 0, 1, timing);
1394          case -1410166417: /*value[x]*/  return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)|Identifier", "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.", 0, 1, value);
1395          case 111972721: /*value*/  return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)|Identifier", "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.", 0, 1, value);
1396          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean", "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.", 0, 1, value);
1397          case -1424603934: /*valueString*/  return new Property("value[x]", "string", "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.", 0, 1, value);
1398          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "Quantity", "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.", 0, 1, value);
1399          case -475566732: /*valueAttachment*/  return new Property("value[x]", "Attachment", "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.", 0, 1, value);
1400          case 1755241690: /*valueReference*/  return new Property("value[x]", "Reference(Any)", "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.", 0, 1, value);
1401          case -130498310: /*valueIdentifier*/  return new Property("value[x]", "Identifier", "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.", 0, 1, value);
1402          case -934964668: /*reason*/  return new Property("reason", "Coding", "Provides the reason in the situation where a reason code is required in addition to the content.", 0, 1, reason);
1403          default: return super.getNamedProperty(_hash, _name, _checkValid);
1404          }
1405
1406        }
1407
1408      @Override
1409      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1410        switch (hash) {
1411        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1412        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1413        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1414        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // DataType
1415        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
1416        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
1417        default: return super.getProperty(hash, name, checkValid);
1418        }
1419
1420      }
1421
1422      @Override
1423      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1424        switch (hash) {
1425        case 1349547969: // sequence
1426          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1427          return value;
1428        case 50511102: // category
1429          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1430          return value;
1431        case 3059181: // code
1432          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1433          return value;
1434        case -873664438: // timing
1435          this.timing = TypeConvertor.castToType(value); // DataType
1436          return value;
1437        case 111972721: // value
1438          this.value = TypeConvertor.castToType(value); // DataType
1439          return value;
1440        case -934964668: // reason
1441          this.reason = TypeConvertor.castToCoding(value); // Coding
1442          return value;
1443        default: return super.setProperty(hash, name, value);
1444        }
1445
1446      }
1447
1448      @Override
1449      public Base setProperty(String name, Base value) throws FHIRException {
1450        if (name.equals("sequence")) {
1451          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1452        } else if (name.equals("category")) {
1453          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1454        } else if (name.equals("code")) {
1455          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1456        } else if (name.equals("timing[x]")) {
1457          this.timing = TypeConvertor.castToType(value); // DataType
1458        } else if (name.equals("value[x]")) {
1459          this.value = TypeConvertor.castToType(value); // DataType
1460        } else if (name.equals("reason")) {
1461          this.reason = TypeConvertor.castToCoding(value); // Coding
1462        } else
1463          return super.setProperty(name, value);
1464        return value;
1465      }
1466
1467      @Override
1468      public Base makeProperty(int hash, String name) throws FHIRException {
1469        switch (hash) {
1470        case 1349547969:  return getSequenceElement();
1471        case 50511102:  return getCategory();
1472        case 3059181:  return getCode();
1473        case 164632566:  return getTiming();
1474        case -873664438:  return getTiming();
1475        case -1410166417:  return getValue();
1476        case 111972721:  return getValue();
1477        case -934964668:  return getReason();
1478        default: return super.makeProperty(hash, name);
1479        }
1480
1481      }
1482
1483      @Override
1484      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1485        switch (hash) {
1486        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1487        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1488        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1489        case -873664438: /*timing*/ return new String[] {"date", "Period"};
1490        case 111972721: /*value*/ return new String[] {"boolean", "string", "Quantity", "Attachment", "Reference", "Identifier"};
1491        case -934964668: /*reason*/ return new String[] {"Coding"};
1492        default: return super.getTypesForProperty(hash, name);
1493        }
1494
1495      }
1496
1497      @Override
1498      public Base addChild(String name) throws FHIRException {
1499        if (name.equals("sequence")) {
1500          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.supportingInfo.sequence");
1501        }
1502        else if (name.equals("category")) {
1503          this.category = new CodeableConcept();
1504          return this.category;
1505        }
1506        else if (name.equals("code")) {
1507          this.code = new CodeableConcept();
1508          return this.code;
1509        }
1510        else if (name.equals("timingDate")) {
1511          this.timing = new DateType();
1512          return this.timing;
1513        }
1514        else if (name.equals("timingPeriod")) {
1515          this.timing = new Period();
1516          return this.timing;
1517        }
1518        else if (name.equals("valueBoolean")) {
1519          this.value = new BooleanType();
1520          return this.value;
1521        }
1522        else if (name.equals("valueString")) {
1523          this.value = new StringType();
1524          return this.value;
1525        }
1526        else if (name.equals("valueQuantity")) {
1527          this.value = new Quantity();
1528          return this.value;
1529        }
1530        else if (name.equals("valueAttachment")) {
1531          this.value = new Attachment();
1532          return this.value;
1533        }
1534        else if (name.equals("valueReference")) {
1535          this.value = new Reference();
1536          return this.value;
1537        }
1538        else if (name.equals("valueIdentifier")) {
1539          this.value = new Identifier();
1540          return this.value;
1541        }
1542        else if (name.equals("reason")) {
1543          this.reason = new Coding();
1544          return this.reason;
1545        }
1546        else
1547          return super.addChild(name);
1548      }
1549
1550      public SupportingInformationComponent copy() {
1551        SupportingInformationComponent dst = new SupportingInformationComponent();
1552        copyValues(dst);
1553        return dst;
1554      }
1555
1556      public void copyValues(SupportingInformationComponent dst) {
1557        super.copyValues(dst);
1558        dst.sequence = sequence == null ? null : sequence.copy();
1559        dst.category = category == null ? null : category.copy();
1560        dst.code = code == null ? null : code.copy();
1561        dst.timing = timing == null ? null : timing.copy();
1562        dst.value = value == null ? null : value.copy();
1563        dst.reason = reason == null ? null : reason.copy();
1564      }
1565
1566      @Override
1567      public boolean equalsDeep(Base other_) {
1568        if (!super.equalsDeep(other_))
1569          return false;
1570        if (!(other_ instanceof SupportingInformationComponent))
1571          return false;
1572        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1573        return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true) && compareDeep(code, o.code, true)
1574           && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true) && compareDeep(reason, o.reason, true)
1575          ;
1576      }
1577
1578      @Override
1579      public boolean equalsShallow(Base other_) {
1580        if (!super.equalsShallow(other_))
1581          return false;
1582        if (!(other_ instanceof SupportingInformationComponent))
1583          return false;
1584        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1585        return compareValues(sequence, o.sequence, true);
1586      }
1587
1588      public boolean isEmpty() {
1589        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code
1590          , timing, value, reason);
1591      }
1592
1593  public String fhirType() {
1594    return "ExplanationOfBenefit.supportingInfo";
1595
1596  }
1597
1598  }
1599
1600    @Block()
1601    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1602        /**
1603         * A number to uniquely identify diagnosis entries.
1604         */
1605        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1606        @Description(shortDefinition="Diagnosis instance identifier", formalDefinition="A number to uniquely identify diagnosis entries." )
1607        protected PositiveIntType sequence;
1608
1609        /**
1610         * The nature of illness or problem in a coded form or as a reference to an external defined Condition.
1611         */
1612        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=2, min=1, max=1, modifier=false, summary=false)
1613        @Description(shortDefinition="Nature of illness or problem", formalDefinition="The nature of illness or problem in a coded form or as a reference to an external defined Condition." )
1614        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
1615        protected DataType diagnosis;
1616
1617        /**
1618         * When the condition was observed or the relative ranking.
1619         */
1620        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1621        @Description(shortDefinition="Timing or nature of the diagnosis", formalDefinition="When the condition was observed or the relative ranking." )
1622        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosistype")
1623        protected List<CodeableConcept> type;
1624
1625        /**
1626         * Indication of whether the diagnosis was present on admission to a facility.
1627         */
1628        @Child(name = "onAdmission", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1629        @Description(shortDefinition="Present on admission", formalDefinition="Indication of whether the diagnosis was present on admission to a facility." )
1630        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission")
1631        protected CodeableConcept onAdmission;
1632
1633        private static final long serialVersionUID = -320261526L;
1634
1635    /**
1636     * Constructor
1637     */
1638      public DiagnosisComponent() {
1639        super();
1640      }
1641
1642    /**
1643     * Constructor
1644     */
1645      public DiagnosisComponent(int sequence, DataType diagnosis) {
1646        super();
1647        this.setSequence(sequence);
1648        this.setDiagnosis(diagnosis);
1649      }
1650
1651        /**
1652         * @return {@link #sequence} (A number to uniquely identify diagnosis entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1653         */
1654        public PositiveIntType getSequenceElement() { 
1655          if (this.sequence == null)
1656            if (Configuration.errorOnAutoCreate())
1657              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
1658            else if (Configuration.doAutoCreate())
1659              this.sequence = new PositiveIntType(); // bb
1660          return this.sequence;
1661        }
1662
1663        public boolean hasSequenceElement() { 
1664          return this.sequence != null && !this.sequence.isEmpty();
1665        }
1666
1667        public boolean hasSequence() { 
1668          return this.sequence != null && !this.sequence.isEmpty();
1669        }
1670
1671        /**
1672         * @param value {@link #sequence} (A number to uniquely identify diagnosis entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1673         */
1674        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
1675          this.sequence = value;
1676          return this;
1677        }
1678
1679        /**
1680         * @return A number to uniquely identify diagnosis entries.
1681         */
1682        public int getSequence() { 
1683          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1684        }
1685
1686        /**
1687         * @param value A number to uniquely identify diagnosis entries.
1688         */
1689        public DiagnosisComponent setSequence(int value) { 
1690            if (this.sequence == null)
1691              this.sequence = new PositiveIntType();
1692            this.sequence.setValue(value);
1693          return this;
1694        }
1695
1696        /**
1697         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1698         */
1699        public DataType getDiagnosis() { 
1700          return this.diagnosis;
1701        }
1702
1703        /**
1704         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1705         */
1706        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
1707          if (this.diagnosis == null)
1708            this.diagnosis = new CodeableConcept();
1709          if (!(this.diagnosis instanceof CodeableConcept))
1710            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1711          return (CodeableConcept) this.diagnosis;
1712        }
1713
1714        public boolean hasDiagnosisCodeableConcept() { 
1715          return this != null && this.diagnosis instanceof CodeableConcept;
1716        }
1717
1718        /**
1719         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1720         */
1721        public Reference getDiagnosisReference() throws FHIRException { 
1722          if (this.diagnosis == null)
1723            this.diagnosis = new Reference();
1724          if (!(this.diagnosis instanceof Reference))
1725            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1726          return (Reference) this.diagnosis;
1727        }
1728
1729        public boolean hasDiagnosisReference() { 
1730          return this != null && this.diagnosis instanceof Reference;
1731        }
1732
1733        public boolean hasDiagnosis() { 
1734          return this.diagnosis != null && !this.diagnosis.isEmpty();
1735        }
1736
1737        /**
1738         * @param value {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1739         */
1740        public DiagnosisComponent setDiagnosis(DataType value) { 
1741          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1742            throw new Error("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: "+value.fhirType());
1743          this.diagnosis = value;
1744          return this;
1745        }
1746
1747        /**
1748         * @return {@link #type} (When the condition was observed or the relative ranking.)
1749         */
1750        public List<CodeableConcept> getType() { 
1751          if (this.type == null)
1752            this.type = new ArrayList<CodeableConcept>();
1753          return this.type;
1754        }
1755
1756        /**
1757         * @return Returns a reference to <code>this</code> for easy method chaining
1758         */
1759        public DiagnosisComponent setType(List<CodeableConcept> theType) { 
1760          this.type = theType;
1761          return this;
1762        }
1763
1764        public boolean hasType() { 
1765          if (this.type == null)
1766            return false;
1767          for (CodeableConcept item : this.type)
1768            if (!item.isEmpty())
1769              return true;
1770          return false;
1771        }
1772
1773        public CodeableConcept addType() { //3
1774          CodeableConcept t = new CodeableConcept();
1775          if (this.type == null)
1776            this.type = new ArrayList<CodeableConcept>();
1777          this.type.add(t);
1778          return t;
1779        }
1780
1781        public DiagnosisComponent addType(CodeableConcept t) { //3
1782          if (t == null)
1783            return this;
1784          if (this.type == null)
1785            this.type = new ArrayList<CodeableConcept>();
1786          this.type.add(t);
1787          return this;
1788        }
1789
1790        /**
1791         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
1792         */
1793        public CodeableConcept getTypeFirstRep() { 
1794          if (getType().isEmpty()) {
1795            addType();
1796          }
1797          return getType().get(0);
1798        }
1799
1800        /**
1801         * @return {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
1802         */
1803        public CodeableConcept getOnAdmission() { 
1804          if (this.onAdmission == null)
1805            if (Configuration.errorOnAutoCreate())
1806              throw new Error("Attempt to auto-create DiagnosisComponent.onAdmission");
1807            else if (Configuration.doAutoCreate())
1808              this.onAdmission = new CodeableConcept(); // cc
1809          return this.onAdmission;
1810        }
1811
1812        public boolean hasOnAdmission() { 
1813          return this.onAdmission != null && !this.onAdmission.isEmpty();
1814        }
1815
1816        /**
1817         * @param value {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
1818         */
1819        public DiagnosisComponent setOnAdmission(CodeableConcept value) { 
1820          this.onAdmission = value;
1821          return this;
1822        }
1823
1824        protected void listChildren(List<Property> children) {
1825          super.listChildren(children);
1826          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence));
1827          children.add(new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis));
1828          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
1829          children.add(new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission));
1830        }
1831
1832        @Override
1833        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1834          switch (_hash) {
1835          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence);
1836          case -1487009809: /*diagnosis[x]*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
1837          case 1196993265: /*diagnosis*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
1838          case 277781616: /*diagnosisCodeableConcept*/  return new Property("diagnosis[x]", "CodeableConcept", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
1839          case 2050454362: /*diagnosisReference*/  return new Property("diagnosis[x]", "Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
1840          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
1841          case -3386134: /*onAdmission*/  return new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission);
1842          default: return super.getNamedProperty(_hash, _name, _checkValid);
1843          }
1844
1845        }
1846
1847      @Override
1848      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1849        switch (hash) {
1850        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1851        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // DataType
1852        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
1853        case -3386134: /*onAdmission*/ return this.onAdmission == null ? new Base[0] : new Base[] {this.onAdmission}; // CodeableConcept
1854        default: return super.getProperty(hash, name, checkValid);
1855        }
1856
1857      }
1858
1859      @Override
1860      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1861        switch (hash) {
1862        case 1349547969: // sequence
1863          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1864          return value;
1865        case 1196993265: // diagnosis
1866          this.diagnosis = TypeConvertor.castToType(value); // DataType
1867          return value;
1868        case 3575610: // type
1869          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1870          return value;
1871        case -3386134: // onAdmission
1872          this.onAdmission = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1873          return value;
1874        default: return super.setProperty(hash, name, value);
1875        }
1876
1877      }
1878
1879      @Override
1880      public Base setProperty(String name, Base value) throws FHIRException {
1881        if (name.equals("sequence")) {
1882          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1883        } else if (name.equals("diagnosis[x]")) {
1884          this.diagnosis = TypeConvertor.castToType(value); // DataType
1885        } else if (name.equals("type")) {
1886          this.getType().add(TypeConvertor.castToCodeableConcept(value));
1887        } else if (name.equals("onAdmission")) {
1888          this.onAdmission = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1889        } else
1890          return super.setProperty(name, value);
1891        return value;
1892      }
1893
1894      @Override
1895      public Base makeProperty(int hash, String name) throws FHIRException {
1896        switch (hash) {
1897        case 1349547969:  return getSequenceElement();
1898        case -1487009809:  return getDiagnosis();
1899        case 1196993265:  return getDiagnosis();
1900        case 3575610:  return addType(); 
1901        case -3386134:  return getOnAdmission();
1902        default: return super.makeProperty(hash, name);
1903        }
1904
1905      }
1906
1907      @Override
1908      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1909        switch (hash) {
1910        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1911        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
1912        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1913        case -3386134: /*onAdmission*/ return new String[] {"CodeableConcept"};
1914        default: return super.getTypesForProperty(hash, name);
1915        }
1916
1917      }
1918
1919      @Override
1920      public Base addChild(String name) throws FHIRException {
1921        if (name.equals("sequence")) {
1922          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.diagnosis.sequence");
1923        }
1924        else if (name.equals("diagnosisCodeableConcept")) {
1925          this.diagnosis = new CodeableConcept();
1926          return this.diagnosis;
1927        }
1928        else if (name.equals("diagnosisReference")) {
1929          this.diagnosis = new Reference();
1930          return this.diagnosis;
1931        }
1932        else if (name.equals("type")) {
1933          return addType();
1934        }
1935        else if (name.equals("onAdmission")) {
1936          this.onAdmission = new CodeableConcept();
1937          return this.onAdmission;
1938        }
1939        else
1940          return super.addChild(name);
1941      }
1942
1943      public DiagnosisComponent copy() {
1944        DiagnosisComponent dst = new DiagnosisComponent();
1945        copyValues(dst);
1946        return dst;
1947      }
1948
1949      public void copyValues(DiagnosisComponent dst) {
1950        super.copyValues(dst);
1951        dst.sequence = sequence == null ? null : sequence.copy();
1952        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
1953        if (type != null) {
1954          dst.type = new ArrayList<CodeableConcept>();
1955          for (CodeableConcept i : type)
1956            dst.type.add(i.copy());
1957        };
1958        dst.onAdmission = onAdmission == null ? null : onAdmission.copy();
1959      }
1960
1961      @Override
1962      public boolean equalsDeep(Base other_) {
1963        if (!super.equalsDeep(other_))
1964          return false;
1965        if (!(other_ instanceof DiagnosisComponent))
1966          return false;
1967        DiagnosisComponent o = (DiagnosisComponent) other_;
1968        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(type, o.type, true)
1969           && compareDeep(onAdmission, o.onAdmission, true);
1970      }
1971
1972      @Override
1973      public boolean equalsShallow(Base other_) {
1974        if (!super.equalsShallow(other_))
1975          return false;
1976        if (!(other_ instanceof DiagnosisComponent))
1977          return false;
1978        DiagnosisComponent o = (DiagnosisComponent) other_;
1979        return compareValues(sequence, o.sequence, true);
1980      }
1981
1982      public boolean isEmpty() {
1983        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type
1984          , onAdmission);
1985      }
1986
1987  public String fhirType() {
1988    return "ExplanationOfBenefit.diagnosis";
1989
1990  }
1991
1992  }
1993
1994    @Block()
1995    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
1996        /**
1997         * A number to uniquely identify procedure entries.
1998         */
1999        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2000        @Description(shortDefinition="Procedure instance identifier", formalDefinition="A number to uniquely identify procedure entries." )
2001        protected PositiveIntType sequence;
2002
2003        /**
2004         * When the condition was observed or the relative ranking.
2005         */
2006        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2007        @Description(shortDefinition="Category of Procedure", formalDefinition="When the condition was observed or the relative ranking." )
2008        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-procedure-type")
2009        protected List<CodeableConcept> type;
2010
2011        /**
2012         * Date and optionally time the procedure was performed.
2013         */
2014        @Child(name = "date", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2015        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed." )
2016        protected DateTimeType date;
2017
2018        /**
2019         * The code or reference to a Procedure resource which identifies the clinical intervention performed.
2020         */
2021        @Child(name = "procedure", type = {CodeableConcept.class, Procedure.class}, order=4, min=1, max=1, modifier=false, summary=false)
2022        @Description(shortDefinition="Specific clinical procedure", formalDefinition="The code or reference to a Procedure resource which identifies the clinical intervention performed." )
2023        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10-procedures")
2024        protected DataType procedure;
2025
2026        /**
2027         * Unique Device Identifiers associated with this line item.
2028         */
2029        @Child(name = "udi", type = {Device.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2030        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
2031        protected List<Reference> udi;
2032
2033        private static final long serialVersionUID = 1165684715L;
2034
2035    /**
2036     * Constructor
2037     */
2038      public ProcedureComponent() {
2039        super();
2040      }
2041
2042    /**
2043     * Constructor
2044     */
2045      public ProcedureComponent(int sequence, DataType procedure) {
2046        super();
2047        this.setSequence(sequence);
2048        this.setProcedure(procedure);
2049      }
2050
2051        /**
2052         * @return {@link #sequence} (A number to uniquely identify procedure entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
2053         */
2054        public PositiveIntType getSequenceElement() { 
2055          if (this.sequence == null)
2056            if (Configuration.errorOnAutoCreate())
2057              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2058            else if (Configuration.doAutoCreate())
2059              this.sequence = new PositiveIntType(); // bb
2060          return this.sequence;
2061        }
2062
2063        public boolean hasSequenceElement() { 
2064          return this.sequence != null && !this.sequence.isEmpty();
2065        }
2066
2067        public boolean hasSequence() { 
2068          return this.sequence != null && !this.sequence.isEmpty();
2069        }
2070
2071        /**
2072         * @param value {@link #sequence} (A number to uniquely identify procedure entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
2073         */
2074        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
2075          this.sequence = value;
2076          return this;
2077        }
2078
2079        /**
2080         * @return A number to uniquely identify procedure entries.
2081         */
2082        public int getSequence() { 
2083          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2084        }
2085
2086        /**
2087         * @param value A number to uniquely identify procedure entries.
2088         */
2089        public ProcedureComponent setSequence(int value) { 
2090            if (this.sequence == null)
2091              this.sequence = new PositiveIntType();
2092            this.sequence.setValue(value);
2093          return this;
2094        }
2095
2096        /**
2097         * @return {@link #type} (When the condition was observed or the relative ranking.)
2098         */
2099        public List<CodeableConcept> getType() { 
2100          if (this.type == null)
2101            this.type = new ArrayList<CodeableConcept>();
2102          return this.type;
2103        }
2104
2105        /**
2106         * @return Returns a reference to <code>this</code> for easy method chaining
2107         */
2108        public ProcedureComponent setType(List<CodeableConcept> theType) { 
2109          this.type = theType;
2110          return this;
2111        }
2112
2113        public boolean hasType() { 
2114          if (this.type == null)
2115            return false;
2116          for (CodeableConcept item : this.type)
2117            if (!item.isEmpty())
2118              return true;
2119          return false;
2120        }
2121
2122        public CodeableConcept addType() { //3
2123          CodeableConcept t = new CodeableConcept();
2124          if (this.type == null)
2125            this.type = new ArrayList<CodeableConcept>();
2126          this.type.add(t);
2127          return t;
2128        }
2129
2130        public ProcedureComponent addType(CodeableConcept t) { //3
2131          if (t == null)
2132            return this;
2133          if (this.type == null)
2134            this.type = new ArrayList<CodeableConcept>();
2135          this.type.add(t);
2136          return this;
2137        }
2138
2139        /**
2140         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
2141         */
2142        public CodeableConcept getTypeFirstRep() { 
2143          if (getType().isEmpty()) {
2144            addType();
2145          }
2146          return getType().get(0);
2147        }
2148
2149        /**
2150         * @return {@link #date} (Date and optionally time the procedure was performed.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2151         */
2152        public DateTimeType getDateElement() { 
2153          if (this.date == null)
2154            if (Configuration.errorOnAutoCreate())
2155              throw new Error("Attempt to auto-create ProcedureComponent.date");
2156            else if (Configuration.doAutoCreate())
2157              this.date = new DateTimeType(); // bb
2158          return this.date;
2159        }
2160
2161        public boolean hasDateElement() { 
2162          return this.date != null && !this.date.isEmpty();
2163        }
2164
2165        public boolean hasDate() { 
2166          return this.date != null && !this.date.isEmpty();
2167        }
2168
2169        /**
2170         * @param value {@link #date} (Date and optionally time the procedure was performed.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2171         */
2172        public ProcedureComponent setDateElement(DateTimeType value) { 
2173          this.date = value;
2174          return this;
2175        }
2176
2177        /**
2178         * @return Date and optionally time the procedure was performed.
2179         */
2180        public Date getDate() { 
2181          return this.date == null ? null : this.date.getValue();
2182        }
2183
2184        /**
2185         * @param value Date and optionally time the procedure was performed.
2186         */
2187        public ProcedureComponent setDate(Date value) { 
2188          if (value == null)
2189            this.date = null;
2190          else {
2191            if (this.date == null)
2192              this.date = new DateTimeType();
2193            this.date.setValue(value);
2194          }
2195          return this;
2196        }
2197
2198        /**
2199         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2200         */
2201        public DataType getProcedure() { 
2202          return this.procedure;
2203        }
2204
2205        /**
2206         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2207         */
2208        public CodeableConcept getProcedureCodeableConcept() throws FHIRException { 
2209          if (this.procedure == null)
2210            this.procedure = new CodeableConcept();
2211          if (!(this.procedure instanceof CodeableConcept))
2212            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.procedure.getClass().getName()+" was encountered");
2213          return (CodeableConcept) this.procedure;
2214        }
2215
2216        public boolean hasProcedureCodeableConcept() { 
2217          return this != null && this.procedure instanceof CodeableConcept;
2218        }
2219
2220        /**
2221         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2222         */
2223        public Reference getProcedureReference() throws FHIRException { 
2224          if (this.procedure == null)
2225            this.procedure = new Reference();
2226          if (!(this.procedure instanceof Reference))
2227            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
2228          return (Reference) this.procedure;
2229        }
2230
2231        public boolean hasProcedureReference() { 
2232          return this != null && this.procedure instanceof Reference;
2233        }
2234
2235        public boolean hasProcedure() { 
2236          return this.procedure != null && !this.procedure.isEmpty();
2237        }
2238
2239        /**
2240         * @param value {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2241         */
2242        public ProcedureComponent setProcedure(DataType value) { 
2243          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2244            throw new Error("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: "+value.fhirType());
2245          this.procedure = value;
2246          return this;
2247        }
2248
2249        /**
2250         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
2251         */
2252        public List<Reference> getUdi() { 
2253          if (this.udi == null)
2254            this.udi = new ArrayList<Reference>();
2255          return this.udi;
2256        }
2257
2258        /**
2259         * @return Returns a reference to <code>this</code> for easy method chaining
2260         */
2261        public ProcedureComponent setUdi(List<Reference> theUdi) { 
2262          this.udi = theUdi;
2263          return this;
2264        }
2265
2266        public boolean hasUdi() { 
2267          if (this.udi == null)
2268            return false;
2269          for (Reference item : this.udi)
2270            if (!item.isEmpty())
2271              return true;
2272          return false;
2273        }
2274
2275        public Reference addUdi() { //3
2276          Reference t = new Reference();
2277          if (this.udi == null)
2278            this.udi = new ArrayList<Reference>();
2279          this.udi.add(t);
2280          return t;
2281        }
2282
2283        public ProcedureComponent addUdi(Reference t) { //3
2284          if (t == null)
2285            return this;
2286          if (this.udi == null)
2287            this.udi = new ArrayList<Reference>();
2288          this.udi.add(t);
2289          return this;
2290        }
2291
2292        /**
2293         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
2294         */
2295        public Reference getUdiFirstRep() { 
2296          if (getUdi().isEmpty()) {
2297            addUdi();
2298          }
2299          return getUdi().get(0);
2300        }
2301
2302        protected void listChildren(List<Property> children) {
2303          super.listChildren(children);
2304          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence));
2305          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
2306          children.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date));
2307          children.add(new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure));
2308          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
2309        }
2310
2311        @Override
2312        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2313          switch (_hash) {
2314          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence);
2315          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2316          case 3076014: /*date*/  return new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date);
2317          case 1640074445: /*procedure[x]*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure);
2318          case -1095204141: /*procedure*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure);
2319          case -1284783026: /*procedureCodeableConcept*/  return new Property("procedure[x]", "CodeableConcept", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure);
2320          case 881809848: /*procedureReference*/  return new Property("procedure[x]", "Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure);
2321          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
2322          default: return super.getNamedProperty(_hash, _name, _checkValid);
2323          }
2324
2325        }
2326
2327      @Override
2328      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2329        switch (hash) {
2330        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2331        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2332        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2333        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // DataType
2334        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
2335        default: return super.getProperty(hash, name, checkValid);
2336        }
2337
2338      }
2339
2340      @Override
2341      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2342        switch (hash) {
2343        case 1349547969: // sequence
2344          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
2345          return value;
2346        case 3575610: // type
2347          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2348          return value;
2349        case 3076014: // date
2350          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
2351          return value;
2352        case -1095204141: // procedure
2353          this.procedure = TypeConvertor.castToType(value); // DataType
2354          return value;
2355        case 115642: // udi
2356          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
2357          return value;
2358        default: return super.setProperty(hash, name, value);
2359        }
2360
2361      }
2362
2363      @Override
2364      public Base setProperty(String name, Base value) throws FHIRException {
2365        if (name.equals("sequence")) {
2366          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
2367        } else if (name.equals("type")) {
2368          this.getType().add(TypeConvertor.castToCodeableConcept(value));
2369        } else if (name.equals("date")) {
2370          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
2371        } else if (name.equals("procedure[x]")) {
2372          this.procedure = TypeConvertor.castToType(value); // DataType
2373        } else if (name.equals("udi")) {
2374          this.getUdi().add(TypeConvertor.castToReference(value));
2375        } else
2376          return super.setProperty(name, value);
2377        return value;
2378      }
2379
2380      @Override
2381      public Base makeProperty(int hash, String name) throws FHIRException {
2382        switch (hash) {
2383        case 1349547969:  return getSequenceElement();
2384        case 3575610:  return addType(); 
2385        case 3076014:  return getDateElement();
2386        case 1640074445:  return getProcedure();
2387        case -1095204141:  return getProcedure();
2388        case 115642:  return addUdi(); 
2389        default: return super.makeProperty(hash, name);
2390        }
2391
2392      }
2393
2394      @Override
2395      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2396        switch (hash) {
2397        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2398        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2399        case 3076014: /*date*/ return new String[] {"dateTime"};
2400        case -1095204141: /*procedure*/ return new String[] {"CodeableConcept", "Reference"};
2401        case 115642: /*udi*/ return new String[] {"Reference"};
2402        default: return super.getTypesForProperty(hash, name);
2403        }
2404
2405      }
2406
2407      @Override
2408      public Base addChild(String name) throws FHIRException {
2409        if (name.equals("sequence")) {
2410          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedure.sequence");
2411        }
2412        else if (name.equals("type")) {
2413          return addType();
2414        }
2415        else if (name.equals("date")) {
2416          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedure.date");
2417        }
2418        else if (name.equals("procedureCodeableConcept")) {
2419          this.procedure = new CodeableConcept();
2420          return this.procedure;
2421        }
2422        else if (name.equals("procedureReference")) {
2423          this.procedure = new Reference();
2424          return this.procedure;
2425        }
2426        else if (name.equals("udi")) {
2427          return addUdi();
2428        }
2429        else
2430          return super.addChild(name);
2431      }
2432
2433      public ProcedureComponent copy() {
2434        ProcedureComponent dst = new ProcedureComponent();
2435        copyValues(dst);
2436        return dst;
2437      }
2438
2439      public void copyValues(ProcedureComponent dst) {
2440        super.copyValues(dst);
2441        dst.sequence = sequence == null ? null : sequence.copy();
2442        if (type != null) {
2443          dst.type = new ArrayList<CodeableConcept>();
2444          for (CodeableConcept i : type)
2445            dst.type.add(i.copy());
2446        };
2447        dst.date = date == null ? null : date.copy();
2448        dst.procedure = procedure == null ? null : procedure.copy();
2449        if (udi != null) {
2450          dst.udi = new ArrayList<Reference>();
2451          for (Reference i : udi)
2452            dst.udi.add(i.copy());
2453        };
2454      }
2455
2456      @Override
2457      public boolean equalsDeep(Base other_) {
2458        if (!super.equalsDeep(other_))
2459          return false;
2460        if (!(other_ instanceof ProcedureComponent))
2461          return false;
2462        ProcedureComponent o = (ProcedureComponent) other_;
2463        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(date, o.date, true)
2464           && compareDeep(procedure, o.procedure, true) && compareDeep(udi, o.udi, true);
2465      }
2466
2467      @Override
2468      public boolean equalsShallow(Base other_) {
2469        if (!super.equalsShallow(other_))
2470          return false;
2471        if (!(other_ instanceof ProcedureComponent))
2472          return false;
2473        ProcedureComponent o = (ProcedureComponent) other_;
2474        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
2475      }
2476
2477      public boolean isEmpty() {
2478        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, date, procedure
2479          , udi);
2480      }
2481
2482  public String fhirType() {
2483    return "ExplanationOfBenefit.procedure";
2484
2485  }
2486
2487  }
2488
2489    @Block()
2490    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
2491        /**
2492         * A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2493         */
2494        @Child(name = "focal", type = {BooleanType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2495        @Description(shortDefinition="Coverage to be used for adjudication", formalDefinition="A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true." )
2496        protected BooleanType focal;
2497
2498        /**
2499         * Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.
2500         */
2501        @Child(name = "coverage", type = {Coverage.class}, order=2, min=1, max=1, modifier=false, summary=true)
2502        @Description(shortDefinition="Insurance information", formalDefinition="Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system." )
2503        protected Reference coverage;
2504
2505        /**
2506         * Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.
2507         */
2508        @Child(name = "preAuthRef", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2509        @Description(shortDefinition="Prior authorization reference number", formalDefinition="Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization." )
2510        protected List<StringType> preAuthRef;
2511
2512        private static final long serialVersionUID = 1519900285L;
2513
2514    /**
2515     * Constructor
2516     */
2517      public InsuranceComponent() {
2518        super();
2519      }
2520
2521    /**
2522     * Constructor
2523     */
2524      public InsuranceComponent(boolean focal, Reference coverage) {
2525        super();
2526        this.setFocal(focal);
2527        this.setCoverage(coverage);
2528      }
2529
2530        /**
2531         * @return {@link #focal} (A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.). This is the underlying object with id, value and extensions. The accessor "getFocal" gives direct access to the value
2532         */
2533        public BooleanType getFocalElement() { 
2534          if (this.focal == null)
2535            if (Configuration.errorOnAutoCreate())
2536              throw new Error("Attempt to auto-create InsuranceComponent.focal");
2537            else if (Configuration.doAutoCreate())
2538              this.focal = new BooleanType(); // bb
2539          return this.focal;
2540        }
2541
2542        public boolean hasFocalElement() { 
2543          return this.focal != null && !this.focal.isEmpty();
2544        }
2545
2546        public boolean hasFocal() { 
2547          return this.focal != null && !this.focal.isEmpty();
2548        }
2549
2550        /**
2551         * @param value {@link #focal} (A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.). This is the underlying object with id, value and extensions. The accessor "getFocal" gives direct access to the value
2552         */
2553        public InsuranceComponent setFocalElement(BooleanType value) { 
2554          this.focal = value;
2555          return this;
2556        }
2557
2558        /**
2559         * @return A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2560         */
2561        public boolean getFocal() { 
2562          return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
2563        }
2564
2565        /**
2566         * @param value A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2567         */
2568        public InsuranceComponent setFocal(boolean value) { 
2569            if (this.focal == null)
2570              this.focal = new BooleanType();
2571            this.focal.setValue(value);
2572          return this;
2573        }
2574
2575        /**
2576         * @return {@link #coverage} (Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.)
2577         */
2578        public Reference getCoverage() { 
2579          if (this.coverage == null)
2580            if (Configuration.errorOnAutoCreate())
2581              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2582            else if (Configuration.doAutoCreate())
2583              this.coverage = new Reference(); // cc
2584          return this.coverage;
2585        }
2586
2587        public boolean hasCoverage() { 
2588          return this.coverage != null && !this.coverage.isEmpty();
2589        }
2590
2591        /**
2592         * @param value {@link #coverage} (Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.)
2593         */
2594        public InsuranceComponent setCoverage(Reference value) { 
2595          this.coverage = value;
2596          return this;
2597        }
2598
2599        /**
2600         * @return {@link #preAuthRef} (Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.)
2601         */
2602        public List<StringType> getPreAuthRef() { 
2603          if (this.preAuthRef == null)
2604            this.preAuthRef = new ArrayList<StringType>();
2605          return this.preAuthRef;
2606        }
2607
2608        /**
2609         * @return Returns a reference to <code>this</code> for easy method chaining
2610         */
2611        public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) { 
2612          this.preAuthRef = thePreAuthRef;
2613          return this;
2614        }
2615
2616        public boolean hasPreAuthRef() { 
2617          if (this.preAuthRef == null)
2618            return false;
2619          for (StringType item : this.preAuthRef)
2620            if (!item.isEmpty())
2621              return true;
2622          return false;
2623        }
2624
2625        /**
2626         * @return {@link #preAuthRef} (Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.)
2627         */
2628        public StringType addPreAuthRefElement() {//2 
2629          StringType t = new StringType();
2630          if (this.preAuthRef == null)
2631            this.preAuthRef = new ArrayList<StringType>();
2632          this.preAuthRef.add(t);
2633          return t;
2634        }
2635
2636        /**
2637         * @param value {@link #preAuthRef} (Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.)
2638         */
2639        public InsuranceComponent addPreAuthRef(String value) { //1
2640          StringType t = new StringType();
2641          t.setValue(value);
2642          if (this.preAuthRef == null)
2643            this.preAuthRef = new ArrayList<StringType>();
2644          this.preAuthRef.add(t);
2645          return this;
2646        }
2647
2648        /**
2649         * @param value {@link #preAuthRef} (Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.)
2650         */
2651        public boolean hasPreAuthRef(String value) { 
2652          if (this.preAuthRef == null)
2653            return false;
2654          for (StringType v : this.preAuthRef)
2655            if (v.getValue().equals(value)) // string
2656              return true;
2657          return false;
2658        }
2659
2660        protected void listChildren(List<Property> children) {
2661          super.listChildren(children);
2662          children.add(new Property("focal", "boolean", "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0, 1, focal));
2663          children.add(new Property("coverage", "Reference(Coverage)", "Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.", 0, 1, coverage));
2664          children.add(new Property("preAuthRef", "string", "Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.", 0, java.lang.Integer.MAX_VALUE, preAuthRef));
2665        }
2666
2667        @Override
2668        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2669          switch (_hash) {
2670          case 97604197: /*focal*/  return new Property("focal", "boolean", "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0, 1, focal);
2671          case -351767064: /*coverage*/  return new Property("coverage", "Reference(Coverage)", "Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.", 0, 1, coverage);
2672          case 522246568: /*preAuthRef*/  return new Property("preAuthRef", "string", "Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.", 0, java.lang.Integer.MAX_VALUE, preAuthRef);
2673          default: return super.getNamedProperty(_hash, _name, _checkValid);
2674          }
2675
2676        }
2677
2678      @Override
2679      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2680        switch (hash) {
2681        case 97604197: /*focal*/ return this.focal == null ? new Base[0] : new Base[] {this.focal}; // BooleanType
2682        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
2683        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
2684        default: return super.getProperty(hash, name, checkValid);
2685        }
2686
2687      }
2688
2689      @Override
2690      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2691        switch (hash) {
2692        case 97604197: // focal
2693          this.focal = TypeConvertor.castToBoolean(value); // BooleanType
2694          return value;
2695        case -351767064: // coverage
2696          this.coverage = TypeConvertor.castToReference(value); // Reference
2697          return value;
2698        case 522246568: // preAuthRef
2699          this.getPreAuthRef().add(TypeConvertor.castToString(value)); // StringType
2700          return value;
2701        default: return super.setProperty(hash, name, value);
2702        }
2703
2704      }
2705
2706      @Override
2707      public Base setProperty(String name, Base value) throws FHIRException {
2708        if (name.equals("focal")) {
2709          this.focal = TypeConvertor.castToBoolean(value); // BooleanType
2710        } else if (name.equals("coverage")) {
2711          this.coverage = TypeConvertor.castToReference(value); // Reference
2712        } else if (name.equals("preAuthRef")) {
2713          this.getPreAuthRef().add(TypeConvertor.castToString(value));
2714        } else
2715          return super.setProperty(name, value);
2716        return value;
2717      }
2718
2719      @Override
2720      public Base makeProperty(int hash, String name) throws FHIRException {
2721        switch (hash) {
2722        case 97604197:  return getFocalElement();
2723        case -351767064:  return getCoverage();
2724        case 522246568:  return addPreAuthRefElement();
2725        default: return super.makeProperty(hash, name);
2726        }
2727
2728      }
2729
2730      @Override
2731      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2732        switch (hash) {
2733        case 97604197: /*focal*/ return new String[] {"boolean"};
2734        case -351767064: /*coverage*/ return new String[] {"Reference"};
2735        case 522246568: /*preAuthRef*/ return new String[] {"string"};
2736        default: return super.getTypesForProperty(hash, name);
2737        }
2738
2739      }
2740
2741      @Override
2742      public Base addChild(String name) throws FHIRException {
2743        if (name.equals("focal")) {
2744          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.insurance.focal");
2745        }
2746        else if (name.equals("coverage")) {
2747          this.coverage = new Reference();
2748          return this.coverage;
2749        }
2750        else if (name.equals("preAuthRef")) {
2751          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.insurance.preAuthRef");
2752        }
2753        else
2754          return super.addChild(name);
2755      }
2756
2757      public InsuranceComponent copy() {
2758        InsuranceComponent dst = new InsuranceComponent();
2759        copyValues(dst);
2760        return dst;
2761      }
2762
2763      public void copyValues(InsuranceComponent dst) {
2764        super.copyValues(dst);
2765        dst.focal = focal == null ? null : focal.copy();
2766        dst.coverage = coverage == null ? null : coverage.copy();
2767        if (preAuthRef != null) {
2768          dst.preAuthRef = new ArrayList<StringType>();
2769          for (StringType i : preAuthRef)
2770            dst.preAuthRef.add(i.copy());
2771        };
2772      }
2773
2774      @Override
2775      public boolean equalsDeep(Base other_) {
2776        if (!super.equalsDeep(other_))
2777          return false;
2778        if (!(other_ instanceof InsuranceComponent))
2779          return false;
2780        InsuranceComponent o = (InsuranceComponent) other_;
2781        return compareDeep(focal, o.focal, true) && compareDeep(coverage, o.coverage, true) && compareDeep(preAuthRef, o.preAuthRef, true)
2782          ;
2783      }
2784
2785      @Override
2786      public boolean equalsShallow(Base other_) {
2787        if (!super.equalsShallow(other_))
2788          return false;
2789        if (!(other_ instanceof InsuranceComponent))
2790          return false;
2791        InsuranceComponent o = (InsuranceComponent) other_;
2792        return compareValues(focal, o.focal, true) && compareValues(preAuthRef, o.preAuthRef, true);
2793      }
2794
2795      public boolean isEmpty() {
2796        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(focal, coverage, preAuthRef
2797          );
2798      }
2799
2800  public String fhirType() {
2801    return "ExplanationOfBenefit.insurance";
2802
2803  }
2804
2805  }
2806
2807    @Block()
2808    public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
2809        /**
2810         * Date of an accident event  related to the products and services contained in the claim.
2811         */
2812        @Child(name = "date", type = {DateType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2813        @Description(shortDefinition="When the incident occurred", formalDefinition="Date of an accident event  related to the products and services contained in the claim." )
2814        protected DateType date;
2815
2816        /**
2817         * The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.
2818         */
2819        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
2820        @Description(shortDefinition="The nature of the accident", formalDefinition="The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers." )
2821        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActIncidentCode")
2822        protected CodeableConcept type;
2823
2824        /**
2825         * The physical location of the accident event.
2826         */
2827        @Child(name = "location", type = {Address.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=false)
2828        @Description(shortDefinition="Where the event occurred", formalDefinition="The physical location of the accident event." )
2829        protected DataType location;
2830
2831        private static final long serialVersionUID = 11882722L;
2832
2833    /**
2834     * Constructor
2835     */
2836      public AccidentComponent() {
2837        super();
2838      }
2839
2840        /**
2841         * @return {@link #date} (Date of an accident event  related to the products and services contained in the claim.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2842         */
2843        public DateType getDateElement() { 
2844          if (this.date == null)
2845            if (Configuration.errorOnAutoCreate())
2846              throw new Error("Attempt to auto-create AccidentComponent.date");
2847            else if (Configuration.doAutoCreate())
2848              this.date = new DateType(); // bb
2849          return this.date;
2850        }
2851
2852        public boolean hasDateElement() { 
2853          return this.date != null && !this.date.isEmpty();
2854        }
2855
2856        public boolean hasDate() { 
2857          return this.date != null && !this.date.isEmpty();
2858        }
2859
2860        /**
2861         * @param value {@link #date} (Date of an accident event  related to the products and services contained in the claim.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2862         */
2863        public AccidentComponent setDateElement(DateType value) { 
2864          this.date = value;
2865          return this;
2866        }
2867
2868        /**
2869         * @return Date of an accident event  related to the products and services contained in the claim.
2870         */
2871        public Date getDate() { 
2872          return this.date == null ? null : this.date.getValue();
2873        }
2874
2875        /**
2876         * @param value Date of an accident event  related to the products and services contained in the claim.
2877         */
2878        public AccidentComponent setDate(Date value) { 
2879          if (value == null)
2880            this.date = null;
2881          else {
2882            if (this.date == null)
2883              this.date = new DateType();
2884            this.date.setValue(value);
2885          }
2886          return this;
2887        }
2888
2889        /**
2890         * @return {@link #type} (The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.)
2891         */
2892        public CodeableConcept getType() { 
2893          if (this.type == null)
2894            if (Configuration.errorOnAutoCreate())
2895              throw new Error("Attempt to auto-create AccidentComponent.type");
2896            else if (Configuration.doAutoCreate())
2897              this.type = new CodeableConcept(); // cc
2898          return this.type;
2899        }
2900
2901        public boolean hasType() { 
2902          return this.type != null && !this.type.isEmpty();
2903        }
2904
2905        /**
2906         * @param value {@link #type} (The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.)
2907         */
2908        public AccidentComponent setType(CodeableConcept value) { 
2909          this.type = value;
2910          return this;
2911        }
2912
2913        /**
2914         * @return {@link #location} (The physical location of the accident event.)
2915         */
2916        public DataType getLocation() { 
2917          return this.location;
2918        }
2919
2920        /**
2921         * @return {@link #location} (The physical location of the accident event.)
2922         */
2923        public Address getLocationAddress() throws FHIRException { 
2924          if (this.location == null)
2925            this.location = new Address();
2926          if (!(this.location instanceof Address))
2927            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
2928          return (Address) this.location;
2929        }
2930
2931        public boolean hasLocationAddress() { 
2932          return this != null && this.location instanceof Address;
2933        }
2934
2935        /**
2936         * @return {@link #location} (The physical location of the accident event.)
2937         */
2938        public Reference getLocationReference() throws FHIRException { 
2939          if (this.location == null)
2940            this.location = new Reference();
2941          if (!(this.location instanceof Reference))
2942            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
2943          return (Reference) this.location;
2944        }
2945
2946        public boolean hasLocationReference() { 
2947          return this != null && this.location instanceof Reference;
2948        }
2949
2950        public boolean hasLocation() { 
2951          return this.location != null && !this.location.isEmpty();
2952        }
2953
2954        /**
2955         * @param value {@link #location} (The physical location of the accident event.)
2956         */
2957        public AccidentComponent setLocation(DataType value) { 
2958          if (value != null && !(value instanceof Address || value instanceof Reference))
2959            throw new Error("Not the right type for ExplanationOfBenefit.accident.location[x]: "+value.fhirType());
2960          this.location = value;
2961          return this;
2962        }
2963
2964        protected void listChildren(List<Property> children) {
2965          super.listChildren(children);
2966          children.add(new Property("date", "date", "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date));
2967          children.add(new Property("type", "CodeableConcept", "The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.", 0, 1, type));
2968          children.add(new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location));
2969        }
2970
2971        @Override
2972        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2973          switch (_hash) {
2974          case 3076014: /*date*/  return new Property("date", "date", "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date);
2975          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.", 0, 1, type);
2976          case 552316075: /*location[x]*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
2977          case 1901043637: /*location*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
2978          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address", "The physical location of the accident event.", 0, 1, location);
2979          case 755866390: /*locationReference*/  return new Property("location[x]", "Reference(Location)", "The physical location of the accident event.", 0, 1, location);
2980          default: return super.getNamedProperty(_hash, _name, _checkValid);
2981          }
2982
2983        }
2984
2985      @Override
2986      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2987        switch (hash) {
2988        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
2989        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2990        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // DataType
2991        default: return super.getProperty(hash, name, checkValid);
2992        }
2993
2994      }
2995
2996      @Override
2997      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2998        switch (hash) {
2999        case 3076014: // date
3000          this.date = TypeConvertor.castToDate(value); // DateType
3001          return value;
3002        case 3575610: // type
3003          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3004          return value;
3005        case 1901043637: // location
3006          this.location = TypeConvertor.castToType(value); // DataType
3007          return value;
3008        default: return super.setProperty(hash, name, value);
3009        }
3010
3011      }
3012
3013      @Override
3014      public Base setProperty(String name, Base value) throws FHIRException {
3015        if (name.equals("date")) {
3016          this.date = TypeConvertor.castToDate(value); // DateType
3017        } else if (name.equals("type")) {
3018          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3019        } else if (name.equals("location[x]")) {
3020          this.location = TypeConvertor.castToType(value); // DataType
3021        } else
3022          return super.setProperty(name, value);
3023        return value;
3024      }
3025
3026      @Override
3027      public Base makeProperty(int hash, String name) throws FHIRException {
3028        switch (hash) {
3029        case 3076014:  return getDateElement();
3030        case 3575610:  return getType();
3031        case 552316075:  return getLocation();
3032        case 1901043637:  return getLocation();
3033        default: return super.makeProperty(hash, name);
3034        }
3035
3036      }
3037
3038      @Override
3039      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3040        switch (hash) {
3041        case 3076014: /*date*/ return new String[] {"date"};
3042        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3043        case 1901043637: /*location*/ return new String[] {"Address", "Reference"};
3044        default: return super.getTypesForProperty(hash, name);
3045        }
3046
3047      }
3048
3049      @Override
3050      public Base addChild(String name) throws FHIRException {
3051        if (name.equals("date")) {
3052          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.accident.date");
3053        }
3054        else if (name.equals("type")) {
3055          this.type = new CodeableConcept();
3056          return this.type;
3057        }
3058        else if (name.equals("locationAddress")) {
3059          this.location = new Address();
3060          return this.location;
3061        }
3062        else if (name.equals("locationReference")) {
3063          this.location = new Reference();
3064          return this.location;
3065        }
3066        else
3067          return super.addChild(name);
3068      }
3069
3070      public AccidentComponent copy() {
3071        AccidentComponent dst = new AccidentComponent();
3072        copyValues(dst);
3073        return dst;
3074      }
3075
3076      public void copyValues(AccidentComponent dst) {
3077        super.copyValues(dst);
3078        dst.date = date == null ? null : date.copy();
3079        dst.type = type == null ? null : type.copy();
3080        dst.location = location == null ? null : location.copy();
3081      }
3082
3083      @Override
3084      public boolean equalsDeep(Base other_) {
3085        if (!super.equalsDeep(other_))
3086          return false;
3087        if (!(other_ instanceof AccidentComponent))
3088          return false;
3089        AccidentComponent o = (AccidentComponent) other_;
3090        return compareDeep(date, o.date, true) && compareDeep(type, o.type, true) && compareDeep(location, o.location, true)
3091          ;
3092      }
3093
3094      @Override
3095      public boolean equalsShallow(Base other_) {
3096        if (!super.equalsShallow(other_))
3097          return false;
3098        if (!(other_ instanceof AccidentComponent))
3099          return false;
3100        AccidentComponent o = (AccidentComponent) other_;
3101        return compareValues(date, o.date, true);
3102      }
3103
3104      public boolean isEmpty() {
3105        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
3106      }
3107
3108  public String fhirType() {
3109    return "ExplanationOfBenefit.accident";
3110
3111  }
3112
3113  }
3114
3115    @Block()
3116    public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
3117        /**
3118         * A number to uniquely identify item entries.
3119         */
3120        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
3121        @Description(shortDefinition="Item instance identifier", formalDefinition="A number to uniquely identify item entries." )
3122        protected PositiveIntType sequence;
3123
3124        /**
3125         * Care team members related to this service or product.
3126         */
3127        @Child(name = "careTeamSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3128        @Description(shortDefinition="Applicable care team members", formalDefinition="Care team members related to this service or product." )
3129        protected List<PositiveIntType> careTeamSequence;
3130
3131        /**
3132         * Diagnoses applicable for this service or product.
3133         */
3134        @Child(name = "diagnosisSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3135        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnoses applicable for this service or product." )
3136        protected List<PositiveIntType> diagnosisSequence;
3137
3138        /**
3139         * Procedures applicable for this service or product.
3140         */
3141        @Child(name = "procedureSequence", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3142        @Description(shortDefinition="Applicable procedures", formalDefinition="Procedures applicable for this service or product." )
3143        protected List<PositiveIntType> procedureSequence;
3144
3145        /**
3146         * Exceptions, special conditions and supporting information applicable for this service or product.
3147         */
3148        @Child(name = "informationSequence", type = {PositiveIntType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3149        @Description(shortDefinition="Applicable exception and supporting information", formalDefinition="Exceptions, special conditions and supporting information applicable for this service or product." )
3150        protected List<PositiveIntType> informationSequence;
3151
3152        /**
3153         * The type of revenue or cost center providing the product and/or service.
3154         */
3155        @Child(name = "revenue", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
3156        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
3157        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
3158        protected CodeableConcept revenue;
3159
3160        /**
3161         * Code to identify the general type of benefits under which products and services are provided.
3162         */
3163        @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
3164        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
3165        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
3166        protected CodeableConcept category;
3167
3168        /**
3169         * When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.
3170         */
3171        @Child(name = "productOrService", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
3172        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used." )
3173        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
3174        protected CodeableConcept productOrService;
3175
3176        /**
3177         * This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.
3178         */
3179        @Child(name = "productOrServiceEnd", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=false)
3180        @Description(shortDefinition="End of a range of codes", formalDefinition="This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims." )
3181        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
3182        protected CodeableConcept productOrServiceEnd;
3183
3184        /**
3185         * Item typification or modifiers codes to convey additional context for the product or service.
3186         */
3187        @Child(name = "modifier", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3188        @Description(shortDefinition="Product or service billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
3189        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
3190        protected List<CodeableConcept> modifier;
3191
3192        /**
3193         * Identifies the program under which this may be recovered.
3194         */
3195        @Child(name = "programCode", type = {CodeableConcept.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3196        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
3197        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
3198        protected List<CodeableConcept> programCode;
3199
3200        /**
3201         * The date or dates when the service or product was supplied, performed or completed.
3202         */
3203        @Child(name = "serviced", type = {DateType.class, Period.class}, order=12, min=0, max=1, modifier=false, summary=false)
3204        @Description(shortDefinition="Date or dates of service or product delivery", formalDefinition="The date or dates when the service or product was supplied, performed or completed." )
3205        protected DataType serviced;
3206
3207        /**
3208         * Where the product or service was provided.
3209         */
3210        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=13, min=0, max=1, modifier=false, summary=false)
3211        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
3212        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
3213        protected DataType location;
3214
3215        /**
3216         * The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.
3217         */
3218        @Child(name = "patientPaid", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
3219        @Description(shortDefinition="Paid by the patient", formalDefinition="The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services." )
3220        protected Money patientPaid;
3221
3222        /**
3223         * The number of repetitions of a service or product.
3224         */
3225        @Child(name = "quantity", type = {Quantity.class}, order=15, min=0, max=1, modifier=false, summary=false)
3226        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
3227        protected Quantity quantity;
3228
3229        /**
3230         * If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.
3231         */
3232        @Child(name = "unitPrice", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
3233        @Description(shortDefinition="Fee, charge or cost per item", formalDefinition="If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group." )
3234        protected Money unitPrice;
3235
3236        /**
3237         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3238         */
3239        @Child(name = "factor", type = {DecimalType.class}, order=17, min=0, max=1, modifier=false, summary=false)
3240        @Description(shortDefinition="Price scaling factor", formalDefinition="A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount." )
3241        protected DecimalType factor;
3242
3243        /**
3244         * The total of taxes applicable for this product or service.
3245         */
3246        @Child(name = "tax", type = {Money.class}, order=18, min=0, max=1, modifier=false, summary=false)
3247        @Description(shortDefinition="Total tax", formalDefinition="The total of taxes applicable for this product or service." )
3248        protected Money tax;
3249
3250        /**
3251         * The quantity times the unit price for an additional service or product or charge.
3252         */
3253        @Child(name = "net", type = {Money.class}, order=19, min=0, max=1, modifier=false, summary=false)
3254        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
3255        protected Money net;
3256
3257        /**
3258         * Unique Device Identifiers associated with this line item.
3259         */
3260        @Child(name = "udi", type = {Device.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3261        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
3262        protected List<Reference> udi;
3263
3264        /**
3265         * Physical location where the service is performed or applies.
3266         */
3267        @Child(name = "bodySite", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3268        @Description(shortDefinition="Anatomical location", formalDefinition="Physical location where the service is performed or applies." )
3269        protected List<ItemBodySiteComponent> bodySite;
3270
3271        /**
3272         * A billed item may include goods or services provided in multiple encounters.
3273         */
3274        @Child(name = "encounter", type = {Encounter.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3275        @Description(shortDefinition="Encounters related to this billed item", formalDefinition="A billed item may include goods or services provided in multiple encounters." )
3276        protected List<Reference> encounter;
3277
3278        /**
3279         * The numbers associated with notes below which apply to the adjudication of this item.
3280         */
3281        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3282        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
3283        protected List<PositiveIntType> noteNumber;
3284
3285        /**
3286         * The result of the claim, predetermination, or preauthorization adjudication.
3287         */
3288        @Child(name = "decision", type = {CodeableConcept.class}, order=24, min=0, max=1, modifier=false, summary=false)
3289        @Description(shortDefinition="Result of the adjudication", formalDefinition="The result of the claim, predetermination, or preauthorization adjudication." )
3290        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-decision")
3291        protected CodeableConcept decision;
3292
3293        /**
3294         * If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.
3295         */
3296        @Child(name = "adjudication", type = {}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3297        @Description(shortDefinition="Adjudication details", formalDefinition="If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item." )
3298        protected List<AdjudicationComponent> adjudication;
3299
3300        /**
3301         * Second-tier of goods and services.
3302         */
3303        @Child(name = "detail", type = {}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3304        @Description(shortDefinition="Additional items", formalDefinition="Second-tier of goods and services." )
3305        protected List<DetailComponent> detail;
3306
3307        private static final long serialVersionUID = 889927807L;
3308
3309    /**
3310     * Constructor
3311     */
3312      public ItemComponent() {
3313        super();
3314      }
3315
3316    /**
3317     * Constructor
3318     */
3319      public ItemComponent(int sequence) {
3320        super();
3321        this.setSequence(sequence);
3322      }
3323
3324        /**
3325         * @return {@link #sequence} (A number to uniquely identify item entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
3326         */
3327        public PositiveIntType getSequenceElement() { 
3328          if (this.sequence == null)
3329            if (Configuration.errorOnAutoCreate())
3330              throw new Error("Attempt to auto-create ItemComponent.sequence");
3331            else if (Configuration.doAutoCreate())
3332              this.sequence = new PositiveIntType(); // bb
3333          return this.sequence;
3334        }
3335
3336        public boolean hasSequenceElement() { 
3337          return this.sequence != null && !this.sequence.isEmpty();
3338        }
3339
3340        public boolean hasSequence() { 
3341          return this.sequence != null && !this.sequence.isEmpty();
3342        }
3343
3344        /**
3345         * @param value {@link #sequence} (A number to uniquely identify item entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
3346         */
3347        public ItemComponent setSequenceElement(PositiveIntType value) { 
3348          this.sequence = value;
3349          return this;
3350        }
3351
3352        /**
3353         * @return A number to uniquely identify item entries.
3354         */
3355        public int getSequence() { 
3356          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3357        }
3358
3359        /**
3360         * @param value A number to uniquely identify item entries.
3361         */
3362        public ItemComponent setSequence(int value) { 
3363            if (this.sequence == null)
3364              this.sequence = new PositiveIntType();
3365            this.sequence.setValue(value);
3366          return this;
3367        }
3368
3369        /**
3370         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3371         */
3372        public List<PositiveIntType> getCareTeamSequence() { 
3373          if (this.careTeamSequence == null)
3374            this.careTeamSequence = new ArrayList<PositiveIntType>();
3375          return this.careTeamSequence;
3376        }
3377
3378        /**
3379         * @return Returns a reference to <code>this</code> for easy method chaining
3380         */
3381        public ItemComponent setCareTeamSequence(List<PositiveIntType> theCareTeamSequence) { 
3382          this.careTeamSequence = theCareTeamSequence;
3383          return this;
3384        }
3385
3386        public boolean hasCareTeamSequence() { 
3387          if (this.careTeamSequence == null)
3388            return false;
3389          for (PositiveIntType item : this.careTeamSequence)
3390            if (!item.isEmpty())
3391              return true;
3392          return false;
3393        }
3394
3395        /**
3396         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3397         */
3398        public PositiveIntType addCareTeamSequenceElement() {//2 
3399          PositiveIntType t = new PositiveIntType();
3400          if (this.careTeamSequence == null)
3401            this.careTeamSequence = new ArrayList<PositiveIntType>();
3402          this.careTeamSequence.add(t);
3403          return t;
3404        }
3405
3406        /**
3407         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3408         */
3409        public ItemComponent addCareTeamSequence(int value) { //1
3410          PositiveIntType t = new PositiveIntType();
3411          t.setValue(value);
3412          if (this.careTeamSequence == null)
3413            this.careTeamSequence = new ArrayList<PositiveIntType>();
3414          this.careTeamSequence.add(t);
3415          return this;
3416        }
3417
3418        /**
3419         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3420         */
3421        public boolean hasCareTeamSequence(int value) { 
3422          if (this.careTeamSequence == null)
3423            return false;
3424          for (PositiveIntType v : this.careTeamSequence)
3425            if (v.getValue().equals(value)) // positiveInt
3426              return true;
3427          return false;
3428        }
3429
3430        /**
3431         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3432         */
3433        public List<PositiveIntType> getDiagnosisSequence() { 
3434          if (this.diagnosisSequence == null)
3435            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3436          return this.diagnosisSequence;
3437        }
3438
3439        /**
3440         * @return Returns a reference to <code>this</code> for easy method chaining
3441         */
3442        public ItemComponent setDiagnosisSequence(List<PositiveIntType> theDiagnosisSequence) { 
3443          this.diagnosisSequence = theDiagnosisSequence;
3444          return this;
3445        }
3446
3447        public boolean hasDiagnosisSequence() { 
3448          if (this.diagnosisSequence == null)
3449            return false;
3450          for (PositiveIntType item : this.diagnosisSequence)
3451            if (!item.isEmpty())
3452              return true;
3453          return false;
3454        }
3455
3456        /**
3457         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3458         */
3459        public PositiveIntType addDiagnosisSequenceElement() {//2 
3460          PositiveIntType t = new PositiveIntType();
3461          if (this.diagnosisSequence == null)
3462            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3463          this.diagnosisSequence.add(t);
3464          return t;
3465        }
3466
3467        /**
3468         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3469         */
3470        public ItemComponent addDiagnosisSequence(int value) { //1
3471          PositiveIntType t = new PositiveIntType();
3472          t.setValue(value);
3473          if (this.diagnosisSequence == null)
3474            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3475          this.diagnosisSequence.add(t);
3476          return this;
3477        }
3478
3479        /**
3480         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3481         */
3482        public boolean hasDiagnosisSequence(int value) { 
3483          if (this.diagnosisSequence == null)
3484            return false;
3485          for (PositiveIntType v : this.diagnosisSequence)
3486            if (v.getValue().equals(value)) // positiveInt
3487              return true;
3488          return false;
3489        }
3490
3491        /**
3492         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3493         */
3494        public List<PositiveIntType> getProcedureSequence() { 
3495          if (this.procedureSequence == null)
3496            this.procedureSequence = new ArrayList<PositiveIntType>();
3497          return this.procedureSequence;
3498        }
3499
3500        /**
3501         * @return Returns a reference to <code>this</code> for easy method chaining
3502         */
3503        public ItemComponent setProcedureSequence(List<PositiveIntType> theProcedureSequence) { 
3504          this.procedureSequence = theProcedureSequence;
3505          return this;
3506        }
3507
3508        public boolean hasProcedureSequence() { 
3509          if (this.procedureSequence == null)
3510            return false;
3511          for (PositiveIntType item : this.procedureSequence)
3512            if (!item.isEmpty())
3513              return true;
3514          return false;
3515        }
3516
3517        /**
3518         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3519         */
3520        public PositiveIntType addProcedureSequenceElement() {//2 
3521          PositiveIntType t = new PositiveIntType();
3522          if (this.procedureSequence == null)
3523            this.procedureSequence = new ArrayList<PositiveIntType>();
3524          this.procedureSequence.add(t);
3525          return t;
3526        }
3527
3528        /**
3529         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3530         */
3531        public ItemComponent addProcedureSequence(int value) { //1
3532          PositiveIntType t = new PositiveIntType();
3533          t.setValue(value);
3534          if (this.procedureSequence == null)
3535            this.procedureSequence = new ArrayList<PositiveIntType>();
3536          this.procedureSequence.add(t);
3537          return this;
3538        }
3539
3540        /**
3541         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3542         */
3543        public boolean hasProcedureSequence(int value) { 
3544          if (this.procedureSequence == null)
3545            return false;
3546          for (PositiveIntType v : this.procedureSequence)
3547            if (v.getValue().equals(value)) // positiveInt
3548              return true;
3549          return false;
3550        }
3551
3552        /**
3553         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3554         */
3555        public List<PositiveIntType> getInformationSequence() { 
3556          if (this.informationSequence == null)
3557            this.informationSequence = new ArrayList<PositiveIntType>();
3558          return this.informationSequence;
3559        }
3560
3561        /**
3562         * @return Returns a reference to <code>this</code> for easy method chaining
3563         */
3564        public ItemComponent setInformationSequence(List<PositiveIntType> theInformationSequence) { 
3565          this.informationSequence = theInformationSequence;
3566          return this;
3567        }
3568
3569        public boolean hasInformationSequence() { 
3570          if (this.informationSequence == null)
3571            return false;
3572          for (PositiveIntType item : this.informationSequence)
3573            if (!item.isEmpty())
3574              return true;
3575          return false;
3576        }
3577
3578        /**
3579         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3580         */
3581        public PositiveIntType addInformationSequenceElement() {//2 
3582          PositiveIntType t = new PositiveIntType();
3583          if (this.informationSequence == null)
3584            this.informationSequence = new ArrayList<PositiveIntType>();
3585          this.informationSequence.add(t);
3586          return t;
3587        }
3588
3589        /**
3590         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3591         */
3592        public ItemComponent addInformationSequence(int value) { //1
3593          PositiveIntType t = new PositiveIntType();
3594          t.setValue(value);
3595          if (this.informationSequence == null)
3596            this.informationSequence = new ArrayList<PositiveIntType>();
3597          this.informationSequence.add(t);
3598          return this;
3599        }
3600
3601        /**
3602         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3603         */
3604        public boolean hasInformationSequence(int value) { 
3605          if (this.informationSequence == null)
3606            return false;
3607          for (PositiveIntType v : this.informationSequence)
3608            if (v.getValue().equals(value)) // positiveInt
3609              return true;
3610          return false;
3611        }
3612
3613        /**
3614         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3615         */
3616        public CodeableConcept getRevenue() { 
3617          if (this.revenue == null)
3618            if (Configuration.errorOnAutoCreate())
3619              throw new Error("Attempt to auto-create ItemComponent.revenue");
3620            else if (Configuration.doAutoCreate())
3621              this.revenue = new CodeableConcept(); // cc
3622          return this.revenue;
3623        }
3624
3625        public boolean hasRevenue() { 
3626          return this.revenue != null && !this.revenue.isEmpty();
3627        }
3628
3629        /**
3630         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3631         */
3632        public ItemComponent setRevenue(CodeableConcept value) { 
3633          this.revenue = value;
3634          return this;
3635        }
3636
3637        /**
3638         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
3639         */
3640        public CodeableConcept getCategory() { 
3641          if (this.category == null)
3642            if (Configuration.errorOnAutoCreate())
3643              throw new Error("Attempt to auto-create ItemComponent.category");
3644            else if (Configuration.doAutoCreate())
3645              this.category = new CodeableConcept(); // cc
3646          return this.category;
3647        }
3648
3649        public boolean hasCategory() { 
3650          return this.category != null && !this.category.isEmpty();
3651        }
3652
3653        /**
3654         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
3655         */
3656        public ItemComponent setCategory(CodeableConcept value) { 
3657          this.category = value;
3658          return this;
3659        }
3660
3661        /**
3662         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.)
3663         */
3664        public CodeableConcept getProductOrService() { 
3665          if (this.productOrService == null)
3666            if (Configuration.errorOnAutoCreate())
3667              throw new Error("Attempt to auto-create ItemComponent.productOrService");
3668            else if (Configuration.doAutoCreate())
3669              this.productOrService = new CodeableConcept(); // cc
3670          return this.productOrService;
3671        }
3672
3673        public boolean hasProductOrService() { 
3674          return this.productOrService != null && !this.productOrService.isEmpty();
3675        }
3676
3677        /**
3678         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.)
3679         */
3680        public ItemComponent setProductOrService(CodeableConcept value) { 
3681          this.productOrService = value;
3682          return this;
3683        }
3684
3685        /**
3686         * @return {@link #productOrServiceEnd} (This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.)
3687         */
3688        public CodeableConcept getProductOrServiceEnd() { 
3689          if (this.productOrServiceEnd == null)
3690            if (Configuration.errorOnAutoCreate())
3691              throw new Error("Attempt to auto-create ItemComponent.productOrServiceEnd");
3692            else if (Configuration.doAutoCreate())
3693              this.productOrServiceEnd = new CodeableConcept(); // cc
3694          return this.productOrServiceEnd;
3695        }
3696
3697        public boolean hasProductOrServiceEnd() { 
3698          return this.productOrServiceEnd != null && !this.productOrServiceEnd.isEmpty();
3699        }
3700
3701        /**
3702         * @param value {@link #productOrServiceEnd} (This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.)
3703         */
3704        public ItemComponent setProductOrServiceEnd(CodeableConcept value) { 
3705          this.productOrServiceEnd = value;
3706          return this;
3707        }
3708
3709        /**
3710         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
3711         */
3712        public List<CodeableConcept> getModifier() { 
3713          if (this.modifier == null)
3714            this.modifier = new ArrayList<CodeableConcept>();
3715          return this.modifier;
3716        }
3717
3718        /**
3719         * @return Returns a reference to <code>this</code> for easy method chaining
3720         */
3721        public ItemComponent setModifier(List<CodeableConcept> theModifier) { 
3722          this.modifier = theModifier;
3723          return this;
3724        }
3725
3726        public boolean hasModifier() { 
3727          if (this.modifier == null)
3728            return false;
3729          for (CodeableConcept item : this.modifier)
3730            if (!item.isEmpty())
3731              return true;
3732          return false;
3733        }
3734
3735        public CodeableConcept addModifier() { //3
3736          CodeableConcept t = new CodeableConcept();
3737          if (this.modifier == null)
3738            this.modifier = new ArrayList<CodeableConcept>();
3739          this.modifier.add(t);
3740          return t;
3741        }
3742
3743        public ItemComponent addModifier(CodeableConcept t) { //3
3744          if (t == null)
3745            return this;
3746          if (this.modifier == null)
3747            this.modifier = new ArrayList<CodeableConcept>();
3748          this.modifier.add(t);
3749          return this;
3750        }
3751
3752        /**
3753         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
3754         */
3755        public CodeableConcept getModifierFirstRep() { 
3756          if (getModifier().isEmpty()) {
3757            addModifier();
3758          }
3759          return getModifier().get(0);
3760        }
3761
3762        /**
3763         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
3764         */
3765        public List<CodeableConcept> getProgramCode() { 
3766          if (this.programCode == null)
3767            this.programCode = new ArrayList<CodeableConcept>();
3768          return this.programCode;
3769        }
3770
3771        /**
3772         * @return Returns a reference to <code>this</code> for easy method chaining
3773         */
3774        public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
3775          this.programCode = theProgramCode;
3776          return this;
3777        }
3778
3779        public boolean hasProgramCode() { 
3780          if (this.programCode == null)
3781            return false;
3782          for (CodeableConcept item : this.programCode)
3783            if (!item.isEmpty())
3784              return true;
3785          return false;
3786        }
3787
3788        public CodeableConcept addProgramCode() { //3
3789          CodeableConcept t = new CodeableConcept();
3790          if (this.programCode == null)
3791            this.programCode = new ArrayList<CodeableConcept>();
3792          this.programCode.add(t);
3793          return t;
3794        }
3795
3796        public ItemComponent addProgramCode(CodeableConcept t) { //3
3797          if (t == null)
3798            return this;
3799          if (this.programCode == null)
3800            this.programCode = new ArrayList<CodeableConcept>();
3801          this.programCode.add(t);
3802          return this;
3803        }
3804
3805        /**
3806         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
3807         */
3808        public CodeableConcept getProgramCodeFirstRep() { 
3809          if (getProgramCode().isEmpty()) {
3810            addProgramCode();
3811          }
3812          return getProgramCode().get(0);
3813        }
3814
3815        /**
3816         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3817         */
3818        public DataType getServiced() { 
3819          return this.serviced;
3820        }
3821
3822        /**
3823         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3824         */
3825        public DateType getServicedDateType() throws FHIRException { 
3826          if (this.serviced == null)
3827            this.serviced = new DateType();
3828          if (!(this.serviced instanceof DateType))
3829            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
3830          return (DateType) this.serviced;
3831        }
3832
3833        public boolean hasServicedDateType() { 
3834          return this != null && this.serviced instanceof DateType;
3835        }
3836
3837        /**
3838         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3839         */
3840        public Period getServicedPeriod() throws FHIRException { 
3841          if (this.serviced == null)
3842            this.serviced = new Period();
3843          if (!(this.serviced instanceof Period))
3844            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
3845          return (Period) this.serviced;
3846        }
3847
3848        public boolean hasServicedPeriod() { 
3849          return this != null && this.serviced instanceof Period;
3850        }
3851
3852        public boolean hasServiced() { 
3853          return this.serviced != null && !this.serviced.isEmpty();
3854        }
3855
3856        /**
3857         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3858         */
3859        public ItemComponent setServiced(DataType value) { 
3860          if (value != null && !(value instanceof DateType || value instanceof Period))
3861            throw new Error("Not the right type for ExplanationOfBenefit.item.serviced[x]: "+value.fhirType());
3862          this.serviced = value;
3863          return this;
3864        }
3865
3866        /**
3867         * @return {@link #location} (Where the product or service was provided.)
3868         */
3869        public DataType getLocation() { 
3870          return this.location;
3871        }
3872
3873        /**
3874         * @return {@link #location} (Where the product or service was provided.)
3875         */
3876        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
3877          if (this.location == null)
3878            this.location = new CodeableConcept();
3879          if (!(this.location instanceof CodeableConcept))
3880            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
3881          return (CodeableConcept) this.location;
3882        }
3883
3884        public boolean hasLocationCodeableConcept() { 
3885          return this != null && this.location instanceof CodeableConcept;
3886        }
3887
3888        /**
3889         * @return {@link #location} (Where the product or service was provided.)
3890         */
3891        public Address getLocationAddress() throws FHIRException { 
3892          if (this.location == null)
3893            this.location = new Address();
3894          if (!(this.location instanceof Address))
3895            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3896          return (Address) this.location;
3897        }
3898
3899        public boolean hasLocationAddress() { 
3900          return this != null && this.location instanceof Address;
3901        }
3902
3903        /**
3904         * @return {@link #location} (Where the product or service was provided.)
3905         */
3906        public Reference getLocationReference() throws FHIRException { 
3907          if (this.location == null)
3908            this.location = new Reference();
3909          if (!(this.location instanceof Reference))
3910            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3911          return (Reference) this.location;
3912        }
3913
3914        public boolean hasLocationReference() { 
3915          return this != null && this.location instanceof Reference;
3916        }
3917
3918        public boolean hasLocation() { 
3919          return this.location != null && !this.location.isEmpty();
3920        }
3921
3922        /**
3923         * @param value {@link #location} (Where the product or service was provided.)
3924         */
3925        public ItemComponent setLocation(DataType value) { 
3926          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
3927            throw new Error("Not the right type for ExplanationOfBenefit.item.location[x]: "+value.fhirType());
3928          this.location = value;
3929          return this;
3930        }
3931
3932        /**
3933         * @return {@link #patientPaid} (The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.)
3934         */
3935        public Money getPatientPaid() { 
3936          if (this.patientPaid == null)
3937            if (Configuration.errorOnAutoCreate())
3938              throw new Error("Attempt to auto-create ItemComponent.patientPaid");
3939            else if (Configuration.doAutoCreate())
3940              this.patientPaid = new Money(); // cc
3941          return this.patientPaid;
3942        }
3943
3944        public boolean hasPatientPaid() { 
3945          return this.patientPaid != null && !this.patientPaid.isEmpty();
3946        }
3947
3948        /**
3949         * @param value {@link #patientPaid} (The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.)
3950         */
3951        public ItemComponent setPatientPaid(Money value) { 
3952          this.patientPaid = value;
3953          return this;
3954        }
3955
3956        /**
3957         * @return {@link #quantity} (The number of repetitions of a service or product.)
3958         */
3959        public Quantity getQuantity() { 
3960          if (this.quantity == null)
3961            if (Configuration.errorOnAutoCreate())
3962              throw new Error("Attempt to auto-create ItemComponent.quantity");
3963            else if (Configuration.doAutoCreate())
3964              this.quantity = new Quantity(); // cc
3965          return this.quantity;
3966        }
3967
3968        public boolean hasQuantity() { 
3969          return this.quantity != null && !this.quantity.isEmpty();
3970        }
3971
3972        /**
3973         * @param value {@link #quantity} (The number of repetitions of a service or product.)
3974         */
3975        public ItemComponent setQuantity(Quantity value) { 
3976          this.quantity = value;
3977          return this;
3978        }
3979
3980        /**
3981         * @return {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
3982         */
3983        public Money getUnitPrice() { 
3984          if (this.unitPrice == null)
3985            if (Configuration.errorOnAutoCreate())
3986              throw new Error("Attempt to auto-create ItemComponent.unitPrice");
3987            else if (Configuration.doAutoCreate())
3988              this.unitPrice = new Money(); // cc
3989          return this.unitPrice;
3990        }
3991
3992        public boolean hasUnitPrice() { 
3993          return this.unitPrice != null && !this.unitPrice.isEmpty();
3994        }
3995
3996        /**
3997         * @param value {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
3998         */
3999        public ItemComponent setUnitPrice(Money value) { 
4000          this.unitPrice = value;
4001          return this;
4002        }
4003
4004        /**
4005         * @return {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
4006         */
4007        public DecimalType getFactorElement() { 
4008          if (this.factor == null)
4009            if (Configuration.errorOnAutoCreate())
4010              throw new Error("Attempt to auto-create ItemComponent.factor");
4011            else if (Configuration.doAutoCreate())
4012              this.factor = new DecimalType(); // bb
4013          return this.factor;
4014        }
4015
4016        public boolean hasFactorElement() { 
4017          return this.factor != null && !this.factor.isEmpty();
4018        }
4019
4020        public boolean hasFactor() { 
4021          return this.factor != null && !this.factor.isEmpty();
4022        }
4023
4024        /**
4025         * @param value {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
4026         */
4027        public ItemComponent setFactorElement(DecimalType value) { 
4028          this.factor = value;
4029          return this;
4030        }
4031
4032        /**
4033         * @return A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
4034         */
4035        public BigDecimal getFactor() { 
4036          return this.factor == null ? null : this.factor.getValue();
4037        }
4038
4039        /**
4040         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
4041         */
4042        public ItemComponent setFactor(BigDecimal value) { 
4043          if (value == null)
4044            this.factor = null;
4045          else {
4046            if (this.factor == null)
4047              this.factor = new DecimalType();
4048            this.factor.setValue(value);
4049          }
4050          return this;
4051        }
4052
4053        /**
4054         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
4055         */
4056        public ItemComponent setFactor(long value) { 
4057              this.factor = new DecimalType();
4058            this.factor.setValue(value);
4059          return this;
4060        }
4061
4062        /**
4063         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
4064         */
4065        public ItemComponent setFactor(double value) { 
4066              this.factor = new DecimalType();
4067            this.factor.setValue(value);
4068          return this;
4069        }
4070
4071        /**
4072         * @return {@link #tax} (The total of taxes applicable for this product or service.)
4073         */
4074        public Money getTax() { 
4075          if (this.tax == null)
4076            if (Configuration.errorOnAutoCreate())
4077              throw new Error("Attempt to auto-create ItemComponent.tax");
4078            else if (Configuration.doAutoCreate())
4079              this.tax = new Money(); // cc
4080          return this.tax;
4081        }
4082
4083        public boolean hasTax() { 
4084          return this.tax != null && !this.tax.isEmpty();
4085        }
4086
4087        /**
4088         * @param value {@link #tax} (The total of taxes applicable for this product or service.)
4089         */
4090        public ItemComponent setTax(Money value) { 
4091          this.tax = value;
4092          return this;
4093        }
4094
4095        /**
4096         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4097         */
4098        public Money getNet() { 
4099          if (this.net == null)
4100            if (Configuration.errorOnAutoCreate())
4101              throw new Error("Attempt to auto-create ItemComponent.net");
4102            else if (Configuration.doAutoCreate())
4103              this.net = new Money(); // cc
4104          return this.net;
4105        }
4106
4107        public boolean hasNet() { 
4108          return this.net != null && !this.net.isEmpty();
4109        }
4110
4111        /**
4112         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4113         */
4114        public ItemComponent setNet(Money value) { 
4115          this.net = value;
4116          return this;
4117        }
4118
4119        /**
4120         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
4121         */
4122        public List<Reference> getUdi() { 
4123          if (this.udi == null)
4124            this.udi = new ArrayList<Reference>();
4125          return this.udi;
4126        }
4127
4128        /**
4129         * @return Returns a reference to <code>this</code> for easy method chaining
4130         */
4131        public ItemComponent setUdi(List<Reference> theUdi) { 
4132          this.udi = theUdi;
4133          return this;
4134        }
4135
4136        public boolean hasUdi() { 
4137          if (this.udi == null)
4138            return false;
4139          for (Reference item : this.udi)
4140            if (!item.isEmpty())
4141              return true;
4142          return false;
4143        }
4144
4145        public Reference addUdi() { //3
4146          Reference t = new Reference();
4147          if (this.udi == null)
4148            this.udi = new ArrayList<Reference>();
4149          this.udi.add(t);
4150          return t;
4151        }
4152
4153        public ItemComponent addUdi(Reference t) { //3
4154          if (t == null)
4155            return this;
4156          if (this.udi == null)
4157            this.udi = new ArrayList<Reference>();
4158          this.udi.add(t);
4159          return this;
4160        }
4161
4162        /**
4163         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
4164         */
4165        public Reference getUdiFirstRep() { 
4166          if (getUdi().isEmpty()) {
4167            addUdi();
4168          }
4169          return getUdi().get(0);
4170        }
4171
4172        /**
4173         * @return {@link #bodySite} (Physical location where the service is performed or applies.)
4174         */
4175        public List<ItemBodySiteComponent> getBodySite() { 
4176          if (this.bodySite == null)
4177            this.bodySite = new ArrayList<ItemBodySiteComponent>();
4178          return this.bodySite;
4179        }
4180
4181        /**
4182         * @return Returns a reference to <code>this</code> for easy method chaining
4183         */
4184        public ItemComponent setBodySite(List<ItemBodySiteComponent> theBodySite) { 
4185          this.bodySite = theBodySite;
4186          return this;
4187        }
4188
4189        public boolean hasBodySite() { 
4190          if (this.bodySite == null)
4191            return false;
4192          for (ItemBodySiteComponent item : this.bodySite)
4193            if (!item.isEmpty())
4194              return true;
4195          return false;
4196        }
4197
4198        public ItemBodySiteComponent addBodySite() { //3
4199          ItemBodySiteComponent t = new ItemBodySiteComponent();
4200          if (this.bodySite == null)
4201            this.bodySite = new ArrayList<ItemBodySiteComponent>();
4202          this.bodySite.add(t);
4203          return t;
4204        }
4205
4206        public ItemComponent addBodySite(ItemBodySiteComponent t) { //3
4207          if (t == null)
4208            return this;
4209          if (this.bodySite == null)
4210            this.bodySite = new ArrayList<ItemBodySiteComponent>();
4211          this.bodySite.add(t);
4212          return this;
4213        }
4214
4215        /**
4216         * @return The first repetition of repeating field {@link #bodySite}, creating it if it does not already exist {3}
4217         */
4218        public ItemBodySiteComponent getBodySiteFirstRep() { 
4219          if (getBodySite().isEmpty()) {
4220            addBodySite();
4221          }
4222          return getBodySite().get(0);
4223        }
4224
4225        /**
4226         * @return {@link #encounter} (A billed item may include goods or services provided in multiple encounters.)
4227         */
4228        public List<Reference> getEncounter() { 
4229          if (this.encounter == null)
4230            this.encounter = new ArrayList<Reference>();
4231          return this.encounter;
4232        }
4233
4234        /**
4235         * @return Returns a reference to <code>this</code> for easy method chaining
4236         */
4237        public ItemComponent setEncounter(List<Reference> theEncounter) { 
4238          this.encounter = theEncounter;
4239          return this;
4240        }
4241
4242        public boolean hasEncounter() { 
4243          if (this.encounter == null)
4244            return false;
4245          for (Reference item : this.encounter)
4246            if (!item.isEmpty())
4247              return true;
4248          return false;
4249        }
4250
4251        public Reference addEncounter() { //3
4252          Reference t = new Reference();
4253          if (this.encounter == null)
4254            this.encounter = new ArrayList<Reference>();
4255          this.encounter.add(t);
4256          return t;
4257        }
4258
4259        public ItemComponent addEncounter(Reference t) { //3
4260          if (t == null)
4261            return this;
4262          if (this.encounter == null)
4263            this.encounter = new ArrayList<Reference>();
4264          this.encounter.add(t);
4265          return this;
4266        }
4267
4268        /**
4269         * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist {3}
4270         */
4271        public Reference getEncounterFirstRep() { 
4272          if (getEncounter().isEmpty()) {
4273            addEncounter();
4274          }
4275          return getEncounter().get(0);
4276        }
4277
4278        /**
4279         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4280         */
4281        public List<PositiveIntType> getNoteNumber() { 
4282          if (this.noteNumber == null)
4283            this.noteNumber = new ArrayList<PositiveIntType>();
4284          return this.noteNumber;
4285        }
4286
4287        /**
4288         * @return Returns a reference to <code>this</code> for easy method chaining
4289         */
4290        public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
4291          this.noteNumber = theNoteNumber;
4292          return this;
4293        }
4294
4295        public boolean hasNoteNumber() { 
4296          if (this.noteNumber == null)
4297            return false;
4298          for (PositiveIntType item : this.noteNumber)
4299            if (!item.isEmpty())
4300              return true;
4301          return false;
4302        }
4303
4304        /**
4305         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4306         */
4307        public PositiveIntType addNoteNumberElement() {//2 
4308          PositiveIntType t = new PositiveIntType();
4309          if (this.noteNumber == null)
4310            this.noteNumber = new ArrayList<PositiveIntType>();
4311          this.noteNumber.add(t);
4312          return t;
4313        }
4314
4315        /**
4316         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4317         */
4318        public ItemComponent addNoteNumber(int value) { //1
4319          PositiveIntType t = new PositiveIntType();
4320          t.setValue(value);
4321          if (this.noteNumber == null)
4322            this.noteNumber = new ArrayList<PositiveIntType>();
4323          this.noteNumber.add(t);
4324          return this;
4325        }
4326
4327        /**
4328         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4329         */
4330        public boolean hasNoteNumber(int value) { 
4331          if (this.noteNumber == null)
4332            return false;
4333          for (PositiveIntType v : this.noteNumber)
4334            if (v.getValue().equals(value)) // positiveInt
4335              return true;
4336          return false;
4337        }
4338
4339        /**
4340         * @return {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
4341         */
4342        public CodeableConcept getDecision() { 
4343          if (this.decision == null)
4344            if (Configuration.errorOnAutoCreate())
4345              throw new Error("Attempt to auto-create ItemComponent.decision");
4346            else if (Configuration.doAutoCreate())
4347              this.decision = new CodeableConcept(); // cc
4348          return this.decision;
4349        }
4350
4351        public boolean hasDecision() { 
4352          return this.decision != null && !this.decision.isEmpty();
4353        }
4354
4355        /**
4356         * @param value {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
4357         */
4358        public ItemComponent setDecision(CodeableConcept value) { 
4359          this.decision = value;
4360          return this;
4361        }
4362
4363        /**
4364         * @return {@link #adjudication} (If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.)
4365         */
4366        public List<AdjudicationComponent> getAdjudication() { 
4367          if (this.adjudication == null)
4368            this.adjudication = new ArrayList<AdjudicationComponent>();
4369          return this.adjudication;
4370        }
4371
4372        /**
4373         * @return Returns a reference to <code>this</code> for easy method chaining
4374         */
4375        public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
4376          this.adjudication = theAdjudication;
4377          return this;
4378        }
4379
4380        public boolean hasAdjudication() { 
4381          if (this.adjudication == null)
4382            return false;
4383          for (AdjudicationComponent item : this.adjudication)
4384            if (!item.isEmpty())
4385              return true;
4386          return false;
4387        }
4388
4389        public AdjudicationComponent addAdjudication() { //3
4390          AdjudicationComponent t = new AdjudicationComponent();
4391          if (this.adjudication == null)
4392            this.adjudication = new ArrayList<AdjudicationComponent>();
4393          this.adjudication.add(t);
4394          return t;
4395        }
4396
4397        public ItemComponent addAdjudication(AdjudicationComponent t) { //3
4398          if (t == null)
4399            return this;
4400          if (this.adjudication == null)
4401            this.adjudication = new ArrayList<AdjudicationComponent>();
4402          this.adjudication.add(t);
4403          return this;
4404        }
4405
4406        /**
4407         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
4408         */
4409        public AdjudicationComponent getAdjudicationFirstRep() { 
4410          if (getAdjudication().isEmpty()) {
4411            addAdjudication();
4412          }
4413          return getAdjudication().get(0);
4414        }
4415
4416        /**
4417         * @return {@link #detail} (Second-tier of goods and services.)
4418         */
4419        public List<DetailComponent> getDetail() { 
4420          if (this.detail == null)
4421            this.detail = new ArrayList<DetailComponent>();
4422          return this.detail;
4423        }
4424
4425        /**
4426         * @return Returns a reference to <code>this</code> for easy method chaining
4427         */
4428        public ItemComponent setDetail(List<DetailComponent> theDetail) { 
4429          this.detail = theDetail;
4430          return this;
4431        }
4432
4433        public boolean hasDetail() { 
4434          if (this.detail == null)
4435            return false;
4436          for (DetailComponent item : this.detail)
4437            if (!item.isEmpty())
4438              return true;
4439          return false;
4440        }
4441
4442        public DetailComponent addDetail() { //3
4443          DetailComponent t = new DetailComponent();
4444          if (this.detail == null)
4445            this.detail = new ArrayList<DetailComponent>();
4446          this.detail.add(t);
4447          return t;
4448        }
4449
4450        public ItemComponent addDetail(DetailComponent t) { //3
4451          if (t == null)
4452            return this;
4453          if (this.detail == null)
4454            this.detail = new ArrayList<DetailComponent>();
4455          this.detail.add(t);
4456          return this;
4457        }
4458
4459        /**
4460         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist {3}
4461         */
4462        public DetailComponent getDetailFirstRep() { 
4463          if (getDetail().isEmpty()) {
4464            addDetail();
4465          }
4466          return getDetail().get(0);
4467        }
4468
4469        protected void listChildren(List<Property> children) {
4470          super.listChildren(children);
4471          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
4472          children.add(new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence));
4473          children.add(new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence));
4474          children.add(new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence));
4475          children.add(new Property("informationSequence", "positiveInt", "Exceptions, special conditions and supporting information applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, informationSequence));
4476          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
4477          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
4478          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.", 0, 1, productOrService));
4479          children.add(new Property("productOrServiceEnd", "CodeableConcept", "This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.", 0, 1, productOrServiceEnd));
4480          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier));
4481          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
4482          children.add(new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced));
4483          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
4484          children.add(new Property("patientPaid", "Money", "The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.", 0, 1, patientPaid));
4485          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
4486          children.add(new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice));
4487          children.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor));
4488          children.add(new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax));
4489          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
4490          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
4491          children.add(new Property("bodySite", "", "Physical location where the service is performed or applies.", 0, java.lang.Integer.MAX_VALUE, bodySite));
4492          children.add(new Property("encounter", "Reference(Encounter)", "A billed item may include goods or services provided in multiple encounters.", 0, java.lang.Integer.MAX_VALUE, encounter));
4493          children.add(new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
4494          children.add(new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision));
4495          children.add(new Property("adjudication", "", "If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, adjudication));
4496          children.add(new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
4497        }
4498
4499        @Override
4500        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4501          switch (_hash) {
4502          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence);
4503          case 1070083823: /*careTeamSequence*/  return new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence);
4504          case -909769262: /*diagnosisSequence*/  return new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence);
4505          case -808920140: /*procedureSequence*/  return new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence);
4506          case -702585587: /*informationSequence*/  return new Property("informationSequence", "positiveInt", "Exceptions, special conditions and supporting information applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, informationSequence);
4507          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
4508          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category);
4509          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.", 0, 1, productOrService);
4510          case -717476168: /*productOrServiceEnd*/  return new Property("productOrServiceEnd", "CodeableConcept", "This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.", 0, 1, productOrServiceEnd);
4511          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier);
4512          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
4513          case -1927922223: /*serviced[x]*/  return new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
4514          case 1379209295: /*serviced*/  return new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
4515          case 363246749: /*servicedDate*/  return new Property("serviced[x]", "date", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
4516          case 1534966512: /*servicedPeriod*/  return new Property("serviced[x]", "Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
4517          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4518          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4519          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept", "Where the product or service was provided.", 0, 1, location);
4520          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address", "Where the product or service was provided.", 0, 1, location);
4521          case 755866390: /*locationReference*/  return new Property("location[x]", "Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4522          case 525514609: /*patientPaid*/  return new Property("patientPaid", "Money", "The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.", 0, 1, patientPaid);
4523          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
4524          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice);
4525          case -1282148017: /*factor*/  return new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor);
4526          case 114603: /*tax*/  return new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax);
4527          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
4528          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
4529          case 1702620169: /*bodySite*/  return new Property("bodySite", "", "Physical location where the service is performed or applies.", 0, java.lang.Integer.MAX_VALUE, bodySite);
4530          case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "A billed item may include goods or services provided in multiple encounters.", 0, java.lang.Integer.MAX_VALUE, encounter);
4531          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
4532          case 565719004: /*decision*/  return new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision);
4533          case -231349275: /*adjudication*/  return new Property("adjudication", "", "If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, adjudication);
4534          case -1335224239: /*detail*/  return new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail);
4535          default: return super.getNamedProperty(_hash, _name, _checkValid);
4536          }
4537
4538        }
4539
4540      @Override
4541      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4542        switch (hash) {
4543        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
4544        case 1070083823: /*careTeamSequence*/ return this.careTeamSequence == null ? new Base[0] : this.careTeamSequence.toArray(new Base[this.careTeamSequence.size()]); // PositiveIntType
4545        case -909769262: /*diagnosisSequence*/ return this.diagnosisSequence == null ? new Base[0] : this.diagnosisSequence.toArray(new Base[this.diagnosisSequence.size()]); // PositiveIntType
4546        case -808920140: /*procedureSequence*/ return this.procedureSequence == null ? new Base[0] : this.procedureSequence.toArray(new Base[this.procedureSequence.size()]); // PositiveIntType
4547        case -702585587: /*informationSequence*/ return this.informationSequence == null ? new Base[0] : this.informationSequence.toArray(new Base[this.informationSequence.size()]); // PositiveIntType
4548        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
4549        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4550        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
4551        case -717476168: /*productOrServiceEnd*/ return this.productOrServiceEnd == null ? new Base[0] : new Base[] {this.productOrServiceEnd}; // CodeableConcept
4552        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
4553        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
4554        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // DataType
4555        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // DataType
4556        case 525514609: /*patientPaid*/ return this.patientPaid == null ? new Base[0] : new Base[] {this.patientPaid}; // Money
4557        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
4558        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
4559        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
4560        case 114603: /*tax*/ return this.tax == null ? new Base[0] : new Base[] {this.tax}; // Money
4561        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
4562        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
4563        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : this.bodySite.toArray(new Base[this.bodySite.size()]); // ItemBodySiteComponent
4564        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
4565        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
4566        case 565719004: /*decision*/ return this.decision == null ? new Base[0] : new Base[] {this.decision}; // CodeableConcept
4567        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
4568        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
4569        default: return super.getProperty(hash, name, checkValid);
4570        }
4571
4572      }
4573
4574      @Override
4575      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4576        switch (hash) {
4577        case 1349547969: // sequence
4578          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
4579          return value;
4580        case 1070083823: // careTeamSequence
4581          this.getCareTeamSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4582          return value;
4583        case -909769262: // diagnosisSequence
4584          this.getDiagnosisSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4585          return value;
4586        case -808920140: // procedureSequence
4587          this.getProcedureSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4588          return value;
4589        case -702585587: // informationSequence
4590          this.getInformationSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4591          return value;
4592        case 1099842588: // revenue
4593          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4594          return value;
4595        case 50511102: // category
4596          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4597          return value;
4598        case 1957227299: // productOrService
4599          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4600          return value;
4601        case -717476168: // productOrServiceEnd
4602          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4603          return value;
4604        case -615513385: // modifier
4605          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4606          return value;
4607        case 1010065041: // programCode
4608          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4609          return value;
4610        case 1379209295: // serviced
4611          this.serviced = TypeConvertor.castToType(value); // DataType
4612          return value;
4613        case 1901043637: // location
4614          this.location = TypeConvertor.castToType(value); // DataType
4615          return value;
4616        case 525514609: // patientPaid
4617          this.patientPaid = TypeConvertor.castToMoney(value); // Money
4618          return value;
4619        case -1285004149: // quantity
4620          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
4621          return value;
4622        case -486196699: // unitPrice
4623          this.unitPrice = TypeConvertor.castToMoney(value); // Money
4624          return value;
4625        case -1282148017: // factor
4626          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
4627          return value;
4628        case 114603: // tax
4629          this.tax = TypeConvertor.castToMoney(value); // Money
4630          return value;
4631        case 108957: // net
4632          this.net = TypeConvertor.castToMoney(value); // Money
4633          return value;
4634        case 115642: // udi
4635          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
4636          return value;
4637        case 1702620169: // bodySite
4638          this.getBodySite().add((ItemBodySiteComponent) value); // ItemBodySiteComponent
4639          return value;
4640        case 1524132147: // encounter
4641          this.getEncounter().add(TypeConvertor.castToReference(value)); // Reference
4642          return value;
4643        case -1110033957: // noteNumber
4644          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4645          return value;
4646        case 565719004: // decision
4647          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4648          return value;
4649        case -231349275: // adjudication
4650          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
4651          return value;
4652        case -1335224239: // detail
4653          this.getDetail().add((DetailComponent) value); // DetailComponent
4654          return value;
4655        default: return super.setProperty(hash, name, value);
4656        }
4657
4658      }
4659
4660      @Override
4661      public Base setProperty(String name, Base value) throws FHIRException {
4662        if (name.equals("sequence")) {
4663          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
4664        } else if (name.equals("careTeamSequence")) {
4665          this.getCareTeamSequence().add(TypeConvertor.castToPositiveInt(value));
4666        } else if (name.equals("diagnosisSequence")) {
4667          this.getDiagnosisSequence().add(TypeConvertor.castToPositiveInt(value));
4668        } else if (name.equals("procedureSequence")) {
4669          this.getProcedureSequence().add(TypeConvertor.castToPositiveInt(value));
4670        } else if (name.equals("informationSequence")) {
4671          this.getInformationSequence().add(TypeConvertor.castToPositiveInt(value));
4672        } else if (name.equals("revenue")) {
4673          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4674        } else if (name.equals("category")) {
4675          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4676        } else if (name.equals("productOrService")) {
4677          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4678        } else if (name.equals("productOrServiceEnd")) {
4679          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4680        } else if (name.equals("modifier")) {
4681          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
4682        } else if (name.equals("programCode")) {
4683          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
4684        } else if (name.equals("serviced[x]")) {
4685          this.serviced = TypeConvertor.castToType(value); // DataType
4686        } else if (name.equals("location[x]")) {
4687          this.location = TypeConvertor.castToType(value); // DataType
4688        } else if (name.equals("patientPaid")) {
4689          this.patientPaid = TypeConvertor.castToMoney(value); // Money
4690        } else if (name.equals("quantity")) {
4691          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
4692        } else if (name.equals("unitPrice")) {
4693          this.unitPrice = TypeConvertor.castToMoney(value); // Money
4694        } else if (name.equals("factor")) {
4695          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
4696        } else if (name.equals("tax")) {
4697          this.tax = TypeConvertor.castToMoney(value); // Money
4698        } else if (name.equals("net")) {
4699          this.net = TypeConvertor.castToMoney(value); // Money
4700        } else if (name.equals("udi")) {
4701          this.getUdi().add(TypeConvertor.castToReference(value));
4702        } else if (name.equals("bodySite")) {
4703          this.getBodySite().add((ItemBodySiteComponent) value);
4704        } else if (name.equals("encounter")) {
4705          this.getEncounter().add(TypeConvertor.castToReference(value));
4706        } else if (name.equals("noteNumber")) {
4707          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
4708        } else if (name.equals("decision")) {
4709          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4710        } else if (name.equals("adjudication")) {
4711          this.getAdjudication().add((AdjudicationComponent) value);
4712        } else if (name.equals("detail")) {
4713          this.getDetail().add((DetailComponent) value);
4714        } else
4715          return super.setProperty(name, value);
4716        return value;
4717      }
4718
4719      @Override
4720      public Base makeProperty(int hash, String name) throws FHIRException {
4721        switch (hash) {
4722        case 1349547969:  return getSequenceElement();
4723        case 1070083823:  return addCareTeamSequenceElement();
4724        case -909769262:  return addDiagnosisSequenceElement();
4725        case -808920140:  return addProcedureSequenceElement();
4726        case -702585587:  return addInformationSequenceElement();
4727        case 1099842588:  return getRevenue();
4728        case 50511102:  return getCategory();
4729        case 1957227299:  return getProductOrService();
4730        case -717476168:  return getProductOrServiceEnd();
4731        case -615513385:  return addModifier(); 
4732        case 1010065041:  return addProgramCode(); 
4733        case -1927922223:  return getServiced();
4734        case 1379209295:  return getServiced();
4735        case 552316075:  return getLocation();
4736        case 1901043637:  return getLocation();
4737        case 525514609:  return getPatientPaid();
4738        case -1285004149:  return getQuantity();
4739        case -486196699:  return getUnitPrice();
4740        case -1282148017:  return getFactorElement();
4741        case 114603:  return getTax();
4742        case 108957:  return getNet();
4743        case 115642:  return addUdi(); 
4744        case 1702620169:  return addBodySite(); 
4745        case 1524132147:  return addEncounter(); 
4746        case -1110033957:  return addNoteNumberElement();
4747        case 565719004:  return getDecision();
4748        case -231349275:  return addAdjudication(); 
4749        case -1335224239:  return addDetail(); 
4750        default: return super.makeProperty(hash, name);
4751        }
4752
4753      }
4754
4755      @Override
4756      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4757        switch (hash) {
4758        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
4759        case 1070083823: /*careTeamSequence*/ return new String[] {"positiveInt"};
4760        case -909769262: /*diagnosisSequence*/ return new String[] {"positiveInt"};
4761        case -808920140: /*procedureSequence*/ return new String[] {"positiveInt"};
4762        case -702585587: /*informationSequence*/ return new String[] {"positiveInt"};
4763        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
4764        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4765        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
4766        case -717476168: /*productOrServiceEnd*/ return new String[] {"CodeableConcept"};
4767        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
4768        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
4769        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
4770        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
4771        case 525514609: /*patientPaid*/ return new String[] {"Money"};
4772        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
4773        case -486196699: /*unitPrice*/ return new String[] {"Money"};
4774        case -1282148017: /*factor*/ return new String[] {"decimal"};
4775        case 114603: /*tax*/ return new String[] {"Money"};
4776        case 108957: /*net*/ return new String[] {"Money"};
4777        case 115642: /*udi*/ return new String[] {"Reference"};
4778        case 1702620169: /*bodySite*/ return new String[] {};
4779        case 1524132147: /*encounter*/ return new String[] {"Reference"};
4780        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
4781        case 565719004: /*decision*/ return new String[] {"CodeableConcept"};
4782        case -231349275: /*adjudication*/ return new String[] {};
4783        case -1335224239: /*detail*/ return new String[] {};
4784        default: return super.getTypesForProperty(hash, name);
4785        }
4786
4787      }
4788
4789      @Override
4790      public Base addChild(String name) throws FHIRException {
4791        if (name.equals("sequence")) {
4792          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.sequence");
4793        }
4794        else if (name.equals("careTeamSequence")) {
4795          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.careTeamSequence");
4796        }
4797        else if (name.equals("diagnosisSequence")) {
4798          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.diagnosisSequence");
4799        }
4800        else if (name.equals("procedureSequence")) {
4801          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.procedureSequence");
4802        }
4803        else if (name.equals("informationSequence")) {
4804          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.informationSequence");
4805        }
4806        else if (name.equals("revenue")) {
4807          this.revenue = new CodeableConcept();
4808          return this.revenue;
4809        }
4810        else if (name.equals("category")) {
4811          this.category = new CodeableConcept();
4812          return this.category;
4813        }
4814        else if (name.equals("productOrService")) {
4815          this.productOrService = new CodeableConcept();
4816          return this.productOrService;
4817        }
4818        else if (name.equals("productOrServiceEnd")) {
4819          this.productOrServiceEnd = new CodeableConcept();
4820          return this.productOrServiceEnd;
4821        }
4822        else if (name.equals("modifier")) {
4823          return addModifier();
4824        }
4825        else if (name.equals("programCode")) {
4826          return addProgramCode();
4827        }
4828        else if (name.equals("servicedDate")) {
4829          this.serviced = new DateType();
4830          return this.serviced;
4831        }
4832        else if (name.equals("servicedPeriod")) {
4833          this.serviced = new Period();
4834          return this.serviced;
4835        }
4836        else if (name.equals("locationCodeableConcept")) {
4837          this.location = new CodeableConcept();
4838          return this.location;
4839        }
4840        else if (name.equals("locationAddress")) {
4841          this.location = new Address();
4842          return this.location;
4843        }
4844        else if (name.equals("locationReference")) {
4845          this.location = new Reference();
4846          return this.location;
4847        }
4848        else if (name.equals("patientPaid")) {
4849          this.patientPaid = new Money();
4850          return this.patientPaid;
4851        }
4852        else if (name.equals("quantity")) {
4853          this.quantity = new Quantity();
4854          return this.quantity;
4855        }
4856        else if (name.equals("unitPrice")) {
4857          this.unitPrice = new Money();
4858          return this.unitPrice;
4859        }
4860        else if (name.equals("factor")) {
4861          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.factor");
4862        }
4863        else if (name.equals("tax")) {
4864          this.tax = new Money();
4865          return this.tax;
4866        }
4867        else if (name.equals("net")) {
4868          this.net = new Money();
4869          return this.net;
4870        }
4871        else if (name.equals("udi")) {
4872          return addUdi();
4873        }
4874        else if (name.equals("bodySite")) {
4875          return addBodySite();
4876        }
4877        else if (name.equals("encounter")) {
4878          return addEncounter();
4879        }
4880        else if (name.equals("noteNumber")) {
4881          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.noteNumber");
4882        }
4883        else if (name.equals("decision")) {
4884          this.decision = new CodeableConcept();
4885          return this.decision;
4886        }
4887        else if (name.equals("adjudication")) {
4888          return addAdjudication();
4889        }
4890        else if (name.equals("detail")) {
4891          return addDetail();
4892        }
4893        else
4894          return super.addChild(name);
4895      }
4896
4897      public ItemComponent copy() {
4898        ItemComponent dst = new ItemComponent();
4899        copyValues(dst);
4900        return dst;
4901      }
4902
4903      public void copyValues(ItemComponent dst) {
4904        super.copyValues(dst);
4905        dst.sequence = sequence == null ? null : sequence.copy();
4906        if (careTeamSequence != null) {
4907          dst.careTeamSequence = new ArrayList<PositiveIntType>();
4908          for (PositiveIntType i : careTeamSequence)
4909            dst.careTeamSequence.add(i.copy());
4910        };
4911        if (diagnosisSequence != null) {
4912          dst.diagnosisSequence = new ArrayList<PositiveIntType>();
4913          for (PositiveIntType i : diagnosisSequence)
4914            dst.diagnosisSequence.add(i.copy());
4915        };
4916        if (procedureSequence != null) {
4917          dst.procedureSequence = new ArrayList<PositiveIntType>();
4918          for (PositiveIntType i : procedureSequence)
4919            dst.procedureSequence.add(i.copy());
4920        };
4921        if (informationSequence != null) {
4922          dst.informationSequence = new ArrayList<PositiveIntType>();
4923          for (PositiveIntType i : informationSequence)
4924            dst.informationSequence.add(i.copy());
4925        };
4926        dst.revenue = revenue == null ? null : revenue.copy();
4927        dst.category = category == null ? null : category.copy();
4928        dst.productOrService = productOrService == null ? null : productOrService.copy();
4929        dst.productOrServiceEnd = productOrServiceEnd == null ? null : productOrServiceEnd.copy();
4930        if (modifier != null) {
4931          dst.modifier = new ArrayList<CodeableConcept>();
4932          for (CodeableConcept i : modifier)
4933            dst.modifier.add(i.copy());
4934        };
4935        if (programCode != null) {
4936          dst.programCode = new ArrayList<CodeableConcept>();
4937          for (CodeableConcept i : programCode)
4938            dst.programCode.add(i.copy());
4939        };
4940        dst.serviced = serviced == null ? null : serviced.copy();
4941        dst.location = location == null ? null : location.copy();
4942        dst.patientPaid = patientPaid == null ? null : patientPaid.copy();
4943        dst.quantity = quantity == null ? null : quantity.copy();
4944        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
4945        dst.factor = factor == null ? null : factor.copy();
4946        dst.tax = tax == null ? null : tax.copy();
4947        dst.net = net == null ? null : net.copy();
4948        if (udi != null) {
4949          dst.udi = new ArrayList<Reference>();
4950          for (Reference i : udi)
4951            dst.udi.add(i.copy());
4952        };
4953        if (bodySite != null) {
4954          dst.bodySite = new ArrayList<ItemBodySiteComponent>();
4955          for (ItemBodySiteComponent i : bodySite)
4956            dst.bodySite.add(i.copy());
4957        };
4958        if (encounter != null) {
4959          dst.encounter = new ArrayList<Reference>();
4960          for (Reference i : encounter)
4961            dst.encounter.add(i.copy());
4962        };
4963        if (noteNumber != null) {
4964          dst.noteNumber = new ArrayList<PositiveIntType>();
4965          for (PositiveIntType i : noteNumber)
4966            dst.noteNumber.add(i.copy());
4967        };
4968        dst.decision = decision == null ? null : decision.copy();
4969        if (adjudication != null) {
4970          dst.adjudication = new ArrayList<AdjudicationComponent>();
4971          for (AdjudicationComponent i : adjudication)
4972            dst.adjudication.add(i.copy());
4973        };
4974        if (detail != null) {
4975          dst.detail = new ArrayList<DetailComponent>();
4976          for (DetailComponent i : detail)
4977            dst.detail.add(i.copy());
4978        };
4979      }
4980
4981      @Override
4982      public boolean equalsDeep(Base other_) {
4983        if (!super.equalsDeep(other_))
4984          return false;
4985        if (!(other_ instanceof ItemComponent))
4986          return false;
4987        ItemComponent o = (ItemComponent) other_;
4988        return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamSequence, o.careTeamSequence, true)
4989           && compareDeep(diagnosisSequence, o.diagnosisSequence, true) && compareDeep(procedureSequence, o.procedureSequence, true)
4990           && compareDeep(informationSequence, o.informationSequence, true) && compareDeep(revenue, o.revenue, true)
4991           && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
4992           && compareDeep(productOrServiceEnd, o.productOrServiceEnd, true) && compareDeep(modifier, o.modifier, true)
4993           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
4994           && compareDeep(patientPaid, o.patientPaid, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
4995           && compareDeep(factor, o.factor, true) && compareDeep(tax, o.tax, true) && compareDeep(net, o.net, true)
4996           && compareDeep(udi, o.udi, true) && compareDeep(bodySite, o.bodySite, true) && compareDeep(encounter, o.encounter, true)
4997           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(decision, o.decision, true) && compareDeep(adjudication, o.adjudication, true)
4998           && compareDeep(detail, o.detail, true);
4999      }
5000
5001      @Override
5002      public boolean equalsShallow(Base other_) {
5003        if (!super.equalsShallow(other_))
5004          return false;
5005        if (!(other_ instanceof ItemComponent))
5006          return false;
5007        ItemComponent o = (ItemComponent) other_;
5008        return compareValues(sequence, o.sequence, true) && compareValues(careTeamSequence, o.careTeamSequence, true)
5009           && compareValues(diagnosisSequence, o.diagnosisSequence, true) && compareValues(procedureSequence, o.procedureSequence, true)
5010           && compareValues(informationSequence, o.informationSequence, true) && compareValues(factor, o.factor, true)
5011           && compareValues(noteNumber, o.noteNumber, true);
5012      }
5013
5014      public boolean isEmpty() {
5015        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamSequence
5016          , diagnosisSequence, procedureSequence, informationSequence, revenue, category, productOrService
5017          , productOrServiceEnd, modifier, programCode, serviced, location, patientPaid, quantity
5018          , unitPrice, factor, tax, net, udi, bodySite, encounter, noteNumber, decision
5019          , adjudication, detail);
5020      }
5021
5022  public String fhirType() {
5023    return "ExplanationOfBenefit.item";
5024
5025  }
5026
5027  }
5028
5029    @Block()
5030    public static class ItemBodySiteComponent extends BackboneElement implements IBaseBackboneElement {
5031        /**
5032         * Physical service site on the patient (limb, tooth, etc.).
5033         */
5034        @Child(name = "site", type = {CodeableReference.class}, order=1, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5035        @Description(shortDefinition="Location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
5036        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
5037        protected List<CodeableReference> site;
5038
5039        /**
5040         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
5041         */
5042        @Child(name = "subSite", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5043        @Description(shortDefinition="Sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
5044        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
5045        protected List<CodeableConcept> subSite;
5046
5047        private static final long serialVersionUID = 1190632415L;
5048
5049    /**
5050     * Constructor
5051     */
5052      public ItemBodySiteComponent() {
5053        super();
5054      }
5055
5056    /**
5057     * Constructor
5058     */
5059      public ItemBodySiteComponent(CodeableReference site) {
5060        super();
5061        this.addSite(site);
5062      }
5063
5064        /**
5065         * @return {@link #site} (Physical service site on the patient (limb, tooth, etc.).)
5066         */
5067        public List<CodeableReference> getSite() { 
5068          if (this.site == null)
5069            this.site = new ArrayList<CodeableReference>();
5070          return this.site;
5071        }
5072
5073        /**
5074         * @return Returns a reference to <code>this</code> for easy method chaining
5075         */
5076        public ItemBodySiteComponent setSite(List<CodeableReference> theSite) { 
5077          this.site = theSite;
5078          return this;
5079        }
5080
5081        public boolean hasSite() { 
5082          if (this.site == null)
5083            return false;
5084          for (CodeableReference item : this.site)
5085            if (!item.isEmpty())
5086              return true;
5087          return false;
5088        }
5089
5090        public CodeableReference addSite() { //3
5091          CodeableReference t = new CodeableReference();
5092          if (this.site == null)
5093            this.site = new ArrayList<CodeableReference>();
5094          this.site.add(t);
5095          return t;
5096        }
5097
5098        public ItemBodySiteComponent addSite(CodeableReference t) { //3
5099          if (t == null)
5100            return this;
5101          if (this.site == null)
5102            this.site = new ArrayList<CodeableReference>();
5103          this.site.add(t);
5104          return this;
5105        }
5106
5107        /**
5108         * @return The first repetition of repeating field {@link #site}, creating it if it does not already exist {3}
5109         */
5110        public CodeableReference getSiteFirstRep() { 
5111          if (getSite().isEmpty()) {
5112            addSite();
5113          }
5114          return getSite().get(0);
5115        }
5116
5117        /**
5118         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
5119         */
5120        public List<CodeableConcept> getSubSite() { 
5121          if (this.subSite == null)
5122            this.subSite = new ArrayList<CodeableConcept>();
5123          return this.subSite;
5124        }
5125
5126        /**
5127         * @return Returns a reference to <code>this</code> for easy method chaining
5128         */
5129        public ItemBodySiteComponent setSubSite(List<CodeableConcept> theSubSite) { 
5130          this.subSite = theSubSite;
5131          return this;
5132        }
5133
5134        public boolean hasSubSite() { 
5135          if (this.subSite == null)
5136            return false;
5137          for (CodeableConcept item : this.subSite)
5138            if (!item.isEmpty())
5139              return true;
5140          return false;
5141        }
5142
5143        public CodeableConcept addSubSite() { //3
5144          CodeableConcept t = new CodeableConcept();
5145          if (this.subSite == null)
5146            this.subSite = new ArrayList<CodeableConcept>();
5147          this.subSite.add(t);
5148          return t;
5149        }
5150
5151        public ItemBodySiteComponent addSubSite(CodeableConcept t) { //3
5152          if (t == null)
5153            return this;
5154          if (this.subSite == null)
5155            this.subSite = new ArrayList<CodeableConcept>();
5156          this.subSite.add(t);
5157          return this;
5158        }
5159
5160        /**
5161         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist {3}
5162         */
5163        public CodeableConcept getSubSiteFirstRep() { 
5164          if (getSubSite().isEmpty()) {
5165            addSubSite();
5166          }
5167          return getSubSite().get(0);
5168        }
5169
5170        protected void listChildren(List<Property> children) {
5171          super.listChildren(children);
5172          children.add(new Property("site", "CodeableReference(BodyStructure)", "Physical service site on the patient (limb, tooth, etc.).", 0, java.lang.Integer.MAX_VALUE, site));
5173          children.add(new Property("subSite", "CodeableConcept", "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite));
5174        }
5175
5176        @Override
5177        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5178          switch (_hash) {
5179          case 3530567: /*site*/  return new Property("site", "CodeableReference(BodyStructure)", "Physical service site on the patient (limb, tooth, etc.).", 0, java.lang.Integer.MAX_VALUE, site);
5180          case -1868566105: /*subSite*/  return new Property("subSite", "CodeableConcept", "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite);
5181          default: return super.getNamedProperty(_hash, _name, _checkValid);
5182          }
5183
5184        }
5185
5186      @Override
5187      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5188        switch (hash) {
5189        case 3530567: /*site*/ return this.site == null ? new Base[0] : this.site.toArray(new Base[this.site.size()]); // CodeableReference
5190        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
5191        default: return super.getProperty(hash, name, checkValid);
5192        }
5193
5194      }
5195
5196      @Override
5197      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5198        switch (hash) {
5199        case 3530567: // site
5200          this.getSite().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
5201          return value;
5202        case -1868566105: // subSite
5203          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
5204          return value;
5205        default: return super.setProperty(hash, name, value);
5206        }
5207
5208      }
5209
5210      @Override
5211      public Base setProperty(String name, Base value) throws FHIRException {
5212        if (name.equals("site")) {
5213          this.getSite().add(TypeConvertor.castToCodeableReference(value));
5214        } else if (name.equals("subSite")) {
5215          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value));
5216        } else
5217          return super.setProperty(name, value);
5218        return value;
5219      }
5220
5221      @Override
5222      public Base makeProperty(int hash, String name) throws FHIRException {
5223        switch (hash) {
5224        case 3530567:  return addSite(); 
5225        case -1868566105:  return addSubSite(); 
5226        default: return super.makeProperty(hash, name);
5227        }
5228
5229      }
5230
5231      @Override
5232      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5233        switch (hash) {
5234        case 3530567: /*site*/ return new String[] {"CodeableReference"};
5235        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
5236        default: return super.getTypesForProperty(hash, name);
5237        }
5238
5239      }
5240
5241      @Override
5242      public Base addChild(String name) throws FHIRException {
5243        if (name.equals("site")) {
5244          return addSite();
5245        }
5246        else if (name.equals("subSite")) {
5247          return addSubSite();
5248        }
5249        else
5250          return super.addChild(name);
5251      }
5252
5253      public ItemBodySiteComponent copy() {
5254        ItemBodySiteComponent dst = new ItemBodySiteComponent();
5255        copyValues(dst);
5256        return dst;
5257      }
5258
5259      public void copyValues(ItemBodySiteComponent dst) {
5260        super.copyValues(dst);
5261        if (site != null) {
5262          dst.site = new ArrayList<CodeableReference>();
5263          for (CodeableReference i : site)
5264            dst.site.add(i.copy());
5265        };
5266        if (subSite != null) {
5267          dst.subSite = new ArrayList<CodeableConcept>();
5268          for (CodeableConcept i : subSite)
5269            dst.subSite.add(i.copy());
5270        };
5271      }
5272
5273      @Override
5274      public boolean equalsDeep(Base other_) {
5275        if (!super.equalsDeep(other_))
5276          return false;
5277        if (!(other_ instanceof ItemBodySiteComponent))
5278          return false;
5279        ItemBodySiteComponent o = (ItemBodySiteComponent) other_;
5280        return compareDeep(site, o.site, true) && compareDeep(subSite, o.subSite, true);
5281      }
5282
5283      @Override
5284      public boolean equalsShallow(Base other_) {
5285        if (!super.equalsShallow(other_))
5286          return false;
5287        if (!(other_ instanceof ItemBodySiteComponent))
5288          return false;
5289        ItemBodySiteComponent o = (ItemBodySiteComponent) other_;
5290        return true;
5291      }
5292
5293      public boolean isEmpty() {
5294        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(site, subSite);
5295      }
5296
5297  public String fhirType() {
5298    return "ExplanationOfBenefit.item.bodySite";
5299
5300  }
5301
5302  }
5303
5304    @Block()
5305    public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
5306        /**
5307         * A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.
5308         */
5309        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
5310        @Description(shortDefinition="Type of adjudication information", formalDefinition="A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item." )
5311        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
5312        protected CodeableConcept category;
5313
5314        /**
5315         * A code supporting the understanding of the adjudication result and explaining variance from expected amount.
5316         */
5317        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5318        @Description(shortDefinition="Explanation of adjudication outcome", formalDefinition="A code supporting the understanding of the adjudication result and explaining variance from expected amount." )
5319        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-reason")
5320        protected CodeableConcept reason;
5321
5322        /**
5323         * Monetary amount associated with the category.
5324         */
5325        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
5326        @Description(shortDefinition="Monetary amount", formalDefinition="Monetary amount associated with the category." )
5327        protected Money amount;
5328
5329        /**
5330         * A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5331         */
5332        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
5333        @Description(shortDefinition="Non-monitary value", formalDefinition="A non-monetary value associated with the category. Mutually exclusive to the amount element above." )
5334        protected DecimalType value;
5335
5336        private static final long serialVersionUID = 1559898786L;
5337
5338    /**
5339     * Constructor
5340     */
5341      public AdjudicationComponent() {
5342        super();
5343      }
5344
5345    /**
5346     * Constructor
5347     */
5348      public AdjudicationComponent(CodeableConcept category) {
5349        super();
5350        this.setCategory(category);
5351      }
5352
5353        /**
5354         * @return {@link #category} (A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.)
5355         */
5356        public CodeableConcept getCategory() { 
5357          if (this.category == null)
5358            if (Configuration.errorOnAutoCreate())
5359              throw new Error("Attempt to auto-create AdjudicationComponent.category");
5360            else if (Configuration.doAutoCreate())
5361              this.category = new CodeableConcept(); // cc
5362          return this.category;
5363        }
5364
5365        public boolean hasCategory() { 
5366          return this.category != null && !this.category.isEmpty();
5367        }
5368
5369        /**
5370         * @param value {@link #category} (A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.)
5371         */
5372        public AdjudicationComponent setCategory(CodeableConcept value) { 
5373          this.category = value;
5374          return this;
5375        }
5376
5377        /**
5378         * @return {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5379         */
5380        public CodeableConcept getReason() { 
5381          if (this.reason == null)
5382            if (Configuration.errorOnAutoCreate())
5383              throw new Error("Attempt to auto-create AdjudicationComponent.reason");
5384            else if (Configuration.doAutoCreate())
5385              this.reason = new CodeableConcept(); // cc
5386          return this.reason;
5387        }
5388
5389        public boolean hasReason() { 
5390          return this.reason != null && !this.reason.isEmpty();
5391        }
5392
5393        /**
5394         * @param value {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5395         */
5396        public AdjudicationComponent setReason(CodeableConcept value) { 
5397          this.reason = value;
5398          return this;
5399        }
5400
5401        /**
5402         * @return {@link #amount} (Monetary amount associated with the category.)
5403         */
5404        public Money getAmount() { 
5405          if (this.amount == null)
5406            if (Configuration.errorOnAutoCreate())
5407              throw new Error("Attempt to auto-create AdjudicationComponent.amount");
5408            else if (Configuration.doAutoCreate())
5409              this.amount = new Money(); // cc
5410          return this.amount;
5411        }
5412
5413        public boolean hasAmount() { 
5414          return this.amount != null && !this.amount.isEmpty();
5415        }
5416
5417        /**
5418         * @param value {@link #amount} (Monetary amount associated with the category.)
5419         */
5420        public AdjudicationComponent setAmount(Money value) { 
5421          this.amount = value;
5422          return this;
5423        }
5424
5425        /**
5426         * @return {@link #value} (A non-monetary value associated with the category. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
5427         */
5428        public DecimalType getValueElement() { 
5429          if (this.value == null)
5430            if (Configuration.errorOnAutoCreate())
5431              throw new Error("Attempt to auto-create AdjudicationComponent.value");
5432            else if (Configuration.doAutoCreate())
5433              this.value = new DecimalType(); // bb
5434          return this.value;
5435        }
5436
5437        public boolean hasValueElement() { 
5438          return this.value != null && !this.value.isEmpty();
5439        }
5440
5441        public boolean hasValue() { 
5442          return this.value != null && !this.value.isEmpty();
5443        }
5444
5445        /**
5446         * @param value {@link #value} (A non-monetary value associated with the category. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
5447         */
5448        public AdjudicationComponent setValueElement(DecimalType value) { 
5449          this.value = value;
5450          return this;
5451        }
5452
5453        /**
5454         * @return A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5455         */
5456        public BigDecimal getValue() { 
5457          return this.value == null ? null : this.value.getValue();
5458        }
5459
5460        /**
5461         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5462         */
5463        public AdjudicationComponent setValue(BigDecimal value) { 
5464          if (value == null)
5465            this.value = null;
5466          else {
5467            if (this.value == null)
5468              this.value = new DecimalType();
5469            this.value.setValue(value);
5470          }
5471          return this;
5472        }
5473
5474        /**
5475         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5476         */
5477        public AdjudicationComponent setValue(long value) { 
5478              this.value = new DecimalType();
5479            this.value.setValue(value);
5480          return this;
5481        }
5482
5483        /**
5484         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5485         */
5486        public AdjudicationComponent setValue(double value) { 
5487              this.value = new DecimalType();
5488            this.value.setValue(value);
5489          return this;
5490        }
5491
5492        protected void listChildren(List<Property> children) {
5493          super.listChildren(children);
5494          children.add(new Property("category", "CodeableConcept", "A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.", 0, 1, category));
5495          children.add(new Property("reason", "CodeableConcept", "A code supporting the understanding of the adjudication result and explaining variance from expected amount.", 0, 1, reason));
5496          children.add(new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount));
5497          children.add(new Property("value", "decimal", "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1, value));
5498        }
5499
5500        @Override
5501        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5502          switch (_hash) {
5503          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.", 0, 1, category);
5504          case -934964668: /*reason*/  return new Property("reason", "CodeableConcept", "A code supporting the understanding of the adjudication result and explaining variance from expected amount.", 0, 1, reason);
5505          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount);
5506          case 111972721: /*value*/  return new Property("value", "decimal", "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1, value);
5507          default: return super.getNamedProperty(_hash, _name, _checkValid);
5508          }
5509
5510        }
5511
5512      @Override
5513      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5514        switch (hash) {
5515        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
5516        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
5517        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
5518        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
5519        default: return super.getProperty(hash, name, checkValid);
5520        }
5521
5522      }
5523
5524      @Override
5525      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5526        switch (hash) {
5527        case 50511102: // category
5528          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5529          return value;
5530        case -934964668: // reason
5531          this.reason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5532          return value;
5533        case -1413853096: // amount
5534          this.amount = TypeConvertor.castToMoney(value); // Money
5535          return value;
5536        case 111972721: // value
5537          this.value = TypeConvertor.castToDecimal(value); // DecimalType
5538          return value;
5539        default: return super.setProperty(hash, name, value);
5540        }
5541
5542      }
5543
5544      @Override
5545      public Base setProperty(String name, Base value) throws FHIRException {
5546        if (name.equals("category")) {
5547          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5548        } else if (name.equals("reason")) {
5549          this.reason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5550        } else if (name.equals("amount")) {
5551          this.amount = TypeConvertor.castToMoney(value); // Money
5552        } else if (name.equals("value")) {
5553          this.value = TypeConvertor.castToDecimal(value); // DecimalType
5554        } else
5555          return super.setProperty(name, value);
5556        return value;
5557      }
5558
5559      @Override
5560      public Base makeProperty(int hash, String name) throws FHIRException {
5561        switch (hash) {
5562        case 50511102:  return getCategory();
5563        case -934964668:  return getReason();
5564        case -1413853096:  return getAmount();
5565        case 111972721:  return getValueElement();
5566        default: return super.makeProperty(hash, name);
5567        }
5568
5569      }
5570
5571      @Override
5572      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5573        switch (hash) {
5574        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5575        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
5576        case -1413853096: /*amount*/ return new String[] {"Money"};
5577        case 111972721: /*value*/ return new String[] {"decimal"};
5578        default: return super.getTypesForProperty(hash, name);
5579        }
5580
5581      }
5582
5583      @Override
5584      public Base addChild(String name) throws FHIRException {
5585        if (name.equals("category")) {
5586          this.category = new CodeableConcept();
5587          return this.category;
5588        }
5589        else if (name.equals("reason")) {
5590          this.reason = new CodeableConcept();
5591          return this.reason;
5592        }
5593        else if (name.equals("amount")) {
5594          this.amount = new Money();
5595          return this.amount;
5596        }
5597        else if (name.equals("value")) {
5598          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.adjudication.value");
5599        }
5600        else
5601          return super.addChild(name);
5602      }
5603
5604      public AdjudicationComponent copy() {
5605        AdjudicationComponent dst = new AdjudicationComponent();
5606        copyValues(dst);
5607        return dst;
5608      }
5609
5610      public void copyValues(AdjudicationComponent dst) {
5611        super.copyValues(dst);
5612        dst.category = category == null ? null : category.copy();
5613        dst.reason = reason == null ? null : reason.copy();
5614        dst.amount = amount == null ? null : amount.copy();
5615        dst.value = value == null ? null : value.copy();
5616      }
5617
5618      @Override
5619      public boolean equalsDeep(Base other_) {
5620        if (!super.equalsDeep(other_))
5621          return false;
5622        if (!(other_ instanceof AdjudicationComponent))
5623          return false;
5624        AdjudicationComponent o = (AdjudicationComponent) other_;
5625        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
5626           && compareDeep(value, o.value, true);
5627      }
5628
5629      @Override
5630      public boolean equalsShallow(Base other_) {
5631        if (!super.equalsShallow(other_))
5632          return false;
5633        if (!(other_ instanceof AdjudicationComponent))
5634          return false;
5635        AdjudicationComponent o = (AdjudicationComponent) other_;
5636        return compareValues(value, o.value, true);
5637      }
5638
5639      public boolean isEmpty() {
5640        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount
5641          , value);
5642      }
5643
5644  public String fhirType() {
5645    return "ExplanationOfBenefit.item.adjudication";
5646
5647  }
5648
5649  }
5650
5651    @Block()
5652    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
5653        /**
5654         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5655         */
5656        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
5657        @Description(shortDefinition="Product or service provided", formalDefinition="A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items." )
5658        protected PositiveIntType sequence;
5659
5660        /**
5661         * The type of revenue or cost center providing the product and/or service.
5662         */
5663        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5664        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
5665        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
5666        protected CodeableConcept revenue;
5667
5668        /**
5669         * Code to identify the general type of benefits under which products and services are provided.
5670         */
5671        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
5672        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
5673        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
5674        protected CodeableConcept category;
5675
5676        /**
5677         * When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.
5678         */
5679        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
5680        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used." )
5681        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
5682        protected CodeableConcept productOrService;
5683
5684        /**
5685         * This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.
5686         */
5687        @Child(name = "productOrServiceEnd", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
5688        @Description(shortDefinition="End of a range of codes", formalDefinition="This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims." )
5689        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
5690        protected CodeableConcept productOrServiceEnd;
5691
5692        /**
5693         * Item typification or modifiers codes to convey additional context for the product or service.
5694         */
5695        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5696        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
5697        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
5698        protected List<CodeableConcept> modifier;
5699
5700        /**
5701         * Identifies the program under which this may be recovered.
5702         */
5703        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5704        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
5705        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
5706        protected List<CodeableConcept> programCode;
5707
5708        /**
5709         * The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.
5710         */
5711        @Child(name = "patientPaid", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
5712        @Description(shortDefinition="Paid by the patient", formalDefinition="The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services." )
5713        protected Money patientPaid;
5714
5715        /**
5716         * The number of repetitions of a service or product.
5717         */
5718        @Child(name = "quantity", type = {Quantity.class}, order=9, min=0, max=1, modifier=false, summary=false)
5719        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
5720        protected Quantity quantity;
5721
5722        /**
5723         * If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.
5724         */
5725        @Child(name = "unitPrice", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
5726        @Description(shortDefinition="Fee, charge or cost per item", formalDefinition="If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group." )
5727        protected Money unitPrice;
5728
5729        /**
5730         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
5731         */
5732        @Child(name = "factor", type = {DecimalType.class}, order=11, min=0, max=1, modifier=false, summary=false)
5733        @Description(shortDefinition="Price scaling factor", formalDefinition="A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount." )
5734        protected DecimalType factor;
5735
5736        /**
5737         * The total of taxes applicable for this product or service.
5738         */
5739        @Child(name = "tax", type = {Money.class}, order=12, min=0, max=1, modifier=false, summary=false)
5740        @Description(shortDefinition="Total tax", formalDefinition="The total of taxes applicable for this product or service." )
5741        protected Money tax;
5742
5743        /**
5744         * The quantity times the unit price for an additional service or product or charge.
5745         */
5746        @Child(name = "net", type = {Money.class}, order=13, min=0, max=1, modifier=false, summary=false)
5747        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
5748        protected Money net;
5749
5750        /**
5751         * Unique Device Identifiers associated with this line item.
5752         */
5753        @Child(name = "udi", type = {Device.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5754        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
5755        protected List<Reference> udi;
5756
5757        /**
5758         * The numbers associated with notes below which apply to the adjudication of this item.
5759         */
5760        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5761        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
5762        protected List<PositiveIntType> noteNumber;
5763
5764        /**
5765         * The result of the claim, predetermination, or preauthorization adjudication.
5766         */
5767        @Child(name = "decision", type = {CodeableConcept.class}, order=16, min=0, max=1, modifier=false, summary=false)
5768        @Description(shortDefinition="Result of the adjudication", formalDefinition="The result of the claim, predetermination, or preauthorization adjudication." )
5769        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-decision")
5770        protected CodeableConcept decision;
5771
5772        /**
5773         * The adjudication results.
5774         */
5775        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5776        @Description(shortDefinition="Detail level adjudication details", formalDefinition="The adjudication results." )
5777        protected List<AdjudicationComponent> adjudication;
5778
5779        /**
5780         * Third-tier of goods and services.
5781         */
5782        @Child(name = "subDetail", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5783        @Description(shortDefinition="Additional items", formalDefinition="Third-tier of goods and services." )
5784        protected List<SubDetailComponent> subDetail;
5785
5786        private static final long serialVersionUID = -1135131173L;
5787
5788    /**
5789     * Constructor
5790     */
5791      public DetailComponent() {
5792        super();
5793      }
5794
5795    /**
5796     * Constructor
5797     */
5798      public DetailComponent(int sequence) {
5799        super();
5800        this.setSequence(sequence);
5801      }
5802
5803        /**
5804         * @return {@link #sequence} (A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
5805         */
5806        public PositiveIntType getSequenceElement() { 
5807          if (this.sequence == null)
5808            if (Configuration.errorOnAutoCreate())
5809              throw new Error("Attempt to auto-create DetailComponent.sequence");
5810            else if (Configuration.doAutoCreate())
5811              this.sequence = new PositiveIntType(); // bb
5812          return this.sequence;
5813        }
5814
5815        public boolean hasSequenceElement() { 
5816          return this.sequence != null && !this.sequence.isEmpty();
5817        }
5818
5819        public boolean hasSequence() { 
5820          return this.sequence != null && !this.sequence.isEmpty();
5821        }
5822
5823        /**
5824         * @param value {@link #sequence} (A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
5825         */
5826        public DetailComponent setSequenceElement(PositiveIntType value) { 
5827          this.sequence = value;
5828          return this;
5829        }
5830
5831        /**
5832         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5833         */
5834        public int getSequence() { 
5835          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
5836        }
5837
5838        /**
5839         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5840         */
5841        public DetailComponent setSequence(int value) { 
5842            if (this.sequence == null)
5843              this.sequence = new PositiveIntType();
5844            this.sequence.setValue(value);
5845          return this;
5846        }
5847
5848        /**
5849         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5850         */
5851        public CodeableConcept getRevenue() { 
5852          if (this.revenue == null)
5853            if (Configuration.errorOnAutoCreate())
5854              throw new Error("Attempt to auto-create DetailComponent.revenue");
5855            else if (Configuration.doAutoCreate())
5856              this.revenue = new CodeableConcept(); // cc
5857          return this.revenue;
5858        }
5859
5860        public boolean hasRevenue() { 
5861          return this.revenue != null && !this.revenue.isEmpty();
5862        }
5863
5864        /**
5865         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5866         */
5867        public DetailComponent setRevenue(CodeableConcept value) { 
5868          this.revenue = value;
5869          return this;
5870        }
5871
5872        /**
5873         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5874         */
5875        public CodeableConcept getCategory() { 
5876          if (this.category == null)
5877            if (Configuration.errorOnAutoCreate())
5878              throw new Error("Attempt to auto-create DetailComponent.category");
5879            else if (Configuration.doAutoCreate())
5880              this.category = new CodeableConcept(); // cc
5881          return this.category;
5882        }
5883
5884        public boolean hasCategory() { 
5885          return this.category != null && !this.category.isEmpty();
5886        }
5887
5888        /**
5889         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5890         */
5891        public DetailComponent setCategory(CodeableConcept value) { 
5892          this.category = value;
5893          return this;
5894        }
5895
5896        /**
5897         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.)
5898         */
5899        public CodeableConcept getProductOrService() { 
5900          if (this.productOrService == null)
5901            if (Configuration.errorOnAutoCreate())
5902              throw new Error("Attempt to auto-create DetailComponent.productOrService");
5903            else if (Configuration.doAutoCreate())
5904              this.productOrService = new CodeableConcept(); // cc
5905          return this.productOrService;
5906        }
5907
5908        public boolean hasProductOrService() { 
5909          return this.productOrService != null && !this.productOrService.isEmpty();
5910        }
5911
5912        /**
5913         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.)
5914         */
5915        public DetailComponent setProductOrService(CodeableConcept value) { 
5916          this.productOrService = value;
5917          return this;
5918        }
5919
5920        /**
5921         * @return {@link #productOrServiceEnd} (This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.)
5922         */
5923        public CodeableConcept getProductOrServiceEnd() { 
5924          if (this.productOrServiceEnd == null)
5925            if (Configuration.errorOnAutoCreate())
5926              throw new Error("Attempt to auto-create DetailComponent.productOrServiceEnd");
5927            else if (Configuration.doAutoCreate())
5928              this.productOrServiceEnd = new CodeableConcept(); // cc
5929          return this.productOrServiceEnd;
5930        }
5931
5932        public boolean hasProductOrServiceEnd() { 
5933          return this.productOrServiceEnd != null && !this.productOrServiceEnd.isEmpty();
5934        }
5935
5936        /**
5937         * @param value {@link #productOrServiceEnd} (This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.)
5938         */
5939        public DetailComponent setProductOrServiceEnd(CodeableConcept value) { 
5940          this.productOrServiceEnd = value;
5941          return this;
5942        }
5943
5944        /**
5945         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
5946         */
5947        public List<CodeableConcept> getModifier() { 
5948          if (this.modifier == null)
5949            this.modifier = new ArrayList<CodeableConcept>();
5950          return this.modifier;
5951        }
5952
5953        /**
5954         * @return Returns a reference to <code>this</code> for easy method chaining
5955         */
5956        public DetailComponent setModifier(List<CodeableConcept> theModifier) { 
5957          this.modifier = theModifier;
5958          return this;
5959        }
5960
5961        public boolean hasModifier() { 
5962          if (this.modifier == null)
5963            return false;
5964          for (CodeableConcept item : this.modifier)
5965            if (!item.isEmpty())
5966              return true;
5967          return false;
5968        }
5969
5970        public CodeableConcept addModifier() { //3
5971          CodeableConcept t = new CodeableConcept();
5972          if (this.modifier == null)
5973            this.modifier = new ArrayList<CodeableConcept>();
5974          this.modifier.add(t);
5975          return t;
5976        }
5977
5978        public DetailComponent addModifier(CodeableConcept t) { //3
5979          if (t == null)
5980            return this;
5981          if (this.modifier == null)
5982            this.modifier = new ArrayList<CodeableConcept>();
5983          this.modifier.add(t);
5984          return this;
5985        }
5986
5987        /**
5988         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
5989         */
5990        public CodeableConcept getModifierFirstRep() { 
5991          if (getModifier().isEmpty()) {
5992            addModifier();
5993          }
5994          return getModifier().get(0);
5995        }
5996
5997        /**
5998         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
5999         */
6000        public List<CodeableConcept> getProgramCode() { 
6001          if (this.programCode == null)
6002            this.programCode = new ArrayList<CodeableConcept>();
6003          return this.programCode;
6004        }
6005
6006        /**
6007         * @return Returns a reference to <code>this</code> for easy method chaining
6008         */
6009        public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
6010          this.programCode = theProgramCode;
6011          return this;
6012        }
6013
6014        public boolean hasProgramCode() { 
6015          if (this.programCode == null)
6016            return false;
6017          for (CodeableConcept item : this.programCode)
6018            if (!item.isEmpty())
6019              return true;
6020          return false;
6021        }
6022
6023        public CodeableConcept addProgramCode() { //3
6024          CodeableConcept t = new CodeableConcept();
6025          if (this.programCode == null)
6026            this.programCode = new ArrayList<CodeableConcept>();
6027          this.programCode.add(t);
6028          return t;
6029        }
6030
6031        public DetailComponent addProgramCode(CodeableConcept t) { //3
6032          if (t == null)
6033            return this;
6034          if (this.programCode == null)
6035            this.programCode = new ArrayList<CodeableConcept>();
6036          this.programCode.add(t);
6037          return this;
6038        }
6039
6040        /**
6041         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
6042         */
6043        public CodeableConcept getProgramCodeFirstRep() { 
6044          if (getProgramCode().isEmpty()) {
6045            addProgramCode();
6046          }
6047          return getProgramCode().get(0);
6048        }
6049
6050        /**
6051         * @return {@link #patientPaid} (The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.)
6052         */
6053        public Money getPatientPaid() { 
6054          if (this.patientPaid == null)
6055            if (Configuration.errorOnAutoCreate())
6056              throw new Error("Attempt to auto-create DetailComponent.patientPaid");
6057            else if (Configuration.doAutoCreate())
6058              this.patientPaid = new Money(); // cc
6059          return this.patientPaid;
6060        }
6061
6062        public boolean hasPatientPaid() { 
6063          return this.patientPaid != null && !this.patientPaid.isEmpty();
6064        }
6065
6066        /**
6067         * @param value {@link #patientPaid} (The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.)
6068         */
6069        public DetailComponent setPatientPaid(Money value) { 
6070          this.patientPaid = value;
6071          return this;
6072        }
6073
6074        /**
6075         * @return {@link #quantity} (The number of repetitions of a service or product.)
6076         */
6077        public Quantity getQuantity() { 
6078          if (this.quantity == null)
6079            if (Configuration.errorOnAutoCreate())
6080              throw new Error("Attempt to auto-create DetailComponent.quantity");
6081            else if (Configuration.doAutoCreate())
6082              this.quantity = new Quantity(); // cc
6083          return this.quantity;
6084        }
6085
6086        public boolean hasQuantity() { 
6087          return this.quantity != null && !this.quantity.isEmpty();
6088        }
6089
6090        /**
6091         * @param value {@link #quantity} (The number of repetitions of a service or product.)
6092         */
6093        public DetailComponent setQuantity(Quantity value) { 
6094          this.quantity = value;
6095          return this;
6096        }
6097
6098        /**
6099         * @return {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
6100         */
6101        public Money getUnitPrice() { 
6102          if (this.unitPrice == null)
6103            if (Configuration.errorOnAutoCreate())
6104              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
6105            else if (Configuration.doAutoCreate())
6106              this.unitPrice = new Money(); // cc
6107          return this.unitPrice;
6108        }
6109
6110        public boolean hasUnitPrice() { 
6111          return this.unitPrice != null && !this.unitPrice.isEmpty();
6112        }
6113
6114        /**
6115         * @param value {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
6116         */
6117        public DetailComponent setUnitPrice(Money value) { 
6118          this.unitPrice = value;
6119          return this;
6120        }
6121
6122        /**
6123         * @return {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
6124         */
6125        public DecimalType getFactorElement() { 
6126          if (this.factor == null)
6127            if (Configuration.errorOnAutoCreate())
6128              throw new Error("Attempt to auto-create DetailComponent.factor");
6129            else if (Configuration.doAutoCreate())
6130              this.factor = new DecimalType(); // bb
6131          return this.factor;
6132        }
6133
6134        public boolean hasFactorElement() { 
6135          return this.factor != null && !this.factor.isEmpty();
6136        }
6137
6138        public boolean hasFactor() { 
6139          return this.factor != null && !this.factor.isEmpty();
6140        }
6141
6142        /**
6143         * @param value {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
6144         */
6145        public DetailComponent setFactorElement(DecimalType value) { 
6146          this.factor = value;
6147          return this;
6148        }
6149
6150        /**
6151         * @return A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
6152         */
6153        public BigDecimal getFactor() { 
6154          return this.factor == null ? null : this.factor.getValue();
6155        }
6156
6157        /**
6158         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
6159         */
6160        public DetailComponent setFactor(BigDecimal value) { 
6161          if (value == null)
6162            this.factor = null;
6163          else {
6164            if (this.factor == null)
6165              this.factor = new DecimalType();
6166            this.factor.setValue(value);
6167          }
6168          return this;
6169        }
6170
6171        /**
6172         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
6173         */
6174        public DetailComponent setFactor(long value) { 
6175              this.factor = new DecimalType();
6176            this.factor.setValue(value);
6177          return this;
6178        }
6179
6180        /**
6181         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
6182         */
6183        public DetailComponent setFactor(double value) { 
6184              this.factor = new DecimalType();
6185            this.factor.setValue(value);
6186          return this;
6187        }
6188
6189        /**
6190         * @return {@link #tax} (The total of taxes applicable for this product or service.)
6191         */
6192        public Money getTax() { 
6193          if (this.tax == null)
6194            if (Configuration.errorOnAutoCreate())
6195              throw new Error("Attempt to auto-create DetailComponent.tax");
6196            else if (Configuration.doAutoCreate())
6197              this.tax = new Money(); // cc
6198          return this.tax;
6199        }
6200
6201        public boolean hasTax() { 
6202          return this.tax != null && !this.tax.isEmpty();
6203        }
6204
6205        /**
6206         * @param value {@link #tax} (The total of taxes applicable for this product or service.)
6207         */
6208        public DetailComponent setTax(Money value) { 
6209          this.tax = value;
6210          return this;
6211        }
6212
6213        /**
6214         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6215         */
6216        public Money getNet() { 
6217          if (this.net == null)
6218            if (Configuration.errorOnAutoCreate())
6219              throw new Error("Attempt to auto-create DetailComponent.net");
6220            else if (Configuration.doAutoCreate())
6221              this.net = new Money(); // cc
6222          return this.net;
6223        }
6224
6225        public boolean hasNet() { 
6226          return this.net != null && !this.net.isEmpty();
6227        }
6228
6229        /**
6230         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6231         */
6232        public DetailComponent setNet(Money value) { 
6233          this.net = value;
6234          return this;
6235        }
6236
6237        /**
6238         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
6239         */
6240        public List<Reference> getUdi() { 
6241          if (this.udi == null)
6242            this.udi = new ArrayList<Reference>();
6243          return this.udi;
6244        }
6245
6246        /**
6247         * @return Returns a reference to <code>this</code> for easy method chaining
6248         */
6249        public DetailComponent setUdi(List<Reference> theUdi) { 
6250          this.udi = theUdi;
6251          return this;
6252        }
6253
6254        public boolean hasUdi() { 
6255          if (this.udi == null)
6256            return false;
6257          for (Reference item : this.udi)
6258            if (!item.isEmpty())
6259              return true;
6260          return false;
6261        }
6262
6263        public Reference addUdi() { //3
6264          Reference t = new Reference();
6265          if (this.udi == null)
6266            this.udi = new ArrayList<Reference>();
6267          this.udi.add(t);
6268          return t;
6269        }
6270
6271        public DetailComponent addUdi(Reference t) { //3
6272          if (t == null)
6273            return this;
6274          if (this.udi == null)
6275            this.udi = new ArrayList<Reference>();
6276          this.udi.add(t);
6277          return this;
6278        }
6279
6280        /**
6281         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
6282         */
6283        public Reference getUdiFirstRep() { 
6284          if (getUdi().isEmpty()) {
6285            addUdi();
6286          }
6287          return getUdi().get(0);
6288        }
6289
6290        /**
6291         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6292         */
6293        public List<PositiveIntType> getNoteNumber() { 
6294          if (this.noteNumber == null)
6295            this.noteNumber = new ArrayList<PositiveIntType>();
6296          return this.noteNumber;
6297        }
6298
6299        /**
6300         * @return Returns a reference to <code>this</code> for easy method chaining
6301         */
6302        public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
6303          this.noteNumber = theNoteNumber;
6304          return this;
6305        }
6306
6307        public boolean hasNoteNumber() { 
6308          if (this.noteNumber == null)
6309            return false;
6310          for (PositiveIntType item : this.noteNumber)
6311            if (!item.isEmpty())
6312              return true;
6313          return false;
6314        }
6315
6316        /**
6317         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6318         */
6319        public PositiveIntType addNoteNumberElement() {//2 
6320          PositiveIntType t = new PositiveIntType();
6321          if (this.noteNumber == null)
6322            this.noteNumber = new ArrayList<PositiveIntType>();
6323          this.noteNumber.add(t);
6324          return t;
6325        }
6326
6327        /**
6328         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6329         */
6330        public DetailComponent addNoteNumber(int value) { //1
6331          PositiveIntType t = new PositiveIntType();
6332          t.setValue(value);
6333          if (this.noteNumber == null)
6334            this.noteNumber = new ArrayList<PositiveIntType>();
6335          this.noteNumber.add(t);
6336          return this;
6337        }
6338
6339        /**
6340         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6341         */
6342        public boolean hasNoteNumber(int value) { 
6343          if (this.noteNumber == null)
6344            return false;
6345          for (PositiveIntType v : this.noteNumber)
6346            if (v.getValue().equals(value)) // positiveInt
6347              return true;
6348          return false;
6349        }
6350
6351        /**
6352         * @return {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
6353         */
6354        public CodeableConcept getDecision() { 
6355          if (this.decision == null)
6356            if (Configuration.errorOnAutoCreate())
6357              throw new Error("Attempt to auto-create DetailComponent.decision");
6358            else if (Configuration.doAutoCreate())
6359              this.decision = new CodeableConcept(); // cc
6360          return this.decision;
6361        }
6362
6363        public boolean hasDecision() { 
6364          return this.decision != null && !this.decision.isEmpty();
6365        }
6366
6367        /**
6368         * @param value {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
6369         */
6370        public DetailComponent setDecision(CodeableConcept value) { 
6371          this.decision = value;
6372          return this;
6373        }
6374
6375        /**
6376         * @return {@link #adjudication} (The adjudication results.)
6377         */
6378        public List<AdjudicationComponent> getAdjudication() { 
6379          if (this.adjudication == null)
6380            this.adjudication = new ArrayList<AdjudicationComponent>();
6381          return this.adjudication;
6382        }
6383
6384        /**
6385         * @return Returns a reference to <code>this</code> for easy method chaining
6386         */
6387        public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
6388          this.adjudication = theAdjudication;
6389          return this;
6390        }
6391
6392        public boolean hasAdjudication() { 
6393          if (this.adjudication == null)
6394            return false;
6395          for (AdjudicationComponent item : this.adjudication)
6396            if (!item.isEmpty())
6397              return true;
6398          return false;
6399        }
6400
6401        public AdjudicationComponent addAdjudication() { //3
6402          AdjudicationComponent t = new AdjudicationComponent();
6403          if (this.adjudication == null)
6404            this.adjudication = new ArrayList<AdjudicationComponent>();
6405          this.adjudication.add(t);
6406          return t;
6407        }
6408
6409        public DetailComponent addAdjudication(AdjudicationComponent t) { //3
6410          if (t == null)
6411            return this;
6412          if (this.adjudication == null)
6413            this.adjudication = new ArrayList<AdjudicationComponent>();
6414          this.adjudication.add(t);
6415          return this;
6416        }
6417
6418        /**
6419         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
6420         */
6421        public AdjudicationComponent getAdjudicationFirstRep() { 
6422          if (getAdjudication().isEmpty()) {
6423            addAdjudication();
6424          }
6425          return getAdjudication().get(0);
6426        }
6427
6428        /**
6429         * @return {@link #subDetail} (Third-tier of goods and services.)
6430         */
6431        public List<SubDetailComponent> getSubDetail() { 
6432          if (this.subDetail == null)
6433            this.subDetail = new ArrayList<SubDetailComponent>();
6434          return this.subDetail;
6435        }
6436
6437        /**
6438         * @return Returns a reference to <code>this</code> for easy method chaining
6439         */
6440        public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) { 
6441          this.subDetail = theSubDetail;
6442          return this;
6443        }
6444
6445        public boolean hasSubDetail() { 
6446          if (this.subDetail == null)
6447            return false;
6448          for (SubDetailComponent item : this.subDetail)
6449            if (!item.isEmpty())
6450              return true;
6451          return false;
6452        }
6453
6454        public SubDetailComponent addSubDetail() { //3
6455          SubDetailComponent t = new SubDetailComponent();
6456          if (this.subDetail == null)
6457            this.subDetail = new ArrayList<SubDetailComponent>();
6458          this.subDetail.add(t);
6459          return t;
6460        }
6461
6462        public DetailComponent addSubDetail(SubDetailComponent t) { //3
6463          if (t == null)
6464            return this;
6465          if (this.subDetail == null)
6466            this.subDetail = new ArrayList<SubDetailComponent>();
6467          this.subDetail.add(t);
6468          return this;
6469        }
6470
6471        /**
6472         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist {3}
6473         */
6474        public SubDetailComponent getSubDetailFirstRep() { 
6475          if (getSubDetail().isEmpty()) {
6476            addSubDetail();
6477          }
6478          return getSubDetail().get(0);
6479        }
6480
6481        protected void listChildren(List<Property> children) {
6482          super.listChildren(children);
6483          children.add(new Property("sequence", "positiveInt", "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.", 0, 1, sequence));
6484          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
6485          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
6486          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.", 0, 1, productOrService));
6487          children.add(new Property("productOrServiceEnd", "CodeableConcept", "This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.", 0, 1, productOrServiceEnd));
6488          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier));
6489          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
6490          children.add(new Property("patientPaid", "Money", "The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.", 0, 1, patientPaid));
6491          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
6492          children.add(new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice));
6493          children.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor));
6494          children.add(new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax));
6495          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
6496          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
6497          children.add(new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
6498          children.add(new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision));
6499          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6500          children.add(new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
6501        }
6502
6503        @Override
6504        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6505          switch (_hash) {
6506          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.", 0, 1, sequence);
6507          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
6508          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category);
6509          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.", 0, 1, productOrService);
6510          case -717476168: /*productOrServiceEnd*/  return new Property("productOrServiceEnd", "CodeableConcept", "This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.", 0, 1, productOrServiceEnd);
6511          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier);
6512          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
6513          case 525514609: /*patientPaid*/  return new Property("patientPaid", "Money", "The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.", 0, 1, patientPaid);
6514          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
6515          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice);
6516          case -1282148017: /*factor*/  return new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor);
6517          case 114603: /*tax*/  return new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax);
6518          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
6519          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
6520          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
6521          case 565719004: /*decision*/  return new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision);
6522          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6523          case -828829007: /*subDetail*/  return new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
6524          default: return super.getNamedProperty(_hash, _name, _checkValid);
6525          }
6526
6527        }
6528
6529      @Override
6530      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6531        switch (hash) {
6532        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6533        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6534        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6535        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
6536        case -717476168: /*productOrServiceEnd*/ return this.productOrServiceEnd == null ? new Base[0] : new Base[] {this.productOrServiceEnd}; // CodeableConcept
6537        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6538        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6539        case 525514609: /*patientPaid*/ return this.patientPaid == null ? new Base[0] : new Base[] {this.patientPaid}; // Money
6540        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
6541        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6542        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6543        case 114603: /*tax*/ return this.tax == null ? new Base[0] : new Base[] {this.tax}; // Money
6544        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6545        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6546        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
6547        case 565719004: /*decision*/ return this.decision == null ? new Base[0] : new Base[] {this.decision}; // CodeableConcept
6548        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
6549        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
6550        default: return super.getProperty(hash, name, checkValid);
6551        }
6552
6553      }
6554
6555      @Override
6556      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6557        switch (hash) {
6558        case 1349547969: // sequence
6559          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
6560          return value;
6561        case 1099842588: // revenue
6562          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6563          return value;
6564        case 50511102: // category
6565          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6566          return value;
6567        case 1957227299: // productOrService
6568          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6569          return value;
6570        case -717476168: // productOrServiceEnd
6571          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6572          return value;
6573        case -615513385: // modifier
6574          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
6575          return value;
6576        case 1010065041: // programCode
6577          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
6578          return value;
6579        case 525514609: // patientPaid
6580          this.patientPaid = TypeConvertor.castToMoney(value); // Money
6581          return value;
6582        case -1285004149: // quantity
6583          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
6584          return value;
6585        case -486196699: // unitPrice
6586          this.unitPrice = TypeConvertor.castToMoney(value); // Money
6587          return value;
6588        case -1282148017: // factor
6589          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
6590          return value;
6591        case 114603: // tax
6592          this.tax = TypeConvertor.castToMoney(value); // Money
6593          return value;
6594        case 108957: // net
6595          this.net = TypeConvertor.castToMoney(value); // Money
6596          return value;
6597        case 115642: // udi
6598          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
6599          return value;
6600        case -1110033957: // noteNumber
6601          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
6602          return value;
6603        case 565719004: // decision
6604          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6605          return value;
6606        case -231349275: // adjudication
6607          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
6608          return value;
6609        case -828829007: // subDetail
6610          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
6611          return value;
6612        default: return super.setProperty(hash, name, value);
6613        }
6614
6615      }
6616
6617      @Override
6618      public Base setProperty(String name, Base value) throws FHIRException {
6619        if (name.equals("sequence")) {
6620          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
6621        } else if (name.equals("revenue")) {
6622          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6623        } else if (name.equals("category")) {
6624          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6625        } else if (name.equals("productOrService")) {
6626          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6627        } else if (name.equals("productOrServiceEnd")) {
6628          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6629        } else if (name.equals("modifier")) {
6630          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
6631        } else if (name.equals("programCode")) {
6632          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
6633        } else if (name.equals("patientPaid")) {
6634          this.patientPaid = TypeConvertor.castToMoney(value); // Money
6635        } else if (name.equals("quantity")) {
6636          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
6637        } else if (name.equals("unitPrice")) {
6638          this.unitPrice = TypeConvertor.castToMoney(value); // Money
6639        } else if (name.equals("factor")) {
6640          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
6641        } else if (name.equals("tax")) {
6642          this.tax = TypeConvertor.castToMoney(value); // Money
6643        } else if (name.equals("net")) {
6644          this.net = TypeConvertor.castToMoney(value); // Money
6645        } else if (name.equals("udi")) {
6646          this.getUdi().add(TypeConvertor.castToReference(value));
6647        } else if (name.equals("noteNumber")) {
6648          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
6649        } else if (name.equals("decision")) {
6650          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6651        } else if (name.equals("adjudication")) {
6652          this.getAdjudication().add((AdjudicationComponent) value);
6653        } else if (name.equals("subDetail")) {
6654          this.getSubDetail().add((SubDetailComponent) value);
6655        } else
6656          return super.setProperty(name, value);
6657        return value;
6658      }
6659
6660      @Override
6661      public Base makeProperty(int hash, String name) throws FHIRException {
6662        switch (hash) {
6663        case 1349547969:  return getSequenceElement();
6664        case 1099842588:  return getRevenue();
6665        case 50511102:  return getCategory();
6666        case 1957227299:  return getProductOrService();
6667        case -717476168:  return getProductOrServiceEnd();
6668        case -615513385:  return addModifier(); 
6669        case 1010065041:  return addProgramCode(); 
6670        case 525514609:  return getPatientPaid();
6671        case -1285004149:  return getQuantity();
6672        case -486196699:  return getUnitPrice();
6673        case -1282148017:  return getFactorElement();
6674        case 114603:  return getTax();
6675        case 108957:  return getNet();
6676        case 115642:  return addUdi(); 
6677        case -1110033957:  return addNoteNumberElement();
6678        case 565719004:  return getDecision();
6679        case -231349275:  return addAdjudication(); 
6680        case -828829007:  return addSubDetail(); 
6681        default: return super.makeProperty(hash, name);
6682        }
6683
6684      }
6685
6686      @Override
6687      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6688        switch (hash) {
6689        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
6690        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
6691        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
6692        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
6693        case -717476168: /*productOrServiceEnd*/ return new String[] {"CodeableConcept"};
6694        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
6695        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
6696        case 525514609: /*patientPaid*/ return new String[] {"Money"};
6697        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
6698        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6699        case -1282148017: /*factor*/ return new String[] {"decimal"};
6700        case 114603: /*tax*/ return new String[] {"Money"};
6701        case 108957: /*net*/ return new String[] {"Money"};
6702        case 115642: /*udi*/ return new String[] {"Reference"};
6703        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
6704        case 565719004: /*decision*/ return new String[] {"CodeableConcept"};
6705        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
6706        case -828829007: /*subDetail*/ return new String[] {};
6707        default: return super.getTypesForProperty(hash, name);
6708        }
6709
6710      }
6711
6712      @Override
6713      public Base addChild(String name) throws FHIRException {
6714        if (name.equals("sequence")) {
6715          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.sequence");
6716        }
6717        else if (name.equals("revenue")) {
6718          this.revenue = new CodeableConcept();
6719          return this.revenue;
6720        }
6721        else if (name.equals("category")) {
6722          this.category = new CodeableConcept();
6723          return this.category;
6724        }
6725        else if (name.equals("productOrService")) {
6726          this.productOrService = new CodeableConcept();
6727          return this.productOrService;
6728        }
6729        else if (name.equals("productOrServiceEnd")) {
6730          this.productOrServiceEnd = new CodeableConcept();
6731          return this.productOrServiceEnd;
6732        }
6733        else if (name.equals("modifier")) {
6734          return addModifier();
6735        }
6736        else if (name.equals("programCode")) {
6737          return addProgramCode();
6738        }
6739        else if (name.equals("patientPaid")) {
6740          this.patientPaid = new Money();
6741          return this.patientPaid;
6742        }
6743        else if (name.equals("quantity")) {
6744          this.quantity = new Quantity();
6745          return this.quantity;
6746        }
6747        else if (name.equals("unitPrice")) {
6748          this.unitPrice = new Money();
6749          return this.unitPrice;
6750        }
6751        else if (name.equals("factor")) {
6752          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.factor");
6753        }
6754        else if (name.equals("tax")) {
6755          this.tax = new Money();
6756          return this.tax;
6757        }
6758        else if (name.equals("net")) {
6759          this.net = new Money();
6760          return this.net;
6761        }
6762        else if (name.equals("udi")) {
6763          return addUdi();
6764        }
6765        else if (name.equals("noteNumber")) {
6766          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.noteNumber");
6767        }
6768        else if (name.equals("decision")) {
6769          this.decision = new CodeableConcept();
6770          return this.decision;
6771        }
6772        else if (name.equals("adjudication")) {
6773          return addAdjudication();
6774        }
6775        else if (name.equals("subDetail")) {
6776          return addSubDetail();
6777        }
6778        else
6779          return super.addChild(name);
6780      }
6781
6782      public DetailComponent copy() {
6783        DetailComponent dst = new DetailComponent();
6784        copyValues(dst);
6785        return dst;
6786      }
6787
6788      public void copyValues(DetailComponent dst) {
6789        super.copyValues(dst);
6790        dst.sequence = sequence == null ? null : sequence.copy();
6791        dst.revenue = revenue == null ? null : revenue.copy();
6792        dst.category = category == null ? null : category.copy();
6793        dst.productOrService = productOrService == null ? null : productOrService.copy();
6794        dst.productOrServiceEnd = productOrServiceEnd == null ? null : productOrServiceEnd.copy();
6795        if (modifier != null) {
6796          dst.modifier = new ArrayList<CodeableConcept>();
6797          for (CodeableConcept i : modifier)
6798            dst.modifier.add(i.copy());
6799        };
6800        if (programCode != null) {
6801          dst.programCode = new ArrayList<CodeableConcept>();
6802          for (CodeableConcept i : programCode)
6803            dst.programCode.add(i.copy());
6804        };
6805        dst.patientPaid = patientPaid == null ? null : patientPaid.copy();
6806        dst.quantity = quantity == null ? null : quantity.copy();
6807        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6808        dst.factor = factor == null ? null : factor.copy();
6809        dst.tax = tax == null ? null : tax.copy();
6810        dst.net = net == null ? null : net.copy();
6811        if (udi != null) {
6812          dst.udi = new ArrayList<Reference>();
6813          for (Reference i : udi)
6814            dst.udi.add(i.copy());
6815        };
6816        if (noteNumber != null) {
6817          dst.noteNumber = new ArrayList<PositiveIntType>();
6818          for (PositiveIntType i : noteNumber)
6819            dst.noteNumber.add(i.copy());
6820        };
6821        dst.decision = decision == null ? null : decision.copy();
6822        if (adjudication != null) {
6823          dst.adjudication = new ArrayList<AdjudicationComponent>();
6824          for (AdjudicationComponent i : adjudication)
6825            dst.adjudication.add(i.copy());
6826        };
6827        if (subDetail != null) {
6828          dst.subDetail = new ArrayList<SubDetailComponent>();
6829          for (SubDetailComponent i : subDetail)
6830            dst.subDetail.add(i.copy());
6831        };
6832      }
6833
6834      @Override
6835      public boolean equalsDeep(Base other_) {
6836        if (!super.equalsDeep(other_))
6837          return false;
6838        if (!(other_ instanceof DetailComponent))
6839          return false;
6840        DetailComponent o = (DetailComponent) other_;
6841        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
6842           && compareDeep(productOrService, o.productOrService, true) && compareDeep(productOrServiceEnd, o.productOrServiceEnd, true)
6843           && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true) && compareDeep(patientPaid, o.patientPaid, true)
6844           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
6845           && compareDeep(tax, o.tax, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6846           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(decision, o.decision, true) && compareDeep(adjudication, o.adjudication, true)
6847           && compareDeep(subDetail, o.subDetail, true);
6848      }
6849
6850      @Override
6851      public boolean equalsShallow(Base other_) {
6852        if (!super.equalsShallow(other_))
6853          return false;
6854        if (!(other_ instanceof DetailComponent))
6855          return false;
6856        DetailComponent o = (DetailComponent) other_;
6857        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
6858          ;
6859      }
6860
6861      public boolean isEmpty() {
6862        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
6863          , productOrService, productOrServiceEnd, modifier, programCode, patientPaid, quantity
6864          , unitPrice, factor, tax, net, udi, noteNumber, decision, adjudication, subDetail
6865          );
6866      }
6867
6868  public String fhirType() {
6869    return "ExplanationOfBenefit.item.detail";
6870
6871  }
6872
6873  }
6874
6875    @Block()
6876    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
6877        /**
6878         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6879         */
6880        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
6881        @Description(shortDefinition="Product or service provided", formalDefinition="A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items." )
6882        protected PositiveIntType sequence;
6883
6884        /**
6885         * The type of revenue or cost center providing the product and/or service.
6886         */
6887        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
6888        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
6889        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
6890        protected CodeableConcept revenue;
6891
6892        /**
6893         * Code to identify the general type of benefits under which products and services are provided.
6894         */
6895        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
6896        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
6897        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
6898        protected CodeableConcept category;
6899
6900        /**
6901         * When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.
6902         */
6903        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
6904        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used." )
6905        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6906        protected CodeableConcept productOrService;
6907
6908        /**
6909         * This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.
6910         */
6911        @Child(name = "productOrServiceEnd", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
6912        @Description(shortDefinition="End of a range of codes", formalDefinition="This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims." )
6913        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6914        protected CodeableConcept productOrServiceEnd;
6915
6916        /**
6917         * Item typification or modifiers codes to convey additional context for the product or service.
6918         */
6919        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6920        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
6921        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
6922        protected List<CodeableConcept> modifier;
6923
6924        /**
6925         * Identifies the program under which this may be recovered.
6926         */
6927        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6928        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
6929        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
6930        protected List<CodeableConcept> programCode;
6931
6932        /**
6933         * The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.
6934         */
6935        @Child(name = "patientPaid", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
6936        @Description(shortDefinition="Paid by the patient", formalDefinition="The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services." )
6937        protected Money patientPaid;
6938
6939        /**
6940         * The number of repetitions of a service or product.
6941         */
6942        @Child(name = "quantity", type = {Quantity.class}, order=9, min=0, max=1, modifier=false, summary=false)
6943        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
6944        protected Quantity quantity;
6945
6946        /**
6947         * If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.
6948         */
6949        @Child(name = "unitPrice", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
6950        @Description(shortDefinition="Fee, charge or cost per item", formalDefinition="If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group." )
6951        protected Money unitPrice;
6952
6953        /**
6954         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
6955         */
6956        @Child(name = "factor", type = {DecimalType.class}, order=11, min=0, max=1, modifier=false, summary=false)
6957        @Description(shortDefinition="Price scaling factor", formalDefinition="A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount." )
6958        protected DecimalType factor;
6959
6960        /**
6961         * The total of taxes applicable for this product or service.
6962         */
6963        @Child(name = "tax", type = {Money.class}, order=12, min=0, max=1, modifier=false, summary=false)
6964        @Description(shortDefinition="Total tax", formalDefinition="The total of taxes applicable for this product or service." )
6965        protected Money tax;
6966
6967        /**
6968         * The quantity times the unit price for an additional service or product or charge.
6969         */
6970        @Child(name = "net", type = {Money.class}, order=13, min=0, max=1, modifier=false, summary=false)
6971        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
6972        protected Money net;
6973
6974        /**
6975         * Unique Device Identifiers associated with this line item.
6976         */
6977        @Child(name = "udi", type = {Device.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6978        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
6979        protected List<Reference> udi;
6980
6981        /**
6982         * The numbers associated with notes below which apply to the adjudication of this item.
6983         */
6984        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6985        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
6986        protected List<PositiveIntType> noteNumber;
6987
6988        /**
6989         * The result of the claim, predetermination, or preauthorization adjudication.
6990         */
6991        @Child(name = "decision", type = {CodeableConcept.class}, order=16, min=0, max=1, modifier=false, summary=false)
6992        @Description(shortDefinition="Result of the adjudication", formalDefinition="The result of the claim, predetermination, or preauthorization adjudication." )
6993        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-decision")
6994        protected CodeableConcept decision;
6995
6996        /**
6997         * The adjudication results.
6998         */
6999        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7000        @Description(shortDefinition="Subdetail level adjudication details", formalDefinition="The adjudication results." )
7001        protected List<AdjudicationComponent> adjudication;
7002
7003        private static final long serialVersionUID = 971869062L;
7004
7005    /**
7006     * Constructor
7007     */
7008      public SubDetailComponent() {
7009        super();
7010      }
7011
7012    /**
7013     * Constructor
7014     */
7015      public SubDetailComponent(int sequence) {
7016        super();
7017        this.setSequence(sequence);
7018      }
7019
7020        /**
7021         * @return {@link #sequence} (A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
7022         */
7023        public PositiveIntType getSequenceElement() { 
7024          if (this.sequence == null)
7025            if (Configuration.errorOnAutoCreate())
7026              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
7027            else if (Configuration.doAutoCreate())
7028              this.sequence = new PositiveIntType(); // bb
7029          return this.sequence;
7030        }
7031
7032        public boolean hasSequenceElement() { 
7033          return this.sequence != null && !this.sequence.isEmpty();
7034        }
7035
7036        public boolean hasSequence() { 
7037          return this.sequence != null && !this.sequence.isEmpty();
7038        }
7039
7040        /**
7041         * @param value {@link #sequence} (A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
7042         */
7043        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
7044          this.sequence = value;
7045          return this;
7046        }
7047
7048        /**
7049         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
7050         */
7051        public int getSequence() { 
7052          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
7053        }
7054
7055        /**
7056         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
7057         */
7058        public SubDetailComponent setSequence(int value) { 
7059            if (this.sequence == null)
7060              this.sequence = new PositiveIntType();
7061            this.sequence.setValue(value);
7062          return this;
7063        }
7064
7065        /**
7066         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
7067         */
7068        public CodeableConcept getRevenue() { 
7069          if (this.revenue == null)
7070            if (Configuration.errorOnAutoCreate())
7071              throw new Error("Attempt to auto-create SubDetailComponent.revenue");
7072            else if (Configuration.doAutoCreate())
7073              this.revenue = new CodeableConcept(); // cc
7074          return this.revenue;
7075        }
7076
7077        public boolean hasRevenue() { 
7078          return this.revenue != null && !this.revenue.isEmpty();
7079        }
7080
7081        /**
7082         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
7083         */
7084        public SubDetailComponent setRevenue(CodeableConcept value) { 
7085          this.revenue = value;
7086          return this;
7087        }
7088
7089        /**
7090         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
7091         */
7092        public CodeableConcept getCategory() { 
7093          if (this.category == null)
7094            if (Configuration.errorOnAutoCreate())
7095              throw new Error("Attempt to auto-create SubDetailComponent.category");
7096            else if (Configuration.doAutoCreate())
7097              this.category = new CodeableConcept(); // cc
7098          return this.category;
7099        }
7100
7101        public boolean hasCategory() { 
7102          return this.category != null && !this.category.isEmpty();
7103        }
7104
7105        /**
7106         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
7107         */
7108        public SubDetailComponent setCategory(CodeableConcept value) { 
7109          this.category = value;
7110          return this;
7111        }
7112
7113        /**
7114         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.)
7115         */
7116        public CodeableConcept getProductOrService() { 
7117          if (this.productOrService == null)
7118            if (Configuration.errorOnAutoCreate())
7119              throw new Error("Attempt to auto-create SubDetailComponent.productOrService");
7120            else if (Configuration.doAutoCreate())
7121              this.productOrService = new CodeableConcept(); // cc
7122          return this.productOrService;
7123        }
7124
7125        public boolean hasProductOrService() { 
7126          return this.productOrService != null && !this.productOrService.isEmpty();
7127        }
7128
7129        /**
7130         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.)
7131         */
7132        public SubDetailComponent setProductOrService(CodeableConcept value) { 
7133          this.productOrService = value;
7134          return this;
7135        }
7136
7137        /**
7138         * @return {@link #productOrServiceEnd} (This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.)
7139         */
7140        public CodeableConcept getProductOrServiceEnd() { 
7141          if (this.productOrServiceEnd == null)
7142            if (Configuration.errorOnAutoCreate())
7143              throw new Error("Attempt to auto-create SubDetailComponent.productOrServiceEnd");
7144            else if (Configuration.doAutoCreate())
7145              this.productOrServiceEnd = new CodeableConcept(); // cc
7146          return this.productOrServiceEnd;
7147        }
7148
7149        public boolean hasProductOrServiceEnd() { 
7150          return this.productOrServiceEnd != null && !this.productOrServiceEnd.isEmpty();
7151        }
7152
7153        /**
7154         * @param value {@link #productOrServiceEnd} (This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.)
7155         */
7156        public SubDetailComponent setProductOrServiceEnd(CodeableConcept value) { 
7157          this.productOrServiceEnd = value;
7158          return this;
7159        }
7160
7161        /**
7162         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
7163         */
7164        public List<CodeableConcept> getModifier() { 
7165          if (this.modifier == null)
7166            this.modifier = new ArrayList<CodeableConcept>();
7167          return this.modifier;
7168        }
7169
7170        /**
7171         * @return Returns a reference to <code>this</code> for easy method chaining
7172         */
7173        public SubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
7174          this.modifier = theModifier;
7175          return this;
7176        }
7177
7178        public boolean hasModifier() { 
7179          if (this.modifier == null)
7180            return false;
7181          for (CodeableConcept item : this.modifier)
7182            if (!item.isEmpty())
7183              return true;
7184          return false;
7185        }
7186
7187        public CodeableConcept addModifier() { //3
7188          CodeableConcept t = new CodeableConcept();
7189          if (this.modifier == null)
7190            this.modifier = new ArrayList<CodeableConcept>();
7191          this.modifier.add(t);
7192          return t;
7193        }
7194
7195        public SubDetailComponent addModifier(CodeableConcept t) { //3
7196          if (t == null)
7197            return this;
7198          if (this.modifier == null)
7199            this.modifier = new ArrayList<CodeableConcept>();
7200          this.modifier.add(t);
7201          return this;
7202        }
7203
7204        /**
7205         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
7206         */
7207        public CodeableConcept getModifierFirstRep() { 
7208          if (getModifier().isEmpty()) {
7209            addModifier();
7210          }
7211          return getModifier().get(0);
7212        }
7213
7214        /**
7215         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
7216         */
7217        public List<CodeableConcept> getProgramCode() { 
7218          if (this.programCode == null)
7219            this.programCode = new ArrayList<CodeableConcept>();
7220          return this.programCode;
7221        }
7222
7223        /**
7224         * @return Returns a reference to <code>this</code> for easy method chaining
7225         */
7226        public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
7227          this.programCode = theProgramCode;
7228          return this;
7229        }
7230
7231        public boolean hasProgramCode() { 
7232          if (this.programCode == null)
7233            return false;
7234          for (CodeableConcept item : this.programCode)
7235            if (!item.isEmpty())
7236              return true;
7237          return false;
7238        }
7239
7240        public CodeableConcept addProgramCode() { //3
7241          CodeableConcept t = new CodeableConcept();
7242          if (this.programCode == null)
7243            this.programCode = new ArrayList<CodeableConcept>();
7244          this.programCode.add(t);
7245          return t;
7246        }
7247
7248        public SubDetailComponent addProgramCode(CodeableConcept t) { //3
7249          if (t == null)
7250            return this;
7251          if (this.programCode == null)
7252            this.programCode = new ArrayList<CodeableConcept>();
7253          this.programCode.add(t);
7254          return this;
7255        }
7256
7257        /**
7258         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
7259         */
7260        public CodeableConcept getProgramCodeFirstRep() { 
7261          if (getProgramCode().isEmpty()) {
7262            addProgramCode();
7263          }
7264          return getProgramCode().get(0);
7265        }
7266
7267        /**
7268         * @return {@link #patientPaid} (The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.)
7269         */
7270        public Money getPatientPaid() { 
7271          if (this.patientPaid == null)
7272            if (Configuration.errorOnAutoCreate())
7273              throw new Error("Attempt to auto-create SubDetailComponent.patientPaid");
7274            else if (Configuration.doAutoCreate())
7275              this.patientPaid = new Money(); // cc
7276          return this.patientPaid;
7277        }
7278
7279        public boolean hasPatientPaid() { 
7280          return this.patientPaid != null && !this.patientPaid.isEmpty();
7281        }
7282
7283        /**
7284         * @param value {@link #patientPaid} (The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.)
7285         */
7286        public SubDetailComponent setPatientPaid(Money value) { 
7287          this.patientPaid = value;
7288          return this;
7289        }
7290
7291        /**
7292         * @return {@link #quantity} (The number of repetitions of a service or product.)
7293         */
7294        public Quantity getQuantity() { 
7295          if (this.quantity == null)
7296            if (Configuration.errorOnAutoCreate())
7297              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
7298            else if (Configuration.doAutoCreate())
7299              this.quantity = new Quantity(); // cc
7300          return this.quantity;
7301        }
7302
7303        public boolean hasQuantity() { 
7304          return this.quantity != null && !this.quantity.isEmpty();
7305        }
7306
7307        /**
7308         * @param value {@link #quantity} (The number of repetitions of a service or product.)
7309         */
7310        public SubDetailComponent setQuantity(Quantity value) { 
7311          this.quantity = value;
7312          return this;
7313        }
7314
7315        /**
7316         * @return {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
7317         */
7318        public Money getUnitPrice() { 
7319          if (this.unitPrice == null)
7320            if (Configuration.errorOnAutoCreate())
7321              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
7322            else if (Configuration.doAutoCreate())
7323              this.unitPrice = new Money(); // cc
7324          return this.unitPrice;
7325        }
7326
7327        public boolean hasUnitPrice() { 
7328          return this.unitPrice != null && !this.unitPrice.isEmpty();
7329        }
7330
7331        /**
7332         * @param value {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
7333         */
7334        public SubDetailComponent setUnitPrice(Money value) { 
7335          this.unitPrice = value;
7336          return this;
7337        }
7338
7339        /**
7340         * @return {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
7341         */
7342        public DecimalType getFactorElement() { 
7343          if (this.factor == null)
7344            if (Configuration.errorOnAutoCreate())
7345              throw new Error("Attempt to auto-create SubDetailComponent.factor");
7346            else if (Configuration.doAutoCreate())
7347              this.factor = new DecimalType(); // bb
7348          return this.factor;
7349        }
7350
7351        public boolean hasFactorElement() { 
7352          return this.factor != null && !this.factor.isEmpty();
7353        }
7354
7355        public boolean hasFactor() { 
7356          return this.factor != null && !this.factor.isEmpty();
7357        }
7358
7359        /**
7360         * @param value {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
7361         */
7362        public SubDetailComponent setFactorElement(DecimalType value) { 
7363          this.factor = value;
7364          return this;
7365        }
7366
7367        /**
7368         * @return A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
7369         */
7370        public BigDecimal getFactor() { 
7371          return this.factor == null ? null : this.factor.getValue();
7372        }
7373
7374        /**
7375         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
7376         */
7377        public SubDetailComponent setFactor(BigDecimal value) { 
7378          if (value == null)
7379            this.factor = null;
7380          else {
7381            if (this.factor == null)
7382              this.factor = new DecimalType();
7383            this.factor.setValue(value);
7384          }
7385          return this;
7386        }
7387
7388        /**
7389         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
7390         */
7391        public SubDetailComponent setFactor(long value) { 
7392              this.factor = new DecimalType();
7393            this.factor.setValue(value);
7394          return this;
7395        }
7396
7397        /**
7398         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
7399         */
7400        public SubDetailComponent setFactor(double value) { 
7401              this.factor = new DecimalType();
7402            this.factor.setValue(value);
7403          return this;
7404        }
7405
7406        /**
7407         * @return {@link #tax} (The total of taxes applicable for this product or service.)
7408         */
7409        public Money getTax() { 
7410          if (this.tax == null)
7411            if (Configuration.errorOnAutoCreate())
7412              throw new Error("Attempt to auto-create SubDetailComponent.tax");
7413            else if (Configuration.doAutoCreate())
7414              this.tax = new Money(); // cc
7415          return this.tax;
7416        }
7417
7418        public boolean hasTax() { 
7419          return this.tax != null && !this.tax.isEmpty();
7420        }
7421
7422        /**
7423         * @param value {@link #tax} (The total of taxes applicable for this product or service.)
7424         */
7425        public SubDetailComponent setTax(Money value) { 
7426          this.tax = value;
7427          return this;
7428        }
7429
7430        /**
7431         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
7432         */
7433        public Money getNet() { 
7434          if (this.net == null)
7435            if (Configuration.errorOnAutoCreate())
7436              throw new Error("Attempt to auto-create SubDetailComponent.net");
7437            else if (Configuration.doAutoCreate())
7438              this.net = new Money(); // cc
7439          return this.net;
7440        }
7441
7442        public boolean hasNet() { 
7443          return this.net != null && !this.net.isEmpty();
7444        }
7445
7446        /**
7447         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
7448         */
7449        public SubDetailComponent setNet(Money value) { 
7450          this.net = value;
7451          return this;
7452        }
7453
7454        /**
7455         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
7456         */
7457        public List<Reference> getUdi() { 
7458          if (this.udi == null)
7459            this.udi = new ArrayList<Reference>();
7460          return this.udi;
7461        }
7462
7463        /**
7464         * @return Returns a reference to <code>this</code> for easy method chaining
7465         */
7466        public SubDetailComponent setUdi(List<Reference> theUdi) { 
7467          this.udi = theUdi;
7468          return this;
7469        }
7470
7471        public boolean hasUdi() { 
7472          if (this.udi == null)
7473            return false;
7474          for (Reference item : this.udi)
7475            if (!item.isEmpty())
7476              return true;
7477          return false;
7478        }
7479
7480        public Reference addUdi() { //3
7481          Reference t = new Reference();
7482          if (this.udi == null)
7483            this.udi = new ArrayList<Reference>();
7484          this.udi.add(t);
7485          return t;
7486        }
7487
7488        public SubDetailComponent addUdi(Reference t) { //3
7489          if (t == null)
7490            return this;
7491          if (this.udi == null)
7492            this.udi = new ArrayList<Reference>();
7493          this.udi.add(t);
7494          return this;
7495        }
7496
7497        /**
7498         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
7499         */
7500        public Reference getUdiFirstRep() { 
7501          if (getUdi().isEmpty()) {
7502            addUdi();
7503          }
7504          return getUdi().get(0);
7505        }
7506
7507        /**
7508         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7509         */
7510        public List<PositiveIntType> getNoteNumber() { 
7511          if (this.noteNumber == null)
7512            this.noteNumber = new ArrayList<PositiveIntType>();
7513          return this.noteNumber;
7514        }
7515
7516        /**
7517         * @return Returns a reference to <code>this</code> for easy method chaining
7518         */
7519        public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
7520          this.noteNumber = theNoteNumber;
7521          return this;
7522        }
7523
7524        public boolean hasNoteNumber() { 
7525          if (this.noteNumber == null)
7526            return false;
7527          for (PositiveIntType item : this.noteNumber)
7528            if (!item.isEmpty())
7529              return true;
7530          return false;
7531        }
7532
7533        /**
7534         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7535         */
7536        public PositiveIntType addNoteNumberElement() {//2 
7537          PositiveIntType t = new PositiveIntType();
7538          if (this.noteNumber == null)
7539            this.noteNumber = new ArrayList<PositiveIntType>();
7540          this.noteNumber.add(t);
7541          return t;
7542        }
7543
7544        /**
7545         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7546         */
7547        public SubDetailComponent addNoteNumber(int value) { //1
7548          PositiveIntType t = new PositiveIntType();
7549          t.setValue(value);
7550          if (this.noteNumber == null)
7551            this.noteNumber = new ArrayList<PositiveIntType>();
7552          this.noteNumber.add(t);
7553          return this;
7554        }
7555
7556        /**
7557         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7558         */
7559        public boolean hasNoteNumber(int value) { 
7560          if (this.noteNumber == null)
7561            return false;
7562          for (PositiveIntType v : this.noteNumber)
7563            if (v.getValue().equals(value)) // positiveInt
7564              return true;
7565          return false;
7566        }
7567
7568        /**
7569         * @return {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
7570         */
7571        public CodeableConcept getDecision() { 
7572          if (this.decision == null)
7573            if (Configuration.errorOnAutoCreate())
7574              throw new Error("Attempt to auto-create SubDetailComponent.decision");
7575            else if (Configuration.doAutoCreate())
7576              this.decision = new CodeableConcept(); // cc
7577          return this.decision;
7578        }
7579
7580        public boolean hasDecision() { 
7581          return this.decision != null && !this.decision.isEmpty();
7582        }
7583
7584        /**
7585         * @param value {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
7586         */
7587        public SubDetailComponent setDecision(CodeableConcept value) { 
7588          this.decision = value;
7589          return this;
7590        }
7591
7592        /**
7593         * @return {@link #adjudication} (The adjudication results.)
7594         */
7595        public List<AdjudicationComponent> getAdjudication() { 
7596          if (this.adjudication == null)
7597            this.adjudication = new ArrayList<AdjudicationComponent>();
7598          return this.adjudication;
7599        }
7600
7601        /**
7602         * @return Returns a reference to <code>this</code> for easy method chaining
7603         */
7604        public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
7605          this.adjudication = theAdjudication;
7606          return this;
7607        }
7608
7609        public boolean hasAdjudication() { 
7610          if (this.adjudication == null)
7611            return false;
7612          for (AdjudicationComponent item : this.adjudication)
7613            if (!item.isEmpty())
7614              return true;
7615          return false;
7616        }
7617
7618        public AdjudicationComponent addAdjudication() { //3
7619          AdjudicationComponent t = new AdjudicationComponent();
7620          if (this.adjudication == null)
7621            this.adjudication = new ArrayList<AdjudicationComponent>();
7622          this.adjudication.add(t);
7623          return t;
7624        }
7625
7626        public SubDetailComponent addAdjudication(AdjudicationComponent t) { //3
7627          if (t == null)
7628            return this;
7629          if (this.adjudication == null)
7630            this.adjudication = new ArrayList<AdjudicationComponent>();
7631          this.adjudication.add(t);
7632          return this;
7633        }
7634
7635        /**
7636         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
7637         */
7638        public AdjudicationComponent getAdjudicationFirstRep() { 
7639          if (getAdjudication().isEmpty()) {
7640            addAdjudication();
7641          }
7642          return getAdjudication().get(0);
7643        }
7644
7645        protected void listChildren(List<Property> children) {
7646          super.listChildren(children);
7647          children.add(new Property("sequence", "positiveInt", "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.", 0, 1, sequence));
7648          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
7649          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
7650          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.", 0, 1, productOrService));
7651          children.add(new Property("productOrServiceEnd", "CodeableConcept", "This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.", 0, 1, productOrServiceEnd));
7652          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier));
7653          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
7654          children.add(new Property("patientPaid", "Money", "The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.", 0, 1, patientPaid));
7655          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
7656          children.add(new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice));
7657          children.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor));
7658          children.add(new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax));
7659          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
7660          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
7661          children.add(new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
7662          children.add(new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision));
7663          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
7664        }
7665
7666        @Override
7667        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7668          switch (_hash) {
7669          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.", 0, 1, sequence);
7670          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
7671          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category);
7672          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.", 0, 1, productOrService);
7673          case -717476168: /*productOrServiceEnd*/  return new Property("productOrServiceEnd", "CodeableConcept", "This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.", 0, 1, productOrServiceEnd);
7674          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier);
7675          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
7676          case 525514609: /*patientPaid*/  return new Property("patientPaid", "Money", "The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.", 0, 1, patientPaid);
7677          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
7678          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice);
7679          case -1282148017: /*factor*/  return new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor);
7680          case 114603: /*tax*/  return new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax);
7681          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
7682          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
7683          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
7684          case 565719004: /*decision*/  return new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision);
7685          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
7686          default: return super.getNamedProperty(_hash, _name, _checkValid);
7687          }
7688
7689        }
7690
7691      @Override
7692      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7693        switch (hash) {
7694        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
7695        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
7696        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
7697        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
7698        case -717476168: /*productOrServiceEnd*/ return this.productOrServiceEnd == null ? new Base[0] : new Base[] {this.productOrServiceEnd}; // CodeableConcept
7699        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7700        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
7701        case 525514609: /*patientPaid*/ return this.patientPaid == null ? new Base[0] : new Base[] {this.patientPaid}; // Money
7702        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
7703        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
7704        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
7705        case 114603: /*tax*/ return this.tax == null ? new Base[0] : new Base[] {this.tax}; // Money
7706        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
7707        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
7708        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7709        case 565719004: /*decision*/ return this.decision == null ? new Base[0] : new Base[] {this.decision}; // CodeableConcept
7710        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7711        default: return super.getProperty(hash, name, checkValid);
7712        }
7713
7714      }
7715
7716      @Override
7717      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7718        switch (hash) {
7719        case 1349547969: // sequence
7720          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
7721          return value;
7722        case 1099842588: // revenue
7723          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7724          return value;
7725        case 50511102: // category
7726          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7727          return value;
7728        case 1957227299: // productOrService
7729          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7730          return value;
7731        case -717476168: // productOrServiceEnd
7732          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7733          return value;
7734        case -615513385: // modifier
7735          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
7736          return value;
7737        case 1010065041: // programCode
7738          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
7739          return value;
7740        case 525514609: // patientPaid
7741          this.patientPaid = TypeConvertor.castToMoney(value); // Money
7742          return value;
7743        case -1285004149: // quantity
7744          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
7745          return value;
7746        case -486196699: // unitPrice
7747          this.unitPrice = TypeConvertor.castToMoney(value); // Money
7748          return value;
7749        case -1282148017: // factor
7750          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
7751          return value;
7752        case 114603: // tax
7753          this.tax = TypeConvertor.castToMoney(value); // Money
7754          return value;
7755        case 108957: // net
7756          this.net = TypeConvertor.castToMoney(value); // Money
7757          return value;
7758        case 115642: // udi
7759          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
7760          return value;
7761        case -1110033957: // noteNumber
7762          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
7763          return value;
7764        case 565719004: // decision
7765          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7766          return value;
7767        case -231349275: // adjudication
7768          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7769          return value;
7770        default: return super.setProperty(hash, name, value);
7771        }
7772
7773      }
7774
7775      @Override
7776      public Base setProperty(String name, Base value) throws FHIRException {
7777        if (name.equals("sequence")) {
7778          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
7779        } else if (name.equals("revenue")) {
7780          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7781        } else if (name.equals("category")) {
7782          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7783        } else if (name.equals("productOrService")) {
7784          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7785        } else if (name.equals("productOrServiceEnd")) {
7786          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7787        } else if (name.equals("modifier")) {
7788          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
7789        } else if (name.equals("programCode")) {
7790          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
7791        } else if (name.equals("patientPaid")) {
7792          this.patientPaid = TypeConvertor.castToMoney(value); // Money
7793        } else if (name.equals("quantity")) {
7794          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
7795        } else if (name.equals("unitPrice")) {
7796          this.unitPrice = TypeConvertor.castToMoney(value); // Money
7797        } else if (name.equals("factor")) {
7798          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
7799        } else if (name.equals("tax")) {
7800          this.tax = TypeConvertor.castToMoney(value); // Money
7801        } else if (name.equals("net")) {
7802          this.net = TypeConvertor.castToMoney(value); // Money
7803        } else if (name.equals("udi")) {
7804          this.getUdi().add(TypeConvertor.castToReference(value));
7805        } else if (name.equals("noteNumber")) {
7806          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
7807        } else if (name.equals("decision")) {
7808          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7809        } else if (name.equals("adjudication")) {
7810          this.getAdjudication().add((AdjudicationComponent) value);
7811        } else
7812          return super.setProperty(name, value);
7813        return value;
7814      }
7815
7816      @Override
7817      public Base makeProperty(int hash, String name) throws FHIRException {
7818        switch (hash) {
7819        case 1349547969:  return getSequenceElement();
7820        case 1099842588:  return getRevenue();
7821        case 50511102:  return getCategory();
7822        case 1957227299:  return getProductOrService();
7823        case -717476168:  return getProductOrServiceEnd();
7824        case -615513385:  return addModifier(); 
7825        case 1010065041:  return addProgramCode(); 
7826        case 525514609:  return getPatientPaid();
7827        case -1285004149:  return getQuantity();
7828        case -486196699:  return getUnitPrice();
7829        case -1282148017:  return getFactorElement();
7830        case 114603:  return getTax();
7831        case 108957:  return getNet();
7832        case 115642:  return addUdi(); 
7833        case -1110033957:  return addNoteNumberElement();
7834        case 565719004:  return getDecision();
7835        case -231349275:  return addAdjudication(); 
7836        default: return super.makeProperty(hash, name);
7837        }
7838
7839      }
7840
7841      @Override
7842      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7843        switch (hash) {
7844        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
7845        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7846        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7847        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
7848        case -717476168: /*productOrServiceEnd*/ return new String[] {"CodeableConcept"};
7849        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7850        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
7851        case 525514609: /*patientPaid*/ return new String[] {"Money"};
7852        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
7853        case -486196699: /*unitPrice*/ return new String[] {"Money"};
7854        case -1282148017: /*factor*/ return new String[] {"decimal"};
7855        case 114603: /*tax*/ return new String[] {"Money"};
7856        case 108957: /*net*/ return new String[] {"Money"};
7857        case 115642: /*udi*/ return new String[] {"Reference"};
7858        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7859        case 565719004: /*decision*/ return new String[] {"CodeableConcept"};
7860        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7861        default: return super.getTypesForProperty(hash, name);
7862        }
7863
7864      }
7865
7866      @Override
7867      public Base addChild(String name) throws FHIRException {
7868        if (name.equals("sequence")) {
7869          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.subDetail.sequence");
7870        }
7871        else if (name.equals("revenue")) {
7872          this.revenue = new CodeableConcept();
7873          return this.revenue;
7874        }
7875        else if (name.equals("category")) {
7876          this.category = new CodeableConcept();
7877          return this.category;
7878        }
7879        else if (name.equals("productOrService")) {
7880          this.productOrService = new CodeableConcept();
7881          return this.productOrService;
7882        }
7883        else if (name.equals("productOrServiceEnd")) {
7884          this.productOrServiceEnd = new CodeableConcept();
7885          return this.productOrServiceEnd;
7886        }
7887        else if (name.equals("modifier")) {
7888          return addModifier();
7889        }
7890        else if (name.equals("programCode")) {
7891          return addProgramCode();
7892        }
7893        else if (name.equals("patientPaid")) {
7894          this.patientPaid = new Money();
7895          return this.patientPaid;
7896        }
7897        else if (name.equals("quantity")) {
7898          this.quantity = new Quantity();
7899          return this.quantity;
7900        }
7901        else if (name.equals("unitPrice")) {
7902          this.unitPrice = new Money();
7903          return this.unitPrice;
7904        }
7905        else if (name.equals("factor")) {
7906          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.subDetail.factor");
7907        }
7908        else if (name.equals("tax")) {
7909          this.tax = new Money();
7910          return this.tax;
7911        }
7912        else if (name.equals("net")) {
7913          this.net = new Money();
7914          return this.net;
7915        }
7916        else if (name.equals("udi")) {
7917          return addUdi();
7918        }
7919        else if (name.equals("noteNumber")) {
7920          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.subDetail.noteNumber");
7921        }
7922        else if (name.equals("decision")) {
7923          this.decision = new CodeableConcept();
7924          return this.decision;
7925        }
7926        else if (name.equals("adjudication")) {
7927          return addAdjudication();
7928        }
7929        else
7930          return super.addChild(name);
7931      }
7932
7933      public SubDetailComponent copy() {
7934        SubDetailComponent dst = new SubDetailComponent();
7935        copyValues(dst);
7936        return dst;
7937      }
7938
7939      public void copyValues(SubDetailComponent dst) {
7940        super.copyValues(dst);
7941        dst.sequence = sequence == null ? null : sequence.copy();
7942        dst.revenue = revenue == null ? null : revenue.copy();
7943        dst.category = category == null ? null : category.copy();
7944        dst.productOrService = productOrService == null ? null : productOrService.copy();
7945        dst.productOrServiceEnd = productOrServiceEnd == null ? null : productOrServiceEnd.copy();
7946        if (modifier != null) {
7947          dst.modifier = new ArrayList<CodeableConcept>();
7948          for (CodeableConcept i : modifier)
7949            dst.modifier.add(i.copy());
7950        };
7951        if (programCode != null) {
7952          dst.programCode = new ArrayList<CodeableConcept>();
7953          for (CodeableConcept i : programCode)
7954            dst.programCode.add(i.copy());
7955        };
7956        dst.patientPaid = patientPaid == null ? null : patientPaid.copy();
7957        dst.quantity = quantity == null ? null : quantity.copy();
7958        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7959        dst.factor = factor == null ? null : factor.copy();
7960        dst.tax = tax == null ? null : tax.copy();
7961        dst.net = net == null ? null : net.copy();
7962        if (udi != null) {
7963          dst.udi = new ArrayList<Reference>();
7964          for (Reference i : udi)
7965            dst.udi.add(i.copy());
7966        };
7967        if (noteNumber != null) {
7968          dst.noteNumber = new ArrayList<PositiveIntType>();
7969          for (PositiveIntType i : noteNumber)
7970            dst.noteNumber.add(i.copy());
7971        };
7972        dst.decision = decision == null ? null : decision.copy();
7973        if (adjudication != null) {
7974          dst.adjudication = new ArrayList<AdjudicationComponent>();
7975          for (AdjudicationComponent i : adjudication)
7976            dst.adjudication.add(i.copy());
7977        };
7978      }
7979
7980      @Override
7981      public boolean equalsDeep(Base other_) {
7982        if (!super.equalsDeep(other_))
7983          return false;
7984        if (!(other_ instanceof SubDetailComponent))
7985          return false;
7986        SubDetailComponent o = (SubDetailComponent) other_;
7987        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
7988           && compareDeep(productOrService, o.productOrService, true) && compareDeep(productOrServiceEnd, o.productOrServiceEnd, true)
7989           && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true) && compareDeep(patientPaid, o.patientPaid, true)
7990           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
7991           && compareDeep(tax, o.tax, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
7992           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(decision, o.decision, true) && compareDeep(adjudication, o.adjudication, true)
7993          ;
7994      }
7995
7996      @Override
7997      public boolean equalsShallow(Base other_) {
7998        if (!super.equalsShallow(other_))
7999          return false;
8000        if (!(other_ instanceof SubDetailComponent))
8001          return false;
8002        SubDetailComponent o = (SubDetailComponent) other_;
8003        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
8004          ;
8005      }
8006
8007      public boolean isEmpty() {
8008        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
8009          , productOrService, productOrServiceEnd, modifier, programCode, patientPaid, quantity
8010          , unitPrice, factor, tax, net, udi, noteNumber, decision, adjudication);
8011      }
8012
8013  public String fhirType() {
8014    return "ExplanationOfBenefit.item.detail.subDetail";
8015
8016  }
8017
8018  }
8019
8020    @Block()
8021    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
8022        /**
8023         * Claim items which this service line is intended to replace.
8024         */
8025        @Child(name = "itemSequence", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8026        @Description(shortDefinition="Item sequence number", formalDefinition="Claim items which this service line is intended to replace." )
8027        protected List<PositiveIntType> itemSequence;
8028
8029        /**
8030         * The sequence number of the details within the claim item which this line is intended to replace.
8031         */
8032        @Child(name = "detailSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8033        @Description(shortDefinition="Detail sequence number", formalDefinition="The sequence number of the details within the claim item which this line is intended to replace." )
8034        protected List<PositiveIntType> detailSequence;
8035
8036        /**
8037         * The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.
8038         */
8039        @Child(name = "subDetailSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8040        @Description(shortDefinition="Subdetail sequence number", formalDefinition="The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace." )
8041        protected List<PositiveIntType> subDetailSequence;
8042
8043        /**
8044         * The providers who are authorized for the services rendered to the patient.
8045         */
8046        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8047        @Description(shortDefinition="Authorized providers", formalDefinition="The providers who are authorized for the services rendered to the patient." )
8048        protected List<Reference> provider;
8049
8050        /**
8051         * The type of revenue or cost center providing the product and/or service.
8052         */
8053        @Child(name = "revenue", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
8054        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
8055        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
8056        protected CodeableConcept revenue;
8057
8058        /**
8059         * When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.
8060         */
8061        @Child(name = "productOrService", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
8062        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used." )
8063        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
8064        protected CodeableConcept productOrService;
8065
8066        /**
8067         * This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.
8068         */
8069        @Child(name = "productOrServiceEnd", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
8070        @Description(shortDefinition="End of a range of codes", formalDefinition="This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims." )
8071        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
8072        protected CodeableConcept productOrServiceEnd;
8073
8074        /**
8075         * Item typification or modifiers codes to convey additional context for the product or service.
8076         */
8077        @Child(name = "modifier", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8078        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
8079        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
8080        protected List<CodeableConcept> modifier;
8081
8082        /**
8083         * Identifies the program under which this may be recovered.
8084         */
8085        @Child(name = "programCode", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8086        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
8087        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
8088        protected List<CodeableConcept> programCode;
8089
8090        /**
8091         * The date or dates when the service or product was supplied, performed or completed.
8092         */
8093        @Child(name = "serviced", type = {DateType.class, Period.class}, order=10, min=0, max=1, modifier=false, summary=false)
8094        @Description(shortDefinition="Date or dates of service or product delivery", formalDefinition="The date or dates when the service or product was supplied, performed or completed." )
8095        protected DataType serviced;
8096
8097        /**
8098         * Where the product or service was provided.
8099         */
8100        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=11, min=0, max=1, modifier=false, summary=false)
8101        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
8102        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
8103        protected DataType location;
8104
8105        /**
8106         * The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.
8107         */
8108        @Child(name = "patientPaid", type = {Money.class}, order=12, min=0, max=1, modifier=false, summary=false)
8109        @Description(shortDefinition="Paid by the patient", formalDefinition="The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services." )
8110        protected Money patientPaid;
8111
8112        /**
8113         * The number of repetitions of a service or product.
8114         */
8115        @Child(name = "quantity", type = {Quantity.class}, order=13, min=0, max=1, modifier=false, summary=false)
8116        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
8117        protected Quantity quantity;
8118
8119        /**
8120         * If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.
8121         */
8122        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
8123        @Description(shortDefinition="Fee, charge or cost per item", formalDefinition="If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group." )
8124        protected Money unitPrice;
8125
8126        /**
8127         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
8128         */
8129        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=false)
8130        @Description(shortDefinition="Price scaling factor", formalDefinition="A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount." )
8131        protected DecimalType factor;
8132
8133        /**
8134         * The total of taxes applicable for this product or service.
8135         */
8136        @Child(name = "tax", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
8137        @Description(shortDefinition="Total tax", formalDefinition="The total of taxes applicable for this product or service." )
8138        protected Money tax;
8139
8140        /**
8141         * The quantity times the unit price for an additional service or product or charge.
8142         */
8143        @Child(name = "net", type = {Money.class}, order=17, min=0, max=1, modifier=false, summary=false)
8144        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
8145        protected Money net;
8146
8147        /**
8148         * Physical location where the service is performed or applies.
8149         */
8150        @Child(name = "bodySite", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8151        @Description(shortDefinition="Anatomical location", formalDefinition="Physical location where the service is performed or applies." )
8152        protected List<AddedItemBodySiteComponent> bodySite;
8153
8154        /**
8155         * The numbers associated with notes below which apply to the adjudication of this item.
8156         */
8157        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8158        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
8159        protected List<PositiveIntType> noteNumber;
8160
8161        /**
8162         * The result of the claim, predetermination, or preauthorization adjudication.
8163         */
8164        @Child(name = "decision", type = {CodeableConcept.class}, order=20, min=0, max=1, modifier=false, summary=false)
8165        @Description(shortDefinition="Result of the adjudication", formalDefinition="The result of the claim, predetermination, or preauthorization adjudication." )
8166        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-decision")
8167        protected CodeableConcept decision;
8168
8169        /**
8170         * The adjudication results.
8171         */
8172        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8173        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
8174        protected List<AdjudicationComponent> adjudication;
8175
8176        /**
8177         * The second-tier service adjudications for payor added services.
8178         */
8179        @Child(name = "detail", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8180        @Description(shortDefinition="Insurer added line items", formalDefinition="The second-tier service adjudications for payor added services." )
8181        protected List<AddedItemDetailComponent> detail;
8182
8183        private static final long serialVersionUID = 468363163L;
8184
8185    /**
8186     * Constructor
8187     */
8188      public AddedItemComponent() {
8189        super();
8190      }
8191
8192        /**
8193         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
8194         */
8195        public List<PositiveIntType> getItemSequence() { 
8196          if (this.itemSequence == null)
8197            this.itemSequence = new ArrayList<PositiveIntType>();
8198          return this.itemSequence;
8199        }
8200
8201        /**
8202         * @return Returns a reference to <code>this</code> for easy method chaining
8203         */
8204        public AddedItemComponent setItemSequence(List<PositiveIntType> theItemSequence) { 
8205          this.itemSequence = theItemSequence;
8206          return this;
8207        }
8208
8209        public boolean hasItemSequence() { 
8210          if (this.itemSequence == null)
8211            return false;
8212          for (PositiveIntType item : this.itemSequence)
8213            if (!item.isEmpty())
8214              return true;
8215          return false;
8216        }
8217
8218        /**
8219         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
8220         */
8221        public PositiveIntType addItemSequenceElement() {//2 
8222          PositiveIntType t = new PositiveIntType();
8223          if (this.itemSequence == null)
8224            this.itemSequence = new ArrayList<PositiveIntType>();
8225          this.itemSequence.add(t);
8226          return t;
8227        }
8228
8229        /**
8230         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
8231         */
8232        public AddedItemComponent addItemSequence(int value) { //1
8233          PositiveIntType t = new PositiveIntType();
8234          t.setValue(value);
8235          if (this.itemSequence == null)
8236            this.itemSequence = new ArrayList<PositiveIntType>();
8237          this.itemSequence.add(t);
8238          return this;
8239        }
8240
8241        /**
8242         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
8243         */
8244        public boolean hasItemSequence(int value) { 
8245          if (this.itemSequence == null)
8246            return false;
8247          for (PositiveIntType v : this.itemSequence)
8248            if (v.getValue().equals(value)) // positiveInt
8249              return true;
8250          return false;
8251        }
8252
8253        /**
8254         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
8255         */
8256        public List<PositiveIntType> getDetailSequence() { 
8257          if (this.detailSequence == null)
8258            this.detailSequence = new ArrayList<PositiveIntType>();
8259          return this.detailSequence;
8260        }
8261
8262        /**
8263         * @return Returns a reference to <code>this</code> for easy method chaining
8264         */
8265        public AddedItemComponent setDetailSequence(List<PositiveIntType> theDetailSequence) { 
8266          this.detailSequence = theDetailSequence;
8267          return this;
8268        }
8269
8270        public boolean hasDetailSequence() { 
8271          if (this.detailSequence == null)
8272            return false;
8273          for (PositiveIntType item : this.detailSequence)
8274            if (!item.isEmpty())
8275              return true;
8276          return false;
8277        }
8278
8279        /**
8280         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
8281         */
8282        public PositiveIntType addDetailSequenceElement() {//2 
8283          PositiveIntType t = new PositiveIntType();
8284          if (this.detailSequence == null)
8285            this.detailSequence = new ArrayList<PositiveIntType>();
8286          this.detailSequence.add(t);
8287          return t;
8288        }
8289
8290        /**
8291         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
8292         */
8293        public AddedItemComponent addDetailSequence(int value) { //1
8294          PositiveIntType t = new PositiveIntType();
8295          t.setValue(value);
8296          if (this.detailSequence == null)
8297            this.detailSequence = new ArrayList<PositiveIntType>();
8298          this.detailSequence.add(t);
8299          return this;
8300        }
8301
8302        /**
8303         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
8304         */
8305        public boolean hasDetailSequence(int value) { 
8306          if (this.detailSequence == null)
8307            return false;
8308          for (PositiveIntType v : this.detailSequence)
8309            if (v.getValue().equals(value)) // positiveInt
8310              return true;
8311          return false;
8312        }
8313
8314        /**
8315         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
8316         */
8317        public List<PositiveIntType> getSubDetailSequence() { 
8318          if (this.subDetailSequence == null)
8319            this.subDetailSequence = new ArrayList<PositiveIntType>();
8320          return this.subDetailSequence;
8321        }
8322
8323        /**
8324         * @return Returns a reference to <code>this</code> for easy method chaining
8325         */
8326        public AddedItemComponent setSubDetailSequence(List<PositiveIntType> theSubDetailSequence) { 
8327          this.subDetailSequence = theSubDetailSequence;
8328          return this;
8329        }
8330
8331        public boolean hasSubDetailSequence() { 
8332          if (this.subDetailSequence == null)
8333            return false;
8334          for (PositiveIntType item : this.subDetailSequence)
8335            if (!item.isEmpty())
8336              return true;
8337          return false;
8338        }
8339
8340        /**
8341         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
8342         */
8343        public PositiveIntType addSubDetailSequenceElement() {//2 
8344          PositiveIntType t = new PositiveIntType();
8345          if (this.subDetailSequence == null)
8346            this.subDetailSequence = new ArrayList<PositiveIntType>();
8347          this.subDetailSequence.add(t);
8348          return t;
8349        }
8350
8351        /**
8352         * @param value {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
8353         */
8354        public AddedItemComponent addSubDetailSequence(int value) { //1
8355          PositiveIntType t = new PositiveIntType();
8356          t.setValue(value);
8357          if (this.subDetailSequence == null)
8358            this.subDetailSequence = new ArrayList<PositiveIntType>();
8359          this.subDetailSequence.add(t);
8360          return this;
8361        }
8362
8363        /**
8364         * @param value {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
8365         */
8366        public boolean hasSubDetailSequence(int value) { 
8367          if (this.subDetailSequence == null)
8368            return false;
8369          for (PositiveIntType v : this.subDetailSequence)
8370            if (v.getValue().equals(value)) // positiveInt
8371              return true;
8372          return false;
8373        }
8374
8375        /**
8376         * @return {@link #provider} (The providers who are authorized for the services rendered to the patient.)
8377         */
8378        public List<Reference> getProvider() { 
8379          if (this.provider == null)
8380            this.provider = new ArrayList<Reference>();
8381          return this.provider;
8382        }
8383
8384        /**
8385         * @return Returns a reference to <code>this</code> for easy method chaining
8386         */
8387        public AddedItemComponent setProvider(List<Reference> theProvider) { 
8388          this.provider = theProvider;
8389          return this;
8390        }
8391
8392        public boolean hasProvider() { 
8393          if (this.provider == null)
8394            return false;
8395          for (Reference item : this.provider)
8396            if (!item.isEmpty())
8397              return true;
8398          return false;
8399        }
8400
8401        public Reference addProvider() { //3
8402          Reference t = new Reference();
8403          if (this.provider == null)
8404            this.provider = new ArrayList<Reference>();
8405          this.provider.add(t);
8406          return t;
8407        }
8408
8409        public AddedItemComponent addProvider(Reference t) { //3
8410          if (t == null)
8411            return this;
8412          if (this.provider == null)
8413            this.provider = new ArrayList<Reference>();
8414          this.provider.add(t);
8415          return this;
8416        }
8417
8418        /**
8419         * @return The first repetition of repeating field {@link #provider}, creating it if it does not already exist {3}
8420         */
8421        public Reference getProviderFirstRep() { 
8422          if (getProvider().isEmpty()) {
8423            addProvider();
8424          }
8425          return getProvider().get(0);
8426        }
8427
8428        /**
8429         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
8430         */
8431        public CodeableConcept getRevenue() { 
8432          if (this.revenue == null)
8433            if (Configuration.errorOnAutoCreate())
8434              throw new Error("Attempt to auto-create AddedItemComponent.revenue");
8435            else if (Configuration.doAutoCreate())
8436              this.revenue = new CodeableConcept(); // cc
8437          return this.revenue;
8438        }
8439
8440        public boolean hasRevenue() { 
8441          return this.revenue != null && !this.revenue.isEmpty();
8442        }
8443
8444        /**
8445         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
8446         */
8447        public AddedItemComponent setRevenue(CodeableConcept value) { 
8448          this.revenue = value;
8449          return this;
8450        }
8451
8452        /**
8453         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.)
8454         */
8455        public CodeableConcept getProductOrService() { 
8456          if (this.productOrService == null)
8457            if (Configuration.errorOnAutoCreate())
8458              throw new Error("Attempt to auto-create AddedItemComponent.productOrService");
8459            else if (Configuration.doAutoCreate())
8460              this.productOrService = new CodeableConcept(); // cc
8461          return this.productOrService;
8462        }
8463
8464        public boolean hasProductOrService() { 
8465          return this.productOrService != null && !this.productOrService.isEmpty();
8466        }
8467
8468        /**
8469         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.)
8470         */
8471        public AddedItemComponent setProductOrService(CodeableConcept value) { 
8472          this.productOrService = value;
8473          return this;
8474        }
8475
8476        /**
8477         * @return {@link #productOrServiceEnd} (This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.)
8478         */
8479        public CodeableConcept getProductOrServiceEnd() { 
8480          if (this.productOrServiceEnd == null)
8481            if (Configuration.errorOnAutoCreate())
8482              throw new Error("Attempt to auto-create AddedItemComponent.productOrServiceEnd");
8483            else if (Configuration.doAutoCreate())
8484              this.productOrServiceEnd = new CodeableConcept(); // cc
8485          return this.productOrServiceEnd;
8486        }
8487
8488        public boolean hasProductOrServiceEnd() { 
8489          return this.productOrServiceEnd != null && !this.productOrServiceEnd.isEmpty();
8490        }
8491
8492        /**
8493         * @param value {@link #productOrServiceEnd} (This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.)
8494         */
8495        public AddedItemComponent setProductOrServiceEnd(CodeableConcept value) { 
8496          this.productOrServiceEnd = value;
8497          return this;
8498        }
8499
8500        /**
8501         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
8502         */
8503        public List<CodeableConcept> getModifier() { 
8504          if (this.modifier == null)
8505            this.modifier = new ArrayList<CodeableConcept>();
8506          return this.modifier;
8507        }
8508
8509        /**
8510         * @return Returns a reference to <code>this</code> for easy method chaining
8511         */
8512        public AddedItemComponent setModifier(List<CodeableConcept> theModifier) { 
8513          this.modifier = theModifier;
8514          return this;
8515        }
8516
8517        public boolean hasModifier() { 
8518          if (this.modifier == null)
8519            return false;
8520          for (CodeableConcept item : this.modifier)
8521            if (!item.isEmpty())
8522              return true;
8523          return false;
8524        }
8525
8526        public CodeableConcept addModifier() { //3
8527          CodeableConcept t = new CodeableConcept();
8528          if (this.modifier == null)
8529            this.modifier = new ArrayList<CodeableConcept>();
8530          this.modifier.add(t);
8531          return t;
8532        }
8533
8534        public AddedItemComponent addModifier(CodeableConcept t) { //3
8535          if (t == null)
8536            return this;
8537          if (this.modifier == null)
8538            this.modifier = new ArrayList<CodeableConcept>();
8539          this.modifier.add(t);
8540          return this;
8541        }
8542
8543        /**
8544         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
8545         */
8546        public CodeableConcept getModifierFirstRep() { 
8547          if (getModifier().isEmpty()) {
8548            addModifier();
8549          }
8550          return getModifier().get(0);
8551        }
8552
8553        /**
8554         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
8555         */
8556        public List<CodeableConcept> getProgramCode() { 
8557          if (this.programCode == null)
8558            this.programCode = new ArrayList<CodeableConcept>();
8559          return this.programCode;
8560        }
8561
8562        /**
8563         * @return Returns a reference to <code>this</code> for easy method chaining
8564         */
8565        public AddedItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
8566          this.programCode = theProgramCode;
8567          return this;
8568        }
8569
8570        public boolean hasProgramCode() { 
8571          if (this.programCode == null)
8572            return false;
8573          for (CodeableConcept item : this.programCode)
8574            if (!item.isEmpty())
8575              return true;
8576          return false;
8577        }
8578
8579        public CodeableConcept addProgramCode() { //3
8580          CodeableConcept t = new CodeableConcept();
8581          if (this.programCode == null)
8582            this.programCode = new ArrayList<CodeableConcept>();
8583          this.programCode.add(t);
8584          return t;
8585        }
8586
8587        public AddedItemComponent addProgramCode(CodeableConcept t) { //3
8588          if (t == null)
8589            return this;
8590          if (this.programCode == null)
8591            this.programCode = new ArrayList<CodeableConcept>();
8592          this.programCode.add(t);
8593          return this;
8594        }
8595
8596        /**
8597         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
8598         */
8599        public CodeableConcept getProgramCodeFirstRep() { 
8600          if (getProgramCode().isEmpty()) {
8601            addProgramCode();
8602          }
8603          return getProgramCode().get(0);
8604        }
8605
8606        /**
8607         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8608         */
8609        public DataType getServiced() { 
8610          return this.serviced;
8611        }
8612
8613        /**
8614         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8615         */
8616        public DateType getServicedDateType() throws FHIRException { 
8617          if (this.serviced == null)
8618            this.serviced = new DateType();
8619          if (!(this.serviced instanceof DateType))
8620            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
8621          return (DateType) this.serviced;
8622        }
8623
8624        public boolean hasServicedDateType() { 
8625          return this != null && this.serviced instanceof DateType;
8626        }
8627
8628        /**
8629         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8630         */
8631        public Period getServicedPeriod() throws FHIRException { 
8632          if (this.serviced == null)
8633            this.serviced = new Period();
8634          if (!(this.serviced instanceof Period))
8635            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
8636          return (Period) this.serviced;
8637        }
8638
8639        public boolean hasServicedPeriod() { 
8640          return this != null && this.serviced instanceof Period;
8641        }
8642
8643        public boolean hasServiced() { 
8644          return this.serviced != null && !this.serviced.isEmpty();
8645        }
8646
8647        /**
8648         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8649         */
8650        public AddedItemComponent setServiced(DataType value) { 
8651          if (value != null && !(value instanceof DateType || value instanceof Period))
8652            throw new Error("Not the right type for ExplanationOfBenefit.addItem.serviced[x]: "+value.fhirType());
8653          this.serviced = value;
8654          return this;
8655        }
8656
8657        /**
8658         * @return {@link #location} (Where the product or service was provided.)
8659         */
8660        public DataType getLocation() { 
8661          return this.location;
8662        }
8663
8664        /**
8665         * @return {@link #location} (Where the product or service was provided.)
8666         */
8667        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
8668          if (this.location == null)
8669            this.location = new CodeableConcept();
8670          if (!(this.location instanceof CodeableConcept))
8671            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
8672          return (CodeableConcept) this.location;
8673        }
8674
8675        public boolean hasLocationCodeableConcept() { 
8676          return this != null && this.location instanceof CodeableConcept;
8677        }
8678
8679        /**
8680         * @return {@link #location} (Where the product or service was provided.)
8681         */
8682        public Address getLocationAddress() throws FHIRException { 
8683          if (this.location == null)
8684            this.location = new Address();
8685          if (!(this.location instanceof Address))
8686            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
8687          return (Address) this.location;
8688        }
8689
8690        public boolean hasLocationAddress() { 
8691          return this != null && this.location instanceof Address;
8692        }
8693
8694        /**
8695         * @return {@link #location} (Where the product or service was provided.)
8696         */
8697        public Reference getLocationReference() throws FHIRException { 
8698          if (this.location == null)
8699            this.location = new Reference();
8700          if (!(this.location instanceof Reference))
8701            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
8702          return (Reference) this.location;
8703        }
8704
8705        public boolean hasLocationReference() { 
8706          return this != null && this.location instanceof Reference;
8707        }
8708
8709        public boolean hasLocation() { 
8710          return this.location != null && !this.location.isEmpty();
8711        }
8712
8713        /**
8714         * @param value {@link #location} (Where the product or service was provided.)
8715         */
8716        public AddedItemComponent setLocation(DataType value) { 
8717          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
8718            throw new Error("Not the right type for ExplanationOfBenefit.addItem.location[x]: "+value.fhirType());
8719          this.location = value;
8720          return this;
8721        }
8722
8723        /**
8724         * @return {@link #patientPaid} (The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.)
8725         */
8726        public Money getPatientPaid() { 
8727          if (this.patientPaid == null)
8728            if (Configuration.errorOnAutoCreate())
8729              throw new Error("Attempt to auto-create AddedItemComponent.patientPaid");
8730            else if (Configuration.doAutoCreate())
8731              this.patientPaid = new Money(); // cc
8732          return this.patientPaid;
8733        }
8734
8735        public boolean hasPatientPaid() { 
8736          return this.patientPaid != null && !this.patientPaid.isEmpty();
8737        }
8738
8739        /**
8740         * @param value {@link #patientPaid} (The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.)
8741         */
8742        public AddedItemComponent setPatientPaid(Money value) { 
8743          this.patientPaid = value;
8744          return this;
8745        }
8746
8747        /**
8748         * @return {@link #quantity} (The number of repetitions of a service or product.)
8749         */
8750        public Quantity getQuantity() { 
8751          if (this.quantity == null)
8752            if (Configuration.errorOnAutoCreate())
8753              throw new Error("Attempt to auto-create AddedItemComponent.quantity");
8754            else if (Configuration.doAutoCreate())
8755              this.quantity = new Quantity(); // cc
8756          return this.quantity;
8757        }
8758
8759        public boolean hasQuantity() { 
8760          return this.quantity != null && !this.quantity.isEmpty();
8761        }
8762
8763        /**
8764         * @param value {@link #quantity} (The number of repetitions of a service or product.)
8765         */
8766        public AddedItemComponent setQuantity(Quantity value) { 
8767          this.quantity = value;
8768          return this;
8769        }
8770
8771        /**
8772         * @return {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
8773         */
8774        public Money getUnitPrice() { 
8775          if (this.unitPrice == null)
8776            if (Configuration.errorOnAutoCreate())
8777              throw new Error("Attempt to auto-create AddedItemComponent.unitPrice");
8778            else if (Configuration.doAutoCreate())
8779              this.unitPrice = new Money(); // cc
8780          return this.unitPrice;
8781        }
8782
8783        public boolean hasUnitPrice() { 
8784          return this.unitPrice != null && !this.unitPrice.isEmpty();
8785        }
8786
8787        /**
8788         * @param value {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
8789         */
8790        public AddedItemComponent setUnitPrice(Money value) { 
8791          this.unitPrice = value;
8792          return this;
8793        }
8794
8795        /**
8796         * @return {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
8797         */
8798        public DecimalType getFactorElement() { 
8799          if (this.factor == null)
8800            if (Configuration.errorOnAutoCreate())
8801              throw new Error("Attempt to auto-create AddedItemComponent.factor");
8802            else if (Configuration.doAutoCreate())
8803              this.factor = new DecimalType(); // bb
8804          return this.factor;
8805        }
8806
8807        public boolean hasFactorElement() { 
8808          return this.factor != null && !this.factor.isEmpty();
8809        }
8810
8811        public boolean hasFactor() { 
8812          return this.factor != null && !this.factor.isEmpty();
8813        }
8814
8815        /**
8816         * @param value {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
8817         */
8818        public AddedItemComponent setFactorElement(DecimalType value) { 
8819          this.factor = value;
8820          return this;
8821        }
8822
8823        /**
8824         * @return A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
8825         */
8826        public BigDecimal getFactor() { 
8827          return this.factor == null ? null : this.factor.getValue();
8828        }
8829
8830        /**
8831         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
8832         */
8833        public AddedItemComponent setFactor(BigDecimal value) { 
8834          if (value == null)
8835            this.factor = null;
8836          else {
8837            if (this.factor == null)
8838              this.factor = new DecimalType();
8839            this.factor.setValue(value);
8840          }
8841          return this;
8842        }
8843
8844        /**
8845         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
8846         */
8847        public AddedItemComponent setFactor(long value) { 
8848              this.factor = new DecimalType();
8849            this.factor.setValue(value);
8850          return this;
8851        }
8852
8853        /**
8854         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
8855         */
8856        public AddedItemComponent setFactor(double value) { 
8857              this.factor = new DecimalType();
8858            this.factor.setValue(value);
8859          return this;
8860        }
8861
8862        /**
8863         * @return {@link #tax} (The total of taxes applicable for this product or service.)
8864         */
8865        public Money getTax() { 
8866          if (this.tax == null)
8867            if (Configuration.errorOnAutoCreate())
8868              throw new Error("Attempt to auto-create AddedItemComponent.tax");
8869            else if (Configuration.doAutoCreate())
8870              this.tax = new Money(); // cc
8871          return this.tax;
8872        }
8873
8874        public boolean hasTax() { 
8875          return this.tax != null && !this.tax.isEmpty();
8876        }
8877
8878        /**
8879         * @param value {@link #tax} (The total of taxes applicable for this product or service.)
8880         */
8881        public AddedItemComponent setTax(Money value) { 
8882          this.tax = value;
8883          return this;
8884        }
8885
8886        /**
8887         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8888         */
8889        public Money getNet() { 
8890          if (this.net == null)
8891            if (Configuration.errorOnAutoCreate())
8892              throw new Error("Attempt to auto-create AddedItemComponent.net");
8893            else if (Configuration.doAutoCreate())
8894              this.net = new Money(); // cc
8895          return this.net;
8896        }
8897
8898        public boolean hasNet() { 
8899          return this.net != null && !this.net.isEmpty();
8900        }
8901
8902        /**
8903         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8904         */
8905        public AddedItemComponent setNet(Money value) { 
8906          this.net = value;
8907          return this;
8908        }
8909
8910        /**
8911         * @return {@link #bodySite} (Physical location where the service is performed or applies.)
8912         */
8913        public List<AddedItemBodySiteComponent> getBodySite() { 
8914          if (this.bodySite == null)
8915            this.bodySite = new ArrayList<AddedItemBodySiteComponent>();
8916          return this.bodySite;
8917        }
8918
8919        /**
8920         * @return Returns a reference to <code>this</code> for easy method chaining
8921         */
8922        public AddedItemComponent setBodySite(List<AddedItemBodySiteComponent> theBodySite) { 
8923          this.bodySite = theBodySite;
8924          return this;
8925        }
8926
8927        public boolean hasBodySite() { 
8928          if (this.bodySite == null)
8929            return false;
8930          for (AddedItemBodySiteComponent item : this.bodySite)
8931            if (!item.isEmpty())
8932              return true;
8933          return false;
8934        }
8935
8936        public AddedItemBodySiteComponent addBodySite() { //3
8937          AddedItemBodySiteComponent t = new AddedItemBodySiteComponent();
8938          if (this.bodySite == null)
8939            this.bodySite = new ArrayList<AddedItemBodySiteComponent>();
8940          this.bodySite.add(t);
8941          return t;
8942        }
8943
8944        public AddedItemComponent addBodySite(AddedItemBodySiteComponent t) { //3
8945          if (t == null)
8946            return this;
8947          if (this.bodySite == null)
8948            this.bodySite = new ArrayList<AddedItemBodySiteComponent>();
8949          this.bodySite.add(t);
8950          return this;
8951        }
8952
8953        /**
8954         * @return The first repetition of repeating field {@link #bodySite}, creating it if it does not already exist {3}
8955         */
8956        public AddedItemBodySiteComponent getBodySiteFirstRep() { 
8957          if (getBodySite().isEmpty()) {
8958            addBodySite();
8959          }
8960          return getBodySite().get(0);
8961        }
8962
8963        /**
8964         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8965         */
8966        public List<PositiveIntType> getNoteNumber() { 
8967          if (this.noteNumber == null)
8968            this.noteNumber = new ArrayList<PositiveIntType>();
8969          return this.noteNumber;
8970        }
8971
8972        /**
8973         * @return Returns a reference to <code>this</code> for easy method chaining
8974         */
8975        public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
8976          this.noteNumber = theNoteNumber;
8977          return this;
8978        }
8979
8980        public boolean hasNoteNumber() { 
8981          if (this.noteNumber == null)
8982            return false;
8983          for (PositiveIntType item : this.noteNumber)
8984            if (!item.isEmpty())
8985              return true;
8986          return false;
8987        }
8988
8989        /**
8990         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8991         */
8992        public PositiveIntType addNoteNumberElement() {//2 
8993          PositiveIntType t = new PositiveIntType();
8994          if (this.noteNumber == null)
8995            this.noteNumber = new ArrayList<PositiveIntType>();
8996          this.noteNumber.add(t);
8997          return t;
8998        }
8999
9000        /**
9001         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9002         */
9003        public AddedItemComponent addNoteNumber(int value) { //1
9004          PositiveIntType t = new PositiveIntType();
9005          t.setValue(value);
9006          if (this.noteNumber == null)
9007            this.noteNumber = new ArrayList<PositiveIntType>();
9008          this.noteNumber.add(t);
9009          return this;
9010        }
9011
9012        /**
9013         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9014         */
9015        public boolean hasNoteNumber(int value) { 
9016          if (this.noteNumber == null)
9017            return false;
9018          for (PositiveIntType v : this.noteNumber)
9019            if (v.getValue().equals(value)) // positiveInt
9020              return true;
9021          return false;
9022        }
9023
9024        /**
9025         * @return {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
9026         */
9027        public CodeableConcept getDecision() { 
9028          if (this.decision == null)
9029            if (Configuration.errorOnAutoCreate())
9030              throw new Error("Attempt to auto-create AddedItemComponent.decision");
9031            else if (Configuration.doAutoCreate())
9032              this.decision = new CodeableConcept(); // cc
9033          return this.decision;
9034        }
9035
9036        public boolean hasDecision() { 
9037          return this.decision != null && !this.decision.isEmpty();
9038        }
9039
9040        /**
9041         * @param value {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
9042         */
9043        public AddedItemComponent setDecision(CodeableConcept value) { 
9044          this.decision = value;
9045          return this;
9046        }
9047
9048        /**
9049         * @return {@link #adjudication} (The adjudication results.)
9050         */
9051        public List<AdjudicationComponent> getAdjudication() { 
9052          if (this.adjudication == null)
9053            this.adjudication = new ArrayList<AdjudicationComponent>();
9054          return this.adjudication;
9055        }
9056
9057        /**
9058         * @return Returns a reference to <code>this</code> for easy method chaining
9059         */
9060        public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
9061          this.adjudication = theAdjudication;
9062          return this;
9063        }
9064
9065        public boolean hasAdjudication() { 
9066          if (this.adjudication == null)
9067            return false;
9068          for (AdjudicationComponent item : this.adjudication)
9069            if (!item.isEmpty())
9070              return true;
9071          return false;
9072        }
9073
9074        public AdjudicationComponent addAdjudication() { //3
9075          AdjudicationComponent t = new AdjudicationComponent();
9076          if (this.adjudication == null)
9077            this.adjudication = new ArrayList<AdjudicationComponent>();
9078          this.adjudication.add(t);
9079          return t;
9080        }
9081
9082        public AddedItemComponent addAdjudication(AdjudicationComponent t) { //3
9083          if (t == null)
9084            return this;
9085          if (this.adjudication == null)
9086            this.adjudication = new ArrayList<AdjudicationComponent>();
9087          this.adjudication.add(t);
9088          return this;
9089        }
9090
9091        /**
9092         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
9093         */
9094        public AdjudicationComponent getAdjudicationFirstRep() { 
9095          if (getAdjudication().isEmpty()) {
9096            addAdjudication();
9097          }
9098          return getAdjudication().get(0);
9099        }
9100
9101        /**
9102         * @return {@link #detail} (The second-tier service adjudications for payor added services.)
9103         */
9104        public List<AddedItemDetailComponent> getDetail() { 
9105          if (this.detail == null)
9106            this.detail = new ArrayList<AddedItemDetailComponent>();
9107          return this.detail;
9108        }
9109
9110        /**
9111         * @return Returns a reference to <code>this</code> for easy method chaining
9112         */
9113        public AddedItemComponent setDetail(List<AddedItemDetailComponent> theDetail) { 
9114          this.detail = theDetail;
9115          return this;
9116        }
9117
9118        public boolean hasDetail() { 
9119          if (this.detail == null)
9120            return false;
9121          for (AddedItemDetailComponent item : this.detail)
9122            if (!item.isEmpty())
9123              return true;
9124          return false;
9125        }
9126
9127        public AddedItemDetailComponent addDetail() { //3
9128          AddedItemDetailComponent t = new AddedItemDetailComponent();
9129          if (this.detail == null)
9130            this.detail = new ArrayList<AddedItemDetailComponent>();
9131          this.detail.add(t);
9132          return t;
9133        }
9134
9135        public AddedItemComponent addDetail(AddedItemDetailComponent t) { //3
9136          if (t == null)
9137            return this;
9138          if (this.detail == null)
9139            this.detail = new ArrayList<AddedItemDetailComponent>();
9140          this.detail.add(t);
9141          return this;
9142        }
9143
9144        /**
9145         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist {3}
9146         */
9147        public AddedItemDetailComponent getDetailFirstRep() { 
9148          if (getDetail().isEmpty()) {
9149            addDetail();
9150          }
9151          return getDetail().get(0);
9152        }
9153
9154        protected void listChildren(List<Property> children) {
9155          super.listChildren(children);
9156          children.add(new Property("itemSequence", "positiveInt", "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, itemSequence));
9157          children.add(new Property("detailSequence", "positiveInt", "The sequence number of the details within the claim item which this line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, detailSequence));
9158          children.add(new Property("subDetailSequence", "positiveInt", "The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, subDetailSequence));
9159          children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The providers who are authorized for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, provider));
9160          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
9161          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));
9162          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));
9163          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));
9164          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
9165          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));
9166          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
9167          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));
9168          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
9169          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));
9170          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));
9171          children.add(new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax));
9172          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
9173          children.add(new Property("bodySite", "", "Physical location where the service is performed or applies.", 0, java.lang.Integer.MAX_VALUE, bodySite));
9174          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));
9175          children.add(new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision));
9176          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
9177          children.add(new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
9178        }
9179
9180        @Override
9181        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9182          switch (_hash) {
9183          case 1977979892: /*itemSequence*/  return new Property("itemSequence", "positiveInt", "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, itemSequence);
9184          case 1321472818: /*detailSequence*/  return new Property("detailSequence", "positiveInt", "The sequence number of the details within the claim item which this line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, detailSequence);
9185          case -855462510: /*subDetailSequence*/  return new Property("subDetailSequence", "positiveInt", "The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, subDetailSequence);
9186          case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The providers who are authorized for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, provider);
9187          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
9188          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);
9189          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);
9190          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);
9191          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
9192          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);
9193          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);
9194          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);
9195          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);
9196          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
9197          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
9198          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept", "Where the product or service was provided.", 0, 1, location);
9199          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address", "Where the product or service was provided.", 0, 1, location);
9200          case 755866390: /*locationReference*/  return new Property("location[x]", "Reference(Location)", "Where the product or service was provided.", 0, 1, location);
9201          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);
9202          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
9203          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);
9204          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);
9205          case 114603: /*tax*/  return new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax);
9206          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
9207          case 1702620169: /*bodySite*/  return new Property("bodySite", "", "Physical location where the service is performed or applies.", 0, java.lang.Integer.MAX_VALUE, bodySite);
9208          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);
9209          case 565719004: /*decision*/  return new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision);
9210          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
9211          case -1335224239: /*detail*/  return new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail);
9212          default: return super.getNamedProperty(_hash, _name, _checkValid);
9213          }
9214
9215        }
9216
9217      @Override
9218      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9219        switch (hash) {
9220        case 1977979892: /*itemSequence*/ return this.itemSequence == null ? new Base[0] : this.itemSequence.toArray(new Base[this.itemSequence.size()]); // PositiveIntType
9221        case 1321472818: /*detailSequence*/ return this.detailSequence == null ? new Base[0] : this.detailSequence.toArray(new Base[this.detailSequence.size()]); // PositiveIntType
9222        case -855462510: /*subDetailSequence*/ return this.subDetailSequence == null ? new Base[0] : this.subDetailSequence.toArray(new Base[this.subDetailSequence.size()]); // PositiveIntType
9223        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : this.provider.toArray(new Base[this.provider.size()]); // Reference
9224        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
9225        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
9226        case -717476168: /*productOrServiceEnd*/ return this.productOrServiceEnd == null ? new Base[0] : new Base[] {this.productOrServiceEnd}; // CodeableConcept
9227        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
9228        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
9229        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // DataType
9230        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // DataType
9231        case 525514609: /*patientPaid*/ return this.patientPaid == null ? new Base[0] : new Base[] {this.patientPaid}; // Money
9232        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
9233        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
9234        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
9235        case 114603: /*tax*/ return this.tax == null ? new Base[0] : new Base[] {this.tax}; // Money
9236        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
9237        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : this.bodySite.toArray(new Base[this.bodySite.size()]); // AddedItemBodySiteComponent
9238        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
9239        case 565719004: /*decision*/ return this.decision == null ? new Base[0] : new Base[] {this.decision}; // CodeableConcept
9240        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
9241        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemDetailComponent
9242        default: return super.getProperty(hash, name, checkValid);
9243        }
9244
9245      }
9246
9247      @Override
9248      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9249        switch (hash) {
9250        case 1977979892: // itemSequence
9251          this.getItemSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
9252          return value;
9253        case 1321472818: // detailSequence
9254          this.getDetailSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
9255          return value;
9256        case -855462510: // subDetailSequence
9257          this.getSubDetailSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
9258          return value;
9259        case -987494927: // provider
9260          this.getProvider().add(TypeConvertor.castToReference(value)); // Reference
9261          return value;
9262        case 1099842588: // revenue
9263          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9264          return value;
9265        case 1957227299: // productOrService
9266          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9267          return value;
9268        case -717476168: // productOrServiceEnd
9269          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9270          return value;
9271        case -615513385: // modifier
9272          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
9273          return value;
9274        case 1010065041: // programCode
9275          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
9276          return value;
9277        case 1379209295: // serviced
9278          this.serviced = TypeConvertor.castToType(value); // DataType
9279          return value;
9280        case 1901043637: // location
9281          this.location = TypeConvertor.castToType(value); // DataType
9282          return value;
9283        case 525514609: // patientPaid
9284          this.patientPaid = TypeConvertor.castToMoney(value); // Money
9285          return value;
9286        case -1285004149: // quantity
9287          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
9288          return value;
9289        case -486196699: // unitPrice
9290          this.unitPrice = TypeConvertor.castToMoney(value); // Money
9291          return value;
9292        case -1282148017: // factor
9293          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
9294          return value;
9295        case 114603: // tax
9296          this.tax = TypeConvertor.castToMoney(value); // Money
9297          return value;
9298        case 108957: // net
9299          this.net = TypeConvertor.castToMoney(value); // Money
9300          return value;
9301        case 1702620169: // bodySite
9302          this.getBodySite().add((AddedItemBodySiteComponent) value); // AddedItemBodySiteComponent
9303          return value;
9304        case -1110033957: // noteNumber
9305          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
9306          return value;
9307        case 565719004: // decision
9308          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9309          return value;
9310        case -231349275: // adjudication
9311          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
9312          return value;
9313        case -1335224239: // detail
9314          this.getDetail().add((AddedItemDetailComponent) value); // AddedItemDetailComponent
9315          return value;
9316        default: return super.setProperty(hash, name, value);
9317        }
9318
9319      }
9320
9321      @Override
9322      public Base setProperty(String name, Base value) throws FHIRException {
9323        if (name.equals("itemSequence")) {
9324          this.getItemSequence().add(TypeConvertor.castToPositiveInt(value));
9325        } else if (name.equals("detailSequence")) {
9326          this.getDetailSequence().add(TypeConvertor.castToPositiveInt(value));
9327        } else if (name.equals("subDetailSequence")) {
9328          this.getSubDetailSequence().add(TypeConvertor.castToPositiveInt(value));
9329        } else if (name.equals("provider")) {
9330          this.getProvider().add(TypeConvertor.castToReference(value));
9331        } else if (name.equals("revenue")) {
9332          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9333        } else if (name.equals("productOrService")) {
9334          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9335        } else if (name.equals("productOrServiceEnd")) {
9336          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9337        } else if (name.equals("modifier")) {
9338          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
9339        } else if (name.equals("programCode")) {
9340          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
9341        } else if (name.equals("serviced[x]")) {
9342          this.serviced = TypeConvertor.castToType(value); // DataType
9343        } else if (name.equals("location[x]")) {
9344          this.location = TypeConvertor.castToType(value); // DataType
9345        } else if (name.equals("patientPaid")) {
9346          this.patientPaid = TypeConvertor.castToMoney(value); // Money
9347        } else if (name.equals("quantity")) {
9348          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
9349        } else if (name.equals("unitPrice")) {
9350          this.unitPrice = TypeConvertor.castToMoney(value); // Money
9351        } else if (name.equals("factor")) {
9352          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
9353        } else if (name.equals("tax")) {
9354          this.tax = TypeConvertor.castToMoney(value); // Money
9355        } else if (name.equals("net")) {
9356          this.net = TypeConvertor.castToMoney(value); // Money
9357        } else if (name.equals("bodySite")) {
9358          this.getBodySite().add((AddedItemBodySiteComponent) value);
9359        } else if (name.equals("noteNumber")) {
9360          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
9361        } else if (name.equals("decision")) {
9362          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9363        } else if (name.equals("adjudication")) {
9364          this.getAdjudication().add((AdjudicationComponent) value);
9365        } else if (name.equals("detail")) {
9366          this.getDetail().add((AddedItemDetailComponent) value);
9367        } else
9368          return super.setProperty(name, value);
9369        return value;
9370      }
9371
9372      @Override
9373      public Base makeProperty(int hash, String name) throws FHIRException {
9374        switch (hash) {
9375        case 1977979892:  return addItemSequenceElement();
9376        case 1321472818:  return addDetailSequenceElement();
9377        case -855462510:  return addSubDetailSequenceElement();
9378        case -987494927:  return addProvider(); 
9379        case 1099842588:  return getRevenue();
9380        case 1957227299:  return getProductOrService();
9381        case -717476168:  return getProductOrServiceEnd();
9382        case -615513385:  return addModifier(); 
9383        case 1010065041:  return addProgramCode(); 
9384        case -1927922223:  return getServiced();
9385        case 1379209295:  return getServiced();
9386        case 552316075:  return getLocation();
9387        case 1901043637:  return getLocation();
9388        case 525514609:  return getPatientPaid();
9389        case -1285004149:  return getQuantity();
9390        case -486196699:  return getUnitPrice();
9391        case -1282148017:  return getFactorElement();
9392        case 114603:  return getTax();
9393        case 108957:  return getNet();
9394        case 1702620169:  return addBodySite(); 
9395        case -1110033957:  return addNoteNumberElement();
9396        case 565719004:  return getDecision();
9397        case -231349275:  return addAdjudication(); 
9398        case -1335224239:  return addDetail(); 
9399        default: return super.makeProperty(hash, name);
9400        }
9401
9402      }
9403
9404      @Override
9405      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9406        switch (hash) {
9407        case 1977979892: /*itemSequence*/ return new String[] {"positiveInt"};
9408        case 1321472818: /*detailSequence*/ return new String[] {"positiveInt"};
9409        case -855462510: /*subDetailSequence*/ return new String[] {"positiveInt"};
9410        case -987494927: /*provider*/ return new String[] {"Reference"};
9411        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
9412        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
9413        case -717476168: /*productOrServiceEnd*/ return new String[] {"CodeableConcept"};
9414        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
9415        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
9416        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
9417        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
9418        case 525514609: /*patientPaid*/ return new String[] {"Money"};
9419        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
9420        case -486196699: /*unitPrice*/ return new String[] {"Money"};
9421        case -1282148017: /*factor*/ return new String[] {"decimal"};
9422        case 114603: /*tax*/ return new String[] {"Money"};
9423        case 108957: /*net*/ return new String[] {"Money"};
9424        case 1702620169: /*bodySite*/ return new String[] {};
9425        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
9426        case 565719004: /*decision*/ return new String[] {"CodeableConcept"};
9427        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
9428        case -1335224239: /*detail*/ return new String[] {};
9429        default: return super.getTypesForProperty(hash, name);
9430        }
9431
9432      }
9433
9434      @Override
9435      public Base addChild(String name) throws FHIRException {
9436        if (name.equals("itemSequence")) {
9437          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.itemSequence");
9438        }
9439        else if (name.equals("detailSequence")) {
9440          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detailSequence");
9441        }
9442        else if (name.equals("subDetailSequence")) {
9443          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.subDetailSequence");
9444        }
9445        else if (name.equals("provider")) {
9446          return addProvider();
9447        }
9448        else if (name.equals("revenue")) {
9449          this.revenue = new CodeableConcept();
9450          return this.revenue;
9451        }
9452        else if (name.equals("productOrService")) {
9453          this.productOrService = new CodeableConcept();
9454          return this.productOrService;
9455        }
9456        else if (name.equals("productOrServiceEnd")) {
9457          this.productOrServiceEnd = new CodeableConcept();
9458          return this.productOrServiceEnd;
9459        }
9460        else if (name.equals("modifier")) {
9461          return addModifier();
9462        }
9463        else if (name.equals("programCode")) {
9464          return addProgramCode();
9465        }
9466        else if (name.equals("servicedDate")) {
9467          this.serviced = new DateType();
9468          return this.serviced;
9469        }
9470        else if (name.equals("servicedPeriod")) {
9471          this.serviced = new Period();
9472          return this.serviced;
9473        }
9474        else if (name.equals("locationCodeableConcept")) {
9475          this.location = new CodeableConcept();
9476          return this.location;
9477        }
9478        else if (name.equals("locationAddress")) {
9479          this.location = new Address();
9480          return this.location;
9481        }
9482        else if (name.equals("locationReference")) {
9483          this.location = new Reference();
9484          return this.location;
9485        }
9486        else if (name.equals("patientPaid")) {
9487          this.patientPaid = new Money();
9488          return this.patientPaid;
9489        }
9490        else if (name.equals("quantity")) {
9491          this.quantity = new Quantity();
9492          return this.quantity;
9493        }
9494        else if (name.equals("unitPrice")) {
9495          this.unitPrice = new Money();
9496          return this.unitPrice;
9497        }
9498        else if (name.equals("factor")) {
9499          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.factor");
9500        }
9501        else if (name.equals("tax")) {
9502          this.tax = new Money();
9503          return this.tax;
9504        }
9505        else if (name.equals("net")) {
9506          this.net = new Money();
9507          return this.net;
9508        }
9509        else if (name.equals("bodySite")) {
9510          return addBodySite();
9511        }
9512        else if (name.equals("noteNumber")) {
9513          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.noteNumber");
9514        }
9515        else if (name.equals("decision")) {
9516          this.decision = new CodeableConcept();
9517          return this.decision;
9518        }
9519        else if (name.equals("adjudication")) {
9520          return addAdjudication();
9521        }
9522        else if (name.equals("detail")) {
9523          return addDetail();
9524        }
9525        else
9526          return super.addChild(name);
9527      }
9528
9529      public AddedItemComponent copy() {
9530        AddedItemComponent dst = new AddedItemComponent();
9531        copyValues(dst);
9532        return dst;
9533      }
9534
9535      public void copyValues(AddedItemComponent dst) {
9536        super.copyValues(dst);
9537        if (itemSequence != null) {
9538          dst.itemSequence = new ArrayList<PositiveIntType>();
9539          for (PositiveIntType i : itemSequence)
9540            dst.itemSequence.add(i.copy());
9541        };
9542        if (detailSequence != null) {
9543          dst.detailSequence = new ArrayList<PositiveIntType>();
9544          for (PositiveIntType i : detailSequence)
9545            dst.detailSequence.add(i.copy());
9546        };
9547        if (subDetailSequence != null) {
9548          dst.subDetailSequence = new ArrayList<PositiveIntType>();
9549          for (PositiveIntType i : subDetailSequence)
9550            dst.subDetailSequence.add(i.copy());
9551        };
9552        if (provider != null) {
9553          dst.provider = new ArrayList<Reference>();
9554          for (Reference i : provider)
9555            dst.provider.add(i.copy());
9556        };
9557        dst.revenue = revenue == null ? null : revenue.copy();
9558        dst.productOrService = productOrService == null ? null : productOrService.copy();
9559        dst.productOrServiceEnd = productOrServiceEnd == null ? null : productOrServiceEnd.copy();
9560        if (modifier != null) {
9561          dst.modifier = new ArrayList<CodeableConcept>();
9562          for (CodeableConcept i : modifier)
9563            dst.modifier.add(i.copy());
9564        };
9565        if (programCode != null) {
9566          dst.programCode = new ArrayList<CodeableConcept>();
9567          for (CodeableConcept i : programCode)
9568            dst.programCode.add(i.copy());
9569        };
9570        dst.serviced = serviced == null ? null : serviced.copy();
9571        dst.location = location == null ? null : location.copy();
9572        dst.patientPaid = patientPaid == null ? null : patientPaid.copy();
9573        dst.quantity = quantity == null ? null : quantity.copy();
9574        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
9575        dst.factor = factor == null ? null : factor.copy();
9576        dst.tax = tax == null ? null : tax.copy();
9577        dst.net = net == null ? null : net.copy();
9578        if (bodySite != null) {
9579          dst.bodySite = new ArrayList<AddedItemBodySiteComponent>();
9580          for (AddedItemBodySiteComponent i : bodySite)
9581            dst.bodySite.add(i.copy());
9582        };
9583        if (noteNumber != null) {
9584          dst.noteNumber = new ArrayList<PositiveIntType>();
9585          for (PositiveIntType i : noteNumber)
9586            dst.noteNumber.add(i.copy());
9587        };
9588        dst.decision = decision == null ? null : decision.copy();
9589        if (adjudication != null) {
9590          dst.adjudication = new ArrayList<AdjudicationComponent>();
9591          for (AdjudicationComponent i : adjudication)
9592            dst.adjudication.add(i.copy());
9593        };
9594        if (detail != null) {
9595          dst.detail = new ArrayList<AddedItemDetailComponent>();
9596          for (AddedItemDetailComponent i : detail)
9597            dst.detail.add(i.copy());
9598        };
9599      }
9600
9601      @Override
9602      public boolean equalsDeep(Base other_) {
9603        if (!super.equalsDeep(other_))
9604          return false;
9605        if (!(other_ instanceof AddedItemComponent))
9606          return false;
9607        AddedItemComponent o = (AddedItemComponent) other_;
9608        return compareDeep(itemSequence, o.itemSequence, true) && compareDeep(detailSequence, o.detailSequence, true)
9609           && compareDeep(subDetailSequence, o.subDetailSequence, true) && compareDeep(provider, o.provider, true)
9610           && compareDeep(revenue, o.revenue, true) && compareDeep(productOrService, o.productOrService, true)
9611           && compareDeep(productOrServiceEnd, o.productOrServiceEnd, true) && compareDeep(modifier, o.modifier, true)
9612           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
9613           && compareDeep(patientPaid, o.patientPaid, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
9614           && compareDeep(factor, o.factor, true) && compareDeep(tax, o.tax, true) && compareDeep(net, o.net, true)
9615           && compareDeep(bodySite, o.bodySite, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(decision, o.decision, true)
9616           && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
9617      }
9618
9619      @Override
9620      public boolean equalsShallow(Base other_) {
9621        if (!super.equalsShallow(other_))
9622          return false;
9623        if (!(other_ instanceof AddedItemComponent))
9624          return false;
9625        AddedItemComponent o = (AddedItemComponent) other_;
9626        return compareValues(itemSequence, o.itemSequence, true) && compareValues(detailSequence, o.detailSequence, true)
9627           && compareValues(subDetailSequence, o.subDetailSequence, true) && compareValues(factor, o.factor, true)
9628           && compareValues(noteNumber, o.noteNumber, true);
9629      }
9630
9631      public boolean isEmpty() {
9632        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemSequence, detailSequence
9633          , subDetailSequence, provider, revenue, productOrService, productOrServiceEnd, modifier
9634          , programCode, serviced, location, patientPaid, quantity, unitPrice, factor, tax
9635          , net, bodySite, noteNumber, decision, adjudication, detail);
9636      }
9637
9638  public String fhirType() {
9639    return "ExplanationOfBenefit.addItem";
9640
9641  }
9642
9643  }
9644
9645    @Block()
9646    public static class AddedItemBodySiteComponent extends BackboneElement implements IBaseBackboneElement {
9647        /**
9648         * Physical service site on the patient (limb, tooth, etc.).
9649         */
9650        @Child(name = "site", type = {CodeableReference.class}, order=1, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9651        @Description(shortDefinition="Location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
9652        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
9653        protected List<CodeableReference> site;
9654
9655        /**
9656         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
9657         */
9658        @Child(name = "subSite", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9659        @Description(shortDefinition="Sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
9660        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
9661        protected List<CodeableConcept> subSite;
9662
9663        private static final long serialVersionUID = 1190632415L;
9664
9665    /**
9666     * Constructor
9667     */
9668      public AddedItemBodySiteComponent() {
9669        super();
9670      }
9671
9672    /**
9673     * Constructor
9674     */
9675      public AddedItemBodySiteComponent(CodeableReference site) {
9676        super();
9677        this.addSite(site);
9678      }
9679
9680        /**
9681         * @return {@link #site} (Physical service site on the patient (limb, tooth, etc.).)
9682         */
9683        public List<CodeableReference> getSite() { 
9684          if (this.site == null)
9685            this.site = new ArrayList<CodeableReference>();
9686          return this.site;
9687        }
9688
9689        /**
9690         * @return Returns a reference to <code>this</code> for easy method chaining
9691         */
9692        public AddedItemBodySiteComponent setSite(List<CodeableReference> theSite) { 
9693          this.site = theSite;
9694          return this;
9695        }
9696
9697        public boolean hasSite() { 
9698          if (this.site == null)
9699            return false;
9700          for (CodeableReference item : this.site)
9701            if (!item.isEmpty())
9702              return true;
9703          return false;
9704        }
9705
9706        public CodeableReference addSite() { //3
9707          CodeableReference t = new CodeableReference();
9708          if (this.site == null)
9709            this.site = new ArrayList<CodeableReference>();
9710          this.site.add(t);
9711          return t;
9712        }
9713
9714        public AddedItemBodySiteComponent addSite(CodeableReference t) { //3
9715          if (t == null)
9716            return this;
9717          if (this.site == null)
9718            this.site = new ArrayList<CodeableReference>();
9719          this.site.add(t);
9720          return this;
9721        }
9722
9723        /**
9724         * @return The first repetition of repeating field {@link #site}, creating it if it does not already exist {3}
9725         */
9726        public CodeableReference getSiteFirstRep() { 
9727          if (getSite().isEmpty()) {
9728            addSite();
9729          }
9730          return getSite().get(0);
9731        }
9732
9733        /**
9734         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
9735         */
9736        public List<CodeableConcept> getSubSite() { 
9737          if (this.subSite == null)
9738            this.subSite = new ArrayList<CodeableConcept>();
9739          return this.subSite;
9740        }
9741
9742        /**
9743         * @return Returns a reference to <code>this</code> for easy method chaining
9744         */
9745        public AddedItemBodySiteComponent setSubSite(List<CodeableConcept> theSubSite) { 
9746          this.subSite = theSubSite;
9747          return this;
9748        }
9749
9750        public boolean hasSubSite() { 
9751          if (this.subSite == null)
9752            return false;
9753          for (CodeableConcept item : this.subSite)
9754            if (!item.isEmpty())
9755              return true;
9756          return false;
9757        }
9758
9759        public CodeableConcept addSubSite() { //3
9760          CodeableConcept t = new CodeableConcept();
9761          if (this.subSite == null)
9762            this.subSite = new ArrayList<CodeableConcept>();
9763          this.subSite.add(t);
9764          return t;
9765        }
9766
9767        public AddedItemBodySiteComponent addSubSite(CodeableConcept t) { //3
9768          if (t == null)
9769            return this;
9770          if (this.subSite == null)
9771            this.subSite = new ArrayList<CodeableConcept>();
9772          this.subSite.add(t);
9773          return this;
9774        }
9775
9776        /**
9777         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist {3}
9778         */
9779        public CodeableConcept getSubSiteFirstRep() { 
9780          if (getSubSite().isEmpty()) {
9781            addSubSite();
9782          }
9783          return getSubSite().get(0);
9784        }
9785
9786        protected void listChildren(List<Property> children) {
9787          super.listChildren(children);
9788          children.add(new Property("site", "CodeableReference(BodyStructure)", "Physical service site on the patient (limb, tooth, etc.).", 0, java.lang.Integer.MAX_VALUE, site));
9789          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));
9790        }
9791
9792        @Override
9793        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9794          switch (_hash) {
9795          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);
9796          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);
9797          default: return super.getNamedProperty(_hash, _name, _checkValid);
9798          }
9799
9800        }
9801
9802      @Override
9803      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9804        switch (hash) {
9805        case 3530567: /*site*/ return this.site == null ? new Base[0] : this.site.toArray(new Base[this.site.size()]); // CodeableReference
9806        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
9807        default: return super.getProperty(hash, name, checkValid);
9808        }
9809
9810      }
9811
9812      @Override
9813      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9814        switch (hash) {
9815        case 3530567: // site
9816          this.getSite().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
9817          return value;
9818        case -1868566105: // subSite
9819          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
9820          return value;
9821        default: return super.setProperty(hash, name, value);
9822        }
9823
9824      }
9825
9826      @Override
9827      public Base setProperty(String name, Base value) throws FHIRException {
9828        if (name.equals("site")) {
9829          this.getSite().add(TypeConvertor.castToCodeableReference(value));
9830        } else if (name.equals("subSite")) {
9831          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value));
9832        } else
9833          return super.setProperty(name, value);
9834        return value;
9835      }
9836
9837      @Override
9838      public Base makeProperty(int hash, String name) throws FHIRException {
9839        switch (hash) {
9840        case 3530567:  return addSite(); 
9841        case -1868566105:  return addSubSite(); 
9842        default: return super.makeProperty(hash, name);
9843        }
9844
9845      }
9846
9847      @Override
9848      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9849        switch (hash) {
9850        case 3530567: /*site*/ return new String[] {"CodeableReference"};
9851        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
9852        default: return super.getTypesForProperty(hash, name);
9853        }
9854
9855      }
9856
9857      @Override
9858      public Base addChild(String name) throws FHIRException {
9859        if (name.equals("site")) {
9860          return addSite();
9861        }
9862        else if (name.equals("subSite")) {
9863          return addSubSite();
9864        }
9865        else
9866          return super.addChild(name);
9867      }
9868
9869      public AddedItemBodySiteComponent copy() {
9870        AddedItemBodySiteComponent dst = new AddedItemBodySiteComponent();
9871        copyValues(dst);
9872        return dst;
9873      }
9874
9875      public void copyValues(AddedItemBodySiteComponent dst) {
9876        super.copyValues(dst);
9877        if (site != null) {
9878          dst.site = new ArrayList<CodeableReference>();
9879          for (CodeableReference i : site)
9880            dst.site.add(i.copy());
9881        };
9882        if (subSite != null) {
9883          dst.subSite = new ArrayList<CodeableConcept>();
9884          for (CodeableConcept i : subSite)
9885            dst.subSite.add(i.copy());
9886        };
9887      }
9888
9889      @Override
9890      public boolean equalsDeep(Base other_) {
9891        if (!super.equalsDeep(other_))
9892          return false;
9893        if (!(other_ instanceof AddedItemBodySiteComponent))
9894          return false;
9895        AddedItemBodySiteComponent o = (AddedItemBodySiteComponent) other_;
9896        return compareDeep(site, o.site, true) && compareDeep(subSite, o.subSite, true);
9897      }
9898
9899      @Override
9900      public boolean equalsShallow(Base other_) {
9901        if (!super.equalsShallow(other_))
9902          return false;
9903        if (!(other_ instanceof AddedItemBodySiteComponent))
9904          return false;
9905        AddedItemBodySiteComponent o = (AddedItemBodySiteComponent) other_;
9906        return true;
9907      }
9908
9909      public boolean isEmpty() {
9910        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(site, subSite);
9911      }
9912
9913  public String fhirType() {
9914    return "ExplanationOfBenefit.addItem.bodySite";
9915
9916  }
9917
9918  }
9919
9920    @Block()
9921    public static class AddedItemDetailComponent extends BackboneElement implements IBaseBackboneElement {
9922        /**
9923         * The type of revenue or cost center providing the product and/or service.
9924         */
9925        @Child(name = "revenue", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
9926        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
9927        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
9928        protected CodeableConcept revenue;
9929
9930        /**
9931         * 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.
9932         */
9933        @Child(name = "productOrService", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
9934        @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." )
9935        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
9936        protected CodeableConcept productOrService;
9937
9938        /**
9939         * 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.
9940         */
9941        @Child(name = "productOrServiceEnd", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
9942        @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." )
9943        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
9944        protected CodeableConcept productOrServiceEnd;
9945
9946        /**
9947         * Item typification or modifiers codes to convey additional context for the product or service.
9948         */
9949        @Child(name = "modifier", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9950        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
9951        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
9952        protected List<CodeableConcept> modifier;
9953
9954        /**
9955         * 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.
9956         */
9957        @Child(name = "patientPaid", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
9958        @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." )
9959        protected Money patientPaid;
9960
9961        /**
9962         * The number of repetitions of a service or product.
9963         */
9964        @Child(name = "quantity", type = {Quantity.class}, order=6, min=0, max=1, modifier=false, summary=false)
9965        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
9966        protected Quantity quantity;
9967
9968        /**
9969         * 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.
9970         */
9971        @Child(name = "unitPrice", type = {Money.class}, order=7, min=0, max=1, modifier=false, summary=false)
9972        @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." )
9973        protected Money unitPrice;
9974
9975        /**
9976         * 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.
9977         */
9978        @Child(name = "factor", type = {DecimalType.class}, order=8, min=0, max=1, modifier=false, summary=false)
9979        @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." )
9980        protected DecimalType factor;
9981
9982        /**
9983         * The total of taxes applicable for this product or service.
9984         */
9985        @Child(name = "tax", type = {Money.class}, order=9, min=0, max=1, modifier=false, summary=false)
9986        @Description(shortDefinition="Total tax", formalDefinition="The total of taxes applicable for this product or service." )
9987        protected Money tax;
9988
9989        /**
9990         * The quantity times the unit price for an additional service or product or charge.
9991         */
9992        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
9993        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
9994        protected Money net;
9995
9996        /**
9997         * The numbers associated with notes below which apply to the adjudication of this item.
9998         */
9999        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10000        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
10001        protected List<PositiveIntType> noteNumber;
10002
10003        /**
10004         * The result of the claim, predetermination, or preauthorization adjudication.
10005         */
10006        @Child(name = "decision", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
10007        @Description(shortDefinition="Result of the adjudication", formalDefinition="The result of the claim, predetermination, or preauthorization adjudication." )
10008        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-decision")
10009        protected CodeableConcept decision;
10010
10011        /**
10012         * The adjudication results.
10013         */
10014        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10015        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
10016        protected List<AdjudicationComponent> adjudication;
10017
10018        /**
10019         * The third-tier service adjudications for payor added services.
10020         */
10021        @Child(name = "subDetail", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10022        @Description(shortDefinition="Insurer added line items", formalDefinition="The third-tier service adjudications for payor added services." )
10023        protected List<AddedItemDetailSubDetailComponent> subDetail;
10024
10025        private static final long serialVersionUID = 1514057274L;
10026
10027    /**
10028     * Constructor
10029     */
10030      public AddedItemDetailComponent() {
10031        super();
10032      }
10033
10034        /**
10035         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
10036         */
10037        public CodeableConcept getRevenue() { 
10038          if (this.revenue == null)
10039            if (Configuration.errorOnAutoCreate())
10040              throw new Error("Attempt to auto-create AddedItemDetailComponent.revenue");
10041            else if (Configuration.doAutoCreate())
10042              this.revenue = new CodeableConcept(); // cc
10043          return this.revenue;
10044        }
10045
10046        public boolean hasRevenue() { 
10047          return this.revenue != null && !this.revenue.isEmpty();
10048        }
10049
10050        /**
10051         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
10052         */
10053        public AddedItemDetailComponent setRevenue(CodeableConcept value) { 
10054          this.revenue = value;
10055          return this;
10056        }
10057
10058        /**
10059         * @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.)
10060         */
10061        public CodeableConcept getProductOrService() { 
10062          if (this.productOrService == null)
10063            if (Configuration.errorOnAutoCreate())
10064              throw new Error("Attempt to auto-create AddedItemDetailComponent.productOrService");
10065            else if (Configuration.doAutoCreate())
10066              this.productOrService = new CodeableConcept(); // cc
10067          return this.productOrService;
10068        }
10069
10070        public boolean hasProductOrService() { 
10071          return this.productOrService != null && !this.productOrService.isEmpty();
10072        }
10073
10074        /**
10075         * @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.)
10076         */
10077        public AddedItemDetailComponent setProductOrService(CodeableConcept value) { 
10078          this.productOrService = value;
10079          return this;
10080        }
10081
10082        /**
10083         * @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.)
10084         */
10085        public CodeableConcept getProductOrServiceEnd() { 
10086          if (this.productOrServiceEnd == null)
10087            if (Configuration.errorOnAutoCreate())
10088              throw new Error("Attempt to auto-create AddedItemDetailComponent.productOrServiceEnd");
10089            else if (Configuration.doAutoCreate())
10090              this.productOrServiceEnd = new CodeableConcept(); // cc
10091          return this.productOrServiceEnd;
10092        }
10093
10094        public boolean hasProductOrServiceEnd() { 
10095          return this.productOrServiceEnd != null && !this.productOrServiceEnd.isEmpty();
10096        }
10097
10098        /**
10099         * @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.)
10100         */
10101        public AddedItemDetailComponent setProductOrServiceEnd(CodeableConcept value) { 
10102          this.productOrServiceEnd = value;
10103          return this;
10104        }
10105
10106        /**
10107         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
10108         */
10109        public List<CodeableConcept> getModifier() { 
10110          if (this.modifier == null)
10111            this.modifier = new ArrayList<CodeableConcept>();
10112          return this.modifier;
10113        }
10114
10115        /**
10116         * @return Returns a reference to <code>this</code> for easy method chaining
10117         */
10118        public AddedItemDetailComponent setModifier(List<CodeableConcept> theModifier) { 
10119          this.modifier = theModifier;
10120          return this;
10121        }
10122
10123        public boolean hasModifier() { 
10124          if (this.modifier == null)
10125            return false;
10126          for (CodeableConcept item : this.modifier)
10127            if (!item.isEmpty())
10128              return true;
10129          return false;
10130        }
10131
10132        public CodeableConcept addModifier() { //3
10133          CodeableConcept t = new CodeableConcept();
10134          if (this.modifier == null)
10135            this.modifier = new ArrayList<CodeableConcept>();
10136          this.modifier.add(t);
10137          return t;
10138        }
10139
10140        public AddedItemDetailComponent addModifier(CodeableConcept t) { //3
10141          if (t == null)
10142            return this;
10143          if (this.modifier == null)
10144            this.modifier = new ArrayList<CodeableConcept>();
10145          this.modifier.add(t);
10146          return this;
10147        }
10148
10149        /**
10150         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
10151         */
10152        public CodeableConcept getModifierFirstRep() { 
10153          if (getModifier().isEmpty()) {
10154            addModifier();
10155          }
10156          return getModifier().get(0);
10157        }
10158
10159        /**
10160         * @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.)
10161         */
10162        public Money getPatientPaid() { 
10163          if (this.patientPaid == null)
10164            if (Configuration.errorOnAutoCreate())
10165              throw new Error("Attempt to auto-create AddedItemDetailComponent.patientPaid");
10166            else if (Configuration.doAutoCreate())
10167              this.patientPaid = new Money(); // cc
10168          return this.patientPaid;
10169        }
10170
10171        public boolean hasPatientPaid() { 
10172          return this.patientPaid != null && !this.patientPaid.isEmpty();
10173        }
10174
10175        /**
10176         * @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.)
10177         */
10178        public AddedItemDetailComponent setPatientPaid(Money value) { 
10179          this.patientPaid = value;
10180          return this;
10181        }
10182
10183        /**
10184         * @return {@link #quantity} (The number of repetitions of a service or product.)
10185         */
10186        public Quantity getQuantity() { 
10187          if (this.quantity == null)
10188            if (Configuration.errorOnAutoCreate())
10189              throw new Error("Attempt to auto-create AddedItemDetailComponent.quantity");
10190            else if (Configuration.doAutoCreate())
10191              this.quantity = new Quantity(); // cc
10192          return this.quantity;
10193        }
10194
10195        public boolean hasQuantity() { 
10196          return this.quantity != null && !this.quantity.isEmpty();
10197        }
10198
10199        /**
10200         * @param value {@link #quantity} (The number of repetitions of a service or product.)
10201         */
10202        public AddedItemDetailComponent setQuantity(Quantity value) { 
10203          this.quantity = value;
10204          return this;
10205        }
10206
10207        /**
10208         * @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.)
10209         */
10210        public Money getUnitPrice() { 
10211          if (this.unitPrice == null)
10212            if (Configuration.errorOnAutoCreate())
10213              throw new Error("Attempt to auto-create AddedItemDetailComponent.unitPrice");
10214            else if (Configuration.doAutoCreate())
10215              this.unitPrice = new Money(); // cc
10216          return this.unitPrice;
10217        }
10218
10219        public boolean hasUnitPrice() { 
10220          return this.unitPrice != null && !this.unitPrice.isEmpty();
10221        }
10222
10223        /**
10224         * @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.)
10225         */
10226        public AddedItemDetailComponent setUnitPrice(Money value) { 
10227          this.unitPrice = value;
10228          return this;
10229        }
10230
10231        /**
10232         * @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
10233         */
10234        public DecimalType getFactorElement() { 
10235          if (this.factor == null)
10236            if (Configuration.errorOnAutoCreate())
10237              throw new Error("Attempt to auto-create AddedItemDetailComponent.factor");
10238            else if (Configuration.doAutoCreate())
10239              this.factor = new DecimalType(); // bb
10240          return this.factor;
10241        }
10242
10243        public boolean hasFactorElement() { 
10244          return this.factor != null && !this.factor.isEmpty();
10245        }
10246
10247        public boolean hasFactor() { 
10248          return this.factor != null && !this.factor.isEmpty();
10249        }
10250
10251        /**
10252         * @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
10253         */
10254        public AddedItemDetailComponent setFactorElement(DecimalType value) { 
10255          this.factor = value;
10256          return this;
10257        }
10258
10259        /**
10260         * @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.
10261         */
10262        public BigDecimal getFactor() { 
10263          return this.factor == null ? null : this.factor.getValue();
10264        }
10265
10266        /**
10267         * @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.
10268         */
10269        public AddedItemDetailComponent setFactor(BigDecimal value) { 
10270          if (value == null)
10271            this.factor = null;
10272          else {
10273            if (this.factor == null)
10274              this.factor = new DecimalType();
10275            this.factor.setValue(value);
10276          }
10277          return this;
10278        }
10279
10280        /**
10281         * @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.
10282         */
10283        public AddedItemDetailComponent setFactor(long value) { 
10284              this.factor = new DecimalType();
10285            this.factor.setValue(value);
10286          return this;
10287        }
10288
10289        /**
10290         * @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.
10291         */
10292        public AddedItemDetailComponent setFactor(double value) { 
10293              this.factor = new DecimalType();
10294            this.factor.setValue(value);
10295          return this;
10296        }
10297
10298        /**
10299         * @return {@link #tax} (The total of taxes applicable for this product or service.)
10300         */
10301        public Money getTax() { 
10302          if (this.tax == null)
10303            if (Configuration.errorOnAutoCreate())
10304              throw new Error("Attempt to auto-create AddedItemDetailComponent.tax");
10305            else if (Configuration.doAutoCreate())
10306              this.tax = new Money(); // cc
10307          return this.tax;
10308        }
10309
10310        public boolean hasTax() { 
10311          return this.tax != null && !this.tax.isEmpty();
10312        }
10313
10314        /**
10315         * @param value {@link #tax} (The total of taxes applicable for this product or service.)
10316         */
10317        public AddedItemDetailComponent setTax(Money value) { 
10318          this.tax = value;
10319          return this;
10320        }
10321
10322        /**
10323         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
10324         */
10325        public Money getNet() { 
10326          if (this.net == null)
10327            if (Configuration.errorOnAutoCreate())
10328              throw new Error("Attempt to auto-create AddedItemDetailComponent.net");
10329            else if (Configuration.doAutoCreate())
10330              this.net = new Money(); // cc
10331          return this.net;
10332        }
10333
10334        public boolean hasNet() { 
10335          return this.net != null && !this.net.isEmpty();
10336        }
10337
10338        /**
10339         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
10340         */
10341        public AddedItemDetailComponent setNet(Money value) { 
10342          this.net = value;
10343          return this;
10344        }
10345
10346        /**
10347         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10348         */
10349        public List<PositiveIntType> getNoteNumber() { 
10350          if (this.noteNumber == null)
10351            this.noteNumber = new ArrayList<PositiveIntType>();
10352          return this.noteNumber;
10353        }
10354
10355        /**
10356         * @return Returns a reference to <code>this</code> for easy method chaining
10357         */
10358        public AddedItemDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
10359          this.noteNumber = theNoteNumber;
10360          return this;
10361        }
10362
10363        public boolean hasNoteNumber() { 
10364          if (this.noteNumber == null)
10365            return false;
10366          for (PositiveIntType item : this.noteNumber)
10367            if (!item.isEmpty())
10368              return true;
10369          return false;
10370        }
10371
10372        /**
10373         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10374         */
10375        public PositiveIntType addNoteNumberElement() {//2 
10376          PositiveIntType t = new PositiveIntType();
10377          if (this.noteNumber == null)
10378            this.noteNumber = new ArrayList<PositiveIntType>();
10379          this.noteNumber.add(t);
10380          return t;
10381        }
10382
10383        /**
10384         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10385         */
10386        public AddedItemDetailComponent addNoteNumber(int value) { //1
10387          PositiveIntType t = new PositiveIntType();
10388          t.setValue(value);
10389          if (this.noteNumber == null)
10390            this.noteNumber = new ArrayList<PositiveIntType>();
10391          this.noteNumber.add(t);
10392          return this;
10393        }
10394
10395        /**
10396         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10397         */
10398        public boolean hasNoteNumber(int value) { 
10399          if (this.noteNumber == null)
10400            return false;
10401          for (PositiveIntType v : this.noteNumber)
10402            if (v.getValue().equals(value)) // positiveInt
10403              return true;
10404          return false;
10405        }
10406
10407        /**
10408         * @return {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
10409         */
10410        public CodeableConcept getDecision() { 
10411          if (this.decision == null)
10412            if (Configuration.errorOnAutoCreate())
10413              throw new Error("Attempt to auto-create AddedItemDetailComponent.decision");
10414            else if (Configuration.doAutoCreate())
10415              this.decision = new CodeableConcept(); // cc
10416          return this.decision;
10417        }
10418
10419        public boolean hasDecision() { 
10420          return this.decision != null && !this.decision.isEmpty();
10421        }
10422
10423        /**
10424         * @param value {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
10425         */
10426        public AddedItemDetailComponent setDecision(CodeableConcept value) { 
10427          this.decision = value;
10428          return this;
10429        }
10430
10431        /**
10432         * @return {@link #adjudication} (The adjudication results.)
10433         */
10434        public List<AdjudicationComponent> getAdjudication() { 
10435          if (this.adjudication == null)
10436            this.adjudication = new ArrayList<AdjudicationComponent>();
10437          return this.adjudication;
10438        }
10439
10440        /**
10441         * @return Returns a reference to <code>this</code> for easy method chaining
10442         */
10443        public AddedItemDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
10444          this.adjudication = theAdjudication;
10445          return this;
10446        }
10447
10448        public boolean hasAdjudication() { 
10449          if (this.adjudication == null)
10450            return false;
10451          for (AdjudicationComponent item : this.adjudication)
10452            if (!item.isEmpty())
10453              return true;
10454          return false;
10455        }
10456
10457        public AdjudicationComponent addAdjudication() { //3
10458          AdjudicationComponent t = new AdjudicationComponent();
10459          if (this.adjudication == null)
10460            this.adjudication = new ArrayList<AdjudicationComponent>();
10461          this.adjudication.add(t);
10462          return t;
10463        }
10464
10465        public AddedItemDetailComponent addAdjudication(AdjudicationComponent t) { //3
10466          if (t == null)
10467            return this;
10468          if (this.adjudication == null)
10469            this.adjudication = new ArrayList<AdjudicationComponent>();
10470          this.adjudication.add(t);
10471          return this;
10472        }
10473
10474        /**
10475         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
10476         */
10477        public AdjudicationComponent getAdjudicationFirstRep() { 
10478          if (getAdjudication().isEmpty()) {
10479            addAdjudication();
10480          }
10481          return getAdjudication().get(0);
10482        }
10483
10484        /**
10485         * @return {@link #subDetail} (The third-tier service adjudications for payor added services.)
10486         */
10487        public List<AddedItemDetailSubDetailComponent> getSubDetail() { 
10488          if (this.subDetail == null)
10489            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
10490          return this.subDetail;
10491        }
10492
10493        /**
10494         * @return Returns a reference to <code>this</code> for easy method chaining
10495         */
10496        public AddedItemDetailComponent setSubDetail(List<AddedItemDetailSubDetailComponent> theSubDetail) { 
10497          this.subDetail = theSubDetail;
10498          return this;
10499        }
10500
10501        public boolean hasSubDetail() { 
10502          if (this.subDetail == null)
10503            return false;
10504          for (AddedItemDetailSubDetailComponent item : this.subDetail)
10505            if (!item.isEmpty())
10506              return true;
10507          return false;
10508        }
10509
10510        public AddedItemDetailSubDetailComponent addSubDetail() { //3
10511          AddedItemDetailSubDetailComponent t = new AddedItemDetailSubDetailComponent();
10512          if (this.subDetail == null)
10513            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
10514          this.subDetail.add(t);
10515          return t;
10516        }
10517
10518        public AddedItemDetailComponent addSubDetail(AddedItemDetailSubDetailComponent t) { //3
10519          if (t == null)
10520            return this;
10521          if (this.subDetail == null)
10522            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
10523          this.subDetail.add(t);
10524          return this;
10525        }
10526
10527        /**
10528         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist {3}
10529         */
10530        public AddedItemDetailSubDetailComponent getSubDetailFirstRep() { 
10531          if (getSubDetail().isEmpty()) {
10532            addSubDetail();
10533          }
10534          return getSubDetail().get(0);
10535        }
10536
10537        protected void listChildren(List<Property> children) {
10538          super.listChildren(children);
10539          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
10540          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));
10541          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));
10542          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));
10543          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));
10544          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
10545          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));
10546          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));
10547          children.add(new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax));
10548          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
10549          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));
10550          children.add(new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision));
10551          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
10552          children.add(new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
10553        }
10554
10555        @Override
10556        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10557          switch (_hash) {
10558          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
10559          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);
10560          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);
10561          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);
10562          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);
10563          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
10564          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);
10565          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);
10566          case 114603: /*tax*/  return new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax);
10567          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
10568          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);
10569          case 565719004: /*decision*/  return new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision);
10570          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
10571          case -828829007: /*subDetail*/  return new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
10572          default: return super.getNamedProperty(_hash, _name, _checkValid);
10573          }
10574
10575        }
10576
10577      @Override
10578      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10579        switch (hash) {
10580        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
10581        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
10582        case -717476168: /*productOrServiceEnd*/ return this.productOrServiceEnd == null ? new Base[0] : new Base[] {this.productOrServiceEnd}; // CodeableConcept
10583        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
10584        case 525514609: /*patientPaid*/ return this.patientPaid == null ? new Base[0] : new Base[] {this.patientPaid}; // Money
10585        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
10586        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
10587        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
10588        case 114603: /*tax*/ return this.tax == null ? new Base[0] : new Base[] {this.tax}; // Money
10589        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
10590        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
10591        case 565719004: /*decision*/ return this.decision == null ? new Base[0] : new Base[] {this.decision}; // CodeableConcept
10592        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
10593        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // AddedItemDetailSubDetailComponent
10594        default: return super.getProperty(hash, name, checkValid);
10595        }
10596
10597      }
10598
10599      @Override
10600      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10601        switch (hash) {
10602        case 1099842588: // revenue
10603          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10604          return value;
10605        case 1957227299: // productOrService
10606          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10607          return value;
10608        case -717476168: // productOrServiceEnd
10609          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10610          return value;
10611        case -615513385: // modifier
10612          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
10613          return value;
10614        case 525514609: // patientPaid
10615          this.patientPaid = TypeConvertor.castToMoney(value); // Money
10616          return value;
10617        case -1285004149: // quantity
10618          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
10619          return value;
10620        case -486196699: // unitPrice
10621          this.unitPrice = TypeConvertor.castToMoney(value); // Money
10622          return value;
10623        case -1282148017: // factor
10624          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
10625          return value;
10626        case 114603: // tax
10627          this.tax = TypeConvertor.castToMoney(value); // Money
10628          return value;
10629        case 108957: // net
10630          this.net = TypeConvertor.castToMoney(value); // Money
10631          return value;
10632        case -1110033957: // noteNumber
10633          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
10634          return value;
10635        case 565719004: // decision
10636          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10637          return value;
10638        case -231349275: // adjudication
10639          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
10640          return value;
10641        case -828829007: // subDetail
10642          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value); // AddedItemDetailSubDetailComponent
10643          return value;
10644        default: return super.setProperty(hash, name, value);
10645        }
10646
10647      }
10648
10649      @Override
10650      public Base setProperty(String name, Base value) throws FHIRException {
10651        if (name.equals("revenue")) {
10652          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10653        } else if (name.equals("productOrService")) {
10654          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10655        } else if (name.equals("productOrServiceEnd")) {
10656          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10657        } else if (name.equals("modifier")) {
10658          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
10659        } else if (name.equals("patientPaid")) {
10660          this.patientPaid = TypeConvertor.castToMoney(value); // Money
10661        } else if (name.equals("quantity")) {
10662          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
10663        } else if (name.equals("unitPrice")) {
10664          this.unitPrice = TypeConvertor.castToMoney(value); // Money
10665        } else if (name.equals("factor")) {
10666          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
10667        } else if (name.equals("tax")) {
10668          this.tax = TypeConvertor.castToMoney(value); // Money
10669        } else if (name.equals("net")) {
10670          this.net = TypeConvertor.castToMoney(value); // Money
10671        } else if (name.equals("noteNumber")) {
10672          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
10673        } else if (name.equals("decision")) {
10674          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10675        } else if (name.equals("adjudication")) {
10676          this.getAdjudication().add((AdjudicationComponent) value);
10677        } else if (name.equals("subDetail")) {
10678          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value);
10679        } else
10680          return super.setProperty(name, value);
10681        return value;
10682      }
10683
10684      @Override
10685      public Base makeProperty(int hash, String name) throws FHIRException {
10686        switch (hash) {
10687        case 1099842588:  return getRevenue();
10688        case 1957227299:  return getProductOrService();
10689        case -717476168:  return getProductOrServiceEnd();
10690        case -615513385:  return addModifier(); 
10691        case 525514609:  return getPatientPaid();
10692        case -1285004149:  return getQuantity();
10693        case -486196699:  return getUnitPrice();
10694        case -1282148017:  return getFactorElement();
10695        case 114603:  return getTax();
10696        case 108957:  return getNet();
10697        case -1110033957:  return addNoteNumberElement();
10698        case 565719004:  return getDecision();
10699        case -231349275:  return addAdjudication(); 
10700        case -828829007:  return addSubDetail(); 
10701        default: return super.makeProperty(hash, name);
10702        }
10703
10704      }
10705
10706      @Override
10707      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10708        switch (hash) {
10709        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
10710        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
10711        case -717476168: /*productOrServiceEnd*/ return new String[] {"CodeableConcept"};
10712        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
10713        case 525514609: /*patientPaid*/ return new String[] {"Money"};
10714        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
10715        case -486196699: /*unitPrice*/ return new String[] {"Money"};
10716        case -1282148017: /*factor*/ return new String[] {"decimal"};
10717        case 114603: /*tax*/ return new String[] {"Money"};
10718        case 108957: /*net*/ return new String[] {"Money"};
10719        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
10720        case 565719004: /*decision*/ return new String[] {"CodeableConcept"};
10721        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
10722        case -828829007: /*subDetail*/ return new String[] {};
10723        default: return super.getTypesForProperty(hash, name);
10724        }
10725
10726      }
10727
10728      @Override
10729      public Base addChild(String name) throws FHIRException {
10730        if (name.equals("revenue")) {
10731          this.revenue = new CodeableConcept();
10732          return this.revenue;
10733        }
10734        else if (name.equals("productOrService")) {
10735          this.productOrService = new CodeableConcept();
10736          return this.productOrService;
10737        }
10738        else if (name.equals("productOrServiceEnd")) {
10739          this.productOrServiceEnd = new CodeableConcept();
10740          return this.productOrServiceEnd;
10741        }
10742        else if (name.equals("modifier")) {
10743          return addModifier();
10744        }
10745        else if (name.equals("patientPaid")) {
10746          this.patientPaid = new Money();
10747          return this.patientPaid;
10748        }
10749        else if (name.equals("quantity")) {
10750          this.quantity = new Quantity();
10751          return this.quantity;
10752        }
10753        else if (name.equals("unitPrice")) {
10754          this.unitPrice = new Money();
10755          return this.unitPrice;
10756        }
10757        else if (name.equals("factor")) {
10758          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detail.factor");
10759        }
10760        else if (name.equals("tax")) {
10761          this.tax = new Money();
10762          return this.tax;
10763        }
10764        else if (name.equals("net")) {
10765          this.net = new Money();
10766          return this.net;
10767        }
10768        else if (name.equals("noteNumber")) {
10769          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detail.noteNumber");
10770        }
10771        else if (name.equals("decision")) {
10772          this.decision = new CodeableConcept();
10773          return this.decision;
10774        }
10775        else if (name.equals("adjudication")) {
10776          return addAdjudication();
10777        }
10778        else if (name.equals("subDetail")) {
10779          return addSubDetail();
10780        }
10781        else
10782          return super.addChild(name);
10783      }
10784
10785      public AddedItemDetailComponent copy() {
10786        AddedItemDetailComponent dst = new AddedItemDetailComponent();
10787        copyValues(dst);
10788        return dst;
10789      }
10790
10791      public void copyValues(AddedItemDetailComponent dst) {
10792        super.copyValues(dst);
10793        dst.revenue = revenue == null ? null : revenue.copy();
10794        dst.productOrService = productOrService == null ? null : productOrService.copy();
10795        dst.productOrServiceEnd = productOrServiceEnd == null ? null : productOrServiceEnd.copy();
10796        if (modifier != null) {
10797          dst.modifier = new ArrayList<CodeableConcept>();
10798          for (CodeableConcept i : modifier)
10799            dst.modifier.add(i.copy());
10800        };
10801        dst.patientPaid = patientPaid == null ? null : patientPaid.copy();
10802        dst.quantity = quantity == null ? null : quantity.copy();
10803        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
10804        dst.factor = factor == null ? null : factor.copy();
10805        dst.tax = tax == null ? null : tax.copy();
10806        dst.net = net == null ? null : net.copy();
10807        if (noteNumber != null) {
10808          dst.noteNumber = new ArrayList<PositiveIntType>();
10809          for (PositiveIntType i : noteNumber)
10810            dst.noteNumber.add(i.copy());
10811        };
10812        dst.decision = decision == null ? null : decision.copy();
10813        if (adjudication != null) {
10814          dst.adjudication = new ArrayList<AdjudicationComponent>();
10815          for (AdjudicationComponent i : adjudication)
10816            dst.adjudication.add(i.copy());
10817        };
10818        if (subDetail != null) {
10819          dst.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
10820          for (AddedItemDetailSubDetailComponent i : subDetail)
10821            dst.subDetail.add(i.copy());
10822        };
10823      }
10824
10825      @Override
10826      public boolean equalsDeep(Base other_) {
10827        if (!super.equalsDeep(other_))
10828          return false;
10829        if (!(other_ instanceof AddedItemDetailComponent))
10830          return false;
10831        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
10832        return compareDeep(revenue, o.revenue, true) && compareDeep(productOrService, o.productOrService, true)
10833           && compareDeep(productOrServiceEnd, o.productOrServiceEnd, true) && compareDeep(modifier, o.modifier, true)
10834           && compareDeep(patientPaid, o.patientPaid, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
10835           && compareDeep(factor, o.factor, true) && compareDeep(tax, o.tax, true) && compareDeep(net, o.net, true)
10836           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(decision, o.decision, true) && compareDeep(adjudication, o.adjudication, true)
10837           && compareDeep(subDetail, o.subDetail, true);
10838      }
10839
10840      @Override
10841      public boolean equalsShallow(Base other_) {
10842        if (!super.equalsShallow(other_))
10843          return false;
10844        if (!(other_ instanceof AddedItemDetailComponent))
10845          return false;
10846        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
10847        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
10848      }
10849
10850      public boolean isEmpty() {
10851        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(revenue, productOrService
10852          , productOrServiceEnd, modifier, patientPaid, quantity, unitPrice, factor, tax
10853          , net, noteNumber, decision, adjudication, subDetail);
10854      }
10855
10856  public String fhirType() {
10857    return "ExplanationOfBenefit.addItem.detail";
10858
10859  }
10860
10861  }
10862
10863    @Block()
10864    public static class AddedItemDetailSubDetailComponent extends BackboneElement implements IBaseBackboneElement {
10865        /**
10866         * The type of revenue or cost center providing the product and/or service.
10867         */
10868        @Child(name = "revenue", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
10869        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
10870        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
10871        protected CodeableConcept revenue;
10872
10873        /**
10874         * 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.
10875         */
10876        @Child(name = "productOrService", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
10877        @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." )
10878        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
10879        protected CodeableConcept productOrService;
10880
10881        /**
10882         * 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.
10883         */
10884        @Child(name = "productOrServiceEnd", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
10885        @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." )
10886        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
10887        protected CodeableConcept productOrServiceEnd;
10888
10889        /**
10890         * Item typification or modifiers codes to convey additional context for the product or service.
10891         */
10892        @Child(name = "modifier", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10893        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
10894        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
10895        protected List<CodeableConcept> modifier;
10896
10897        /**
10898         * 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.
10899         */
10900        @Child(name = "patientPaid", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
10901        @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." )
10902        protected Money patientPaid;
10903
10904        /**
10905         * The number of repetitions of a service or product.
10906         */
10907        @Child(name = "quantity", type = {Quantity.class}, order=6, min=0, max=1, modifier=false, summary=false)
10908        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
10909        protected Quantity quantity;
10910
10911        /**
10912         * 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.
10913         */
10914        @Child(name = "unitPrice", type = {Money.class}, order=7, min=0, max=1, modifier=false, summary=false)
10915        @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." )
10916        protected Money unitPrice;
10917
10918        /**
10919         * 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.
10920         */
10921        @Child(name = "factor", type = {DecimalType.class}, order=8, min=0, max=1, modifier=false, summary=false)
10922        @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." )
10923        protected DecimalType factor;
10924
10925        /**
10926         * The total of taxes applicable for this product or service.
10927         */
10928        @Child(name = "tax", type = {Money.class}, order=9, min=0, max=1, modifier=false, summary=false)
10929        @Description(shortDefinition="Total tax", formalDefinition="The total of taxes applicable for this product or service." )
10930        protected Money tax;
10931
10932        /**
10933         * The quantity times the unit price for an additional service or product or charge.
10934         */
10935        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
10936        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
10937        protected Money net;
10938
10939        /**
10940         * The numbers associated with notes below which apply to the adjudication of this item.
10941         */
10942        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10943        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
10944        protected List<PositiveIntType> noteNumber;
10945
10946        /**
10947         * The result of the claim, predetermination, or preauthorization adjudication.
10948         */
10949        @Child(name = "decision", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
10950        @Description(shortDefinition="Result of the adjudication", formalDefinition="The result of the claim, predetermination, or preauthorization adjudication." )
10951        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-decision")
10952        protected CodeableConcept decision;
10953
10954        /**
10955         * The adjudication results.
10956         */
10957        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10958        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
10959        protected List<AdjudicationComponent> adjudication;
10960
10961        private static final long serialVersionUID = 1436664749L;
10962
10963    /**
10964     * Constructor
10965     */
10966      public AddedItemDetailSubDetailComponent() {
10967        super();
10968      }
10969
10970        /**
10971         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
10972         */
10973        public CodeableConcept getRevenue() { 
10974          if (this.revenue == null)
10975            if (Configuration.errorOnAutoCreate())
10976              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.revenue");
10977            else if (Configuration.doAutoCreate())
10978              this.revenue = new CodeableConcept(); // cc
10979          return this.revenue;
10980        }
10981
10982        public boolean hasRevenue() { 
10983          return this.revenue != null && !this.revenue.isEmpty();
10984        }
10985
10986        /**
10987         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
10988         */
10989        public AddedItemDetailSubDetailComponent setRevenue(CodeableConcept value) { 
10990          this.revenue = value;
10991          return this;
10992        }
10993
10994        /**
10995         * @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.)
10996         */
10997        public CodeableConcept getProductOrService() { 
10998          if (this.productOrService == null)
10999            if (Configuration.errorOnAutoCreate())
11000              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.productOrService");
11001            else if (Configuration.doAutoCreate())
11002              this.productOrService = new CodeableConcept(); // cc
11003          return this.productOrService;
11004        }
11005
11006        public boolean hasProductOrService() { 
11007          return this.productOrService != null && !this.productOrService.isEmpty();
11008        }
11009
11010        /**
11011         * @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.)
11012         */
11013        public AddedItemDetailSubDetailComponent setProductOrService(CodeableConcept value) { 
11014          this.productOrService = value;
11015          return this;
11016        }
11017
11018        /**
11019         * @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.)
11020         */
11021        public CodeableConcept getProductOrServiceEnd() { 
11022          if (this.productOrServiceEnd == null)
11023            if (Configuration.errorOnAutoCreate())
11024              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.productOrServiceEnd");
11025            else if (Configuration.doAutoCreate())
11026              this.productOrServiceEnd = new CodeableConcept(); // cc
11027          return this.productOrServiceEnd;
11028        }
11029
11030        public boolean hasProductOrServiceEnd() { 
11031          return this.productOrServiceEnd != null && !this.productOrServiceEnd.isEmpty();
11032        }
11033
11034        /**
11035         * @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.)
11036         */
11037        public AddedItemDetailSubDetailComponent setProductOrServiceEnd(CodeableConcept value) { 
11038          this.productOrServiceEnd = value;
11039          return this;
11040        }
11041
11042        /**
11043         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
11044         */
11045        public List<CodeableConcept> getModifier() { 
11046          if (this.modifier == null)
11047            this.modifier = new ArrayList<CodeableConcept>();
11048          return this.modifier;
11049        }
11050
11051        /**
11052         * @return Returns a reference to <code>this</code> for easy method chaining
11053         */
11054        public AddedItemDetailSubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
11055          this.modifier = theModifier;
11056          return this;
11057        }
11058
11059        public boolean hasModifier() { 
11060          if (this.modifier == null)
11061            return false;
11062          for (CodeableConcept item : this.modifier)
11063            if (!item.isEmpty())
11064              return true;
11065          return false;
11066        }
11067
11068        public CodeableConcept addModifier() { //3
11069          CodeableConcept t = new CodeableConcept();
11070          if (this.modifier == null)
11071            this.modifier = new ArrayList<CodeableConcept>();
11072          this.modifier.add(t);
11073          return t;
11074        }
11075
11076        public AddedItemDetailSubDetailComponent addModifier(CodeableConcept t) { //3
11077          if (t == null)
11078            return this;
11079          if (this.modifier == null)
11080            this.modifier = new ArrayList<CodeableConcept>();
11081          this.modifier.add(t);
11082          return this;
11083        }
11084
11085        /**
11086         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
11087         */
11088        public CodeableConcept getModifierFirstRep() { 
11089          if (getModifier().isEmpty()) {
11090            addModifier();
11091          }
11092          return getModifier().get(0);
11093        }
11094
11095        /**
11096         * @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.)
11097         */
11098        public Money getPatientPaid() { 
11099          if (this.patientPaid == null)
11100            if (Configuration.errorOnAutoCreate())
11101              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.patientPaid");
11102            else if (Configuration.doAutoCreate())
11103              this.patientPaid = new Money(); // cc
11104          return this.patientPaid;
11105        }
11106
11107        public boolean hasPatientPaid() { 
11108          return this.patientPaid != null && !this.patientPaid.isEmpty();
11109        }
11110
11111        /**
11112         * @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.)
11113         */
11114        public AddedItemDetailSubDetailComponent setPatientPaid(Money value) { 
11115          this.patientPaid = value;
11116          return this;
11117        }
11118
11119        /**
11120         * @return {@link #quantity} (The number of repetitions of a service or product.)
11121         */
11122        public Quantity getQuantity() { 
11123          if (this.quantity == null)
11124            if (Configuration.errorOnAutoCreate())
11125              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.quantity");
11126            else if (Configuration.doAutoCreate())
11127              this.quantity = new Quantity(); // cc
11128          return this.quantity;
11129        }
11130
11131        public boolean hasQuantity() { 
11132          return this.quantity != null && !this.quantity.isEmpty();
11133        }
11134
11135        /**
11136         * @param value {@link #quantity} (The number of repetitions of a service or product.)
11137         */
11138        public AddedItemDetailSubDetailComponent setQuantity(Quantity value) { 
11139          this.quantity = value;
11140          return this;
11141        }
11142
11143        /**
11144         * @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.)
11145         */
11146        public Money getUnitPrice() { 
11147          if (this.unitPrice == null)
11148            if (Configuration.errorOnAutoCreate())
11149              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.unitPrice");
11150            else if (Configuration.doAutoCreate())
11151              this.unitPrice = new Money(); // cc
11152          return this.unitPrice;
11153        }
11154
11155        public boolean hasUnitPrice() { 
11156          return this.unitPrice != null && !this.unitPrice.isEmpty();
11157        }
11158
11159        /**
11160         * @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.)
11161         */
11162        public AddedItemDetailSubDetailComponent setUnitPrice(Money value) { 
11163          this.unitPrice = value;
11164          return this;
11165        }
11166
11167        /**
11168         * @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
11169         */
11170        public DecimalType getFactorElement() { 
11171          if (this.factor == null)
11172            if (Configuration.errorOnAutoCreate())
11173              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.factor");
11174            else if (Configuration.doAutoCreate())
11175              this.factor = new DecimalType(); // bb
11176          return this.factor;
11177        }
11178
11179        public boolean hasFactorElement() { 
11180          return this.factor != null && !this.factor.isEmpty();
11181        }
11182
11183        public boolean hasFactor() { 
11184          return this.factor != null && !this.factor.isEmpty();
11185        }
11186
11187        /**
11188         * @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
11189         */
11190        public AddedItemDetailSubDetailComponent setFactorElement(DecimalType value) { 
11191          this.factor = value;
11192          return this;
11193        }
11194
11195        /**
11196         * @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.
11197         */
11198        public BigDecimal getFactor() { 
11199          return this.factor == null ? null : this.factor.getValue();
11200        }
11201
11202        /**
11203         * @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.
11204         */
11205        public AddedItemDetailSubDetailComponent setFactor(BigDecimal value) { 
11206          if (value == null)
11207            this.factor = null;
11208          else {
11209            if (this.factor == null)
11210              this.factor = new DecimalType();
11211            this.factor.setValue(value);
11212          }
11213          return this;
11214        }
11215
11216        /**
11217         * @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.
11218         */
11219        public AddedItemDetailSubDetailComponent setFactor(long value) { 
11220              this.factor = new DecimalType();
11221            this.factor.setValue(value);
11222          return this;
11223        }
11224
11225        /**
11226         * @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.
11227         */
11228        public AddedItemDetailSubDetailComponent setFactor(double value) { 
11229              this.factor = new DecimalType();
11230            this.factor.setValue(value);
11231          return this;
11232        }
11233
11234        /**
11235         * @return {@link #tax} (The total of taxes applicable for this product or service.)
11236         */
11237        public Money getTax() { 
11238          if (this.tax == null)
11239            if (Configuration.errorOnAutoCreate())
11240              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.tax");
11241            else if (Configuration.doAutoCreate())
11242              this.tax = new Money(); // cc
11243          return this.tax;
11244        }
11245
11246        public boolean hasTax() { 
11247          return this.tax != null && !this.tax.isEmpty();
11248        }
11249
11250        /**
11251         * @param value {@link #tax} (The total of taxes applicable for this product or service.)
11252         */
11253        public AddedItemDetailSubDetailComponent setTax(Money value) { 
11254          this.tax = value;
11255          return this;
11256        }
11257
11258        /**
11259         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
11260         */
11261        public Money getNet() { 
11262          if (this.net == null)
11263            if (Configuration.errorOnAutoCreate())
11264              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.net");
11265            else if (Configuration.doAutoCreate())
11266              this.net = new Money(); // cc
11267          return this.net;
11268        }
11269
11270        public boolean hasNet() { 
11271          return this.net != null && !this.net.isEmpty();
11272        }
11273
11274        /**
11275         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
11276         */
11277        public AddedItemDetailSubDetailComponent setNet(Money value) { 
11278          this.net = value;
11279          return this;
11280        }
11281
11282        /**
11283         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
11284         */
11285        public List<PositiveIntType> getNoteNumber() { 
11286          if (this.noteNumber == null)
11287            this.noteNumber = new ArrayList<PositiveIntType>();
11288          return this.noteNumber;
11289        }
11290
11291        /**
11292         * @return Returns a reference to <code>this</code> for easy method chaining
11293         */
11294        public AddedItemDetailSubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
11295          this.noteNumber = theNoteNumber;
11296          return this;
11297        }
11298
11299        public boolean hasNoteNumber() { 
11300          if (this.noteNumber == null)
11301            return false;
11302          for (PositiveIntType item : this.noteNumber)
11303            if (!item.isEmpty())
11304              return true;
11305          return false;
11306        }
11307
11308        /**
11309         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
11310         */
11311        public PositiveIntType addNoteNumberElement() {//2 
11312          PositiveIntType t = new PositiveIntType();
11313          if (this.noteNumber == null)
11314            this.noteNumber = new ArrayList<PositiveIntType>();
11315          this.noteNumber.add(t);
11316          return t;
11317        }
11318
11319        /**
11320         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
11321         */
11322        public AddedItemDetailSubDetailComponent addNoteNumber(int value) { //1
11323          PositiveIntType t = new PositiveIntType();
11324          t.setValue(value);
11325          if (this.noteNumber == null)
11326            this.noteNumber = new ArrayList<PositiveIntType>();
11327          this.noteNumber.add(t);
11328          return this;
11329        }
11330
11331        /**
11332         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
11333         */
11334        public boolean hasNoteNumber(int value) { 
11335          if (this.noteNumber == null)
11336            return false;
11337          for (PositiveIntType v : this.noteNumber)
11338            if (v.getValue().equals(value)) // positiveInt
11339              return true;
11340          return false;
11341        }
11342
11343        /**
11344         * @return {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
11345         */
11346        public CodeableConcept getDecision() { 
11347          if (this.decision == null)
11348            if (Configuration.errorOnAutoCreate())
11349              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.decision");
11350            else if (Configuration.doAutoCreate())
11351              this.decision = new CodeableConcept(); // cc
11352          return this.decision;
11353        }
11354
11355        public boolean hasDecision() { 
11356          return this.decision != null && !this.decision.isEmpty();
11357        }
11358
11359        /**
11360         * @param value {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
11361         */
11362        public AddedItemDetailSubDetailComponent setDecision(CodeableConcept value) { 
11363          this.decision = value;
11364          return this;
11365        }
11366
11367        /**
11368         * @return {@link #adjudication} (The adjudication results.)
11369         */
11370        public List<AdjudicationComponent> getAdjudication() { 
11371          if (this.adjudication == null)
11372            this.adjudication = new ArrayList<AdjudicationComponent>();
11373          return this.adjudication;
11374        }
11375
11376        /**
11377         * @return Returns a reference to <code>this</code> for easy method chaining
11378         */
11379        public AddedItemDetailSubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
11380          this.adjudication = theAdjudication;
11381          return this;
11382        }
11383
11384        public boolean hasAdjudication() { 
11385          if (this.adjudication == null)
11386            return false;
11387          for (AdjudicationComponent item : this.adjudication)
11388            if (!item.isEmpty())
11389              return true;
11390          return false;
11391        }
11392
11393        public AdjudicationComponent addAdjudication() { //3
11394          AdjudicationComponent t = new AdjudicationComponent();
11395          if (this.adjudication == null)
11396            this.adjudication = new ArrayList<AdjudicationComponent>();
11397          this.adjudication.add(t);
11398          return t;
11399        }
11400
11401        public AddedItemDetailSubDetailComponent addAdjudication(AdjudicationComponent t) { //3
11402          if (t == null)
11403            return this;
11404          if (this.adjudication == null)
11405            this.adjudication = new ArrayList<AdjudicationComponent>();
11406          this.adjudication.add(t);
11407          return this;
11408        }
11409
11410        /**
11411         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
11412         */
11413        public AdjudicationComponent getAdjudicationFirstRep() { 
11414          if (getAdjudication().isEmpty()) {
11415            addAdjudication();
11416          }
11417          return getAdjudication().get(0);
11418        }
11419
11420        protected void listChildren(List<Property> children) {
11421          super.listChildren(children);
11422          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
11423          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));
11424          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));
11425          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));
11426          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));
11427          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
11428          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));
11429          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));
11430          children.add(new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax));
11431          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
11432          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));
11433          children.add(new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision));
11434          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
11435        }
11436
11437        @Override
11438        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11439          switch (_hash) {
11440          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
11441          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);
11442          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);
11443          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);
11444          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);
11445          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
11446          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);
11447          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);
11448          case 114603: /*tax*/  return new Property("tax", "Money", "The total of taxes applicable for this product or service.", 0, 1, tax);
11449          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
11450          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);
11451          case 565719004: /*decision*/  return new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision);
11452          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
11453          default: return super.getNamedProperty(_hash, _name, _checkValid);
11454          }
11455
11456        }
11457
11458      @Override
11459      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11460        switch (hash) {
11461        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
11462        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
11463        case -717476168: /*productOrServiceEnd*/ return this.productOrServiceEnd == null ? new Base[0] : new Base[] {this.productOrServiceEnd}; // CodeableConcept
11464        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
11465        case 525514609: /*patientPaid*/ return this.patientPaid == null ? new Base[0] : new Base[] {this.patientPaid}; // Money
11466        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
11467        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
11468        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
11469        case 114603: /*tax*/ return this.tax == null ? new Base[0] : new Base[] {this.tax}; // Money
11470        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
11471        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
11472        case 565719004: /*decision*/ return this.decision == null ? new Base[0] : new Base[] {this.decision}; // CodeableConcept
11473        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
11474        default: return super.getProperty(hash, name, checkValid);
11475        }
11476
11477      }
11478
11479      @Override
11480      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11481        switch (hash) {
11482        case 1099842588: // revenue
11483          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11484          return value;
11485        case 1957227299: // productOrService
11486          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11487          return value;
11488        case -717476168: // productOrServiceEnd
11489          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11490          return value;
11491        case -615513385: // modifier
11492          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
11493          return value;
11494        case 525514609: // patientPaid
11495          this.patientPaid = TypeConvertor.castToMoney(value); // Money
11496          return value;
11497        case -1285004149: // quantity
11498          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
11499          return value;
11500        case -486196699: // unitPrice
11501          this.unitPrice = TypeConvertor.castToMoney(value); // Money
11502          return value;
11503        case -1282148017: // factor
11504          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
11505          return value;
11506        case 114603: // tax
11507          this.tax = TypeConvertor.castToMoney(value); // Money
11508          return value;
11509        case 108957: // net
11510          this.net = TypeConvertor.castToMoney(value); // Money
11511          return value;
11512        case -1110033957: // noteNumber
11513          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
11514          return value;
11515        case 565719004: // decision
11516          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11517          return value;
11518        case -231349275: // adjudication
11519          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
11520          return value;
11521        default: return super.setProperty(hash, name, value);
11522        }
11523
11524      }
11525
11526      @Override
11527      public Base setProperty(String name, Base value) throws FHIRException {
11528        if (name.equals("revenue")) {
11529          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11530        } else if (name.equals("productOrService")) {
11531          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11532        } else if (name.equals("productOrServiceEnd")) {
11533          this.productOrServiceEnd = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11534        } else if (name.equals("modifier")) {
11535          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
11536        } else if (name.equals("patientPaid")) {
11537          this.patientPaid = TypeConvertor.castToMoney(value); // Money
11538        } else if (name.equals("quantity")) {
11539          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
11540        } else if (name.equals("unitPrice")) {
11541          this.unitPrice = TypeConvertor.castToMoney(value); // Money
11542        } else if (name.equals("factor")) {
11543          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
11544        } else if (name.equals("tax")) {
11545          this.tax = TypeConvertor.castToMoney(value); // Money
11546        } else if (name.equals("net")) {
11547          this.net = TypeConvertor.castToMoney(value); // Money
11548        } else if (name.equals("noteNumber")) {
11549          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
11550        } else if (name.equals("decision")) {
11551          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11552        } else if (name.equals("adjudication")) {
11553          this.getAdjudication().add((AdjudicationComponent) value);
11554        } else
11555          return super.setProperty(name, value);
11556        return value;
11557      }
11558
11559      @Override
11560      public Base makeProperty(int hash, String name) throws FHIRException {
11561        switch (hash) {
11562        case 1099842588:  return getRevenue();
11563        case 1957227299:  return getProductOrService();
11564        case -717476168:  return getProductOrServiceEnd();
11565        case -615513385:  return addModifier(); 
11566        case 525514609:  return getPatientPaid();
11567        case -1285004149:  return getQuantity();
11568        case -486196699:  return getUnitPrice();
11569        case -1282148017:  return getFactorElement();
11570        case 114603:  return getTax();
11571        case 108957:  return getNet();
11572        case -1110033957:  return addNoteNumberElement();
11573        case 565719004:  return getDecision();
11574        case -231349275:  return addAdjudication(); 
11575        default: return super.makeProperty(hash, name);
11576        }
11577
11578      }
11579
11580      @Override
11581      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11582        switch (hash) {
11583        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
11584        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
11585        case -717476168: /*productOrServiceEnd*/ return new String[] {"CodeableConcept"};
11586        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
11587        case 525514609: /*patientPaid*/ return new String[] {"Money"};
11588        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
11589        case -486196699: /*unitPrice*/ return new String[] {"Money"};
11590        case -1282148017: /*factor*/ return new String[] {"decimal"};
11591        case 114603: /*tax*/ return new String[] {"Money"};
11592        case 108957: /*net*/ return new String[] {"Money"};
11593        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
11594        case 565719004: /*decision*/ return new String[] {"CodeableConcept"};
11595        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
11596        default: return super.getTypesForProperty(hash, name);
11597        }
11598
11599      }
11600
11601      @Override
11602      public Base addChild(String name) throws FHIRException {
11603        if (name.equals("revenue")) {
11604          this.revenue = new CodeableConcept();
11605          return this.revenue;
11606        }
11607        else if (name.equals("productOrService")) {
11608          this.productOrService = new CodeableConcept();
11609          return this.productOrService;
11610        }
11611        else if (name.equals("productOrServiceEnd")) {
11612          this.productOrServiceEnd = new CodeableConcept();
11613          return this.productOrServiceEnd;
11614        }
11615        else if (name.equals("modifier")) {
11616          return addModifier();
11617        }
11618        else if (name.equals("patientPaid")) {
11619          this.patientPaid = new Money();
11620          return this.patientPaid;
11621        }
11622        else if (name.equals("quantity")) {
11623          this.quantity = new Quantity();
11624          return this.quantity;
11625        }
11626        else if (name.equals("unitPrice")) {
11627          this.unitPrice = new Money();
11628          return this.unitPrice;
11629        }
11630        else if (name.equals("factor")) {
11631          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detail.subDetail.factor");
11632        }
11633        else if (name.equals("tax")) {
11634          this.tax = new Money();
11635          return this.tax;
11636        }
11637        else if (name.equals("net")) {
11638          this.net = new Money();
11639          return this.net;
11640        }
11641        else if (name.equals("noteNumber")) {
11642          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detail.subDetail.noteNumber");
11643        }
11644        else if (name.equals("decision")) {
11645          this.decision = new CodeableConcept();
11646          return this.decision;
11647        }
11648        else if (name.equals("adjudication")) {
11649          return addAdjudication();
11650        }
11651        else
11652          return super.addChild(name);
11653      }
11654
11655      public AddedItemDetailSubDetailComponent copy() {
11656        AddedItemDetailSubDetailComponent dst = new AddedItemDetailSubDetailComponent();
11657        copyValues(dst);
11658        return dst;
11659      }
11660
11661      public void copyValues(AddedItemDetailSubDetailComponent dst) {
11662        super.copyValues(dst);
11663        dst.revenue = revenue == null ? null : revenue.copy();
11664        dst.productOrService = productOrService == null ? null : productOrService.copy();
11665        dst.productOrServiceEnd = productOrServiceEnd == null ? null : productOrServiceEnd.copy();
11666        if (modifier != null) {
11667          dst.modifier = new ArrayList<CodeableConcept>();
11668          for (CodeableConcept i : modifier)
11669            dst.modifier.add(i.copy());
11670        };
11671        dst.patientPaid = patientPaid == null ? null : patientPaid.copy();
11672        dst.quantity = quantity == null ? null : quantity.copy();
11673        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
11674        dst.factor = factor == null ? null : factor.copy();
11675        dst.tax = tax == null ? null : tax.copy();
11676        dst.net = net == null ? null : net.copy();
11677        if (noteNumber != null) {
11678          dst.noteNumber = new ArrayList<PositiveIntType>();
11679          for (PositiveIntType i : noteNumber)
11680            dst.noteNumber.add(i.copy());
11681        };
11682        dst.decision = decision == null ? null : decision.copy();
11683        if (adjudication != null) {
11684          dst.adjudication = new ArrayList<AdjudicationComponent>();
11685          for (AdjudicationComponent i : adjudication)
11686            dst.adjudication.add(i.copy());
11687        };
11688      }
11689
11690      @Override
11691      public boolean equalsDeep(Base other_) {
11692        if (!super.equalsDeep(other_))
11693          return false;
11694        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
11695          return false;
11696        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
11697        return compareDeep(revenue, o.revenue, true) && compareDeep(productOrService, o.productOrService, true)
11698           && compareDeep(productOrServiceEnd, o.productOrServiceEnd, true) && compareDeep(modifier, o.modifier, true)
11699           && compareDeep(patientPaid, o.patientPaid, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
11700           && compareDeep(factor, o.factor, true) && compareDeep(tax, o.tax, true) && compareDeep(net, o.net, true)
11701           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(decision, o.decision, true) && compareDeep(adjudication, o.adjudication, true)
11702          ;
11703      }
11704
11705      @Override
11706      public boolean equalsShallow(Base other_) {
11707        if (!super.equalsShallow(other_))
11708          return false;
11709        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
11710          return false;
11711        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
11712        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
11713      }
11714
11715      public boolean isEmpty() {
11716        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(revenue, productOrService
11717          , productOrServiceEnd, modifier, patientPaid, quantity, unitPrice, factor, tax
11718          , net, noteNumber, decision, adjudication);
11719      }
11720
11721  public String fhirType() {
11722    return "ExplanationOfBenefit.addItem.detail.subDetail";
11723
11724  }
11725
11726  }
11727
11728    @Block()
11729    public static class TotalComponent extends BackboneElement implements IBaseBackboneElement {
11730        /**
11731         * 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.
11732         */
11733        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
11734        @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." )
11735        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
11736        protected CodeableConcept category;
11737
11738        /**
11739         * Monetary total amount associated with the category.
11740         */
11741        @Child(name = "amount", type = {Money.class}, order=2, min=1, max=1, modifier=false, summary=true)
11742        @Description(shortDefinition="Financial total for the category", formalDefinition="Monetary total amount associated with the category." )
11743        protected Money amount;
11744
11745        private static final long serialVersionUID = 2012310309L;
11746
11747    /**
11748     * Constructor
11749     */
11750      public TotalComponent() {
11751        super();
11752      }
11753
11754    /**
11755     * Constructor
11756     */
11757      public TotalComponent(CodeableConcept category, Money amount) {
11758        super();
11759        this.setCategory(category);
11760        this.setAmount(amount);
11761      }
11762
11763        /**
11764         * @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.)
11765         */
11766        public CodeableConcept getCategory() { 
11767          if (this.category == null)
11768            if (Configuration.errorOnAutoCreate())
11769              throw new Error("Attempt to auto-create TotalComponent.category");
11770            else if (Configuration.doAutoCreate())
11771              this.category = new CodeableConcept(); // cc
11772          return this.category;
11773        }
11774
11775        public boolean hasCategory() { 
11776          return this.category != null && !this.category.isEmpty();
11777        }
11778
11779        /**
11780         * @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.)
11781         */
11782        public TotalComponent setCategory(CodeableConcept value) { 
11783          this.category = value;
11784          return this;
11785        }
11786
11787        /**
11788         * @return {@link #amount} (Monetary total amount associated with the category.)
11789         */
11790        public Money getAmount() { 
11791          if (this.amount == null)
11792            if (Configuration.errorOnAutoCreate())
11793              throw new Error("Attempt to auto-create TotalComponent.amount");
11794            else if (Configuration.doAutoCreate())
11795              this.amount = new Money(); // cc
11796          return this.amount;
11797        }
11798
11799        public boolean hasAmount() { 
11800          return this.amount != null && !this.amount.isEmpty();
11801        }
11802
11803        /**
11804         * @param value {@link #amount} (Monetary total amount associated with the category.)
11805         */
11806        public TotalComponent setAmount(Money value) { 
11807          this.amount = value;
11808          return this;
11809        }
11810
11811        protected void listChildren(List<Property> children) {
11812          super.listChildren(children);
11813          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));
11814          children.add(new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount));
11815        }
11816
11817        @Override
11818        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11819          switch (_hash) {
11820          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);
11821          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount);
11822          default: return super.getNamedProperty(_hash, _name, _checkValid);
11823          }
11824
11825        }
11826
11827      @Override
11828      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11829        switch (hash) {
11830        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
11831        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
11832        default: return super.getProperty(hash, name, checkValid);
11833        }
11834
11835      }
11836
11837      @Override
11838      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11839        switch (hash) {
11840        case 50511102: // category
11841          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11842          return value;
11843        case -1413853096: // amount
11844          this.amount = TypeConvertor.castToMoney(value); // Money
11845          return value;
11846        default: return super.setProperty(hash, name, value);
11847        }
11848
11849      }
11850
11851      @Override
11852      public Base setProperty(String name, Base value) throws FHIRException {
11853        if (name.equals("category")) {
11854          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11855        } else if (name.equals("amount")) {
11856          this.amount = TypeConvertor.castToMoney(value); // Money
11857        } else
11858          return super.setProperty(name, value);
11859        return value;
11860      }
11861
11862      @Override
11863      public Base makeProperty(int hash, String name) throws FHIRException {
11864        switch (hash) {
11865        case 50511102:  return getCategory();
11866        case -1413853096:  return getAmount();
11867        default: return super.makeProperty(hash, name);
11868        }
11869
11870      }
11871
11872      @Override
11873      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11874        switch (hash) {
11875        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
11876        case -1413853096: /*amount*/ return new String[] {"Money"};
11877        default: return super.getTypesForProperty(hash, name);
11878        }
11879
11880      }
11881
11882      @Override
11883      public Base addChild(String name) throws FHIRException {
11884        if (name.equals("category")) {
11885          this.category = new CodeableConcept();
11886          return this.category;
11887        }
11888        else if (name.equals("amount")) {
11889          this.amount = new Money();
11890          return this.amount;
11891        }
11892        else
11893          return super.addChild(name);
11894      }
11895
11896      public TotalComponent copy() {
11897        TotalComponent dst = new TotalComponent();
11898        copyValues(dst);
11899        return dst;
11900      }
11901
11902      public void copyValues(TotalComponent dst) {
11903        super.copyValues(dst);
11904        dst.category = category == null ? null : category.copy();
11905        dst.amount = amount == null ? null : amount.copy();
11906      }
11907
11908      @Override
11909      public boolean equalsDeep(Base other_) {
11910        if (!super.equalsDeep(other_))
11911          return false;
11912        if (!(other_ instanceof TotalComponent))
11913          return false;
11914        TotalComponent o = (TotalComponent) other_;
11915        return compareDeep(category, o.category, true) && compareDeep(amount, o.amount, true);
11916      }
11917
11918      @Override
11919      public boolean equalsShallow(Base other_) {
11920        if (!super.equalsShallow(other_))
11921          return false;
11922        if (!(other_ instanceof TotalComponent))
11923          return false;
11924        TotalComponent o = (TotalComponent) other_;
11925        return true;
11926      }
11927
11928      public boolean isEmpty() {
11929        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, amount);
11930      }
11931
11932  public String fhirType() {
11933    return "ExplanationOfBenefit.total";
11934
11935  }
11936
11937  }
11938
11939    @Block()
11940    public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
11941        /**
11942         * Whether this represents partial or complete payment of the benefits payable.
11943         */
11944        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
11945        @Description(shortDefinition="Partial or complete payment", formalDefinition="Whether this represents partial or complete payment of the benefits payable." )
11946        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-paymenttype")
11947        protected CodeableConcept type;
11948
11949        /**
11950         * Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.
11951         */
11952        @Child(name = "adjustment", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
11953        @Description(shortDefinition="Payment adjustment for non-claim issues", formalDefinition="Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication." )
11954        protected Money adjustment;
11955
11956        /**
11957         * Reason for the payment adjustment.
11958         */
11959        @Child(name = "adjustmentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
11960        @Description(shortDefinition="Explanation for the variance", formalDefinition="Reason for the payment adjustment." )
11961        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
11962        protected CodeableConcept adjustmentReason;
11963
11964        /**
11965         * Estimated date the payment will be issued or the actual issue date of payment.
11966         */
11967        @Child(name = "date", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=false)
11968        @Description(shortDefinition="Expected date of payment", formalDefinition="Estimated date the payment will be issued or the actual issue date of payment." )
11969        protected DateType date;
11970
11971        /**
11972         * Benefits payable less any payment adjustment.
11973         */
11974        @Child(name = "amount", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
11975        @Description(shortDefinition="Payable amount after adjustment", formalDefinition="Benefits payable less any payment adjustment." )
11976        protected Money amount;
11977
11978        /**
11979         * Issuer's unique identifier for the payment instrument.
11980         */
11981        @Child(name = "identifier", type = {Identifier.class}, order=6, min=0, max=1, modifier=false, summary=false)
11982        @Description(shortDefinition="Business identifier for the payment", formalDefinition="Issuer's unique identifier for the payment instrument." )
11983        protected Identifier identifier;
11984
11985        private static final long serialVersionUID = 1539906026L;
11986
11987    /**
11988     * Constructor
11989     */
11990      public PaymentComponent() {
11991        super();
11992      }
11993
11994        /**
11995         * @return {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
11996         */
11997        public CodeableConcept getType() { 
11998          if (this.type == null)
11999            if (Configuration.errorOnAutoCreate())
12000              throw new Error("Attempt to auto-create PaymentComponent.type");
12001            else if (Configuration.doAutoCreate())
12002              this.type = new CodeableConcept(); // cc
12003          return this.type;
12004        }
12005
12006        public boolean hasType() { 
12007          return this.type != null && !this.type.isEmpty();
12008        }
12009
12010        /**
12011         * @param value {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
12012         */
12013        public PaymentComponent setType(CodeableConcept value) { 
12014          this.type = value;
12015          return this;
12016        }
12017
12018        /**
12019         * @return {@link #adjustment} (Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.)
12020         */
12021        public Money getAdjustment() { 
12022          if (this.adjustment == null)
12023            if (Configuration.errorOnAutoCreate())
12024              throw new Error("Attempt to auto-create PaymentComponent.adjustment");
12025            else if (Configuration.doAutoCreate())
12026              this.adjustment = new Money(); // cc
12027          return this.adjustment;
12028        }
12029
12030        public boolean hasAdjustment() { 
12031          return this.adjustment != null && !this.adjustment.isEmpty();
12032        }
12033
12034        /**
12035         * @param value {@link #adjustment} (Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.)
12036         */
12037        public PaymentComponent setAdjustment(Money value) { 
12038          this.adjustment = value;
12039          return this;
12040        }
12041
12042        /**
12043         * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
12044         */
12045        public CodeableConcept getAdjustmentReason() { 
12046          if (this.adjustmentReason == null)
12047            if (Configuration.errorOnAutoCreate())
12048              throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
12049            else if (Configuration.doAutoCreate())
12050              this.adjustmentReason = new CodeableConcept(); // cc
12051          return this.adjustmentReason;
12052        }
12053
12054        public boolean hasAdjustmentReason() { 
12055          return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
12056        }
12057
12058        /**
12059         * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
12060         */
12061        public PaymentComponent setAdjustmentReason(CodeableConcept value) { 
12062          this.adjustmentReason = value;
12063          return this;
12064        }
12065
12066        /**
12067         * @return {@link #date} (Estimated date the payment will be issued or the actual issue date of payment.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
12068         */
12069        public DateType getDateElement() { 
12070          if (this.date == null)
12071            if (Configuration.errorOnAutoCreate())
12072              throw new Error("Attempt to auto-create PaymentComponent.date");
12073            else if (Configuration.doAutoCreate())
12074              this.date = new DateType(); // bb
12075          return this.date;
12076        }
12077
12078        public boolean hasDateElement() { 
12079          return this.date != null && !this.date.isEmpty();
12080        }
12081
12082        public boolean hasDate() { 
12083          return this.date != null && !this.date.isEmpty();
12084        }
12085
12086        /**
12087         * @param value {@link #date} (Estimated date the payment will be issued or the actual issue date of payment.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
12088         */
12089        public PaymentComponent setDateElement(DateType value) { 
12090          this.date = value;
12091          return this;
12092        }
12093
12094        /**
12095         * @return Estimated date the payment will be issued or the actual issue date of payment.
12096         */
12097        public Date getDate() { 
12098          return this.date == null ? null : this.date.getValue();
12099        }
12100
12101        /**
12102         * @param value Estimated date the payment will be issued or the actual issue date of payment.
12103         */
12104        public PaymentComponent setDate(Date value) { 
12105          if (value == null)
12106            this.date = null;
12107          else {
12108            if (this.date == null)
12109              this.date = new DateType();
12110            this.date.setValue(value);
12111          }
12112          return this;
12113        }
12114
12115        /**
12116         * @return {@link #amount} (Benefits payable less any payment adjustment.)
12117         */
12118        public Money getAmount() { 
12119          if (this.amount == null)
12120            if (Configuration.errorOnAutoCreate())
12121              throw new Error("Attempt to auto-create PaymentComponent.amount");
12122            else if (Configuration.doAutoCreate())
12123              this.amount = new Money(); // cc
12124          return this.amount;
12125        }
12126
12127        public boolean hasAmount() { 
12128          return this.amount != null && !this.amount.isEmpty();
12129        }
12130
12131        /**
12132         * @param value {@link #amount} (Benefits payable less any payment adjustment.)
12133         */
12134        public PaymentComponent setAmount(Money value) { 
12135          this.amount = value;
12136          return this;
12137        }
12138
12139        /**
12140         * @return {@link #identifier} (Issuer's unique identifier for the payment instrument.)
12141         */
12142        public Identifier getIdentifier() { 
12143          if (this.identifier == null)
12144            if (Configuration.errorOnAutoCreate())
12145              throw new Error("Attempt to auto-create PaymentComponent.identifier");
12146            else if (Configuration.doAutoCreate())
12147              this.identifier = new Identifier(); // cc
12148          return this.identifier;
12149        }
12150
12151        public boolean hasIdentifier() { 
12152          return this.identifier != null && !this.identifier.isEmpty();
12153        }
12154
12155        /**
12156         * @param value {@link #identifier} (Issuer's unique identifier for the payment instrument.)
12157         */
12158        public PaymentComponent setIdentifier(Identifier value) { 
12159          this.identifier = value;
12160          return this;
12161        }
12162
12163        protected void listChildren(List<Property> children) {
12164          super.listChildren(children);
12165          children.add(new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type));
12166          children.add(new Property("adjustment", "Money", "Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.", 0, 1, adjustment));
12167          children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason));
12168          children.add(new Property("date", "date", "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date));
12169          children.add(new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount));
12170          children.add(new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier));
12171        }
12172
12173        @Override
12174        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
12175          switch (_hash) {
12176          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type);
12177          case 1977085293: /*adjustment*/  return new Property("adjustment", "Money", "Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.", 0, 1, adjustment);
12178          case -1255938543: /*adjustmentReason*/  return new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason);
12179          case 3076014: /*date*/  return new Property("date", "date", "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date);
12180          case -1413853096: /*amount*/  return new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount);
12181          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier);
12182          default: return super.getNamedProperty(_hash, _name, _checkValid);
12183          }
12184
12185        }
12186
12187      @Override
12188      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
12189        switch (hash) {
12190        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
12191        case 1977085293: /*adjustment*/ return this.adjustment == null ? new Base[0] : new Base[] {this.adjustment}; // Money
12192        case -1255938543: /*adjustmentReason*/ return this.adjustmentReason == null ? new Base[0] : new Base[] {this.adjustmentReason}; // CodeableConcept
12193        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
12194        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
12195        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
12196        default: return super.getProperty(hash, name, checkValid);
12197        }
12198
12199      }
12200
12201      @Override
12202      public Base setProperty(int hash, String name, Base value) throws FHIRException {
12203        switch (hash) {
12204        case 3575610: // type
12205          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
12206          return value;
12207        case 1977085293: // adjustment
12208          this.adjustment = TypeConvertor.castToMoney(value); // Money
12209          return value;
12210        case -1255938543: // adjustmentReason
12211          this.adjustmentReason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
12212          return value;
12213        case 3076014: // date
12214          this.date = TypeConvertor.castToDate(value); // DateType
12215          return value;
12216        case -1413853096: // amount
12217          this.amount = TypeConvertor.castToMoney(value); // Money
12218          return value;
12219        case -1618432855: // identifier
12220          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
12221          return value;
12222        default: return super.setProperty(hash, name, value);
12223        }
12224
12225      }
12226
12227      @Override
12228      public Base setProperty(String name, Base value) throws FHIRException {
12229        if (name.equals("type")) {
12230          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
12231        } else if (name.equals("adjustment")) {
12232          this.adjustment = TypeConvertor.castToMoney(value); // Money
12233        } else if (name.equals("adjustmentReason")) {
12234          this.adjustmentReason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
12235        } else if (name.equals("date")) {
12236          this.date = TypeConvertor.castToDate(value); // DateType
12237        } else if (name.equals("amount")) {
12238          this.amount = TypeConvertor.castToMoney(value); // Money
12239        } else if (name.equals("identifier")) {
12240          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
12241        } else
12242          return super.setProperty(name, value);
12243        return value;
12244      }
12245
12246      @Override
12247      public Base makeProperty(int hash, String name) throws FHIRException {
12248        switch (hash) {
12249        case 3575610:  return getType();
12250        case 1977085293:  return getAdjustment();
12251        case -1255938543:  return getAdjustmentReason();
12252        case 3076014:  return getDateElement();
12253        case -1413853096:  return getAmount();
12254        case -1618432855:  return getIdentifier();
12255        default: return super.makeProperty(hash, name);
12256        }
12257
12258      }
12259
12260      @Override
12261      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12262        switch (hash) {
12263        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
12264        case 1977085293: /*adjustment*/ return new String[] {"Money"};
12265        case -1255938543: /*adjustmentReason*/ return new String[] {"CodeableConcept"};
12266        case 3076014: /*date*/ return new String[] {"date"};
12267        case -1413853096: /*amount*/ return new String[] {"Money"};
12268        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
12269        default: return super.getTypesForProperty(hash, name);
12270        }
12271
12272      }
12273
12274      @Override
12275      public Base addChild(String name) throws FHIRException {
12276        if (name.equals("type")) {
12277          this.type = new CodeableConcept();
12278          return this.type;
12279        }
12280        else if (name.equals("adjustment")) {
12281          this.adjustment = new Money();
12282          return this.adjustment;
12283        }
12284        else if (name.equals("adjustmentReason")) {
12285          this.adjustmentReason = new CodeableConcept();
12286          return this.adjustmentReason;
12287        }
12288        else if (name.equals("date")) {
12289          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.payment.date");
12290        }
12291        else if (name.equals("amount")) {
12292          this.amount = new Money();
12293          return this.amount;
12294        }
12295        else if (name.equals("identifier")) {
12296          this.identifier = new Identifier();
12297          return this.identifier;
12298        }
12299        else
12300          return super.addChild(name);
12301      }
12302
12303      public PaymentComponent copy() {
12304        PaymentComponent dst = new PaymentComponent();
12305        copyValues(dst);
12306        return dst;
12307      }
12308
12309      public void copyValues(PaymentComponent dst) {
12310        super.copyValues(dst);
12311        dst.type = type == null ? null : type.copy();
12312        dst.adjustment = adjustment == null ? null : adjustment.copy();
12313        dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
12314        dst.date = date == null ? null : date.copy();
12315        dst.amount = amount == null ? null : amount.copy();
12316        dst.identifier = identifier == null ? null : identifier.copy();
12317      }
12318
12319      @Override
12320      public boolean equalsDeep(Base other_) {
12321        if (!super.equalsDeep(other_))
12322          return false;
12323        if (!(other_ instanceof PaymentComponent))
12324          return false;
12325        PaymentComponent o = (PaymentComponent) other_;
12326        return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true) && compareDeep(adjustmentReason, o.adjustmentReason, true)
12327           && compareDeep(date, o.date, true) && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true)
12328          ;
12329      }
12330
12331      @Override
12332      public boolean equalsShallow(Base other_) {
12333        if (!super.equalsShallow(other_))
12334          return false;
12335        if (!(other_ instanceof PaymentComponent))
12336          return false;
12337        PaymentComponent o = (PaymentComponent) other_;
12338        return compareValues(date, o.date, true);
12339      }
12340
12341      public boolean isEmpty() {
12342        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason
12343          , date, amount, identifier);
12344      }
12345
12346  public String fhirType() {
12347    return "ExplanationOfBenefit.payment";
12348
12349  }
12350
12351  }
12352
12353    @Block()
12354    public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
12355        /**
12356         * A number to uniquely identify a note entry.
12357         */
12358        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
12359        @Description(shortDefinition="Note instance identifier", formalDefinition="A number to uniquely identify a note entry." )
12360        protected PositiveIntType number;
12361
12362        /**
12363         * The business purpose of the note text.
12364         */
12365        @Child(name = "type", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
12366        @Description(shortDefinition="display | print | printoper", formalDefinition="The business purpose of the note text." )
12367        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
12368        protected Enumeration<NoteType> type;
12369
12370        /**
12371         * The explanation or description associated with the processing.
12372         */
12373        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
12374        @Description(shortDefinition="Note explanatory text", formalDefinition="The explanation or description associated with the processing." )
12375        protected StringType text;
12376
12377        /**
12378         * A code to define the language used in the text of the note.
12379         */
12380        @Child(name = "language", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
12381        @Description(shortDefinition="Language of the text", formalDefinition="A code to define the language used in the text of the note." )
12382        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
12383        protected CodeableConcept language;
12384
12385        private static final long serialVersionUID = -385184277L;
12386
12387    /**
12388     * Constructor
12389     */
12390      public NoteComponent() {
12391        super();
12392      }
12393
12394        /**
12395         * @return {@link #number} (A number to uniquely identify a note entry.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
12396         */
12397        public PositiveIntType getNumberElement() { 
12398          if (this.number == null)
12399            if (Configuration.errorOnAutoCreate())
12400              throw new Error("Attempt to auto-create NoteComponent.number");
12401            else if (Configuration.doAutoCreate())
12402              this.number = new PositiveIntType(); // bb
12403          return this.number;
12404        }
12405
12406        public boolean hasNumberElement() { 
12407          return this.number != null && !this.number.isEmpty();
12408        }
12409
12410        public boolean hasNumber() { 
12411          return this.number != null && !this.number.isEmpty();
12412        }
12413
12414        /**
12415         * @param value {@link #number} (A number to uniquely identify a note entry.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
12416         */
12417        public NoteComponent setNumberElement(PositiveIntType value) { 
12418          this.number = value;
12419          return this;
12420        }
12421
12422        /**
12423         * @return A number to uniquely identify a note entry.
12424         */
12425        public int getNumber() { 
12426          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
12427        }
12428
12429        /**
12430         * @param value A number to uniquely identify a note entry.
12431         */
12432        public NoteComponent setNumber(int value) { 
12433            if (this.number == null)
12434              this.number = new PositiveIntType();
12435            this.number.setValue(value);
12436          return this;
12437        }
12438
12439        /**
12440         * @return {@link #type} (The business purpose of the note text.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
12441         */
12442        public Enumeration<NoteType> getTypeElement() { 
12443          if (this.type == null)
12444            if (Configuration.errorOnAutoCreate())
12445              throw new Error("Attempt to auto-create NoteComponent.type");
12446            else if (Configuration.doAutoCreate())
12447              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory()); // bb
12448          return this.type;
12449        }
12450
12451        public boolean hasTypeElement() { 
12452          return this.type != null && !this.type.isEmpty();
12453        }
12454
12455        public boolean hasType() { 
12456          return this.type != null && !this.type.isEmpty();
12457        }
12458
12459        /**
12460         * @param value {@link #type} (The business purpose of the note text.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
12461         */
12462        public NoteComponent setTypeElement(Enumeration<NoteType> value) { 
12463          this.type = value;
12464          return this;
12465        }
12466
12467        /**
12468         * @return The business purpose of the note text.
12469         */
12470        public NoteType getType() { 
12471          return this.type == null ? null : this.type.getValue();
12472        }
12473
12474        /**
12475         * @param value The business purpose of the note text.
12476         */
12477        public NoteComponent setType(NoteType value) { 
12478          if (value == null)
12479            this.type = null;
12480          else {
12481            if (this.type == null)
12482              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory());
12483            this.type.setValue(value);
12484          }
12485          return this;
12486        }
12487
12488        /**
12489         * @return {@link #text} (The explanation or description associated with the processing.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
12490         */
12491        public StringType getTextElement() { 
12492          if (this.text == null)
12493            if (Configuration.errorOnAutoCreate())
12494              throw new Error("Attempt to auto-create NoteComponent.text");
12495            else if (Configuration.doAutoCreate())
12496              this.text = new StringType(); // bb
12497          return this.text;
12498        }
12499
12500        public boolean hasTextElement() { 
12501          return this.text != null && !this.text.isEmpty();
12502        }
12503
12504        public boolean hasText() { 
12505          return this.text != null && !this.text.isEmpty();
12506        }
12507
12508        /**
12509         * @param value {@link #text} (The explanation or description associated with the processing.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
12510         */
12511        public NoteComponent setTextElement(StringType value) { 
12512          this.text = value;
12513          return this;
12514        }
12515
12516        /**
12517         * @return The explanation or description associated with the processing.
12518         */
12519        public String getText() { 
12520          return this.text == null ? null : this.text.getValue();
12521        }
12522
12523        /**
12524         * @param value The explanation or description associated with the processing.
12525         */
12526        public NoteComponent setText(String value) { 
12527          if (Utilities.noString(value))
12528            this.text = null;
12529          else {
12530            if (this.text == null)
12531              this.text = new StringType();
12532            this.text.setValue(value);
12533          }
12534          return this;
12535        }
12536
12537        /**
12538         * @return {@link #language} (A code to define the language used in the text of the note.)
12539         */
12540        public CodeableConcept getLanguage() { 
12541          if (this.language == null)
12542            if (Configuration.errorOnAutoCreate())
12543              throw new Error("Attempt to auto-create NoteComponent.language");
12544            else if (Configuration.doAutoCreate())
12545              this.language = new CodeableConcept(); // cc
12546          return this.language;
12547        }
12548
12549        public boolean hasLanguage() { 
12550          return this.language != null && !this.language.isEmpty();
12551        }
12552
12553        /**
12554         * @param value {@link #language} (A code to define the language used in the text of the note.)
12555         */
12556        public NoteComponent setLanguage(CodeableConcept value) { 
12557          this.language = value;
12558          return this;
12559        }
12560
12561        protected void listChildren(List<Property> children) {
12562          super.listChildren(children);
12563          children.add(new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number));
12564          children.add(new Property("type", "code", "The business purpose of the note text.", 0, 1, type));
12565          children.add(new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text));
12566          children.add(new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language));
12567        }
12568
12569        @Override
12570        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
12571          switch (_hash) {
12572          case -1034364087: /*number*/  return new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number);
12573          case 3575610: /*type*/  return new Property("type", "code", "The business purpose of the note text.", 0, 1, type);
12574          case 3556653: /*text*/  return new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text);
12575          case -1613589672: /*language*/  return new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language);
12576          default: return super.getNamedProperty(_hash, _name, _checkValid);
12577          }
12578
12579        }
12580
12581      @Override
12582      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
12583        switch (hash) {
12584        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
12585        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<NoteType>
12586        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
12587        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
12588        default: return super.getProperty(hash, name, checkValid);
12589        }
12590
12591      }
12592
12593      @Override
12594      public Base setProperty(int hash, String name, Base value) throws FHIRException {
12595        switch (hash) {
12596        case -1034364087: // number
12597          this.number = TypeConvertor.castToPositiveInt(value); // PositiveIntType
12598          return value;
12599        case 3575610: // type
12600          value = new NoteTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
12601          this.type = (Enumeration) value; // Enumeration<NoteType>
12602          return value;
12603        case 3556653: // text
12604          this.text = TypeConvertor.castToString(value); // StringType
12605          return value;
12606        case -1613589672: // language
12607          this.language = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
12608          return value;
12609        default: return super.setProperty(hash, name, value);
12610        }
12611
12612      }
12613
12614      @Override
12615      public Base setProperty(String name, Base value) throws FHIRException {
12616        if (name.equals("number")) {
12617          this.number = TypeConvertor.castToPositiveInt(value); // PositiveIntType
12618        } else if (name.equals("type")) {
12619          value = new NoteTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
12620          this.type = (Enumeration) value; // Enumeration<NoteType>
12621        } else if (name.equals("text")) {
12622          this.text = TypeConvertor.castToString(value); // StringType
12623        } else if (name.equals("language")) {
12624          this.language = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
12625        } else
12626          return super.setProperty(name, value);
12627        return value;
12628      }
12629
12630      @Override
12631      public Base makeProperty(int hash, String name) throws FHIRException {
12632        switch (hash) {
12633        case -1034364087:  return getNumberElement();
12634        case 3575610:  return getTypeElement();
12635        case 3556653:  return getTextElement();
12636        case -1613589672:  return getLanguage();
12637        default: return super.makeProperty(hash, name);
12638        }
12639
12640      }
12641
12642      @Override
12643      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12644        switch (hash) {
12645        case -1034364087: /*number*/ return new String[] {"positiveInt"};
12646        case 3575610: /*type*/ return new String[] {"code"};
12647        case 3556653: /*text*/ return new String[] {"string"};
12648        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
12649        default: return super.getTypesForProperty(hash, name);
12650        }
12651
12652      }
12653
12654      @Override
12655      public Base addChild(String name) throws FHIRException {
12656        if (name.equals("number")) {
12657          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.processNote.number");
12658        }
12659        else if (name.equals("type")) {
12660          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.processNote.type");
12661        }
12662        else if (name.equals("text")) {
12663          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.processNote.text");
12664        }
12665        else if (name.equals("language")) {
12666          this.language = new CodeableConcept();
12667          return this.language;
12668        }
12669        else
12670          return super.addChild(name);
12671      }
12672
12673      public NoteComponent copy() {
12674        NoteComponent dst = new NoteComponent();
12675        copyValues(dst);
12676        return dst;
12677      }
12678
12679      public void copyValues(NoteComponent dst) {
12680        super.copyValues(dst);
12681        dst.number = number == null ? null : number.copy();
12682        dst.type = type == null ? null : type.copy();
12683        dst.text = text == null ? null : text.copy();
12684        dst.language = language == null ? null : language.copy();
12685      }
12686
12687      @Override
12688      public boolean equalsDeep(Base other_) {
12689        if (!super.equalsDeep(other_))
12690          return false;
12691        if (!(other_ instanceof NoteComponent))
12692          return false;
12693        NoteComponent o = (NoteComponent) other_;
12694        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
12695           && compareDeep(language, o.language, true);
12696      }
12697
12698      @Override
12699      public boolean equalsShallow(Base other_) {
12700        if (!super.equalsShallow(other_))
12701          return false;
12702        if (!(other_ instanceof NoteComponent))
12703          return false;
12704        NoteComponent o = (NoteComponent) other_;
12705        return compareValues(number, o.number, true) && compareValues(type, o.type, true) && compareValues(text, o.text, true)
12706          ;
12707      }
12708
12709      public boolean isEmpty() {
12710        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language
12711          );
12712      }
12713
12714  public String fhirType() {
12715    return "ExplanationOfBenefit.processNote";
12716
12717  }
12718
12719  }
12720
12721    @Block()
12722    public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
12723        /**
12724         * Code to identify the general type of benefits under which products and services are provided.
12725         */
12726        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
12727        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
12728        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
12729        protected CodeableConcept category;
12730
12731        /**
12732         * True if the indicated class of service is excluded from the plan, missing or False indicates the product or service is included in the coverage.
12733         */
12734        @Child(name = "excluded", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
12735        @Description(shortDefinition="Excluded from the plan", formalDefinition="True if the indicated class of service is excluded from the plan, missing or False indicates the product or service is included in the coverage." )
12736        protected BooleanType excluded;
12737
12738        /**
12739         * A short name or tag for the benefit.
12740         */
12741        @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
12742        @Description(shortDefinition="Short name for the benefit", formalDefinition="A short name or tag for the benefit." )
12743        protected StringType name;
12744
12745        /**
12746         * A richer description of the benefit or services covered.
12747         */
12748        @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
12749        @Description(shortDefinition="Description of the benefit or services covered", formalDefinition="A richer description of the benefit or services covered." )
12750        protected StringType description;
12751
12752        /**
12753         * Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.
12754         */
12755        @Child(name = "network", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
12756        @Description(shortDefinition="In or out of network", formalDefinition="Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers." )
12757        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-network")
12758        protected CodeableConcept network;
12759
12760        /**
12761         * Indicates if the benefits apply to an individual or to the family.
12762         */
12763        @Child(name = "unit", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
12764        @Description(shortDefinition="Individual or family", formalDefinition="Indicates if the benefits apply to an individual or to the family." )
12765        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-unit")
12766        protected CodeableConcept unit;
12767
12768        /**
12769         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.
12770         */
12771        @Child(name = "term", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
12772        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'." )
12773        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-term")
12774        protected CodeableConcept term;
12775
12776        /**
12777         * Benefits Used to date.
12778         */
12779        @Child(name = "financial", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12780        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
12781        protected List<BenefitComponent> financial;
12782
12783        private static final long serialVersionUID = -1889655824L;
12784
12785    /**
12786     * Constructor
12787     */
12788      public BenefitBalanceComponent() {
12789        super();
12790      }
12791
12792    /**
12793     * Constructor
12794     */
12795      public BenefitBalanceComponent(CodeableConcept category) {
12796        super();
12797        this.setCategory(category);
12798      }
12799
12800        /**
12801         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
12802         */
12803        public CodeableConcept getCategory() { 
12804          if (this.category == null)
12805            if (Configuration.errorOnAutoCreate())
12806              throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
12807            else if (Configuration.doAutoCreate())
12808              this.category = new CodeableConcept(); // cc
12809          return this.category;
12810        }
12811
12812        public boolean hasCategory() { 
12813          return this.category != null && !this.category.isEmpty();
12814        }
12815
12816        /**
12817         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
12818         */
12819        public BenefitBalanceComponent setCategory(CodeableConcept value) { 
12820          this.category = value;
12821          return this;
12822        }
12823
12824        /**
12825         * @return {@link #excluded} (True if the indicated class of service is excluded from the plan, missing or False indicates the product or service is included in the coverage.). This is the underlying object with id, value and extensions. The accessor "getExcluded" gives direct access to the value
12826         */
12827        public BooleanType getExcludedElement() { 
12828          if (this.excluded == null)
12829            if (Configuration.errorOnAutoCreate())
12830              throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
12831            else if (Configuration.doAutoCreate())
12832              this.excluded = new BooleanType(); // bb
12833          return this.excluded;
12834        }
12835
12836        public boolean hasExcludedElement() { 
12837          return this.excluded != null && !this.excluded.isEmpty();
12838        }
12839
12840        public boolean hasExcluded() { 
12841          return this.excluded != null && !this.excluded.isEmpty();
12842        }
12843
12844        /**
12845         * @param value {@link #excluded} (True if the indicated class of service is excluded from the plan, missing or False indicates the product or service is included in the coverage.). This is the underlying object with id, value and extensions. The accessor "getExcluded" gives direct access to the value
12846         */
12847        public BenefitBalanceComponent setExcludedElement(BooleanType value) { 
12848          this.excluded = value;
12849          return this;
12850        }
12851
12852        /**
12853         * @return True if the indicated class of service is excluded from the plan, missing or False indicates the product or service is included in the coverage.
12854         */
12855        public boolean getExcluded() { 
12856          return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
12857        }
12858
12859        /**
12860         * @param value True if the indicated class of service is excluded from the plan, missing or False indicates the product or service is included in the coverage.
12861         */
12862        public BenefitBalanceComponent setExcluded(boolean value) { 
12863            if (this.excluded == null)
12864              this.excluded = new BooleanType();
12865            this.excluded.setValue(value);
12866          return this;
12867        }
12868
12869        /**
12870         * @return {@link #name} (A short name or tag for the benefit.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
12871         */
12872        public StringType getNameElement() { 
12873          if (this.name == null)
12874            if (Configuration.errorOnAutoCreate())
12875              throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
12876            else if (Configuration.doAutoCreate())
12877              this.name = new StringType(); // bb
12878          return this.name;
12879        }
12880
12881        public boolean hasNameElement() { 
12882          return this.name != null && !this.name.isEmpty();
12883        }
12884
12885        public boolean hasName() { 
12886          return this.name != null && !this.name.isEmpty();
12887        }
12888
12889        /**
12890         * @param value {@link #name} (A short name or tag for the benefit.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
12891         */
12892        public BenefitBalanceComponent setNameElement(StringType value) { 
12893          this.name = value;
12894          return this;
12895        }
12896
12897        /**
12898         * @return A short name or tag for the benefit.
12899         */
12900        public String getName() { 
12901          return this.name == null ? null : this.name.getValue();
12902        }
12903
12904        /**
12905         * @param value A short name or tag for the benefit.
12906         */
12907        public BenefitBalanceComponent setName(String value) { 
12908          if (Utilities.noString(value))
12909            this.name = null;
12910          else {
12911            if (this.name == null)
12912              this.name = new StringType();
12913            this.name.setValue(value);
12914          }
12915          return this;
12916        }
12917
12918        /**
12919         * @return {@link #description} (A richer description of the benefit or services covered.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
12920         */
12921        public StringType getDescriptionElement() { 
12922          if (this.description == null)
12923            if (Configuration.errorOnAutoCreate())
12924              throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
12925            else if (Configuration.doAutoCreate())
12926              this.description = new StringType(); // bb
12927          return this.description;
12928        }
12929
12930        public boolean hasDescriptionElement() { 
12931          return this.description != null && !this.description.isEmpty();
12932        }
12933
12934        public boolean hasDescription() { 
12935          return this.description != null && !this.description.isEmpty();
12936        }
12937
12938        /**
12939         * @param value {@link #description} (A richer description of the benefit or services covered.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
12940         */
12941        public BenefitBalanceComponent setDescriptionElement(StringType value) { 
12942          this.description = value;
12943          return this;
12944        }
12945
12946        /**
12947         * @return A richer description of the benefit or services covered.
12948         */
12949        public String getDescription() { 
12950          return this.description == null ? null : this.description.getValue();
12951        }
12952
12953        /**
12954         * @param value A richer description of the benefit or services covered.
12955         */
12956        public BenefitBalanceComponent setDescription(String value) { 
12957          if (Utilities.noString(value))
12958            this.description = null;
12959          else {
12960            if (this.description == null)
12961              this.description = new StringType();
12962            this.description.setValue(value);
12963          }
12964          return this;
12965        }
12966
12967        /**
12968         * @return {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
12969         */
12970        public CodeableConcept getNetwork() { 
12971          if (this.network == null)
12972            if (Configuration.errorOnAutoCreate())
12973              throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
12974            else if (Configuration.doAutoCreate())
12975              this.network = new CodeableConcept(); // cc
12976          return this.network;
12977        }
12978
12979        public boolean hasNetwork() { 
12980          return this.network != null && !this.network.isEmpty();
12981        }
12982
12983        /**
12984         * @param value {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
12985         */
12986        public BenefitBalanceComponent setNetwork(CodeableConcept value) { 
12987          this.network = value;
12988          return this;
12989        }
12990
12991        /**
12992         * @return {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
12993         */
12994        public CodeableConcept getUnit() { 
12995          if (this.unit == null)
12996            if (Configuration.errorOnAutoCreate())
12997              throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
12998            else if (Configuration.doAutoCreate())
12999              this.unit = new CodeableConcept(); // cc
13000          return this.unit;
13001        }
13002
13003        public boolean hasUnit() { 
13004          return this.unit != null && !this.unit.isEmpty();
13005        }
13006
13007        /**
13008         * @param value {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
13009         */
13010        public BenefitBalanceComponent setUnit(CodeableConcept value) { 
13011          this.unit = value;
13012          return this;
13013        }
13014
13015        /**
13016         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
13017         */
13018        public CodeableConcept getTerm() { 
13019          if (this.term == null)
13020            if (Configuration.errorOnAutoCreate())
13021              throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
13022            else if (Configuration.doAutoCreate())
13023              this.term = new CodeableConcept(); // cc
13024          return this.term;
13025        }
13026
13027        public boolean hasTerm() { 
13028          return this.term != null && !this.term.isEmpty();
13029        }
13030
13031        /**
13032         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
13033         */
13034        public BenefitBalanceComponent setTerm(CodeableConcept value) { 
13035          this.term = value;
13036          return this;
13037        }
13038
13039        /**
13040         * @return {@link #financial} (Benefits Used to date.)
13041         */
13042        public List<BenefitComponent> getFinancial() { 
13043          if (this.financial == null)
13044            this.financial = new ArrayList<BenefitComponent>();
13045          return this.financial;
13046        }
13047
13048        /**
13049         * @return Returns a reference to <code>this</code> for easy method chaining
13050         */
13051        public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) { 
13052          this.financial = theFinancial;
13053          return this;
13054        }
13055
13056        public boolean hasFinancial() { 
13057          if (this.financial == null)
13058            return false;
13059          for (BenefitComponent item : this.financial)
13060            if (!item.isEmpty())
13061              return true;
13062          return false;
13063        }
13064
13065        public BenefitComponent addFinancial() { //3
13066          BenefitComponent t = new BenefitComponent();
13067          if (this.financial == null)
13068            this.financial = new ArrayList<BenefitComponent>();
13069          this.financial.add(t);
13070          return t;
13071        }
13072
13073        public BenefitBalanceComponent addFinancial(BenefitComponent t) { //3
13074          if (t == null)
13075            return this;
13076          if (this.financial == null)
13077            this.financial = new ArrayList<BenefitComponent>();
13078          this.financial.add(t);
13079          return this;
13080        }
13081
13082        /**
13083         * @return The first repetition of repeating field {@link #financial}, creating it if it does not already exist {3}
13084         */
13085        public BenefitComponent getFinancialFirstRep() { 
13086          if (getFinancial().isEmpty()) {
13087            addFinancial();
13088          }
13089          return getFinancial().get(0);
13090        }
13091
13092        protected void listChildren(List<Property> children) {
13093          super.listChildren(children);
13094          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
13095          children.add(new Property("excluded", "boolean", "True if the indicated class of service is excluded from the plan, missing or False indicates the product or service is included in the coverage.", 0, 1, excluded));
13096          children.add(new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name));
13097          children.add(new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description));
13098          children.add(new Property("network", "CodeableConcept", "Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.", 0, 1, network));
13099          children.add(new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit));
13100          children.add(new Property("term", "CodeableConcept", "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.", 0, 1, term));
13101          children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
13102        }
13103
13104        @Override
13105        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
13106          switch (_hash) {
13107          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);
13108          case 1994055114: /*excluded*/  return new Property("excluded", "boolean", "True if the indicated class of service is excluded from the plan, missing or False indicates the product or service is included in the coverage.", 0, 1, excluded);
13109          case 3373707: /*name*/  return new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name);
13110          case -1724546052: /*description*/  return new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description);
13111          case 1843485230: /*network*/  return new Property("network", "CodeableConcept", "Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.", 0, 1, network);
13112          case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit);
13113          case 3556460: /*term*/  return new Property("term", "CodeableConcept", "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.", 0, 1, term);
13114          case 357555337: /*financial*/  return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial);
13115          default: return super.getNamedProperty(_hash, _name, _checkValid);
13116          }
13117
13118        }
13119
13120      @Override
13121      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
13122        switch (hash) {
13123        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
13124        case 1994055114: /*excluded*/ return this.excluded == null ? new Base[0] : new Base[] {this.excluded}; // BooleanType
13125        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
13126        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
13127        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // CodeableConcept
13128        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
13129        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // CodeableConcept
13130        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
13131        default: return super.getProperty(hash, name, checkValid);
13132        }
13133
13134      }
13135
13136      @Override
13137      public Base setProperty(int hash, String name, Base value) throws FHIRException {
13138        switch (hash) {
13139        case 50511102: // category
13140          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
13141          return value;
13142        case 1994055114: // excluded
13143          this.excluded = TypeConvertor.castToBoolean(value); // BooleanType
13144          return value;
13145        case 3373707: // name
13146          this.name = TypeConvertor.castToString(value); // StringType
13147          return value;
13148        case -1724546052: // description
13149          this.description = TypeConvertor.castToString(value); // StringType
13150          return value;
13151        case 1843485230: // network
13152          this.network = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
13153          return value;
13154        case 3594628: // unit
13155          this.unit = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
13156          return value;
13157        case 3556460: // term
13158          this.term = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
13159          return value;
13160        case 357555337: // financial
13161          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
13162          return value;
13163        default: return super.setProperty(hash, name, value);
13164        }
13165
13166      }
13167
13168      @Override
13169      public Base setProperty(String name, Base value) throws FHIRException {
13170        if (name.equals("category")) {
13171          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
13172        } else if (name.equals("excluded")) {
13173          this.excluded = TypeConvertor.castToBoolean(value); // BooleanType
13174        } else if (name.equals("name")) {
13175          this.name = TypeConvertor.castToString(value); // StringType
13176        } else if (name.equals("description")) {
13177          this.description = TypeConvertor.castToString(value); // StringType
13178        } else if (name.equals("network")) {
13179          this.network = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
13180        } else if (name.equals("unit")) {
13181          this.unit = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
13182        } else if (name.equals("term")) {
13183          this.term = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
13184        } else if (name.equals("financial")) {
13185          this.getFinancial().add((BenefitComponent) value);
13186        } else
13187          return super.setProperty(name, value);
13188        return value;
13189      }
13190
13191      @Override
13192      public Base makeProperty(int hash, String name) throws FHIRException {
13193        switch (hash) {
13194        case 50511102:  return getCategory();
13195        case 1994055114:  return getExcludedElement();
13196        case 3373707:  return getNameElement();
13197        case -1724546052:  return getDescriptionElement();
13198        case 1843485230:  return getNetwork();
13199        case 3594628:  return getUnit();
13200        case 3556460:  return getTerm();
13201        case 357555337:  return addFinancial(); 
13202        default: return super.makeProperty(hash, name);
13203        }
13204
13205      }
13206
13207      @Override
13208      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
13209        switch (hash) {
13210        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
13211        case 1994055114: /*excluded*/ return new String[] {"boolean"};
13212        case 3373707: /*name*/ return new String[] {"string"};
13213        case -1724546052: /*description*/ return new String[] {"string"};
13214        case 1843485230: /*network*/ return new String[] {"CodeableConcept"};
13215        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
13216        case 3556460: /*term*/ return new String[] {"CodeableConcept"};
13217        case 357555337: /*financial*/ return new String[] {};
13218        default: return super.getTypesForProperty(hash, name);
13219        }
13220
13221      }
13222
13223      @Override
13224      public Base addChild(String name) throws FHIRException {
13225        if (name.equals("category")) {
13226          this.category = new CodeableConcept();
13227          return this.category;
13228        }
13229        else if (name.equals("excluded")) {
13230          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.benefitBalance.excluded");
13231        }
13232        else if (name.equals("name")) {
13233          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.benefitBalance.name");
13234        }
13235        else if (name.equals("description")) {
13236          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.benefitBalance.description");
13237        }
13238        else if (name.equals("network")) {
13239          this.network = new CodeableConcept();
13240          return this.network;
13241        }
13242        else if (name.equals("unit")) {
13243          this.unit = new CodeableConcept();
13244          return this.unit;
13245        }
13246        else if (name.equals("term")) {
13247          this.term = new CodeableConcept();
13248          return this.term;
13249        }
13250        else if (name.equals("financial")) {
13251          return addFinancial();
13252        }
13253        else
13254          return super.addChild(name);
13255      }
13256
13257      public BenefitBalanceComponent copy() {
13258        BenefitBalanceComponent dst = new BenefitBalanceComponent();
13259        copyValues(dst);
13260        return dst;
13261      }
13262
13263      public void copyValues(BenefitBalanceComponent dst) {
13264        super.copyValues(dst);
13265        dst.category = category == null ? null : category.copy();
13266        dst.excluded = excluded == null ? null : excluded.copy();
13267        dst.name = name == null ? null : name.copy();
13268        dst.description = description == null ? null : description.copy();
13269        dst.network = network == null ? null : network.copy();
13270        dst.unit = unit == null ? null : unit.copy();
13271        dst.term = term == null ? null : term.copy();
13272        if (financial != null) {
13273          dst.financial = new ArrayList<BenefitComponent>();
13274          for (BenefitComponent i : financial)
13275            dst.financial.add(i.copy());
13276        };
13277      }
13278
13279      @Override
13280      public boolean equalsDeep(Base other_) {
13281        if (!super.equalsDeep(other_))
13282          return false;
13283        if (!(other_ instanceof BenefitBalanceComponent))
13284          return false;
13285        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
13286        return compareDeep(category, o.category, true) && compareDeep(excluded, o.excluded, true) && compareDeep(name, o.name, true)
13287           && compareDeep(description, o.description, true) && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true)
13288           && compareDeep(term, o.term, true) && compareDeep(financial, o.financial, true);
13289      }
13290
13291      @Override
13292      public boolean equalsShallow(Base other_) {
13293        if (!super.equalsShallow(other_))
13294          return false;
13295        if (!(other_ instanceof BenefitBalanceComponent))
13296          return false;
13297        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
13298        return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
13299          ;
13300      }
13301
13302      public boolean isEmpty() {
13303        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, excluded, name
13304          , description, network, unit, term, financial);
13305      }
13306
13307  public String fhirType() {
13308    return "ExplanationOfBenefit.benefitBalance";
13309
13310  }
13311
13312  }
13313
13314    @Block()
13315    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
13316        /**
13317         * Classification of benefit being provided.
13318         */
13319        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
13320        @Description(shortDefinition="Benefit classification", formalDefinition="Classification of benefit being provided." )
13321        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-type")
13322        protected CodeableConcept type;
13323
13324        /**
13325         * The quantity of the benefit which is permitted under the coverage.
13326         */
13327        @Child(name = "allowed", type = {UnsignedIntType.class, StringType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
13328        @Description(shortDefinition="Benefits allowed", formalDefinition="The quantity of the benefit which is permitted under the coverage." )
13329        protected DataType allowed;
13330
13331        /**
13332         * The quantity of the benefit which have been consumed to date.
13333         */
13334        @Child(name = "used", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
13335        @Description(shortDefinition="Benefits used", formalDefinition="The quantity of the benefit which have been consumed to date." )
13336        protected DataType used;
13337
13338        private static final long serialVersionUID = 1900247614L;
13339
13340    /**
13341     * Constructor
13342     */
13343      public BenefitComponent() {
13344        super();
13345      }
13346
13347    /**
13348     * Constructor
13349     */
13350      public BenefitComponent(CodeableConcept type) {
13351        super();
13352        this.setType(type);
13353      }
13354
13355        /**
13356         * @return {@link #type} (Classification of benefit being provided.)
13357         */
13358        public CodeableConcept getType() { 
13359          if (this.type == null)
13360            if (Configuration.errorOnAutoCreate())
13361              throw new Error("Attempt to auto-create BenefitComponent.type");
13362            else if (Configuration.doAutoCreate())
13363              this.type = new CodeableConcept(); // cc
13364          return this.type;
13365        }
13366
13367        public boolean hasType() { 
13368          return this.type != null && !this.type.isEmpty();
13369        }
13370
13371        /**
13372         * @param value {@link #type} (Classification of benefit being provided.)
13373         */
13374        public BenefitComponent setType(CodeableConcept value) { 
13375          this.type = value;
13376          return this;
13377        }
13378
13379        /**
13380         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
13381         */
13382        public DataType getAllowed() { 
13383          return this.allowed;
13384        }
13385
13386        /**
13387         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
13388         */
13389        public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException { 
13390          if (this.allowed == null)
13391            this.allowed = new UnsignedIntType();
13392          if (!(this.allowed instanceof UnsignedIntType))
13393            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.allowed.getClass().getName()+" was encountered");
13394          return (UnsignedIntType) this.allowed;
13395        }
13396
13397        public boolean hasAllowedUnsignedIntType() { 
13398          return this != null && this.allowed instanceof UnsignedIntType;
13399        }
13400
13401        /**
13402         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
13403         */
13404        public StringType getAllowedStringType() throws FHIRException { 
13405          if (this.allowed == null)
13406            this.allowed = new StringType();
13407          if (!(this.allowed instanceof StringType))
13408            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.allowed.getClass().getName()+" was encountered");
13409          return (StringType) this.allowed;
13410        }
13411
13412        public boolean hasAllowedStringType() { 
13413          return this != null && this.allowed instanceof StringType;
13414        }
13415
13416        /**
13417         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
13418         */
13419        public Money getAllowedMoney() throws FHIRException { 
13420          if (this.allowed == null)
13421            this.allowed = new Money();
13422          if (!(this.allowed instanceof Money))
13423            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.allowed.getClass().getName()+" was encountered");
13424          return (Money) this.allowed;
13425        }
13426
13427        public boolean hasAllowedMoney() { 
13428          return this != null && this.allowed instanceof Money;
13429        }
13430
13431        public boolean hasAllowed() { 
13432          return this.allowed != null && !this.allowed.isEmpty();
13433        }
13434
13435        /**
13436         * @param value {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
13437         */
13438        public BenefitComponent setAllowed(DataType value) { 
13439          if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
13440            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.allowed[x]: "+value.fhirType());
13441          this.allowed = value;
13442          return this;
13443        }
13444
13445        /**
13446         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
13447         */
13448        public DataType getUsed() { 
13449          return this.used;
13450        }
13451
13452        /**
13453         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
13454         */
13455        public UnsignedIntType getUsedUnsignedIntType() throws FHIRException { 
13456          if (this.used == null)
13457            this.used = new UnsignedIntType();
13458          if (!(this.used instanceof UnsignedIntType))
13459            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.used.getClass().getName()+" was encountered");
13460          return (UnsignedIntType) this.used;
13461        }
13462
13463        public boolean hasUsedUnsignedIntType() { 
13464          return this != null && this.used instanceof UnsignedIntType;
13465        }
13466
13467        /**
13468         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
13469         */
13470        public Money getUsedMoney() throws FHIRException { 
13471          if (this.used == null)
13472            this.used = new Money();
13473          if (!(this.used instanceof Money))
13474            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.used.getClass().getName()+" was encountered");
13475          return (Money) this.used;
13476        }
13477
13478        public boolean hasUsedMoney() { 
13479          return this != null && this.used instanceof Money;
13480        }
13481
13482        public boolean hasUsed() { 
13483          return this.used != null && !this.used.isEmpty();
13484        }
13485
13486        /**
13487         * @param value {@link #used} (The quantity of the benefit which have been consumed to date.)
13488         */
13489        public BenefitComponent setUsed(DataType value) { 
13490          if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
13491            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.used[x]: "+value.fhirType());
13492          this.used = value;
13493          return this;
13494        }
13495
13496        protected void listChildren(List<Property> children) {
13497          super.listChildren(children);
13498          children.add(new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type));
13499          children.add(new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed));
13500          children.add(new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used));
13501        }
13502
13503        @Override
13504        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
13505          switch (_hash) {
13506          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type);
13507          case -1336663592: /*allowed[x]*/  return new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
13508          case -911343192: /*allowed*/  return new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
13509          case 1668802034: /*allowedUnsignedInt*/  return new Property("allowed[x]", "unsignedInt", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
13510          case -2135265319: /*allowedString*/  return new Property("allowed[x]", "string", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
13511          case -351668232: /*allowedMoney*/  return new Property("allowed[x]", "Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
13512          case -147553373: /*used[x]*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
13513          case 3599293: /*used*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
13514          case 1252740285: /*usedUnsignedInt*/  return new Property("used[x]", "unsignedInt", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
13515          case -78048509: /*usedMoney*/  return new Property("used[x]", "Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
13516          default: return super.getNamedProperty(_hash, _name, _checkValid);
13517          }
13518
13519        }
13520
13521      @Override
13522      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
13523        switch (hash) {
13524        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
13525        case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // DataType
13526        case 3599293: /*used*/ return this.used == null ? new Base[0] : new Base[] {this.used}; // DataType
13527        default: return super.getProperty(hash, name, checkValid);
13528        }
13529
13530      }
13531
13532      @Override
13533      public Base setProperty(int hash, String name, Base value) throws FHIRException {
13534        switch (hash) {
13535        case 3575610: // type
13536          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
13537          return value;
13538        case -911343192: // allowed
13539          this.allowed = TypeConvertor.castToType(value); // DataType
13540          return value;
13541        case 3599293: // used
13542          this.used = TypeConvertor.castToType(value); // DataType
13543          return value;
13544        default: return super.setProperty(hash, name, value);
13545        }
13546
13547      }
13548
13549      @Override
13550      public Base setProperty(String name, Base value) throws FHIRException {
13551        if (name.equals("type")) {
13552          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
13553        } else if (name.equals("allowed[x]")) {
13554          this.allowed = TypeConvertor.castToType(value); // DataType
13555        } else if (name.equals("used[x]")) {
13556          this.used = TypeConvertor.castToType(value); // DataType
13557        } else
13558          return super.setProperty(name, value);
13559        return value;
13560      }
13561
13562      @Override
13563      public Base makeProperty(int hash, String name) throws FHIRException {
13564        switch (hash) {
13565        case 3575610:  return getType();
13566        case -1336663592:  return getAllowed();
13567        case -911343192:  return getAllowed();
13568        case -147553373:  return getUsed();
13569        case 3599293:  return getUsed();
13570        default: return super.makeProperty(hash, name);
13571        }
13572
13573      }
13574
13575      @Override
13576      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
13577        switch (hash) {
13578        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
13579        case -911343192: /*allowed*/ return new String[] {"unsignedInt", "string", "Money"};
13580        case 3599293: /*used*/ return new String[] {"unsignedInt", "Money"};
13581        default: return super.getTypesForProperty(hash, name);
13582        }
13583
13584      }
13585
13586      @Override
13587      public Base addChild(String name) throws FHIRException {
13588        if (name.equals("type")) {
13589          this.type = new CodeableConcept();
13590          return this.type;
13591        }
13592        else if (name.equals("allowedUnsignedInt")) {
13593          this.allowed = new UnsignedIntType();
13594          return this.allowed;
13595        }
13596        else if (name.equals("allowedString")) {
13597          this.allowed = new StringType();
13598          return this.allowed;
13599        }
13600        else if (name.equals("allowedMoney")) {
13601          this.allowed = new Money();
13602          return this.allowed;
13603        }
13604        else if (name.equals("usedUnsignedInt")) {
13605          this.used = new UnsignedIntType();
13606          return this.used;
13607        }
13608        else if (name.equals("usedMoney")) {
13609          this.used = new Money();
13610          return this.used;
13611        }
13612        else
13613          return super.addChild(name);
13614      }
13615
13616      public BenefitComponent copy() {
13617        BenefitComponent dst = new BenefitComponent();
13618        copyValues(dst);
13619        return dst;
13620      }
13621
13622      public void copyValues(BenefitComponent dst) {
13623        super.copyValues(dst);
13624        dst.type = type == null ? null : type.copy();
13625        dst.allowed = allowed == null ? null : allowed.copy();
13626        dst.used = used == null ? null : used.copy();
13627      }
13628
13629      @Override
13630      public boolean equalsDeep(Base other_) {
13631        if (!super.equalsDeep(other_))
13632          return false;
13633        if (!(other_ instanceof BenefitComponent))
13634          return false;
13635        BenefitComponent o = (BenefitComponent) other_;
13636        return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true) && compareDeep(used, o.used, true)
13637          ;
13638      }
13639
13640      @Override
13641      public boolean equalsShallow(Base other_) {
13642        if (!super.equalsShallow(other_))
13643          return false;
13644        if (!(other_ instanceof BenefitComponent))
13645          return false;
13646        BenefitComponent o = (BenefitComponent) other_;
13647        return true;
13648      }
13649
13650      public boolean isEmpty() {
13651        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
13652      }
13653
13654  public String fhirType() {
13655    return "ExplanationOfBenefit.benefitBalance.financial";
13656
13657  }
13658
13659  }
13660
13661    /**
13662     * A unique identifier assigned to this explanation of benefit.
13663     */
13664    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
13665    @Description(shortDefinition="Business Identifier for the resource", formalDefinition="A unique identifier assigned to this explanation of benefit." )
13666    protected List<Identifier> identifier;
13667
13668    /**
13669     * The status of the resource instance.
13670     */
13671    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
13672    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
13673    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
13674    protected Enumeration<ExplanationOfBenefitStatus> status;
13675
13676    /**
13677     * The category of claim, e.g. oral, pharmacy, vision, institutional, professional.
13678     */
13679    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
13680    @Description(shortDefinition="Category or discipline", formalDefinition="The category of claim, e.g. oral, pharmacy, vision, institutional, professional." )
13681    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-type")
13682    protected CodeableConcept type;
13683
13684    /**
13685     * A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.
13686     */
13687    @Child(name = "subType", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
13688    @Description(shortDefinition="More granular claim type", formalDefinition="A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service." )
13689    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-subtype")
13690    protected CodeableConcept subType;
13691
13692    /**
13693     * A code to indicate whether the nature of the request is: Claim - A request to an Insurer to adjudicate the supplied charges for health care goods and services under the identified policy and to pay the determined Benefit amount, if any; Preauthorization - A request to an Insurer to adjudicate the supplied proposed future charges for health care goods and services under the identified policy and to approve the services and provide the expected benefit amounts and potentially to reserve funds to pay the benefits when Claims for the indicated services are later submitted; or, Pre-determination - A request to an Insurer to adjudicate the supplied 'what if' charges for health care goods and services under the identified policy and report back what the Benefit payable would be had the services actually been provided.
13694     */
13695    @Child(name = "use", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
13696    @Description(shortDefinition="claim | preauthorization | predetermination", formalDefinition="A code to indicate whether the nature of the request is: Claim - A request to an Insurer to adjudicate the supplied charges for health care goods and services under the identified policy and to pay the determined Benefit amount, if any; Preauthorization - A request to an Insurer to adjudicate the supplied proposed future charges for health care goods and services under the identified policy and to approve the services and provide the expected benefit amounts and potentially to reserve funds to pay the benefits when Claims for the indicated services are later submitted; or, Pre-determination - A request to an Insurer to adjudicate the supplied 'what if' charges for health care goods and services under the identified policy and report back what the Benefit payable would be had the services actually been provided." )
13697    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-use")
13698    protected Enumeration<Use> use;
13699
13700    /**
13701     * The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for forecast reimbursement is sought.
13702     */
13703    @Child(name = "patient", type = {Patient.class}, order=5, min=1, max=1, modifier=false, summary=true)
13704    @Description(shortDefinition="The recipient of the products and services", formalDefinition="The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for forecast reimbursement is sought." )
13705    protected Reference patient;
13706
13707    /**
13708     * The period for which charges are being submitted.
13709     */
13710    @Child(name = "billablePeriod", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=true)
13711    @Description(shortDefinition="Relevant time frame for the claim", formalDefinition="The period for which charges are being submitted." )
13712    protected Period billablePeriod;
13713
13714    /**
13715     * The date this resource was created.
13716     */
13717    @Child(name = "created", type = {DateTimeType.class}, order=7, min=1, max=1, modifier=false, summary=true)
13718    @Description(shortDefinition="Response creation date", formalDefinition="The date this resource was created." )
13719    protected DateTimeType created;
13720
13721    /**
13722     * Individual who created the claim, predetermination or preauthorization.
13723     */
13724    @Child(name = "enterer", type = {Practitioner.class, PractitionerRole.class, Patient.class, RelatedPerson.class}, order=8, min=0, max=1, modifier=false, summary=false)
13725    @Description(shortDefinition="Author of the claim", formalDefinition="Individual who created the claim, predetermination or preauthorization." )
13726    protected Reference enterer;
13727
13728    /**
13729     * The party responsible for authorization, adjudication and reimbursement.
13730     */
13731    @Child(name = "insurer", type = {Organization.class}, order=9, min=0, max=1, modifier=false, summary=true)
13732    @Description(shortDefinition="Party responsible for reimbursement", formalDefinition="The party responsible for authorization, adjudication and reimbursement." )
13733    protected Reference insurer;
13734
13735    /**
13736     * The provider which is responsible for the claim, predetermination or preauthorization.
13737     */
13738    @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=10, min=0, max=1, modifier=false, summary=true)
13739    @Description(shortDefinition="Party responsible for the claim", formalDefinition="The provider which is responsible for the claim, predetermination or preauthorization." )
13740    protected Reference provider;
13741
13742    /**
13743     * The provider-required urgency of processing the request. Typical values include: stat, normal deferred.
13744     */
13745    @Child(name = "priority", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=false)
13746    @Description(shortDefinition="Desired processing urgency", formalDefinition="The provider-required urgency of processing the request. Typical values include: stat, normal deferred." )
13747    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/process-priority")
13748    protected CodeableConcept priority;
13749
13750    /**
13751     * A code to indicate whether and for whom funds are to be reserved for future claims.
13752     */
13753    @Child(name = "fundsReserveRequested", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
13754    @Description(shortDefinition="For whom to reserve funds", formalDefinition="A code to indicate whether and for whom funds are to be reserved for future claims." )
13755    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
13756    protected CodeableConcept fundsReserveRequested;
13757
13758    /**
13759     * A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.
13760     */
13761    @Child(name = "fundsReserve", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
13762    @Description(shortDefinition="Funds reserved status", formalDefinition="A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom." )
13763    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
13764    protected CodeableConcept fundsReserve;
13765
13766    /**
13767     * Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.
13768     */
13769    @Child(name = "related", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
13770    @Description(shortDefinition="Prior or corollary claims", formalDefinition="Other claims which are related to this claim such as prior submissions or claims for related services or for the same event." )
13771    protected List<RelatedClaimComponent> related;
13772
13773    /**
13774     * Prescription is the document/authorization given to the claim author for them to provide products and services for which consideration (reimbursement) is sought. Could be a RX for medications, an 'order' for oxygen or wheelchair or physiotherapy treatments.
13775     */
13776    @Child(name = "prescription", type = {MedicationRequest.class, VisionPrescription.class}, order=15, min=0, max=1, modifier=false, summary=false)
13777    @Description(shortDefinition="Prescription authorizing services or products", formalDefinition="Prescription is the document/authorization given to the claim author for them to provide products and services for which consideration (reimbursement) is sought. Could be a RX for medications, an 'order' for oxygen or wheelchair or physiotherapy treatments." )
13778    protected Reference prescription;
13779
13780    /**
13781     * Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.
13782     */
13783    @Child(name = "originalPrescription", type = {MedicationRequest.class}, order=16, min=0, max=1, modifier=false, summary=false)
13784    @Description(shortDefinition="Original prescription if superceded by fulfiller", formalDefinition="Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products." )
13785    protected Reference originalPrescription;
13786
13787    /**
13788     * The party to be reimbursed for cost of the products and services according to the terms of the policy.
13789     */
13790    @Child(name = "payee", type = {}, order=17, min=0, max=1, modifier=false, summary=false)
13791    @Description(shortDefinition="Recipient of benefits payable", formalDefinition="The party to be reimbursed for cost of the products and services according to the terms of the policy." )
13792    protected PayeeComponent payee;
13793
13794    /**
13795     * The referral information received by the claim author, it is not to be used when the author generates a referral for a patient. A copy of that referral may be provided as supporting information. Some insurers require proof of referral to pay for services or to pay specialist rates for services.
13796     */
13797    @Child(name = "referral", type = {ServiceRequest.class}, order=18, min=0, max=1, modifier=false, summary=false)
13798    @Description(shortDefinition="Treatment Referral", formalDefinition="The referral information received by the claim author, it is not to be used when the author generates a referral for a patient. A copy of that referral may be provided as supporting information. Some insurers require proof of referral to pay for services or to pay specialist rates for services." )
13799    protected Reference referral;
13800
13801    /**
13802     * A billed item may include goods or services provided in multiple encounters.
13803     */
13804    @Child(name = "encounter", type = {Encounter.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
13805    @Description(shortDefinition="Encounters related to this billed item", formalDefinition="A billed item may include goods or services provided in multiple encounters." )
13806    protected List<Reference> encounter;
13807
13808    /**
13809     * Facility where the services were provided.
13810     */
13811    @Child(name = "facility", type = {Location.class, Organization.class}, order=20, min=0, max=1, modifier=false, summary=false)
13812    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
13813    protected Reference facility;
13814
13815    /**
13816     * The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.
13817     */
13818    @Child(name = "claim", type = {Claim.class}, order=21, min=0, max=1, modifier=false, summary=false)
13819    @Description(shortDefinition="Claim reference", formalDefinition="The business identifier for the instance of the adjudication request: claim predetermination or preauthorization." )
13820    protected Reference claim;
13821
13822    /**
13823     * The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.
13824     */
13825    @Child(name = "claimResponse", type = {ClaimResponse.class}, order=22, min=0, max=1, modifier=false, summary=false)
13826    @Description(shortDefinition="Claim response reference", formalDefinition="The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response." )
13827    protected Reference claimResponse;
13828
13829    /**
13830     * The outcome of the claim, predetermination, or preauthorization processing.
13831     */
13832    @Child(name = "outcome", type = {CodeType.class}, order=23, min=1, max=1, modifier=false, summary=true)
13833    @Description(shortDefinition="queued | complete | error | partial", formalDefinition="The outcome of the claim, predetermination, or preauthorization processing." )
13834    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-outcome")
13835    protected Enumeration<ClaimProcessingCodes> outcome;
13836
13837    /**
13838     * The result of the claim, predetermination, or preauthorization adjudication.
13839     */
13840    @Child(name = "decision", type = {CodeableConcept.class}, order=24, min=0, max=1, modifier=false, summary=true)
13841    @Description(shortDefinition="Result of the adjudication", formalDefinition="The result of the claim, predetermination, or preauthorization adjudication." )
13842    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-decision")
13843    protected CodeableConcept decision;
13844
13845    /**
13846     * A human readable description of the status of the adjudication.
13847     */
13848    @Child(name = "disposition", type = {StringType.class}, order=25, min=0, max=1, modifier=false, summary=false)
13849    @Description(shortDefinition="Disposition Message", formalDefinition="A human readable description of the status of the adjudication." )
13850    protected StringType disposition;
13851
13852    /**
13853     * Reference from the Insurer which is used in later communications which refers to this adjudication.
13854     */
13855    @Child(name = "preAuthRef", type = {StringType.class}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
13856    @Description(shortDefinition="Preauthorization reference", formalDefinition="Reference from the Insurer which is used in later communications which refers to this adjudication." )
13857    protected List<StringType> preAuthRef;
13858
13859    /**
13860     * The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.
13861     */
13862    @Child(name = "preAuthRefPeriod", type = {Period.class}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
13863    @Description(shortDefinition="Preauthorization in-effect period", formalDefinition="The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided." )
13864    protected List<Period> preAuthRefPeriod;
13865
13866    /**
13867     * A package billing code or bundle code used to group products and services to a particular health condition (such as heart attack) which is based on a predetermined grouping code system.
13868     */
13869    @Child(name = "diagnosisRelatedGroup", type = {CodeableConcept.class}, order=28, min=0, max=1, modifier=false, summary=false)
13870    @Description(shortDefinition="Package billing code", formalDefinition="A package billing code or bundle code used to group products and services to a particular health condition (such as heart attack) which is based on a predetermined grouping code system." )
13871    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
13872    protected CodeableConcept diagnosisRelatedGroup;
13873
13874    /**
13875     * The members of the team who provided the products and services.
13876     */
13877    @Child(name = "careTeam", type = {}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
13878    @Description(shortDefinition="Care Team members", formalDefinition="The members of the team who provided the products and services." )
13879    protected List<CareTeamComponent> careTeam;
13880
13881    /**
13882     * Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.
13883     */
13884    @Child(name = "supportingInfo", type = {}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
13885    @Description(shortDefinition="Supporting information", formalDefinition="Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues." )
13886    protected List<SupportingInformationComponent> supportingInfo;
13887
13888    /**
13889     * Information about diagnoses relevant to the claim items.
13890     */
13891    @Child(name = "diagnosis", type = {}, order=31, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
13892    @Description(shortDefinition="Pertinent diagnosis information", formalDefinition="Information about diagnoses relevant to the claim items." )
13893    protected List<DiagnosisComponent> diagnosis;
13894
13895    /**
13896     * Procedures performed on the patient relevant to the billing items with the claim.
13897     */
13898    @Child(name = "procedure", type = {}, order=32, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
13899    @Description(shortDefinition="Clinical procedures performed", formalDefinition="Procedures performed on the patient relevant to the billing items with the claim." )
13900    protected List<ProcedureComponent> procedure;
13901
13902    /**
13903     * This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
13904     */
13905    @Child(name = "precedence", type = {PositiveIntType.class}, order=33, min=0, max=1, modifier=false, summary=false)
13906    @Description(shortDefinition="Precedence (primary, secondary, etc.)", formalDefinition="This indicates the relative order of a series of EOBs related to different coverages for the same suite of services." )
13907    protected PositiveIntType precedence;
13908
13909    /**
13910     * Financial instruments for reimbursement for the health care products and services specified on the claim.
13911     */
13912    @Child(name = "insurance", type = {}, order=34, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
13913    @Description(shortDefinition="Patient insurance information", formalDefinition="Financial instruments for reimbursement for the health care products and services specified on the claim." )
13914    protected List<InsuranceComponent> insurance;
13915
13916    /**
13917     * Details of a accident which resulted in injuries which required the products and services listed in the claim.
13918     */
13919    @Child(name = "accident", type = {}, order=35, min=0, max=1, modifier=false, summary=false)
13920    @Description(shortDefinition="Details of the event", formalDefinition="Details of a accident which resulted in injuries which required the products and services listed in the claim." )
13921    protected AccidentComponent accident;
13922
13923    /**
13924     * 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.
13925     */
13926    @Child(name = "patientPaid", type = {Money.class}, order=36, min=0, max=1, modifier=false, summary=false)
13927    @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." )
13928    protected Money patientPaid;
13929
13930    /**
13931     * A claim line. Either a simple (a product or service) or a 'group' of details which can also be a simple items or groups of sub-details.
13932     */
13933    @Child(name = "item", type = {}, order=37, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
13934    @Description(shortDefinition="Product or service provided", formalDefinition="A claim line. Either a simple (a product or service) or a 'group' of details which can also be a simple items or groups of sub-details." )
13935    protected List<ItemComponent> item;
13936
13937    /**
13938     * The first-tier service adjudications for payor added product or service lines.
13939     */
13940    @Child(name = "addItem", type = {}, order=38, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
13941    @Description(shortDefinition="Insurer added line items", formalDefinition="The first-tier service adjudications for payor added product or service lines." )
13942    protected List<AddedItemComponent> addItem;
13943
13944    /**
13945     * The adjudication results which are presented at the header level rather than at the line-item or add-item levels.
13946     */
13947    @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=39, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
13948    @Description(shortDefinition="Header-level adjudication", formalDefinition="The adjudication results which are presented at the header level rather than at the line-item or add-item levels." )
13949    protected List<AdjudicationComponent> adjudication;
13950
13951    /**
13952     * Categorized monetary totals for the adjudication.
13953     */
13954    @Child(name = "total", type = {}, order=40, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
13955    @Description(shortDefinition="Adjudication totals", formalDefinition="Categorized monetary totals for the adjudication." )
13956    protected List<TotalComponent> total;
13957
13958    /**
13959     * Payment details for the adjudication of the claim.
13960     */
13961    @Child(name = "payment", type = {}, order=41, min=0, max=1, modifier=false, summary=false)
13962    @Description(shortDefinition="Payment Details", formalDefinition="Payment details for the adjudication of the claim." )
13963    protected PaymentComponent payment;
13964
13965    /**
13966     * A code for the form to be used for printing the content.
13967     */
13968    @Child(name = "formCode", type = {CodeableConcept.class}, order=42, min=0, max=1, modifier=false, summary=false)
13969    @Description(shortDefinition="Printed form identifier", formalDefinition="A code for the form to be used for printing the content." )
13970    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
13971    protected CodeableConcept formCode;
13972
13973    /**
13974     * The actual form, by reference or inclusion, for printing the content or an EOB.
13975     */
13976    @Child(name = "form", type = {Attachment.class}, order=43, min=0, max=1, modifier=false, summary=false)
13977    @Description(shortDefinition="Printed reference or actual form", formalDefinition="The actual form, by reference or inclusion, for printing the content or an EOB." )
13978    protected Attachment form;
13979
13980    /**
13981     * A note that describes or explains adjudication results in a human readable form.
13982     */
13983    @Child(name = "processNote", type = {}, order=44, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
13984    @Description(shortDefinition="Note concerning adjudication", formalDefinition="A note that describes or explains adjudication results in a human readable form." )
13985    protected List<NoteComponent> processNote;
13986
13987    /**
13988     * The term of the benefits documented in this response.
13989     */
13990    @Child(name = "benefitPeriod", type = {Period.class}, order=45, min=0, max=1, modifier=false, summary=false)
13991    @Description(shortDefinition="When the benefits are applicable", formalDefinition="The term of the benefits documented in this response." )
13992    protected Period benefitPeriod;
13993
13994    /**
13995     * Balance by Benefit Category.
13996     */
13997    @Child(name = "benefitBalance", type = {}, order=46, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
13998    @Description(shortDefinition="Balance by Benefit Category", formalDefinition="Balance by Benefit Category." )
13999    protected List<BenefitBalanceComponent> benefitBalance;
14000
14001    private static final long serialVersionUID = 934384125L;
14002
14003  /**
14004   * Constructor
14005   */
14006    public ExplanationOfBenefit() {
14007      super();
14008    }
14009
14010  /**
14011   * Constructor
14012   */
14013    public ExplanationOfBenefit(ExplanationOfBenefitStatus status, CodeableConcept type, Use use, Reference patient, Date created, ClaimProcessingCodes outcome) {
14014      super();
14015      this.setStatus(status);
14016      this.setType(type);
14017      this.setUse(use);
14018      this.setPatient(patient);
14019      this.setCreated(created);
14020      this.setOutcome(outcome);
14021    }
14022
14023    /**
14024     * @return {@link #identifier} (A unique identifier assigned to this explanation of benefit.)
14025     */
14026    public List<Identifier> getIdentifier() { 
14027      if (this.identifier == null)
14028        this.identifier = new ArrayList<Identifier>();
14029      return this.identifier;
14030    }
14031
14032    /**
14033     * @return Returns a reference to <code>this</code> for easy method chaining
14034     */
14035    public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) { 
14036      this.identifier = theIdentifier;
14037      return this;
14038    }
14039
14040    public boolean hasIdentifier() { 
14041      if (this.identifier == null)
14042        return false;
14043      for (Identifier item : this.identifier)
14044        if (!item.isEmpty())
14045          return true;
14046      return false;
14047    }
14048
14049    public Identifier addIdentifier() { //3
14050      Identifier t = new Identifier();
14051      if (this.identifier == null)
14052        this.identifier = new ArrayList<Identifier>();
14053      this.identifier.add(t);
14054      return t;
14055    }
14056
14057    public ExplanationOfBenefit addIdentifier(Identifier t) { //3
14058      if (t == null)
14059        return this;
14060      if (this.identifier == null)
14061        this.identifier = new ArrayList<Identifier>();
14062      this.identifier.add(t);
14063      return this;
14064    }
14065
14066    /**
14067     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
14068     */
14069    public Identifier getIdentifierFirstRep() { 
14070      if (getIdentifier().isEmpty()) {
14071        addIdentifier();
14072      }
14073      return getIdentifier().get(0);
14074    }
14075
14076    /**
14077     * @return {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
14078     */
14079    public Enumeration<ExplanationOfBenefitStatus> getStatusElement() { 
14080      if (this.status == null)
14081        if (Configuration.errorOnAutoCreate())
14082          throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
14083        else if (Configuration.doAutoCreate())
14084          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
14085      return this.status;
14086    }
14087
14088    public boolean hasStatusElement() { 
14089      return this.status != null && !this.status.isEmpty();
14090    }
14091
14092    public boolean hasStatus() { 
14093      return this.status != null && !this.status.isEmpty();
14094    }
14095
14096    /**
14097     * @param value {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
14098     */
14099    public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) { 
14100      this.status = value;
14101      return this;
14102    }
14103
14104    /**
14105     * @return The status of the resource instance.
14106     */
14107    public ExplanationOfBenefitStatus getStatus() { 
14108      return this.status == null ? null : this.status.getValue();
14109    }
14110
14111    /**
14112     * @param value The status of the resource instance.
14113     */
14114    public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) { 
14115        if (this.status == null)
14116          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
14117        this.status.setValue(value);
14118      return this;
14119    }
14120
14121    /**
14122     * @return {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
14123     */
14124    public CodeableConcept getType() { 
14125      if (this.type == null)
14126        if (Configuration.errorOnAutoCreate())
14127          throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
14128        else if (Configuration.doAutoCreate())
14129          this.type = new CodeableConcept(); // cc
14130      return this.type;
14131    }
14132
14133    public boolean hasType() { 
14134      return this.type != null && !this.type.isEmpty();
14135    }
14136
14137    /**
14138     * @param value {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
14139     */
14140    public ExplanationOfBenefit setType(CodeableConcept value) { 
14141      this.type = value;
14142      return this;
14143    }
14144
14145    /**
14146     * @return {@link #subType} (A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.)
14147     */
14148    public CodeableConcept getSubType() { 
14149      if (this.subType == null)
14150        if (Configuration.errorOnAutoCreate())
14151          throw new Error("Attempt to auto-create ExplanationOfBenefit.subType");
14152        else if (Configuration.doAutoCreate())
14153          this.subType = new CodeableConcept(); // cc
14154      return this.subType;
14155    }
14156
14157    public boolean hasSubType() { 
14158      return this.subType != null && !this.subType.isEmpty();
14159    }
14160
14161    /**
14162     * @param value {@link #subType} (A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.)
14163     */
14164    public ExplanationOfBenefit setSubType(CodeableConcept value) { 
14165      this.subType = value;
14166      return this;
14167    }
14168
14169    /**
14170     * @return {@link #use} (A code to indicate whether the nature of the request is: Claim - A request to an Insurer to adjudicate the supplied charges for health care goods and services under the identified policy and to pay the determined Benefit amount, if any; Preauthorization - A request to an Insurer to adjudicate the supplied proposed future charges for health care goods and services under the identified policy and to approve the services and provide the expected benefit amounts and potentially to reserve funds to pay the benefits when Claims for the indicated services are later submitted; or, Pre-determination - A request to an Insurer to adjudicate the supplied 'what if' charges for health care goods and services under the identified policy and report back what the Benefit payable would be had the services actually been provided.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
14171     */
14172    public Enumeration<Use> getUseElement() { 
14173      if (this.use == null)
14174        if (Configuration.errorOnAutoCreate())
14175          throw new Error("Attempt to auto-create ExplanationOfBenefit.use");
14176        else if (Configuration.doAutoCreate())
14177          this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
14178      return this.use;
14179    }
14180
14181    public boolean hasUseElement() { 
14182      return this.use != null && !this.use.isEmpty();
14183    }
14184
14185    public boolean hasUse() { 
14186      return this.use != null && !this.use.isEmpty();
14187    }
14188
14189    /**
14190     * @param value {@link #use} (A code to indicate whether the nature of the request is: Claim - A request to an Insurer to adjudicate the supplied charges for health care goods and services under the identified policy and to pay the determined Benefit amount, if any; Preauthorization - A request to an Insurer to adjudicate the supplied proposed future charges for health care goods and services under the identified policy and to approve the services and provide the expected benefit amounts and potentially to reserve funds to pay the benefits when Claims for the indicated services are later submitted; or, Pre-determination - A request to an Insurer to adjudicate the supplied 'what if' charges for health care goods and services under the identified policy and report back what the Benefit payable would be had the services actually been provided.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
14191     */
14192    public ExplanationOfBenefit setUseElement(Enumeration<Use> value) { 
14193      this.use = value;
14194      return this;
14195    }
14196
14197    /**
14198     * @return A code to indicate whether the nature of the request is: Claim - A request to an Insurer to adjudicate the supplied charges for health care goods and services under the identified policy and to pay the determined Benefit amount, if any; Preauthorization - A request to an Insurer to adjudicate the supplied proposed future charges for health care goods and services under the identified policy and to approve the services and provide the expected benefit amounts and potentially to reserve funds to pay the benefits when Claims for the indicated services are later submitted; or, Pre-determination - A request to an Insurer to adjudicate the supplied 'what if' charges for health care goods and services under the identified policy and report back what the Benefit payable would be had the services actually been provided.
14199     */
14200    public Use getUse() { 
14201      return this.use == null ? null : this.use.getValue();
14202    }
14203
14204    /**
14205     * @param value A code to indicate whether the nature of the request is: Claim - A request to an Insurer to adjudicate the supplied charges for health care goods and services under the identified policy and to pay the determined Benefit amount, if any; Preauthorization - A request to an Insurer to adjudicate the supplied proposed future charges for health care goods and services under the identified policy and to approve the services and provide the expected benefit amounts and potentially to reserve funds to pay the benefits when Claims for the indicated services are later submitted; or, Pre-determination - A request to an Insurer to adjudicate the supplied 'what if' charges for health care goods and services under the identified policy and report back what the Benefit payable would be had the services actually been provided.
14206     */
14207    public ExplanationOfBenefit setUse(Use value) { 
14208        if (this.use == null)
14209          this.use = new Enumeration<Use>(new UseEnumFactory());
14210        this.use.setValue(value);
14211      return this;
14212    }
14213
14214    /**
14215     * @return {@link #patient} (The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for forecast reimbursement is sought.)
14216     */
14217    public Reference getPatient() { 
14218      if (this.patient == null)
14219        if (Configuration.errorOnAutoCreate())
14220          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
14221        else if (Configuration.doAutoCreate())
14222          this.patient = new Reference(); // cc
14223      return this.patient;
14224    }
14225
14226    public boolean hasPatient() { 
14227      return this.patient != null && !this.patient.isEmpty();
14228    }
14229
14230    /**
14231     * @param value {@link #patient} (The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for forecast reimbursement is sought.)
14232     */
14233    public ExplanationOfBenefit setPatient(Reference value) { 
14234      this.patient = value;
14235      return this;
14236    }
14237
14238    /**
14239     * @return {@link #billablePeriod} (The period for which charges are being submitted.)
14240     */
14241    public Period getBillablePeriod() { 
14242      if (this.billablePeriod == null)
14243        if (Configuration.errorOnAutoCreate())
14244          throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
14245        else if (Configuration.doAutoCreate())
14246          this.billablePeriod = new Period(); // cc
14247      return this.billablePeriod;
14248    }
14249
14250    public boolean hasBillablePeriod() { 
14251      return this.billablePeriod != null && !this.billablePeriod.isEmpty();
14252    }
14253
14254    /**
14255     * @param value {@link #billablePeriod} (The period for which charges are being submitted.)
14256     */
14257    public ExplanationOfBenefit setBillablePeriod(Period value) { 
14258      this.billablePeriod = value;
14259      return this;
14260    }
14261
14262    /**
14263     * @return {@link #created} (The date this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
14264     */
14265    public DateTimeType getCreatedElement() { 
14266      if (this.created == null)
14267        if (Configuration.errorOnAutoCreate())
14268          throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
14269        else if (Configuration.doAutoCreate())
14270          this.created = new DateTimeType(); // bb
14271      return this.created;
14272    }
14273
14274    public boolean hasCreatedElement() { 
14275      return this.created != null && !this.created.isEmpty();
14276    }
14277
14278    public boolean hasCreated() { 
14279      return this.created != null && !this.created.isEmpty();
14280    }
14281
14282    /**
14283     * @param value {@link #created} (The date this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
14284     */
14285    public ExplanationOfBenefit setCreatedElement(DateTimeType value) { 
14286      this.created = value;
14287      return this;
14288    }
14289
14290    /**
14291     * @return The date this resource was created.
14292     */
14293    public Date getCreated() { 
14294      return this.created == null ? null : this.created.getValue();
14295    }
14296
14297    /**
14298     * @param value The date this resource was created.
14299     */
14300    public ExplanationOfBenefit setCreated(Date value) { 
14301        if (this.created == null)
14302          this.created = new DateTimeType();
14303        this.created.setValue(value);
14304      return this;
14305    }
14306
14307    /**
14308     * @return {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
14309     */
14310    public Reference getEnterer() { 
14311      if (this.enterer == null)
14312        if (Configuration.errorOnAutoCreate())
14313          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
14314        else if (Configuration.doAutoCreate())
14315          this.enterer = new Reference(); // cc
14316      return this.enterer;
14317    }
14318
14319    public boolean hasEnterer() { 
14320      return this.enterer != null && !this.enterer.isEmpty();
14321    }
14322
14323    /**
14324     * @param value {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
14325     */
14326    public ExplanationOfBenefit setEnterer(Reference value) { 
14327      this.enterer = value;
14328      return this;
14329    }
14330
14331    /**
14332     * @return {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
14333     */
14334    public Reference getInsurer() { 
14335      if (this.insurer == null)
14336        if (Configuration.errorOnAutoCreate())
14337          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
14338        else if (Configuration.doAutoCreate())
14339          this.insurer = new Reference(); // cc
14340      return this.insurer;
14341    }
14342
14343    public boolean hasInsurer() { 
14344      return this.insurer != null && !this.insurer.isEmpty();
14345    }
14346
14347    /**
14348     * @param value {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
14349     */
14350    public ExplanationOfBenefit setInsurer(Reference value) { 
14351      this.insurer = value;
14352      return this;
14353    }
14354
14355    /**
14356     * @return {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
14357     */
14358    public Reference getProvider() { 
14359      if (this.provider == null)
14360        if (Configuration.errorOnAutoCreate())
14361          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
14362        else if (Configuration.doAutoCreate())
14363          this.provider = new Reference(); // cc
14364      return this.provider;
14365    }
14366
14367    public boolean hasProvider() { 
14368      return this.provider != null && !this.provider.isEmpty();
14369    }
14370
14371    /**
14372     * @param value {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
14373     */
14374    public ExplanationOfBenefit setProvider(Reference value) { 
14375      this.provider = value;
14376      return this;
14377    }
14378
14379    /**
14380     * @return {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, normal deferred.)
14381     */
14382    public CodeableConcept getPriority() { 
14383      if (this.priority == null)
14384        if (Configuration.errorOnAutoCreate())
14385          throw new Error("Attempt to auto-create ExplanationOfBenefit.priority");
14386        else if (Configuration.doAutoCreate())
14387          this.priority = new CodeableConcept(); // cc
14388      return this.priority;
14389    }
14390
14391    public boolean hasPriority() { 
14392      return this.priority != null && !this.priority.isEmpty();
14393    }
14394
14395    /**
14396     * @param value {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, normal deferred.)
14397     */
14398    public ExplanationOfBenefit setPriority(CodeableConcept value) { 
14399      this.priority = value;
14400      return this;
14401    }
14402
14403    /**
14404     * @return {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
14405     */
14406    public CodeableConcept getFundsReserveRequested() { 
14407      if (this.fundsReserveRequested == null)
14408        if (Configuration.errorOnAutoCreate())
14409          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserveRequested");
14410        else if (Configuration.doAutoCreate())
14411          this.fundsReserveRequested = new CodeableConcept(); // cc
14412      return this.fundsReserveRequested;
14413    }
14414
14415    public boolean hasFundsReserveRequested() { 
14416      return this.fundsReserveRequested != null && !this.fundsReserveRequested.isEmpty();
14417    }
14418
14419    /**
14420     * @param value {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
14421     */
14422    public ExplanationOfBenefit setFundsReserveRequested(CodeableConcept value) { 
14423      this.fundsReserveRequested = value;
14424      return this;
14425    }
14426
14427    /**
14428     * @return {@link #fundsReserve} (A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.)
14429     */
14430    public CodeableConcept getFundsReserve() { 
14431      if (this.fundsReserve == null)
14432        if (Configuration.errorOnAutoCreate())
14433          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserve");
14434        else if (Configuration.doAutoCreate())
14435          this.fundsReserve = new CodeableConcept(); // cc
14436      return this.fundsReserve;
14437    }
14438
14439    public boolean hasFundsReserve() { 
14440      return this.fundsReserve != null && !this.fundsReserve.isEmpty();
14441    }
14442
14443    /**
14444     * @param value {@link #fundsReserve} (A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.)
14445     */
14446    public ExplanationOfBenefit setFundsReserve(CodeableConcept value) { 
14447      this.fundsReserve = value;
14448      return this;
14449    }
14450
14451    /**
14452     * @return {@link #related} (Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.)
14453     */
14454    public List<RelatedClaimComponent> getRelated() { 
14455      if (this.related == null)
14456        this.related = new ArrayList<RelatedClaimComponent>();
14457      return this.related;
14458    }
14459
14460    /**
14461     * @return Returns a reference to <code>this</code> for easy method chaining
14462     */
14463    public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) { 
14464      this.related = theRelated;
14465      return this;
14466    }
14467
14468    public boolean hasRelated() { 
14469      if (this.related == null)
14470        return false;
14471      for (RelatedClaimComponent item : this.related)
14472        if (!item.isEmpty())
14473          return true;
14474      return false;
14475    }
14476
14477    public RelatedClaimComponent addRelated() { //3
14478      RelatedClaimComponent t = new RelatedClaimComponent();
14479      if (this.related == null)
14480        this.related = new ArrayList<RelatedClaimComponent>();
14481      this.related.add(t);
14482      return t;
14483    }
14484
14485    public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { //3
14486      if (t == null)
14487        return this;
14488      if (this.related == null)
14489        this.related = new ArrayList<RelatedClaimComponent>();
14490      this.related.add(t);
14491      return this;
14492    }
14493
14494    /**
14495     * @return The first repetition of repeating field {@link #related}, creating it if it does not already exist {3}
14496     */
14497    public RelatedClaimComponent getRelatedFirstRep() { 
14498      if (getRelated().isEmpty()) {
14499        addRelated();
14500      }
14501      return getRelated().get(0);
14502    }
14503
14504    /**
14505     * @return {@link #prescription} (Prescription is the document/authorization given to the claim author for them to provide products and services for which consideration (reimbursement) is sought. Could be a RX for medications, an 'order' for oxygen or wheelchair or physiotherapy treatments.)
14506     */
14507    public Reference getPrescription() { 
14508      if (this.prescription == null)
14509        if (Configuration.errorOnAutoCreate())
14510          throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
14511        else if (Configuration.doAutoCreate())
14512          this.prescription = new Reference(); // cc
14513      return this.prescription;
14514    }
14515
14516    public boolean hasPrescription() { 
14517      return this.prescription != null && !this.prescription.isEmpty();
14518    }
14519
14520    /**
14521     * @param value {@link #prescription} (Prescription is the document/authorization given to the claim author for them to provide products and services for which consideration (reimbursement) is sought. Could be a RX for medications, an 'order' for oxygen or wheelchair or physiotherapy treatments.)
14522     */
14523    public ExplanationOfBenefit setPrescription(Reference value) { 
14524      this.prescription = value;
14525      return this;
14526    }
14527
14528    /**
14529     * @return {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
14530     */
14531    public Reference getOriginalPrescription() { 
14532      if (this.originalPrescription == null)
14533        if (Configuration.errorOnAutoCreate())
14534          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
14535        else if (Configuration.doAutoCreate())
14536          this.originalPrescription = new Reference(); // cc
14537      return this.originalPrescription;
14538    }
14539
14540    public boolean hasOriginalPrescription() { 
14541      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
14542    }
14543
14544    /**
14545     * @param value {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
14546     */
14547    public ExplanationOfBenefit setOriginalPrescription(Reference value) { 
14548      this.originalPrescription = value;
14549      return this;
14550    }
14551
14552    /**
14553     * @return {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
14554     */
14555    public PayeeComponent getPayee() { 
14556      if (this.payee == null)
14557        if (Configuration.errorOnAutoCreate())
14558          throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
14559        else if (Configuration.doAutoCreate())
14560          this.payee = new PayeeComponent(); // cc
14561      return this.payee;
14562    }
14563
14564    public boolean hasPayee() { 
14565      return this.payee != null && !this.payee.isEmpty();
14566    }
14567
14568    /**
14569     * @param value {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
14570     */
14571    public ExplanationOfBenefit setPayee(PayeeComponent value) { 
14572      this.payee = value;
14573      return this;
14574    }
14575
14576    /**
14577     * @return {@link #referral} (The referral information received by the claim author, it is not to be used when the author generates a referral for a patient. A copy of that referral may be provided as supporting information. Some insurers require proof of referral to pay for services or to pay specialist rates for services.)
14578     */
14579    public Reference getReferral() { 
14580      if (this.referral == null)
14581        if (Configuration.errorOnAutoCreate())
14582          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
14583        else if (Configuration.doAutoCreate())
14584          this.referral = new Reference(); // cc
14585      return this.referral;
14586    }
14587
14588    public boolean hasReferral() { 
14589      return this.referral != null && !this.referral.isEmpty();
14590    }
14591
14592    /**
14593     * @param value {@link #referral} (The referral information received by the claim author, it is not to be used when the author generates a referral for a patient. A copy of that referral may be provided as supporting information. Some insurers require proof of referral to pay for services or to pay specialist rates for services.)
14594     */
14595    public ExplanationOfBenefit setReferral(Reference value) { 
14596      this.referral = value;
14597      return this;
14598    }
14599
14600    /**
14601     * @return {@link #encounter} (A billed item may include goods or services provided in multiple encounters.)
14602     */
14603    public List<Reference> getEncounter() { 
14604      if (this.encounter == null)
14605        this.encounter = new ArrayList<Reference>();
14606      return this.encounter;
14607    }
14608
14609    /**
14610     * @return Returns a reference to <code>this</code> for easy method chaining
14611     */
14612    public ExplanationOfBenefit setEncounter(List<Reference> theEncounter) { 
14613      this.encounter = theEncounter;
14614      return this;
14615    }
14616
14617    public boolean hasEncounter() { 
14618      if (this.encounter == null)
14619        return false;
14620      for (Reference item : this.encounter)
14621        if (!item.isEmpty())
14622          return true;
14623      return false;
14624    }
14625
14626    public Reference addEncounter() { //3
14627      Reference t = new Reference();
14628      if (this.encounter == null)
14629        this.encounter = new ArrayList<Reference>();
14630      this.encounter.add(t);
14631      return t;
14632    }
14633
14634    public ExplanationOfBenefit addEncounter(Reference t) { //3
14635      if (t == null)
14636        return this;
14637      if (this.encounter == null)
14638        this.encounter = new ArrayList<Reference>();
14639      this.encounter.add(t);
14640      return this;
14641    }
14642
14643    /**
14644     * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist {3}
14645     */
14646    public Reference getEncounterFirstRep() { 
14647      if (getEncounter().isEmpty()) {
14648        addEncounter();
14649      }
14650      return getEncounter().get(0);
14651    }
14652
14653    /**
14654     * @return {@link #facility} (Facility where the services were provided.)
14655     */
14656    public Reference getFacility() { 
14657      if (this.facility == null)
14658        if (Configuration.errorOnAutoCreate())
14659          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
14660        else if (Configuration.doAutoCreate())
14661          this.facility = new Reference(); // cc
14662      return this.facility;
14663    }
14664
14665    public boolean hasFacility() { 
14666      return this.facility != null && !this.facility.isEmpty();
14667    }
14668
14669    /**
14670     * @param value {@link #facility} (Facility where the services were provided.)
14671     */
14672    public ExplanationOfBenefit setFacility(Reference value) { 
14673      this.facility = value;
14674      return this;
14675    }
14676
14677    /**
14678     * @return {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
14679     */
14680    public Reference getClaim() { 
14681      if (this.claim == null)
14682        if (Configuration.errorOnAutoCreate())
14683          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
14684        else if (Configuration.doAutoCreate())
14685          this.claim = new Reference(); // cc
14686      return this.claim;
14687    }
14688
14689    public boolean hasClaim() { 
14690      return this.claim != null && !this.claim.isEmpty();
14691    }
14692
14693    /**
14694     * @param value {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
14695     */
14696    public ExplanationOfBenefit setClaim(Reference value) { 
14697      this.claim = value;
14698      return this;
14699    }
14700
14701    /**
14702     * @return {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
14703     */
14704    public Reference getClaimResponse() { 
14705      if (this.claimResponse == null)
14706        if (Configuration.errorOnAutoCreate())
14707          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
14708        else if (Configuration.doAutoCreate())
14709          this.claimResponse = new Reference(); // cc
14710      return this.claimResponse;
14711    }
14712
14713    public boolean hasClaimResponse() { 
14714      return this.claimResponse != null && !this.claimResponse.isEmpty();
14715    }
14716
14717    /**
14718     * @param value {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
14719     */
14720    public ExplanationOfBenefit setClaimResponse(Reference value) { 
14721      this.claimResponse = value;
14722      return this;
14723    }
14724
14725    /**
14726     * @return {@link #outcome} (The outcome of the claim, predetermination, or preauthorization processing.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
14727     */
14728    public Enumeration<ClaimProcessingCodes> getOutcomeElement() { 
14729      if (this.outcome == null)
14730        if (Configuration.errorOnAutoCreate())
14731          throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
14732        else if (Configuration.doAutoCreate())
14733          this.outcome = new Enumeration<ClaimProcessingCodes>(new ClaimProcessingCodesEnumFactory()); // bb
14734      return this.outcome;
14735    }
14736
14737    public boolean hasOutcomeElement() { 
14738      return this.outcome != null && !this.outcome.isEmpty();
14739    }
14740
14741    public boolean hasOutcome() { 
14742      return this.outcome != null && !this.outcome.isEmpty();
14743    }
14744
14745    /**
14746     * @param value {@link #outcome} (The outcome of the claim, predetermination, or preauthorization processing.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
14747     */
14748    public ExplanationOfBenefit setOutcomeElement(Enumeration<ClaimProcessingCodes> value) { 
14749      this.outcome = value;
14750      return this;
14751    }
14752
14753    /**
14754     * @return The outcome of the claim, predetermination, or preauthorization processing.
14755     */
14756    public ClaimProcessingCodes getOutcome() { 
14757      return this.outcome == null ? null : this.outcome.getValue();
14758    }
14759
14760    /**
14761     * @param value The outcome of the claim, predetermination, or preauthorization processing.
14762     */
14763    public ExplanationOfBenefit setOutcome(ClaimProcessingCodes value) { 
14764        if (this.outcome == null)
14765          this.outcome = new Enumeration<ClaimProcessingCodes>(new ClaimProcessingCodesEnumFactory());
14766        this.outcome.setValue(value);
14767      return this;
14768    }
14769
14770    /**
14771     * @return {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
14772     */
14773    public CodeableConcept getDecision() { 
14774      if (this.decision == null)
14775        if (Configuration.errorOnAutoCreate())
14776          throw new Error("Attempt to auto-create ExplanationOfBenefit.decision");
14777        else if (Configuration.doAutoCreate())
14778          this.decision = new CodeableConcept(); // cc
14779      return this.decision;
14780    }
14781
14782    public boolean hasDecision() { 
14783      return this.decision != null && !this.decision.isEmpty();
14784    }
14785
14786    /**
14787     * @param value {@link #decision} (The result of the claim, predetermination, or preauthorization adjudication.)
14788     */
14789    public ExplanationOfBenefit setDecision(CodeableConcept value) { 
14790      this.decision = value;
14791      return this;
14792    }
14793
14794    /**
14795     * @return {@link #disposition} (A human readable description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
14796     */
14797    public StringType getDispositionElement() { 
14798      if (this.disposition == null)
14799        if (Configuration.errorOnAutoCreate())
14800          throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
14801        else if (Configuration.doAutoCreate())
14802          this.disposition = new StringType(); // bb
14803      return this.disposition;
14804    }
14805
14806    public boolean hasDispositionElement() { 
14807      return this.disposition != null && !this.disposition.isEmpty();
14808    }
14809
14810    public boolean hasDisposition() { 
14811      return this.disposition != null && !this.disposition.isEmpty();
14812    }
14813
14814    /**
14815     * @param value {@link #disposition} (A human readable description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
14816     */
14817    public ExplanationOfBenefit setDispositionElement(StringType value) { 
14818      this.disposition = value;
14819      return this;
14820    }
14821
14822    /**
14823     * @return A human readable description of the status of the adjudication.
14824     */
14825    public String getDisposition() { 
14826      return this.disposition == null ? null : this.disposition.getValue();
14827    }
14828
14829    /**
14830     * @param value A human readable description of the status of the adjudication.
14831     */
14832    public ExplanationOfBenefit setDisposition(String value) { 
14833      if (Utilities.noString(value))
14834        this.disposition = null;
14835      else {
14836        if (this.disposition == null)
14837          this.disposition = new StringType();
14838        this.disposition.setValue(value);
14839      }
14840      return this;
14841    }
14842
14843    /**
14844     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
14845     */
14846    public List<StringType> getPreAuthRef() { 
14847      if (this.preAuthRef == null)
14848        this.preAuthRef = new ArrayList<StringType>();
14849      return this.preAuthRef;
14850    }
14851
14852    /**
14853     * @return Returns a reference to <code>this</code> for easy method chaining
14854     */
14855    public ExplanationOfBenefit setPreAuthRef(List<StringType> thePreAuthRef) { 
14856      this.preAuthRef = thePreAuthRef;
14857      return this;
14858    }
14859
14860    public boolean hasPreAuthRef() { 
14861      if (this.preAuthRef == null)
14862        return false;
14863      for (StringType item : this.preAuthRef)
14864        if (!item.isEmpty())
14865          return true;
14866      return false;
14867    }
14868
14869    /**
14870     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
14871     */
14872    public StringType addPreAuthRefElement() {//2 
14873      StringType t = new StringType();
14874      if (this.preAuthRef == null)
14875        this.preAuthRef = new ArrayList<StringType>();
14876      this.preAuthRef.add(t);
14877      return t;
14878    }
14879
14880    /**
14881     * @param value {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
14882     */
14883    public ExplanationOfBenefit addPreAuthRef(String value) { //1
14884      StringType t = new StringType();
14885      t.setValue(value);
14886      if (this.preAuthRef == null)
14887        this.preAuthRef = new ArrayList<StringType>();
14888      this.preAuthRef.add(t);
14889      return this;
14890    }
14891
14892    /**
14893     * @param value {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
14894     */
14895    public boolean hasPreAuthRef(String value) { 
14896      if (this.preAuthRef == null)
14897        return false;
14898      for (StringType v : this.preAuthRef)
14899        if (v.getValue().equals(value)) // string
14900          return true;
14901      return false;
14902    }
14903
14904    /**
14905     * @return {@link #preAuthRefPeriod} (The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.)
14906     */
14907    public List<Period> getPreAuthRefPeriod() { 
14908      if (this.preAuthRefPeriod == null)
14909        this.preAuthRefPeriod = new ArrayList<Period>();
14910      return this.preAuthRefPeriod;
14911    }
14912
14913    /**
14914     * @return Returns a reference to <code>this</code> for easy method chaining
14915     */
14916    public ExplanationOfBenefit setPreAuthRefPeriod(List<Period> thePreAuthRefPeriod) { 
14917      this.preAuthRefPeriod = thePreAuthRefPeriod;
14918      return this;
14919    }
14920
14921    public boolean hasPreAuthRefPeriod() { 
14922      if (this.preAuthRefPeriod == null)
14923        return false;
14924      for (Period item : this.preAuthRefPeriod)
14925        if (!item.isEmpty())
14926          return true;
14927      return false;
14928    }
14929
14930    public Period addPreAuthRefPeriod() { //3
14931      Period t = new Period();
14932      if (this.preAuthRefPeriod == null)
14933        this.preAuthRefPeriod = new ArrayList<Period>();
14934      this.preAuthRefPeriod.add(t);
14935      return t;
14936    }
14937
14938    public ExplanationOfBenefit addPreAuthRefPeriod(Period t) { //3
14939      if (t == null)
14940        return this;
14941      if (this.preAuthRefPeriod == null)
14942        this.preAuthRefPeriod = new ArrayList<Period>();
14943      this.preAuthRefPeriod.add(t);
14944      return this;
14945    }
14946
14947    /**
14948     * @return The first repetition of repeating field {@link #preAuthRefPeriod}, creating it if it does not already exist {3}
14949     */
14950    public Period getPreAuthRefPeriodFirstRep() { 
14951      if (getPreAuthRefPeriod().isEmpty()) {
14952        addPreAuthRefPeriod();
14953      }
14954      return getPreAuthRefPeriod().get(0);
14955    }
14956
14957    /**
14958     * @return {@link #diagnosisRelatedGroup} (A package billing code or bundle code used to group products and services to a particular health condition (such as heart attack) which is based on a predetermined grouping code system.)
14959     */
14960    public CodeableConcept getDiagnosisRelatedGroup() { 
14961      if (this.diagnosisRelatedGroup == null)
14962        if (Configuration.errorOnAutoCreate())
14963          throw new Error("Attempt to auto-create ExplanationOfBenefit.diagnosisRelatedGroup");
14964        else if (Configuration.doAutoCreate())
14965          this.diagnosisRelatedGroup = new CodeableConcept(); // cc
14966      return this.diagnosisRelatedGroup;
14967    }
14968
14969    public boolean hasDiagnosisRelatedGroup() { 
14970      return this.diagnosisRelatedGroup != null && !this.diagnosisRelatedGroup.isEmpty();
14971    }
14972
14973    /**
14974     * @param value {@link #diagnosisRelatedGroup} (A package billing code or bundle code used to group products and services to a particular health condition (such as heart attack) which is based on a predetermined grouping code system.)
14975     */
14976    public ExplanationOfBenefit setDiagnosisRelatedGroup(CodeableConcept value) { 
14977      this.diagnosisRelatedGroup = value;
14978      return this;
14979    }
14980
14981    /**
14982     * @return {@link #careTeam} (The members of the team who provided the products and services.)
14983     */
14984    public List<CareTeamComponent> getCareTeam() { 
14985      if (this.careTeam == null)
14986        this.careTeam = new ArrayList<CareTeamComponent>();
14987      return this.careTeam;
14988    }
14989
14990    /**
14991     * @return Returns a reference to <code>this</code> for easy method chaining
14992     */
14993    public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) { 
14994      this.careTeam = theCareTeam;
14995      return this;
14996    }
14997
14998    public boolean hasCareTeam() { 
14999      if (this.careTeam == null)
15000        return false;
15001      for (CareTeamComponent item : this.careTeam)
15002        if (!item.isEmpty())
15003          return true;
15004      return false;
15005    }
15006
15007    public CareTeamComponent addCareTeam() { //3
15008      CareTeamComponent t = new CareTeamComponent();
15009      if (this.careTeam == null)
15010        this.careTeam = new ArrayList<CareTeamComponent>();
15011      this.careTeam.add(t);
15012      return t;
15013    }
15014
15015    public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { //3
15016      if (t == null)
15017        return this;
15018      if (this.careTeam == null)
15019        this.careTeam = new ArrayList<CareTeamComponent>();
15020      this.careTeam.add(t);
15021      return this;
15022    }
15023
15024    /**
15025     * @return The first repetition of repeating field {@link #careTeam}, creating it if it does not already exist {3}
15026     */
15027    public CareTeamComponent getCareTeamFirstRep() { 
15028      if (getCareTeam().isEmpty()) {
15029        addCareTeam();
15030      }
15031      return getCareTeam().get(0);
15032    }
15033
15034    /**
15035     * @return {@link #supportingInfo} (Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.)
15036     */
15037    public List<SupportingInformationComponent> getSupportingInfo() { 
15038      if (this.supportingInfo == null)
15039        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
15040      return this.supportingInfo;
15041    }
15042
15043    /**
15044     * @return Returns a reference to <code>this</code> for easy method chaining
15045     */
15046    public ExplanationOfBenefit setSupportingInfo(List<SupportingInformationComponent> theSupportingInfo) { 
15047      this.supportingInfo = theSupportingInfo;
15048      return this;
15049    }
15050
15051    public boolean hasSupportingInfo() { 
15052      if (this.supportingInfo == null)
15053        return false;
15054      for (SupportingInformationComponent item : this.supportingInfo)
15055        if (!item.isEmpty())
15056          return true;
15057      return false;
15058    }
15059
15060    public SupportingInformationComponent addSupportingInfo() { //3
15061      SupportingInformationComponent t = new SupportingInformationComponent();
15062      if (this.supportingInfo == null)
15063        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
15064      this.supportingInfo.add(t);
15065      return t;
15066    }
15067
15068    public ExplanationOfBenefit addSupportingInfo(SupportingInformationComponent t) { //3
15069      if (t == null)
15070        return this;
15071      if (this.supportingInfo == null)
15072        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
15073      this.supportingInfo.add(t);
15074      return this;
15075    }
15076
15077    /**
15078     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist {3}
15079     */
15080    public SupportingInformationComponent getSupportingInfoFirstRep() { 
15081      if (getSupportingInfo().isEmpty()) {
15082        addSupportingInfo();
15083      }
15084      return getSupportingInfo().get(0);
15085    }
15086
15087    /**
15088     * @return {@link #diagnosis} (Information about diagnoses relevant to the claim items.)
15089     */
15090    public List<DiagnosisComponent> getDiagnosis() { 
15091      if (this.diagnosis == null)
15092        this.diagnosis = new ArrayList<DiagnosisComponent>();
15093      return this.diagnosis;
15094    }
15095
15096    /**
15097     * @return Returns a reference to <code>this</code> for easy method chaining
15098     */
15099    public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
15100      this.diagnosis = theDiagnosis;
15101      return this;
15102    }
15103
15104    public boolean hasDiagnosis() { 
15105      if (this.diagnosis == null)
15106        return false;
15107      for (DiagnosisComponent item : this.diagnosis)
15108        if (!item.isEmpty())
15109          return true;
15110      return false;
15111    }
15112
15113    public DiagnosisComponent addDiagnosis() { //3
15114      DiagnosisComponent t = new DiagnosisComponent();
15115      if (this.diagnosis == null)
15116        this.diagnosis = new ArrayList<DiagnosisComponent>();
15117      this.diagnosis.add(t);
15118      return t;
15119    }
15120
15121    public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { //3
15122      if (t == null)
15123        return this;
15124      if (this.diagnosis == null)
15125        this.diagnosis = new ArrayList<DiagnosisComponent>();
15126      this.diagnosis.add(t);
15127      return this;
15128    }
15129
15130    /**
15131     * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist {3}
15132     */
15133    public DiagnosisComponent getDiagnosisFirstRep() { 
15134      if (getDiagnosis().isEmpty()) {
15135        addDiagnosis();
15136      }
15137      return getDiagnosis().get(0);
15138    }
15139
15140    /**
15141     * @return {@link #procedure} (Procedures performed on the patient relevant to the billing items with the claim.)
15142     */
15143    public List<ProcedureComponent> getProcedure() { 
15144      if (this.procedure == null)
15145        this.procedure = new ArrayList<ProcedureComponent>();
15146      return this.procedure;
15147    }
15148
15149    /**
15150     * @return Returns a reference to <code>this</code> for easy method chaining
15151     */
15152    public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) { 
15153      this.procedure = theProcedure;
15154      return this;
15155    }
15156
15157    public boolean hasProcedure() { 
15158      if (this.procedure == null)
15159        return false;
15160      for (ProcedureComponent item : this.procedure)
15161        if (!item.isEmpty())
15162          return true;
15163      return false;
15164    }
15165
15166    public ProcedureComponent addProcedure() { //3
15167      ProcedureComponent t = new ProcedureComponent();
15168      if (this.procedure == null)
15169        this.procedure = new ArrayList<ProcedureComponent>();
15170      this.procedure.add(t);
15171      return t;
15172    }
15173
15174    public ExplanationOfBenefit addProcedure(ProcedureComponent t) { //3
15175      if (t == null)
15176        return this;
15177      if (this.procedure == null)
15178        this.procedure = new ArrayList<ProcedureComponent>();
15179      this.procedure.add(t);
15180      return this;
15181    }
15182
15183    /**
15184     * @return The first repetition of repeating field {@link #procedure}, creating it if it does not already exist {3}
15185     */
15186    public ProcedureComponent getProcedureFirstRep() { 
15187      if (getProcedure().isEmpty()) {
15188        addProcedure();
15189      }
15190      return getProcedure().get(0);
15191    }
15192
15193    /**
15194     * @return {@link #precedence} (This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.). This is the underlying object with id, value and extensions. The accessor "getPrecedence" gives direct access to the value
15195     */
15196    public PositiveIntType getPrecedenceElement() { 
15197      if (this.precedence == null)
15198        if (Configuration.errorOnAutoCreate())
15199          throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
15200        else if (Configuration.doAutoCreate())
15201          this.precedence = new PositiveIntType(); // bb
15202      return this.precedence;
15203    }
15204
15205    public boolean hasPrecedenceElement() { 
15206      return this.precedence != null && !this.precedence.isEmpty();
15207    }
15208
15209    public boolean hasPrecedence() { 
15210      return this.precedence != null && !this.precedence.isEmpty();
15211    }
15212
15213    /**
15214     * @param value {@link #precedence} (This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.). This is the underlying object with id, value and extensions. The accessor "getPrecedence" gives direct access to the value
15215     */
15216    public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) { 
15217      this.precedence = value;
15218      return this;
15219    }
15220
15221    /**
15222     * @return This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
15223     */
15224    public int getPrecedence() { 
15225      return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
15226    }
15227
15228    /**
15229     * @param value This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
15230     */
15231    public ExplanationOfBenefit setPrecedence(int value) { 
15232        if (this.precedence == null)
15233          this.precedence = new PositiveIntType();
15234        this.precedence.setValue(value);
15235      return this;
15236    }
15237
15238    /**
15239     * @return {@link #insurance} (Financial instruments for reimbursement for the health care products and services specified on the claim.)
15240     */
15241    public List<InsuranceComponent> getInsurance() { 
15242      if (this.insurance == null)
15243        this.insurance = new ArrayList<InsuranceComponent>();
15244      return this.insurance;
15245    }
15246
15247    /**
15248     * @return Returns a reference to <code>this</code> for easy method chaining
15249     */
15250    public ExplanationOfBenefit setInsurance(List<InsuranceComponent> theInsurance) { 
15251      this.insurance = theInsurance;
15252      return this;
15253    }
15254
15255    public boolean hasInsurance() { 
15256      if (this.insurance == null)
15257        return false;
15258      for (InsuranceComponent item : this.insurance)
15259        if (!item.isEmpty())
15260          return true;
15261      return false;
15262    }
15263
15264    public InsuranceComponent addInsurance() { //3
15265      InsuranceComponent t = new InsuranceComponent();
15266      if (this.insurance == null)
15267        this.insurance = new ArrayList<InsuranceComponent>();
15268      this.insurance.add(t);
15269      return t;
15270    }
15271
15272    public ExplanationOfBenefit addInsurance(InsuranceComponent t) { //3
15273      if (t == null)
15274        return this;
15275      if (this.insurance == null)
15276        this.insurance = new ArrayList<InsuranceComponent>();
15277      this.insurance.add(t);
15278      return this;
15279    }
15280
15281    /**
15282     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist {3}
15283     */
15284    public InsuranceComponent getInsuranceFirstRep() { 
15285      if (getInsurance().isEmpty()) {
15286        addInsurance();
15287      }
15288      return getInsurance().get(0);
15289    }
15290
15291    /**
15292     * @return {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
15293     */
15294    public AccidentComponent getAccident() { 
15295      if (this.accident == null)
15296        if (Configuration.errorOnAutoCreate())
15297          throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
15298        else if (Configuration.doAutoCreate())
15299          this.accident = new AccidentComponent(); // cc
15300      return this.accident;
15301    }
15302
15303    public boolean hasAccident() { 
15304      return this.accident != null && !this.accident.isEmpty();
15305    }
15306
15307    /**
15308     * @param value {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
15309     */
15310    public ExplanationOfBenefit setAccident(AccidentComponent value) { 
15311      this.accident = value;
15312      return this;
15313    }
15314
15315    /**
15316     * @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.)
15317     */
15318    public Money getPatientPaid() { 
15319      if (this.patientPaid == null)
15320        if (Configuration.errorOnAutoCreate())
15321          throw new Error("Attempt to auto-create ExplanationOfBenefit.patientPaid");
15322        else if (Configuration.doAutoCreate())
15323          this.patientPaid = new Money(); // cc
15324      return this.patientPaid;
15325    }
15326
15327    public boolean hasPatientPaid() { 
15328      return this.patientPaid != null && !this.patientPaid.isEmpty();
15329    }
15330
15331    /**
15332     * @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.)
15333     */
15334    public ExplanationOfBenefit setPatientPaid(Money value) { 
15335      this.patientPaid = value;
15336      return this;
15337    }
15338
15339    /**
15340     * @return {@link #item} (A claim line. Either a simple (a product or service) or a 'group' of details which can also be a simple items or groups of sub-details.)
15341     */
15342    public List<ItemComponent> getItem() { 
15343      if (this.item == null)
15344        this.item = new ArrayList<ItemComponent>();
15345      return this.item;
15346    }
15347
15348    /**
15349     * @return Returns a reference to <code>this</code> for easy method chaining
15350     */
15351    public ExplanationOfBenefit setItem(List<ItemComponent> theItem) { 
15352      this.item = theItem;
15353      return this;
15354    }
15355
15356    public boolean hasItem() { 
15357      if (this.item == null)
15358        return false;
15359      for (ItemComponent item : this.item)
15360        if (!item.isEmpty())
15361          return true;
15362      return false;
15363    }
15364
15365    public ItemComponent addItem() { //3
15366      ItemComponent t = new ItemComponent();
15367      if (this.item == null)
15368        this.item = new ArrayList<ItemComponent>();
15369      this.item.add(t);
15370      return t;
15371    }
15372
15373    public ExplanationOfBenefit addItem(ItemComponent t) { //3
15374      if (t == null)
15375        return this;
15376      if (this.item == null)
15377        this.item = new ArrayList<ItemComponent>();
15378      this.item.add(t);
15379      return this;
15380    }
15381
15382    /**
15383     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist {3}
15384     */
15385    public ItemComponent getItemFirstRep() { 
15386      if (getItem().isEmpty()) {
15387        addItem();
15388      }
15389      return getItem().get(0);
15390    }
15391
15392    /**
15393     * @return {@link #addItem} (The first-tier service adjudications for payor added product or service lines.)
15394     */
15395    public List<AddedItemComponent> getAddItem() { 
15396      if (this.addItem == null)
15397        this.addItem = new ArrayList<AddedItemComponent>();
15398      return this.addItem;
15399    }
15400
15401    /**
15402     * @return Returns a reference to <code>this</code> for easy method chaining
15403     */
15404    public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) { 
15405      this.addItem = theAddItem;
15406      return this;
15407    }
15408
15409    public boolean hasAddItem() { 
15410      if (this.addItem == null)
15411        return false;
15412      for (AddedItemComponent item : this.addItem)
15413        if (!item.isEmpty())
15414          return true;
15415      return false;
15416    }
15417
15418    public AddedItemComponent addAddItem() { //3
15419      AddedItemComponent t = new AddedItemComponent();
15420      if (this.addItem == null)
15421        this.addItem = new ArrayList<AddedItemComponent>();
15422      this.addItem.add(t);
15423      return t;
15424    }
15425
15426    public ExplanationOfBenefit addAddItem(AddedItemComponent t) { //3
15427      if (t == null)
15428        return this;
15429      if (this.addItem == null)
15430        this.addItem = new ArrayList<AddedItemComponent>();
15431      this.addItem.add(t);
15432      return this;
15433    }
15434
15435    /**
15436     * @return The first repetition of repeating field {@link #addItem}, creating it if it does not already exist {3}
15437     */
15438    public AddedItemComponent getAddItemFirstRep() { 
15439      if (getAddItem().isEmpty()) {
15440        addAddItem();
15441      }
15442      return getAddItem().get(0);
15443    }
15444
15445    /**
15446     * @return {@link #adjudication} (The adjudication results which are presented at the header level rather than at the line-item or add-item levels.)
15447     */
15448    public List<AdjudicationComponent> getAdjudication() { 
15449      if (this.adjudication == null)
15450        this.adjudication = new ArrayList<AdjudicationComponent>();
15451      return this.adjudication;
15452    }
15453
15454    /**
15455     * @return Returns a reference to <code>this</code> for easy method chaining
15456     */
15457    public ExplanationOfBenefit setAdjudication(List<AdjudicationComponent> theAdjudication) { 
15458      this.adjudication = theAdjudication;
15459      return this;
15460    }
15461
15462    public boolean hasAdjudication() { 
15463      if (this.adjudication == null)
15464        return false;
15465      for (AdjudicationComponent item : this.adjudication)
15466        if (!item.isEmpty())
15467          return true;
15468      return false;
15469    }
15470
15471    public AdjudicationComponent addAdjudication() { //3
15472      AdjudicationComponent t = new AdjudicationComponent();
15473      if (this.adjudication == null)
15474        this.adjudication = new ArrayList<AdjudicationComponent>();
15475      this.adjudication.add(t);
15476      return t;
15477    }
15478
15479    public ExplanationOfBenefit addAdjudication(AdjudicationComponent t) { //3
15480      if (t == null)
15481        return this;
15482      if (this.adjudication == null)
15483        this.adjudication = new ArrayList<AdjudicationComponent>();
15484      this.adjudication.add(t);
15485      return this;
15486    }
15487
15488    /**
15489     * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
15490     */
15491    public AdjudicationComponent getAdjudicationFirstRep() { 
15492      if (getAdjudication().isEmpty()) {
15493        addAdjudication();
15494      }
15495      return getAdjudication().get(0);
15496    }
15497
15498    /**
15499     * @return {@link #total} (Categorized monetary totals for the adjudication.)
15500     */
15501    public List<TotalComponent> getTotal() { 
15502      if (this.total == null)
15503        this.total = new ArrayList<TotalComponent>();
15504      return this.total;
15505    }
15506
15507    /**
15508     * @return Returns a reference to <code>this</code> for easy method chaining
15509     */
15510    public ExplanationOfBenefit setTotal(List<TotalComponent> theTotal) { 
15511      this.total = theTotal;
15512      return this;
15513    }
15514
15515    public boolean hasTotal() { 
15516      if (this.total == null)
15517        return false;
15518      for (TotalComponent item : this.total)
15519        if (!item.isEmpty())
15520          return true;
15521      return false;
15522    }
15523
15524    public TotalComponent addTotal() { //3
15525      TotalComponent t = new TotalComponent();
15526      if (this.total == null)
15527        this.total = new ArrayList<TotalComponent>();
15528      this.total.add(t);
15529      return t;
15530    }
15531
15532    public ExplanationOfBenefit addTotal(TotalComponent t) { //3
15533      if (t == null)
15534        return this;
15535      if (this.total == null)
15536        this.total = new ArrayList<TotalComponent>();
15537      this.total.add(t);
15538      return this;
15539    }
15540
15541    /**
15542     * @return The first repetition of repeating field {@link #total}, creating it if it does not already exist {3}
15543     */
15544    public TotalComponent getTotalFirstRep() { 
15545      if (getTotal().isEmpty()) {
15546        addTotal();
15547      }
15548      return getTotal().get(0);
15549    }
15550
15551    /**
15552     * @return {@link #payment} (Payment details for the adjudication of the claim.)
15553     */
15554    public PaymentComponent getPayment() { 
15555      if (this.payment == null)
15556        if (Configuration.errorOnAutoCreate())
15557          throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
15558        else if (Configuration.doAutoCreate())
15559          this.payment = new PaymentComponent(); // cc
15560      return this.payment;
15561    }
15562
15563    public boolean hasPayment() { 
15564      return this.payment != null && !this.payment.isEmpty();
15565    }
15566
15567    /**
15568     * @param value {@link #payment} (Payment details for the adjudication of the claim.)
15569     */
15570    public ExplanationOfBenefit setPayment(PaymentComponent value) { 
15571      this.payment = value;
15572      return this;
15573    }
15574
15575    /**
15576     * @return {@link #formCode} (A code for the form to be used for printing the content.)
15577     */
15578    public CodeableConcept getFormCode() { 
15579      if (this.formCode == null)
15580        if (Configuration.errorOnAutoCreate())
15581          throw new Error("Attempt to auto-create ExplanationOfBenefit.formCode");
15582        else if (Configuration.doAutoCreate())
15583          this.formCode = new CodeableConcept(); // cc
15584      return this.formCode;
15585    }
15586
15587    public boolean hasFormCode() { 
15588      return this.formCode != null && !this.formCode.isEmpty();
15589    }
15590
15591    /**
15592     * @param value {@link #formCode} (A code for the form to be used for printing the content.)
15593     */
15594    public ExplanationOfBenefit setFormCode(CodeableConcept value) { 
15595      this.formCode = value;
15596      return this;
15597    }
15598
15599    /**
15600     * @return {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
15601     */
15602    public Attachment getForm() { 
15603      if (this.form == null)
15604        if (Configuration.errorOnAutoCreate())
15605          throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
15606        else if (Configuration.doAutoCreate())
15607          this.form = new Attachment(); // cc
15608      return this.form;
15609    }
15610
15611    public boolean hasForm() { 
15612      return this.form != null && !this.form.isEmpty();
15613    }
15614
15615    /**
15616     * @param value {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
15617     */
15618    public ExplanationOfBenefit setForm(Attachment value) { 
15619      this.form = value;
15620      return this;
15621    }
15622
15623    /**
15624     * @return {@link #processNote} (A note that describes or explains adjudication results in a human readable form.)
15625     */
15626    public List<NoteComponent> getProcessNote() { 
15627      if (this.processNote == null)
15628        this.processNote = new ArrayList<NoteComponent>();
15629      return this.processNote;
15630    }
15631
15632    /**
15633     * @return Returns a reference to <code>this</code> for easy method chaining
15634     */
15635    public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) { 
15636      this.processNote = theProcessNote;
15637      return this;
15638    }
15639
15640    public boolean hasProcessNote() { 
15641      if (this.processNote == null)
15642        return false;
15643      for (NoteComponent item : this.processNote)
15644        if (!item.isEmpty())
15645          return true;
15646      return false;
15647    }
15648
15649    public NoteComponent addProcessNote() { //3
15650      NoteComponent t = new NoteComponent();
15651      if (this.processNote == null)
15652        this.processNote = new ArrayList<NoteComponent>();
15653      this.processNote.add(t);
15654      return t;
15655    }
15656
15657    public ExplanationOfBenefit addProcessNote(NoteComponent t) { //3
15658      if (t == null)
15659        return this;
15660      if (this.processNote == null)
15661        this.processNote = new ArrayList<NoteComponent>();
15662      this.processNote.add(t);
15663      return this;
15664    }
15665
15666    /**
15667     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist {3}
15668     */
15669    public NoteComponent getProcessNoteFirstRep() { 
15670      if (getProcessNote().isEmpty()) {
15671        addProcessNote();
15672      }
15673      return getProcessNote().get(0);
15674    }
15675
15676    /**
15677     * @return {@link #benefitPeriod} (The term of the benefits documented in this response.)
15678     */
15679    public Period getBenefitPeriod() { 
15680      if (this.benefitPeriod == null)
15681        if (Configuration.errorOnAutoCreate())
15682          throw new Error("Attempt to auto-create ExplanationOfBenefit.benefitPeriod");
15683        else if (Configuration.doAutoCreate())
15684          this.benefitPeriod = new Period(); // cc
15685      return this.benefitPeriod;
15686    }
15687
15688    public boolean hasBenefitPeriod() { 
15689      return this.benefitPeriod != null && !this.benefitPeriod.isEmpty();
15690    }
15691
15692    /**
15693     * @param value {@link #benefitPeriod} (The term of the benefits documented in this response.)
15694     */
15695    public ExplanationOfBenefit setBenefitPeriod(Period value) { 
15696      this.benefitPeriod = value;
15697      return this;
15698    }
15699
15700    /**
15701     * @return {@link #benefitBalance} (Balance by Benefit Category.)
15702     */
15703    public List<BenefitBalanceComponent> getBenefitBalance() { 
15704      if (this.benefitBalance == null)
15705        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
15706      return this.benefitBalance;
15707    }
15708
15709    /**
15710     * @return Returns a reference to <code>this</code> for easy method chaining
15711     */
15712    public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) { 
15713      this.benefitBalance = theBenefitBalance;
15714      return this;
15715    }
15716
15717    public boolean hasBenefitBalance() { 
15718      if (this.benefitBalance == null)
15719        return false;
15720      for (BenefitBalanceComponent item : this.benefitBalance)
15721        if (!item.isEmpty())
15722          return true;
15723      return false;
15724    }
15725
15726    public BenefitBalanceComponent addBenefitBalance() { //3
15727      BenefitBalanceComponent t = new BenefitBalanceComponent();
15728      if (this.benefitBalance == null)
15729        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
15730      this.benefitBalance.add(t);
15731      return t;
15732    }
15733
15734    public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { //3
15735      if (t == null)
15736        return this;
15737      if (this.benefitBalance == null)
15738        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
15739      this.benefitBalance.add(t);
15740      return this;
15741    }
15742
15743    /**
15744     * @return The first repetition of repeating field {@link #benefitBalance}, creating it if it does not already exist {3}
15745     */
15746    public BenefitBalanceComponent getBenefitBalanceFirstRep() { 
15747      if (getBenefitBalance().isEmpty()) {
15748        addBenefitBalance();
15749      }
15750      return getBenefitBalance().get(0);
15751    }
15752
15753      protected void listChildren(List<Property> children) {
15754        super.listChildren(children);
15755        children.add(new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier));
15756        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
15757        children.add(new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type));
15758        children.add(new Property("subType", "CodeableConcept", "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.", 0, 1, subType));
15759        children.add(new Property("use", "code", "A code to indicate whether the nature of the request is: Claim - A request to an Insurer to adjudicate the supplied charges for health care goods and services under the identified policy and to pay the determined Benefit amount, if any; Preauthorization - A request to an Insurer to adjudicate the supplied proposed future charges for health care goods and services under the identified policy and to approve the services and provide the expected benefit amounts and potentially to reserve funds to pay the benefits when Claims for the indicated services are later submitted; or, Pre-determination - A request to an Insurer to adjudicate the supplied 'what if' charges for health care goods and services under the identified policy and report back what the Benefit payable would be had the services actually been provided.", 0, 1, use));
15760        children.add(new Property("patient", "Reference(Patient)", "The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for forecast reimbursement is sought.", 0, 1, patient));
15761        children.add(new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod));
15762        children.add(new Property("created", "dateTime", "The date this resource was created.", 0, 1, created));
15763        children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole|Patient|RelatedPerson)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer));
15764        children.add(new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer));
15765        children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider));
15766        children.add(new Property("priority", "CodeableConcept", "The provider-required urgency of processing the request. Typical values include: stat, normal deferred.", 0, 1, priority));
15767        children.add(new Property("fundsReserveRequested", "CodeableConcept", "A code to indicate whether and for whom funds are to be reserved for future claims.", 0, 1, fundsReserveRequested));
15768        children.add(new Property("fundsReserve", "CodeableConcept", "A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.", 0, 1, fundsReserve));
15769        children.add(new Property("related", "", "Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.", 0, java.lang.Integer.MAX_VALUE, related));
15770        children.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription is the document/authorization given to the claim author for them to provide products and services for which consideration (reimbursement) is sought. Could be a RX for medications, an 'order' for oxygen or wheelchair or physiotherapy treatments.", 0, 1, prescription));
15771        children.add(new Property("originalPrescription", "Reference(MedicationRequest)", "Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.", 0, 1, originalPrescription));
15772        children.add(new Property("payee", "", "The party to be reimbursed for cost of the products and services according to the terms of the policy.", 0, 1, payee));
15773        children.add(new Property("referral", "Reference(ServiceRequest)", "The referral information received by the claim author, it is not to be used when the author generates a referral for a patient. A copy of that referral may be provided as supporting information. Some insurers require proof of referral to pay for services or to pay specialist rates for services.", 0, 1, referral));
15774        children.add(new Property("encounter", "Reference(Encounter)", "A billed item may include goods or services provided in multiple encounters.", 0, java.lang.Integer.MAX_VALUE, encounter));
15775        children.add(new Property("facility", "Reference(Location|Organization)", "Facility where the services were provided.", 0, 1, facility));
15776        children.add(new Property("claim", "Reference(Claim)", "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.", 0, 1, claim));
15777        children.add(new Property("claimResponse", "Reference(ClaimResponse)", "The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.", 0, 1, claimResponse));
15778        children.add(new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome));
15779        children.add(new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision));
15780        children.add(new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition));
15781        children.add(new Property("preAuthRef", "string", "Reference from the Insurer which is used in later communications which refers to this adjudication.", 0, java.lang.Integer.MAX_VALUE, preAuthRef));
15782        children.add(new Property("preAuthRefPeriod", "Period", "The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.", 0, java.lang.Integer.MAX_VALUE, preAuthRefPeriod));
15783        children.add(new Property("diagnosisRelatedGroup", "CodeableConcept", "A package billing code or bundle code used to group products and services to a particular health condition (such as heart attack) which is based on a predetermined grouping code system.", 0, 1, diagnosisRelatedGroup));
15784        children.add(new Property("careTeam", "", "The members of the team who provided the products and services.", 0, java.lang.Integer.MAX_VALUE, careTeam));
15785        children.add(new Property("supportingInfo", "", "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.", 0, java.lang.Integer.MAX_VALUE, supportingInfo));
15786        children.add(new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
15787        children.add(new Property("procedure", "", "Procedures performed on the patient relevant to the billing items with the claim.", 0, java.lang.Integer.MAX_VALUE, procedure));
15788        children.add(new Property("precedence", "positiveInt", "This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.", 0, 1, precedence));
15789        children.add(new Property("insurance", "", "Financial instruments for reimbursement for the health care products and services specified on the claim.", 0, java.lang.Integer.MAX_VALUE, insurance));
15790        children.add(new Property("accident", "", "Details of a accident which resulted in injuries which required the products and services listed in the claim.", 0, 1, accident));
15791        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));
15792        children.add(new Property("item", "", "A claim line. Either a simple (a product or service) or a 'group' of details which can also be a simple items or groups of sub-details.", 0, java.lang.Integer.MAX_VALUE, item));
15793        children.add(new Property("addItem", "", "The first-tier service adjudications for payor added product or service lines.", 0, java.lang.Integer.MAX_VALUE, addItem));
15794        children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results which are presented at the header level rather than at the line-item or add-item levels.", 0, java.lang.Integer.MAX_VALUE, adjudication));
15795        children.add(new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total));
15796        children.add(new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment));
15797        children.add(new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode));
15798        children.add(new Property("form", "Attachment", "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form));
15799        children.add(new Property("processNote", "", "A note that describes or explains adjudication results in a human readable form.", 0, java.lang.Integer.MAX_VALUE, processNote));
15800        children.add(new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod));
15801        children.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
15802      }
15803
15804      @Override
15805      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
15806        switch (_hash) {
15807        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier);
15808        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
15809        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type);
15810        case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.", 0, 1, subType);
15811        case 116103: /*use*/  return new Property("use", "code", "A code to indicate whether the nature of the request is: Claim - A request to an Insurer to adjudicate the supplied charges for health care goods and services under the identified policy and to pay the determined Benefit amount, if any; Preauthorization - A request to an Insurer to adjudicate the supplied proposed future charges for health care goods and services under the identified policy and to approve the services and provide the expected benefit amounts and potentially to reserve funds to pay the benefits when Claims for the indicated services are later submitted; or, Pre-determination - A request to an Insurer to adjudicate the supplied 'what if' charges for health care goods and services under the identified policy and report back what the Benefit payable would be had the services actually been provided.", 0, 1, use);
15812        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for forecast reimbursement is sought.", 0, 1, patient);
15813        case -332066046: /*billablePeriod*/  return new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod);
15814        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date this resource was created.", 0, 1, created);
15815        case -1591951995: /*enterer*/  return new Property("enterer", "Reference(Practitioner|PractitionerRole|Patient|RelatedPerson)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer);
15816        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer);
15817        case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider);
15818        case -1165461084: /*priority*/  return new Property("priority", "CodeableConcept", "The provider-required urgency of processing the request. Typical values include: stat, normal deferred.", 0, 1, priority);
15819        case -1688904576: /*fundsReserveRequested*/  return new Property("fundsReserveRequested", "CodeableConcept", "A code to indicate whether and for whom funds are to be reserved for future claims.", 0, 1, fundsReserveRequested);
15820        case 1314609806: /*fundsReserve*/  return new Property("fundsReserve", "CodeableConcept", "A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.", 0, 1, fundsReserve);
15821        case 1090493483: /*related*/  return new Property("related", "", "Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.", 0, java.lang.Integer.MAX_VALUE, related);
15822        case 460301338: /*prescription*/  return new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription is the document/authorization given to the claim author for them to provide products and services for which consideration (reimbursement) is sought. Could be a RX for medications, an 'order' for oxygen or wheelchair or physiotherapy treatments.", 0, 1, prescription);
15823        case -1814015861: /*originalPrescription*/  return new Property("originalPrescription", "Reference(MedicationRequest)", "Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.", 0, 1, originalPrescription);
15824        case 106443592: /*payee*/  return new Property("payee", "", "The party to be reimbursed for cost of the products and services according to the terms of the policy.", 0, 1, payee);
15825        case -722568291: /*referral*/  return new Property("referral", "Reference(ServiceRequest)", "The referral information received by the claim author, it is not to be used when the author generates a referral for a patient. A copy of that referral may be provided as supporting information. Some insurers require proof of referral to pay for services or to pay specialist rates for services.", 0, 1, referral);
15826        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "A billed item may include goods or services provided in multiple encounters.", 0, java.lang.Integer.MAX_VALUE, encounter);
15827        case 501116579: /*facility*/  return new Property("facility", "Reference(Location|Organization)", "Facility where the services were provided.", 0, 1, facility);
15828        case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.", 0, 1, claim);
15829        case 689513629: /*claimResponse*/  return new Property("claimResponse", "Reference(ClaimResponse)", "The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.", 0, 1, claimResponse);
15830        case -1106507950: /*outcome*/  return new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome);
15831        case 565719004: /*decision*/  return new Property("decision", "CodeableConcept", "The result of the claim, predetermination, or preauthorization adjudication.", 0, 1, decision);
15832        case 583380919: /*disposition*/  return new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition);
15833        case 522246568: /*preAuthRef*/  return new Property("preAuthRef", "string", "Reference from the Insurer which is used in later communications which refers to this adjudication.", 0, java.lang.Integer.MAX_VALUE, preAuthRef);
15834        case -1262920311: /*preAuthRefPeriod*/  return new Property("preAuthRefPeriod", "Period", "The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.", 0, java.lang.Integer.MAX_VALUE, preAuthRefPeriod);
15835        case -1599182171: /*diagnosisRelatedGroup*/  return new Property("diagnosisRelatedGroup", "CodeableConcept", "A package billing code or bundle code used to group products and services to a particular health condition (such as heart attack) which is based on a predetermined grouping code system.", 0, 1, diagnosisRelatedGroup);
15836        case -7323378: /*careTeam*/  return new Property("careTeam", "", "The members of the team who provided the products and services.", 0, java.lang.Integer.MAX_VALUE, careTeam);
15837        case 1922406657: /*supportingInfo*/  return new Property("supportingInfo", "", "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.", 0, java.lang.Integer.MAX_VALUE, supportingInfo);
15838        case 1196993265: /*diagnosis*/  return new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis);
15839        case -1095204141: /*procedure*/  return new Property("procedure", "", "Procedures performed on the patient relevant to the billing items with the claim.", 0, java.lang.Integer.MAX_VALUE, procedure);
15840        case 159695370: /*precedence*/  return new Property("precedence", "positiveInt", "This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.", 0, 1, precedence);
15841        case 73049818: /*insurance*/  return new Property("insurance", "", "Financial instruments for reimbursement for the health care products and services specified on the claim.", 0, java.lang.Integer.MAX_VALUE, insurance);
15842        case -2143202801: /*accident*/  return new Property("accident", "", "Details of a accident which resulted in injuries which required the products and services listed in the claim.", 0, 1, accident);
15843        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);
15844        case 3242771: /*item*/  return new Property("item", "", "A claim line. Either a simple (a product or service) or a 'group' of details which can also be a simple items or groups of sub-details.", 0, java.lang.Integer.MAX_VALUE, item);
15845        case -1148899500: /*addItem*/  return new Property("addItem", "", "The first-tier service adjudications for payor added product or service lines.", 0, java.lang.Integer.MAX_VALUE, addItem);
15846        case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results which are presented at the header level rather than at the line-item or add-item levels.", 0, java.lang.Integer.MAX_VALUE, adjudication);
15847        case 110549828: /*total*/  return new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total);
15848        case -786681338: /*payment*/  return new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment);
15849        case 473181393: /*formCode*/  return new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode);
15850        case 3148996: /*form*/  return new Property("form", "Attachment", "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form);
15851        case 202339073: /*processNote*/  return new Property("processNote", "", "A note that describes or explains adjudication results in a human readable form.", 0, java.lang.Integer.MAX_VALUE, processNote);
15852        case -407369416: /*benefitPeriod*/  return new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod);
15853        case 596003397: /*benefitBalance*/  return new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance);
15854        default: return super.getNamedProperty(_hash, _name, _checkValid);
15855        }
15856
15857      }
15858
15859      @Override
15860      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
15861        switch (hash) {
15862        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
15863        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ExplanationOfBenefitStatus>
15864        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
15865        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
15866        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<Use>
15867        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
15868        case -332066046: /*billablePeriod*/ return this.billablePeriod == null ? new Base[0] : new Base[] {this.billablePeriod}; // Period
15869        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
15870        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
15871        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
15872        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
15873        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
15874        case -1688904576: /*fundsReserveRequested*/ return this.fundsReserveRequested == null ? new Base[0] : new Base[] {this.fundsReserveRequested}; // CodeableConcept
15875        case 1314609806: /*fundsReserve*/ return this.fundsReserve == null ? new Base[0] : new Base[] {this.fundsReserve}; // CodeableConcept
15876        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
15877        case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Reference
15878        case -1814015861: /*originalPrescription*/ return this.originalPrescription == null ? new Base[0] : new Base[] {this.originalPrescription}; // Reference
15879        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // PayeeComponent
15880        case -722568291: /*referral*/ return this.referral == null ? new Base[0] : new Base[] {this.referral}; // Reference
15881        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
15882        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
15883        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
15884        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Reference
15885        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // Enumeration<ClaimProcessingCodes>
15886        case 565719004: /*decision*/ return this.decision == null ? new Base[0] : new Base[] {this.decision}; // CodeableConcept
15887        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
15888        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
15889        case -1262920311: /*preAuthRefPeriod*/ return this.preAuthRefPeriod == null ? new Base[0] : this.preAuthRefPeriod.toArray(new Base[this.preAuthRefPeriod.size()]); // Period
15890        case -1599182171: /*diagnosisRelatedGroup*/ return this.diagnosisRelatedGroup == null ? new Base[0] : new Base[] {this.diagnosisRelatedGroup}; // CodeableConcept
15891        case -7323378: /*careTeam*/ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
15892        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // SupportingInformationComponent
15893        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
15894        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
15895        case 159695370: /*precedence*/ return this.precedence == null ? new Base[0] : new Base[] {this.precedence}; // PositiveIntType
15896        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
15897        case -2143202801: /*accident*/ return this.accident == null ? new Base[0] : new Base[] {this.accident}; // AccidentComponent
15898        case 525514609: /*patientPaid*/ return this.patientPaid == null ? new Base[0] : new Base[] {this.patientPaid}; // Money
15899        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
15900        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
15901        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
15902        case 110549828: /*total*/ return this.total == null ? new Base[0] : this.total.toArray(new Base[this.total.size()]); // TotalComponent
15903        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // PaymentComponent
15904        case 473181393: /*formCode*/ return this.formCode == null ? new Base[0] : new Base[] {this.formCode}; // CodeableConcept
15905        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // Attachment
15906        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
15907        case -407369416: /*benefitPeriod*/ return this.benefitPeriod == null ? new Base[0] : new Base[] {this.benefitPeriod}; // Period
15908        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
15909        default: return super.getProperty(hash, name, checkValid);
15910        }
15911
15912      }
15913
15914      @Override
15915      public Base setProperty(int hash, String name, Base value) throws FHIRException {
15916        switch (hash) {
15917        case -1618432855: // identifier
15918          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
15919          return value;
15920        case -892481550: // status
15921          value = new ExplanationOfBenefitStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
15922          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
15923          return value;
15924        case 3575610: // type
15925          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
15926          return value;
15927        case -1868521062: // subType
15928          this.subType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
15929          return value;
15930        case 116103: // use
15931          value = new UseEnumFactory().fromType(TypeConvertor.castToCode(value));
15932          this.use = (Enumeration) value; // Enumeration<Use>
15933          return value;
15934        case -791418107: // patient
15935          this.patient = TypeConvertor.castToReference(value); // Reference
15936          return value;
15937        case -332066046: // billablePeriod
15938          this.billablePeriod = TypeConvertor.castToPeriod(value); // Period
15939          return value;
15940        case 1028554472: // created
15941          this.created = TypeConvertor.castToDateTime(value); // DateTimeType
15942          return value;
15943        case -1591951995: // enterer
15944          this.enterer = TypeConvertor.castToReference(value); // Reference
15945          return value;
15946        case 1957615864: // insurer
15947          this.insurer = TypeConvertor.castToReference(value); // Reference
15948          return value;
15949        case -987494927: // provider
15950          this.provider = TypeConvertor.castToReference(value); // Reference
15951          return value;
15952        case -1165461084: // priority
15953          this.priority = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
15954          return value;
15955        case -1688904576: // fundsReserveRequested
15956          this.fundsReserveRequested = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
15957          return value;
15958        case 1314609806: // fundsReserve
15959          this.fundsReserve = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
15960          return value;
15961        case 1090493483: // related
15962          this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
15963          return value;
15964        case 460301338: // prescription
15965          this.prescription = TypeConvertor.castToReference(value); // Reference
15966          return value;
15967        case -1814015861: // originalPrescription
15968          this.originalPrescription = TypeConvertor.castToReference(value); // Reference
15969          return value;
15970        case 106443592: // payee
15971          this.payee = (PayeeComponent) value; // PayeeComponent
15972          return value;
15973        case -722568291: // referral
15974          this.referral = TypeConvertor.castToReference(value); // Reference
15975          return value;
15976        case 1524132147: // encounter
15977          this.getEncounter().add(TypeConvertor.castToReference(value)); // Reference
15978          return value;
15979        case 501116579: // facility
15980          this.facility = TypeConvertor.castToReference(value); // Reference
15981          return value;
15982        case 94742588: // claim
15983          this.claim = TypeConvertor.castToReference(value); // Reference
15984          return value;
15985        case 689513629: // claimResponse
15986          this.claimResponse = TypeConvertor.castToReference(value); // Reference
15987          return value;
15988        case -1106507950: // outcome
15989          value = new ClaimProcessingCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
15990          this.outcome = (Enumeration) value; // Enumeration<ClaimProcessingCodes>
15991          return value;
15992        case 565719004: // decision
15993          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
15994          return value;
15995        case 583380919: // disposition
15996          this.disposition = TypeConvertor.castToString(value); // StringType
15997          return value;
15998        case 522246568: // preAuthRef
15999          this.getPreAuthRef().add(TypeConvertor.castToString(value)); // StringType
16000          return value;
16001        case -1262920311: // preAuthRefPeriod
16002          this.getPreAuthRefPeriod().add(TypeConvertor.castToPeriod(value)); // Period
16003          return value;
16004        case -1599182171: // diagnosisRelatedGroup
16005          this.diagnosisRelatedGroup = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
16006          return value;
16007        case -7323378: // careTeam
16008          this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
16009          return value;
16010        case 1922406657: // supportingInfo
16011          this.getSupportingInfo().add((SupportingInformationComponent) value); // SupportingInformationComponent
16012          return value;
16013        case 1196993265: // diagnosis
16014          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
16015          return value;
16016        case -1095204141: // procedure
16017          this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
16018          return value;
16019        case 159695370: // precedence
16020          this.precedence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
16021          return value;
16022        case 73049818: // insurance
16023          this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
16024          return value;
16025        case -2143202801: // accident
16026          this.accident = (AccidentComponent) value; // AccidentComponent
16027          return value;
16028        case 525514609: // patientPaid
16029          this.patientPaid = TypeConvertor.castToMoney(value); // Money
16030          return value;
16031        case 3242771: // item
16032          this.getItem().add((ItemComponent) value); // ItemComponent
16033          return value;
16034        case -1148899500: // addItem
16035          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
16036          return value;
16037        case -231349275: // adjudication
16038          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
16039          return value;
16040        case 110549828: // total
16041          this.getTotal().add((TotalComponent) value); // TotalComponent
16042          return value;
16043        case -786681338: // payment
16044          this.payment = (PaymentComponent) value; // PaymentComponent
16045          return value;
16046        case 473181393: // formCode
16047          this.formCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
16048          return value;
16049        case 3148996: // form
16050          this.form = TypeConvertor.castToAttachment(value); // Attachment
16051          return value;
16052        case 202339073: // processNote
16053          this.getProcessNote().add((NoteComponent) value); // NoteComponent
16054          return value;
16055        case -407369416: // benefitPeriod
16056          this.benefitPeriod = TypeConvertor.castToPeriod(value); // Period
16057          return value;
16058        case 596003397: // benefitBalance
16059          this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
16060          return value;
16061        default: return super.setProperty(hash, name, value);
16062        }
16063
16064      }
16065
16066      @Override
16067      public Base setProperty(String name, Base value) throws FHIRException {
16068        if (name.equals("identifier")) {
16069          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
16070        } else if (name.equals("status")) {
16071          value = new ExplanationOfBenefitStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
16072          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
16073        } else if (name.equals("type")) {
16074          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
16075        } else if (name.equals("subType")) {
16076          this.subType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
16077        } else if (name.equals("use")) {
16078          value = new UseEnumFactory().fromType(TypeConvertor.castToCode(value));
16079          this.use = (Enumeration) value; // Enumeration<Use>
16080        } else if (name.equals("patient")) {
16081          this.patient = TypeConvertor.castToReference(value); // Reference
16082        } else if (name.equals("billablePeriod")) {
16083          this.billablePeriod = TypeConvertor.castToPeriod(value); // Period
16084        } else if (name.equals("created")) {
16085          this.created = TypeConvertor.castToDateTime(value); // DateTimeType
16086        } else if (name.equals("enterer")) {
16087          this.enterer = TypeConvertor.castToReference(value); // Reference
16088        } else if (name.equals("insurer")) {
16089          this.insurer = TypeConvertor.castToReference(value); // Reference
16090        } else if (name.equals("provider")) {
16091          this.provider = TypeConvertor.castToReference(value); // Reference
16092        } else if (name.equals("priority")) {
16093          this.priority = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
16094        } else if (name.equals("fundsReserveRequested")) {
16095          this.fundsReserveRequested = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
16096        } else if (name.equals("fundsReserve")) {
16097          this.fundsReserve = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
16098        } else if (name.equals("related")) {
16099          this.getRelated().add((RelatedClaimComponent) value);
16100        } else if (name.equals("prescription")) {
16101          this.prescription = TypeConvertor.castToReference(value); // Reference
16102        } else if (name.equals("originalPrescription")) {
16103          this.originalPrescription = TypeConvertor.castToReference(value); // Reference
16104        } else if (name.equals("payee")) {
16105          this.payee = (PayeeComponent) value; // PayeeComponent
16106        } else if (name.equals("referral")) {
16107          this.referral = TypeConvertor.castToReference(value); // Reference
16108        } else if (name.equals("encounter")) {
16109          this.getEncounter().add(TypeConvertor.castToReference(value));
16110        } else if (name.equals("facility")) {
16111          this.facility = TypeConvertor.castToReference(value); // Reference
16112        } else if (name.equals("claim")) {
16113          this.claim = TypeConvertor.castToReference(value); // Reference
16114        } else if (name.equals("claimResponse")) {
16115          this.claimResponse = TypeConvertor.castToReference(value); // Reference
16116        } else if (name.equals("outcome")) {
16117          value = new ClaimProcessingCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
16118          this.outcome = (Enumeration) value; // Enumeration<ClaimProcessingCodes>
16119        } else if (name.equals("decision")) {
16120          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
16121        } else if (name.equals("disposition")) {
16122          this.disposition = TypeConvertor.castToString(value); // StringType
16123        } else if (name.equals("preAuthRef")) {
16124          this.getPreAuthRef().add(TypeConvertor.castToString(value));
16125        } else if (name.equals("preAuthRefPeriod")) {
16126          this.getPreAuthRefPeriod().add(TypeConvertor.castToPeriod(value));
16127        } else if (name.equals("diagnosisRelatedGroup")) {
16128          this.diagnosisRelatedGroup = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
16129        } else if (name.equals("careTeam")) {
16130          this.getCareTeam().add((CareTeamComponent) value);
16131        } else if (name.equals("supportingInfo")) {
16132          this.getSupportingInfo().add((SupportingInformationComponent) value);
16133        } else if (name.equals("diagnosis")) {
16134          this.getDiagnosis().add((DiagnosisComponent) value);
16135        } else if (name.equals("procedure")) {
16136          this.getProcedure().add((ProcedureComponent) value);
16137        } else if (name.equals("precedence")) {
16138          this.precedence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
16139        } else if (name.equals("insurance")) {
16140          this.getInsurance().add((InsuranceComponent) value);
16141        } else if (name.equals("accident")) {
16142          this.accident = (AccidentComponent) value; // AccidentComponent
16143        } else if (name.equals("patientPaid")) {
16144          this.patientPaid = TypeConvertor.castToMoney(value); // Money
16145        } else if (name.equals("item")) {
16146          this.getItem().add((ItemComponent) value);
16147        } else if (name.equals("addItem")) {
16148          this.getAddItem().add((AddedItemComponent) value);
16149        } else if (name.equals("adjudication")) {
16150          this.getAdjudication().add((AdjudicationComponent) value);
16151        } else if (name.equals("total")) {
16152          this.getTotal().add((TotalComponent) value);
16153        } else if (name.equals("payment")) {
16154          this.payment = (PaymentComponent) value; // PaymentComponent
16155        } else if (name.equals("formCode")) {
16156          this.formCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
16157        } else if (name.equals("form")) {
16158          this.form = TypeConvertor.castToAttachment(value); // Attachment
16159        } else if (name.equals("processNote")) {
16160          this.getProcessNote().add((NoteComponent) value);
16161        } else if (name.equals("benefitPeriod")) {
16162          this.benefitPeriod = TypeConvertor.castToPeriod(value); // Period
16163        } else if (name.equals("benefitBalance")) {
16164          this.getBenefitBalance().add((BenefitBalanceComponent) value);
16165        } else
16166          return super.setProperty(name, value);
16167        return value;
16168      }
16169
16170      @Override
16171      public Base makeProperty(int hash, String name) throws FHIRException {
16172        switch (hash) {
16173        case -1618432855:  return addIdentifier(); 
16174        case -892481550:  return getStatusElement();
16175        case 3575610:  return getType();
16176        case -1868521062:  return getSubType();
16177        case 116103:  return getUseElement();
16178        case -791418107:  return getPatient();
16179        case -332066046:  return getBillablePeriod();
16180        case 1028554472:  return getCreatedElement();
16181        case -1591951995:  return getEnterer();
16182        case 1957615864:  return getInsurer();
16183        case -987494927:  return getProvider();
16184        case -1165461084:  return getPriority();
16185        case -1688904576:  return getFundsReserveRequested();
16186        case 1314609806:  return getFundsReserve();
16187        case 1090493483:  return addRelated(); 
16188        case 460301338:  return getPrescription();
16189        case -1814015861:  return getOriginalPrescription();
16190        case 106443592:  return getPayee();
16191        case -722568291:  return getReferral();
16192        case 1524132147:  return addEncounter(); 
16193        case 501116579:  return getFacility();
16194        case 94742588:  return getClaim();
16195        case 689513629:  return getClaimResponse();
16196        case -1106507950:  return getOutcomeElement();
16197        case 565719004:  return getDecision();
16198        case 583380919:  return getDispositionElement();
16199        case 522246568:  return addPreAuthRefElement();
16200        case -1262920311:  return addPreAuthRefPeriod(); 
16201        case -1599182171:  return getDiagnosisRelatedGroup();
16202        case -7323378:  return addCareTeam(); 
16203        case 1922406657:  return addSupportingInfo(); 
16204        case 1196993265:  return addDiagnosis(); 
16205        case -1095204141:  return addProcedure(); 
16206        case 159695370:  return getPrecedenceElement();
16207        case 73049818:  return addInsurance(); 
16208        case -2143202801:  return getAccident();
16209        case 525514609:  return getPatientPaid();
16210        case 3242771:  return addItem(); 
16211        case -1148899500:  return addAddItem(); 
16212        case -231349275:  return addAdjudication(); 
16213        case 110549828:  return addTotal(); 
16214        case -786681338:  return getPayment();
16215        case 473181393:  return getFormCode();
16216        case 3148996:  return getForm();
16217        case 202339073:  return addProcessNote(); 
16218        case -407369416:  return getBenefitPeriod();
16219        case 596003397:  return addBenefitBalance(); 
16220        default: return super.makeProperty(hash, name);
16221        }
16222
16223      }
16224
16225      @Override
16226      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
16227        switch (hash) {
16228        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
16229        case -892481550: /*status*/ return new String[] {"code"};
16230        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
16231        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
16232        case 116103: /*use*/ return new String[] {"code"};
16233        case -791418107: /*patient*/ return new String[] {"Reference"};
16234        case -332066046: /*billablePeriod*/ return new String[] {"Period"};
16235        case 1028554472: /*created*/ return new String[] {"dateTime"};
16236        case -1591951995: /*enterer*/ return new String[] {"Reference"};
16237        case 1957615864: /*insurer*/ return new String[] {"Reference"};
16238        case -987494927: /*provider*/ return new String[] {"Reference"};
16239        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
16240        case -1688904576: /*fundsReserveRequested*/ return new String[] {"CodeableConcept"};
16241        case 1314609806: /*fundsReserve*/ return new String[] {"CodeableConcept"};
16242        case 1090493483: /*related*/ return new String[] {};
16243        case 460301338: /*prescription*/ return new String[] {"Reference"};
16244        case -1814015861: /*originalPrescription*/ return new String[] {"Reference"};
16245        case 106443592: /*payee*/ return new String[] {};
16246        case -722568291: /*referral*/ return new String[] {"Reference"};
16247        case 1524132147: /*encounter*/ return new String[] {"Reference"};
16248        case 501116579: /*facility*/ return new String[] {"Reference"};
16249        case 94742588: /*claim*/ return new String[] {"Reference"};
16250        case 689513629: /*claimResponse*/ return new String[] {"Reference"};
16251        case -1106507950: /*outcome*/ return new String[] {"code"};
16252        case 565719004: /*decision*/ return new String[] {"CodeableConcept"};
16253        case 583380919: /*disposition*/ return new String[] {"string"};
16254        case 522246568: /*preAuthRef*/ return new String[] {"string"};
16255        case -1262920311: /*preAuthRefPeriod*/ return new String[] {"Period"};
16256        case -1599182171: /*diagnosisRelatedGroup*/ return new String[] {"CodeableConcept"};
16257        case -7323378: /*careTeam*/ return new String[] {};
16258        case 1922406657: /*supportingInfo*/ return new String[] {};
16259        case 1196993265: /*diagnosis*/ return new String[] {};
16260        case -1095204141: /*procedure*/ return new String[] {};
16261        case 159695370: /*precedence*/ return new String[] {"positiveInt"};
16262        case 73049818: /*insurance*/ return new String[] {};
16263        case -2143202801: /*accident*/ return new String[] {};
16264        case 525514609: /*patientPaid*/ return new String[] {"Money"};
16265        case 3242771: /*item*/ return new String[] {};
16266        case -1148899500: /*addItem*/ return new String[] {};
16267        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
16268        case 110549828: /*total*/ return new String[] {};
16269        case -786681338: /*payment*/ return new String[] {};
16270        case 473181393: /*formCode*/ return new String[] {"CodeableConcept"};
16271        case 3148996: /*form*/ return new String[] {"Attachment"};
16272        case 202339073: /*processNote*/ return new String[] {};
16273        case -407369416: /*benefitPeriod*/ return new String[] {"Period"};
16274        case 596003397: /*benefitBalance*/ return new String[] {};
16275        default: return super.getTypesForProperty(hash, name);
16276        }
16277
16278      }
16279
16280      @Override
16281      public Base addChild(String name) throws FHIRException {
16282        if (name.equals("identifier")) {
16283          return addIdentifier();
16284        }
16285        else if (name.equals("status")) {
16286          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.status");
16287        }
16288        else if (name.equals("type")) {
16289          this.type = new CodeableConcept();
16290          return this.type;
16291        }
16292        else if (name.equals("subType")) {
16293          this.subType = new CodeableConcept();
16294          return this.subType;
16295        }
16296        else if (name.equals("use")) {
16297          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.use");
16298        }
16299        else if (name.equals("patient")) {
16300          this.patient = new Reference();
16301          return this.patient;
16302        }
16303        else if (name.equals("billablePeriod")) {
16304          this.billablePeriod = new Period();
16305          return this.billablePeriod;
16306        }
16307        else if (name.equals("created")) {
16308          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.created");
16309        }
16310        else if (name.equals("enterer")) {
16311          this.enterer = new Reference();
16312          return this.enterer;
16313        }
16314        else if (name.equals("insurer")) {
16315          this.insurer = new Reference();
16316          return this.insurer;
16317        }
16318        else if (name.equals("provider")) {
16319          this.provider = new Reference();
16320          return this.provider;
16321        }
16322        else if (name.equals("priority")) {
16323          this.priority = new CodeableConcept();
16324          return this.priority;
16325        }
16326        else if (name.equals("fundsReserveRequested")) {
16327          this.fundsReserveRequested = new CodeableConcept();
16328          return this.fundsReserveRequested;
16329        }
16330        else if (name.equals("fundsReserve")) {
16331          this.fundsReserve = new CodeableConcept();
16332          return this.fundsReserve;
16333        }
16334        else if (name.equals("related")) {
16335          return addRelated();
16336        }
16337        else if (name.equals("prescription")) {
16338          this.prescription = new Reference();
16339          return this.prescription;
16340        }
16341        else if (name.equals("originalPrescription")) {
16342          this.originalPrescription = new Reference();
16343          return this.originalPrescription;
16344        }
16345        else if (name.equals("payee")) {
16346          this.payee = new PayeeComponent();
16347          return this.payee;
16348        }
16349        else if (name.equals("referral")) {
16350          this.referral = new Reference();
16351          return this.referral;
16352        }
16353        else if (name.equals("encounter")) {
16354          return addEncounter();
16355        }
16356        else if (name.equals("facility")) {
16357          this.facility = new Reference();
16358          return this.facility;
16359        }
16360        else if (name.equals("claim")) {
16361          this.claim = new Reference();
16362          return this.claim;
16363        }
16364        else if (name.equals("claimResponse")) {
16365          this.claimResponse = new Reference();
16366          return this.claimResponse;
16367        }
16368        else if (name.equals("outcome")) {
16369          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.outcome");
16370        }
16371        else if (name.equals("decision")) {
16372          this.decision = new CodeableConcept();
16373          return this.decision;
16374        }
16375        else if (name.equals("disposition")) {
16376          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.disposition");
16377        }
16378        else if (name.equals("preAuthRef")) {
16379          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
16380        }
16381        else if (name.equals("preAuthRefPeriod")) {
16382          return addPreAuthRefPeriod();
16383        }
16384        else if (name.equals("diagnosisRelatedGroup")) {
16385          this.diagnosisRelatedGroup = new CodeableConcept();
16386          return this.diagnosisRelatedGroup;
16387        }
16388        else if (name.equals("careTeam")) {
16389          return addCareTeam();
16390        }
16391        else if (name.equals("supportingInfo")) {
16392          return addSupportingInfo();
16393        }
16394        else if (name.equals("diagnosis")) {
16395          return addDiagnosis();
16396        }
16397        else if (name.equals("procedure")) {
16398          return addProcedure();
16399        }
16400        else if (name.equals("precedence")) {
16401          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.precedence");
16402        }
16403        else if (name.equals("insurance")) {
16404          return addInsurance();
16405        }
16406        else if (name.equals("accident")) {
16407          this.accident = new AccidentComponent();
16408          return this.accident;
16409        }
16410        else if (name.equals("patientPaid")) {
16411          this.patientPaid = new Money();
16412          return this.patientPaid;
16413        }
16414        else if (name.equals("item")) {
16415          return addItem();
16416        }
16417        else if (name.equals("addItem")) {
16418          return addAddItem();
16419        }
16420        else if (name.equals("adjudication")) {
16421          return addAdjudication();
16422        }
16423        else if (name.equals("total")) {
16424          return addTotal();
16425        }
16426        else if (name.equals("payment")) {
16427          this.payment = new PaymentComponent();
16428          return this.payment;
16429        }
16430        else if (name.equals("formCode")) {
16431          this.formCode = new CodeableConcept();
16432          return this.formCode;
16433        }
16434        else if (name.equals("form")) {
16435          this.form = new Attachment();
16436          return this.form;
16437        }
16438        else if (name.equals("processNote")) {
16439          return addProcessNote();
16440        }
16441        else if (name.equals("benefitPeriod")) {
16442          this.benefitPeriod = new Period();
16443          return this.benefitPeriod;
16444        }
16445        else if (name.equals("benefitBalance")) {
16446          return addBenefitBalance();
16447        }
16448        else
16449          return super.addChild(name);
16450      }
16451
16452  public String fhirType() {
16453    return "ExplanationOfBenefit";
16454
16455  }
16456
16457      public ExplanationOfBenefit copy() {
16458        ExplanationOfBenefit dst = new ExplanationOfBenefit();
16459        copyValues(dst);
16460        return dst;
16461      }
16462
16463      public void copyValues(ExplanationOfBenefit dst) {
16464        super.copyValues(dst);
16465        if (identifier != null) {
16466          dst.identifier = new ArrayList<Identifier>();
16467          for (Identifier i : identifier)
16468            dst.identifier.add(i.copy());
16469        };
16470        dst.status = status == null ? null : status.copy();
16471        dst.type = type == null ? null : type.copy();
16472        dst.subType = subType == null ? null : subType.copy();
16473        dst.use = use == null ? null : use.copy();
16474        dst.patient = patient == null ? null : patient.copy();
16475        dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
16476        dst.created = created == null ? null : created.copy();
16477        dst.enterer = enterer == null ? null : enterer.copy();
16478        dst.insurer = insurer == null ? null : insurer.copy();
16479        dst.provider = provider == null ? null : provider.copy();
16480        dst.priority = priority == null ? null : priority.copy();
16481        dst.fundsReserveRequested = fundsReserveRequested == null ? null : fundsReserveRequested.copy();
16482        dst.fundsReserve = fundsReserve == null ? null : fundsReserve.copy();
16483        if (related != null) {
16484          dst.related = new ArrayList<RelatedClaimComponent>();
16485          for (RelatedClaimComponent i : related)
16486            dst.related.add(i.copy());
16487        };
16488        dst.prescription = prescription == null ? null : prescription.copy();
16489        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
16490        dst.payee = payee == null ? null : payee.copy();
16491        dst.referral = referral == null ? null : referral.copy();
16492        if (encounter != null) {
16493          dst.encounter = new ArrayList<Reference>();
16494          for (Reference i : encounter)
16495            dst.encounter.add(i.copy());
16496        };
16497        dst.facility = facility == null ? null : facility.copy();
16498        dst.claim = claim == null ? null : claim.copy();
16499        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
16500        dst.outcome = outcome == null ? null : outcome.copy();
16501        dst.decision = decision == null ? null : decision.copy();
16502        dst.disposition = disposition == null ? null : disposition.copy();
16503        if (preAuthRef != null) {
16504          dst.preAuthRef = new ArrayList<StringType>();
16505          for (StringType i : preAuthRef)
16506            dst.preAuthRef.add(i.copy());
16507        };
16508        if (preAuthRefPeriod != null) {
16509          dst.preAuthRefPeriod = new ArrayList<Period>();
16510          for (Period i : preAuthRefPeriod)
16511            dst.preAuthRefPeriod.add(i.copy());
16512        };
16513        dst.diagnosisRelatedGroup = diagnosisRelatedGroup == null ? null : diagnosisRelatedGroup.copy();
16514        if (careTeam != null) {
16515          dst.careTeam = new ArrayList<CareTeamComponent>();
16516          for (CareTeamComponent i : careTeam)
16517            dst.careTeam.add(i.copy());
16518        };
16519        if (supportingInfo != null) {
16520          dst.supportingInfo = new ArrayList<SupportingInformationComponent>();
16521          for (SupportingInformationComponent i : supportingInfo)
16522            dst.supportingInfo.add(i.copy());
16523        };
16524        if (diagnosis != null) {
16525          dst.diagnosis = new ArrayList<DiagnosisComponent>();
16526          for (DiagnosisComponent i : diagnosis)
16527            dst.diagnosis.add(i.copy());
16528        };
16529        if (procedure != null) {
16530          dst.procedure = new ArrayList<ProcedureComponent>();
16531          for (ProcedureComponent i : procedure)
16532            dst.procedure.add(i.copy());
16533        };
16534        dst.precedence = precedence == null ? null : precedence.copy();
16535        if (insurance != null) {
16536          dst.insurance = new ArrayList<InsuranceComponent>();
16537          for (InsuranceComponent i : insurance)
16538            dst.insurance.add(i.copy());
16539        };
16540        dst.accident = accident == null ? null : accident.copy();
16541        dst.patientPaid = patientPaid == null ? null : patientPaid.copy();
16542        if (item != null) {
16543          dst.item = new ArrayList<ItemComponent>();
16544          for (ItemComponent i : item)
16545            dst.item.add(i.copy());
16546        };
16547        if (addItem != null) {
16548          dst.addItem = new ArrayList<AddedItemComponent>();
16549          for (AddedItemComponent i : addItem)
16550            dst.addItem.add(i.copy());
16551        };
16552        if (adjudication != null) {
16553          dst.adjudication = new ArrayList<AdjudicationComponent>();
16554          for (AdjudicationComponent i : adjudication)
16555            dst.adjudication.add(i.copy());
16556        };
16557        if (total != null) {
16558          dst.total = new ArrayList<TotalComponent>();
16559          for (TotalComponent i : total)
16560            dst.total.add(i.copy());
16561        };
16562        dst.payment = payment == null ? null : payment.copy();
16563        dst.formCode = formCode == null ? null : formCode.copy();
16564        dst.form = form == null ? null : form.copy();
16565        if (processNote != null) {
16566          dst.processNote = new ArrayList<NoteComponent>();
16567          for (NoteComponent i : processNote)
16568            dst.processNote.add(i.copy());
16569        };
16570        dst.benefitPeriod = benefitPeriod == null ? null : benefitPeriod.copy();
16571        if (benefitBalance != null) {
16572          dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
16573          for (BenefitBalanceComponent i : benefitBalance)
16574            dst.benefitBalance.add(i.copy());
16575        };
16576      }
16577
16578      protected ExplanationOfBenefit typedCopy() {
16579        return copy();
16580      }
16581
16582      @Override
16583      public boolean equalsDeep(Base other_) {
16584        if (!super.equalsDeep(other_))
16585          return false;
16586        if (!(other_ instanceof ExplanationOfBenefit))
16587          return false;
16588        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
16589        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
16590           && compareDeep(subType, o.subType, true) && compareDeep(use, o.use, true) && compareDeep(patient, o.patient, true)
16591           && compareDeep(billablePeriod, o.billablePeriod, true) && compareDeep(created, o.created, true)
16592           && compareDeep(enterer, o.enterer, true) && compareDeep(insurer, o.insurer, true) && compareDeep(provider, o.provider, true)
16593           && compareDeep(priority, o.priority, true) && compareDeep(fundsReserveRequested, o.fundsReserveRequested, true)
16594           && compareDeep(fundsReserve, o.fundsReserve, true) && compareDeep(related, o.related, true) && compareDeep(prescription, o.prescription, true)
16595           && compareDeep(originalPrescription, o.originalPrescription, true) && compareDeep(payee, o.payee, true)
16596           && compareDeep(referral, o.referral, true) && compareDeep(encounter, o.encounter, true) && compareDeep(facility, o.facility, true)
16597           && compareDeep(claim, o.claim, true) && compareDeep(claimResponse, o.claimResponse, true) && compareDeep(outcome, o.outcome, true)
16598           && compareDeep(decision, o.decision, true) && compareDeep(disposition, o.disposition, true) && compareDeep(preAuthRef, o.preAuthRef, true)
16599           && compareDeep(preAuthRefPeriod, o.preAuthRefPeriod, true) && compareDeep(diagnosisRelatedGroup, o.diagnosisRelatedGroup, true)
16600           && compareDeep(careTeam, o.careTeam, true) && compareDeep(supportingInfo, o.supportingInfo, true)
16601           && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true) && compareDeep(precedence, o.precedence, true)
16602           && compareDeep(insurance, o.insurance, true) && compareDeep(accident, o.accident, true) && compareDeep(patientPaid, o.patientPaid, true)
16603           && compareDeep(item, o.item, true) && compareDeep(addItem, o.addItem, true) && compareDeep(adjudication, o.adjudication, true)
16604           && compareDeep(total, o.total, true) && compareDeep(payment, o.payment, true) && compareDeep(formCode, o.formCode, true)
16605           && compareDeep(form, o.form, true) && compareDeep(processNote, o.processNote, true) && compareDeep(benefitPeriod, o.benefitPeriod, true)
16606           && compareDeep(benefitBalance, o.benefitBalance, true);
16607      }
16608
16609      @Override
16610      public boolean equalsShallow(Base other_) {
16611        if (!super.equalsShallow(other_))
16612          return false;
16613        if (!(other_ instanceof ExplanationOfBenefit))
16614          return false;
16615        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
16616        return compareValues(status, o.status, true) && compareValues(use, o.use, true) && compareValues(created, o.created, true)
16617           && compareValues(outcome, o.outcome, true) && compareValues(disposition, o.disposition, true) && compareValues(preAuthRef, o.preAuthRef, true)
16618           && compareValues(precedence, o.precedence, true);
16619      }
16620
16621      public boolean isEmpty() {
16622        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
16623          , subType, use, patient, billablePeriod, created, enterer, insurer, provider
16624          , priority, fundsReserveRequested, fundsReserve, related, prescription, originalPrescription
16625          , payee, referral, encounter, facility, claim, claimResponse, outcome, decision
16626          , disposition, preAuthRef, preAuthRefPeriod, diagnosisRelatedGroup, careTeam, supportingInfo
16627          , diagnosis, procedure, precedence, insurance, accident, patientPaid, item, addItem
16628          , adjudication, total, payment, formCode, form, processNote, benefitPeriod, benefitBalance
16629          );
16630      }
16631
16632  @Override
16633  public ResourceType getResourceType() {
16634    return ResourceType.ExplanationOfBenefit;
16635   }
16636
16637 /**
16638   * Search parameter: <b>care-team</b>
16639   * <p>
16640   * Description: <b>Member of the CareTeam</b><br>
16641   * Type: <b>reference</b><br>
16642   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
16643   * </p>
16644   */
16645  @SearchParamDefinition(name="care-team", path="ExplanationOfBenefit.careTeam.provider", description="Member of the CareTeam", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner") }, target={Organization.class, Practitioner.class, PractitionerRole.class } )
16646  public static final String SP_CARE_TEAM = "care-team";
16647 /**
16648   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
16649   * <p>
16650   * Description: <b>Member of the CareTeam</b><br>
16651   * Type: <b>reference</b><br>
16652   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
16653   * </p>
16654   */
16655  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_TEAM);
16656
16657/**
16658   * Constant for fluent queries to be used to add include statements. Specifies
16659   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
16660   */
16661  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:care-team").toLocked();
16662
16663 /**
16664   * Search parameter: <b>claim</b>
16665   * <p>
16666   * Description: <b>The reference to the claim</b><br>
16667   * Type: <b>reference</b><br>
16668   * Path: <b>ExplanationOfBenefit.claim</b><br>
16669   * </p>
16670   */
16671  @SearchParamDefinition(name="claim", path="ExplanationOfBenefit.claim", description="The reference to the claim", type="reference", target={Claim.class } )
16672  public static final String SP_CLAIM = "claim";
16673 /**
16674   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
16675   * <p>
16676   * Description: <b>The reference to the claim</b><br>
16677   * Type: <b>reference</b><br>
16678   * Path: <b>ExplanationOfBenefit.claim</b><br>
16679   * </p>
16680   */
16681  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CLAIM);
16682
16683/**
16684   * Constant for fluent queries to be used to add include statements. Specifies
16685   * the path value of "<b>ExplanationOfBenefit:claim</b>".
16686   */
16687  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:claim").toLocked();
16688
16689 /**
16690   * Search parameter: <b>coverage</b>
16691   * <p>
16692   * Description: <b>The plan under which the claim was adjudicated</b><br>
16693   * Type: <b>reference</b><br>
16694   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
16695   * </p>
16696   */
16697  @SearchParamDefinition(name="coverage", path="ExplanationOfBenefit.insurance.coverage", description="The plan under which the claim was adjudicated", type="reference", target={Coverage.class } )
16698  public static final String SP_COVERAGE = "coverage";
16699 /**
16700   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
16701   * <p>
16702   * Description: <b>The plan under which the claim was adjudicated</b><br>
16703   * Type: <b>reference</b><br>
16704   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
16705   * </p>
16706   */
16707  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COVERAGE);
16708
16709/**
16710   * Constant for fluent queries to be used to add include statements. Specifies
16711   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
16712   */
16713  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:coverage").toLocked();
16714
16715 /**
16716   * Search parameter: <b>created</b>
16717   * <p>
16718   * Description: <b>The creation date for the EOB</b><br>
16719   * Type: <b>date</b><br>
16720   * Path: <b>ExplanationOfBenefit.created</b><br>
16721   * </p>
16722   */
16723  @SearchParamDefinition(name="created", path="ExplanationOfBenefit.created", description="The creation date for the EOB", type="date" )
16724  public static final String SP_CREATED = "created";
16725 /**
16726   * <b>Fluent Client</b> search parameter constant for <b>created</b>
16727   * <p>
16728   * Description: <b>The creation date for the EOB</b><br>
16729   * Type: <b>date</b><br>
16730   * Path: <b>ExplanationOfBenefit.created</b><br>
16731   * </p>
16732   */
16733  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
16734
16735 /**
16736   * Search parameter: <b>detail-udi</b>
16737   * <p>
16738   * Description: <b>UDI associated with a line item detail product or service</b><br>
16739   * Type: <b>reference</b><br>
16740   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
16741   * </p>
16742   */
16743  @SearchParamDefinition(name="detail-udi", path="ExplanationOfBenefit.item.detail.udi", description="UDI associated with a line item detail product or service", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Device") }, target={Device.class } )
16744  public static final String SP_DETAIL_UDI = "detail-udi";
16745 /**
16746   * <b>Fluent Client</b> search parameter constant for <b>detail-udi</b>
16747   * <p>
16748   * Description: <b>UDI associated with a line item detail product or service</b><br>
16749   * Type: <b>reference</b><br>
16750   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
16751   * </p>
16752   */
16753  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DETAIL_UDI);
16754
16755/**
16756   * Constant for fluent queries to be used to add include statements. Specifies
16757   * the path value of "<b>ExplanationOfBenefit:detail-udi</b>".
16758   */
16759  public static final ca.uhn.fhir.model.api.Include INCLUDE_DETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:detail-udi").toLocked();
16760
16761 /**
16762   * Search parameter: <b>disposition</b>
16763   * <p>
16764   * Description: <b>The contents of the disposition message</b><br>
16765   * Type: <b>string</b><br>
16766   * Path: <b>ExplanationOfBenefit.disposition</b><br>
16767   * </p>
16768   */
16769  @SearchParamDefinition(name="disposition", path="ExplanationOfBenefit.disposition", description="The contents of the disposition message", type="string" )
16770  public static final String SP_DISPOSITION = "disposition";
16771 /**
16772   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
16773   * <p>
16774   * Description: <b>The contents of the disposition message</b><br>
16775   * Type: <b>string</b><br>
16776   * Path: <b>ExplanationOfBenefit.disposition</b><br>
16777   * </p>
16778   */
16779  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
16780
16781 /**
16782   * Search parameter: <b>encounter</b>
16783   * <p>
16784   * Description: <b>Encounters associated with a billed line item</b><br>
16785   * Type: <b>reference</b><br>
16786   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
16787   * </p>
16788   */
16789  @SearchParamDefinition(name="encounter", path="ExplanationOfBenefit.item.encounter", description="Encounters associated with a billed line item", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Encounter") }, target={Encounter.class } )
16790  public static final String SP_ENCOUNTER = "encounter";
16791 /**
16792   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
16793   * <p>
16794   * Description: <b>Encounters associated with a billed line item</b><br>
16795   * Type: <b>reference</b><br>
16796   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
16797   * </p>
16798   */
16799  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
16800
16801/**
16802   * Constant for fluent queries to be used to add include statements. Specifies
16803   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
16804   */
16805  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:encounter").toLocked();
16806
16807 /**
16808   * Search parameter: <b>enterer</b>
16809   * <p>
16810   * Description: <b>The party responsible for the entry of the Claim</b><br>
16811   * Type: <b>reference</b><br>
16812   * Path: <b>ExplanationOfBenefit.enterer</b><br>
16813   * </p>
16814   */
16815  @SearchParamDefinition(name="enterer", path="ExplanationOfBenefit.enterer", description="The party responsible for the entry of the Claim", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner") }, target={Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
16816  public static final String SP_ENTERER = "enterer";
16817 /**
16818   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
16819   * <p>
16820   * Description: <b>The party responsible for the entry of the Claim</b><br>
16821   * Type: <b>reference</b><br>
16822   * Path: <b>ExplanationOfBenefit.enterer</b><br>
16823   * </p>
16824   */
16825  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
16826
16827/**
16828   * Constant for fluent queries to be used to add include statements. Specifies
16829   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
16830   */
16831  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:enterer").toLocked();
16832
16833 /**
16834   * Search parameter: <b>facility</b>
16835   * <p>
16836   * Description: <b>Facility responsible for the goods and services</b><br>
16837   * Type: <b>reference</b><br>
16838   * Path: <b>ExplanationOfBenefit.facility</b><br>
16839   * </p>
16840   */
16841  @SearchParamDefinition(name="facility", path="ExplanationOfBenefit.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class, Organization.class } )
16842  public static final String SP_FACILITY = "facility";
16843 /**
16844   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
16845   * <p>
16846   * Description: <b>Facility responsible for the goods and services</b><br>
16847   * Type: <b>reference</b><br>
16848   * Path: <b>ExplanationOfBenefit.facility</b><br>
16849   * </p>
16850   */
16851  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
16852
16853/**
16854   * Constant for fluent queries to be used to add include statements. Specifies
16855   * the path value of "<b>ExplanationOfBenefit:facility</b>".
16856   */
16857  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:facility").toLocked();
16858
16859 /**
16860   * Search parameter: <b>identifier</b>
16861   * <p>
16862   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
16863   * Type: <b>token</b><br>
16864   * Path: <b>ExplanationOfBenefit.identifier</b><br>
16865   * </p>
16866   */
16867  @SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
16868  public static final String SP_IDENTIFIER = "identifier";
16869 /**
16870   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
16871   * <p>
16872   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
16873   * Type: <b>token</b><br>
16874   * Path: <b>ExplanationOfBenefit.identifier</b><br>
16875   * </p>
16876   */
16877  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
16878
16879 /**
16880   * Search parameter: <b>item-udi</b>
16881   * <p>
16882   * Description: <b>UDI associated with a line item product or service</b><br>
16883   * Type: <b>reference</b><br>
16884   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
16885   * </p>
16886   */
16887  @SearchParamDefinition(name="item-udi", path="ExplanationOfBenefit.item.udi", description="UDI associated with a line item product or service", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Device") }, target={Device.class } )
16888  public static final String SP_ITEM_UDI = "item-udi";
16889 /**
16890   * <b>Fluent Client</b> search parameter constant for <b>item-udi</b>
16891   * <p>
16892   * Description: <b>UDI associated with a line item product or service</b><br>
16893   * Type: <b>reference</b><br>
16894   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
16895   * </p>
16896   */
16897  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ITEM_UDI);
16898
16899/**
16900   * Constant for fluent queries to be used to add include statements. Specifies
16901   * the path value of "<b>ExplanationOfBenefit:item-udi</b>".
16902   */
16903  public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:item-udi").toLocked();
16904
16905 /**
16906   * Search parameter: <b>patient</b>
16907   * <p>
16908   * Description: <b>The reference to the patient</b><br>
16909   * Type: <b>reference</b><br>
16910   * Path: <b>ExplanationOfBenefit.patient</b><br>
16911   * </p>
16912   */
16913  @SearchParamDefinition(name="patient", path="ExplanationOfBenefit.patient", description="The reference to the patient", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Patient.class } )
16914  public static final String SP_PATIENT = "patient";
16915 /**
16916   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
16917   * <p>
16918   * Description: <b>The reference to the patient</b><br>
16919   * Type: <b>reference</b><br>
16920   * Path: <b>ExplanationOfBenefit.patient</b><br>
16921   * </p>
16922   */
16923  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
16924
16925/**
16926   * Constant for fluent queries to be used to add include statements. Specifies
16927   * the path value of "<b>ExplanationOfBenefit:patient</b>".
16928   */
16929  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:patient").toLocked();
16930
16931 /**
16932   * Search parameter: <b>payee</b>
16933   * <p>
16934   * Description: <b>The party receiving any payment for the Claim</b><br>
16935   * Type: <b>reference</b><br>
16936   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
16937   * </p>
16938   */
16939  @SearchParamDefinition(name="payee", path="ExplanationOfBenefit.payee.party", description="The party receiving any payment for the Claim", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for RelatedPerson") }, target={Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
16940  public static final String SP_PAYEE = "payee";
16941 /**
16942   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
16943   * <p>
16944   * Description: <b>The party receiving any payment for the Claim</b><br>
16945   * Type: <b>reference</b><br>
16946   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
16947   * </p>
16948   */
16949  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PAYEE);
16950
16951/**
16952   * Constant for fluent queries to be used to add include statements. Specifies
16953   * the path value of "<b>ExplanationOfBenefit:payee</b>".
16954   */
16955  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:payee").toLocked();
16956
16957 /**
16958   * Search parameter: <b>procedure-udi</b>
16959   * <p>
16960   * Description: <b>UDI associated with a procedure</b><br>
16961   * Type: <b>reference</b><br>
16962   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
16963   * </p>
16964   */
16965  @SearchParamDefinition(name="procedure-udi", path="ExplanationOfBenefit.procedure.udi", description="UDI associated with a procedure", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Device") }, target={Device.class } )
16966  public static final String SP_PROCEDURE_UDI = "procedure-udi";
16967 /**
16968   * <b>Fluent Client</b> search parameter constant for <b>procedure-udi</b>
16969   * <p>
16970   * Description: <b>UDI associated with a procedure</b><br>
16971   * Type: <b>reference</b><br>
16972   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
16973   * </p>
16974   */
16975  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROCEDURE_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROCEDURE_UDI);
16976
16977/**
16978   * Constant for fluent queries to be used to add include statements. Specifies
16979   * the path value of "<b>ExplanationOfBenefit:procedure-udi</b>".
16980   */
16981  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROCEDURE_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:procedure-udi").toLocked();
16982
16983 /**
16984   * Search parameter: <b>provider</b>
16985   * <p>
16986   * Description: <b>The reference to the provider</b><br>
16987   * Type: <b>reference</b><br>
16988   * Path: <b>ExplanationOfBenefit.provider</b><br>
16989   * </p>
16990   */
16991  @SearchParamDefinition(name="provider", path="ExplanationOfBenefit.provider", description="The reference to the provider", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner") }, target={Organization.class, Practitioner.class, PractitionerRole.class } )
16992  public static final String SP_PROVIDER = "provider";
16993 /**
16994   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
16995   * <p>
16996   * Description: <b>The reference to the provider</b><br>
16997   * Type: <b>reference</b><br>
16998   * Path: <b>ExplanationOfBenefit.provider</b><br>
16999   * </p>
17000   */
17001  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
17002
17003/**
17004   * Constant for fluent queries to be used to add include statements. Specifies
17005   * the path value of "<b>ExplanationOfBenefit:provider</b>".
17006   */
17007  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:provider").toLocked();
17008
17009 /**
17010   * Search parameter: <b>status</b>
17011   * <p>
17012   * Description: <b>Status of the instance</b><br>
17013   * Type: <b>token</b><br>
17014   * Path: <b>ExplanationOfBenefit.status</b><br>
17015   * </p>
17016   */
17017  @SearchParamDefinition(name="status", path="ExplanationOfBenefit.status", description="Status of the instance", type="token" )
17018  public static final String SP_STATUS = "status";
17019 /**
17020   * <b>Fluent Client</b> search parameter constant for <b>status</b>
17021   * <p>
17022   * Description: <b>Status of the instance</b><br>
17023   * Type: <b>token</b><br>
17024   * Path: <b>ExplanationOfBenefit.status</b><br>
17025   * </p>
17026   */
17027  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
17028
17029 /**
17030   * Search parameter: <b>subdetail-udi</b>
17031   * <p>
17032   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
17033   * Type: <b>reference</b><br>
17034   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
17035   * </p>
17036   */
17037  @SearchParamDefinition(name="subdetail-udi", path="ExplanationOfBenefit.item.detail.subDetail.udi", description="UDI associated with a line item detail subdetail product or service", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Device") }, target={Device.class } )
17038  public static final String SP_SUBDETAIL_UDI = "subdetail-udi";
17039 /**
17040   * <b>Fluent Client</b> search parameter constant for <b>subdetail-udi</b>
17041   * <p>
17042   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
17043   * Type: <b>reference</b><br>
17044   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
17045   * </p>
17046   */
17047  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBDETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBDETAIL_UDI);
17048
17049/**
17050   * Constant for fluent queries to be used to add include statements. Specifies
17051   * the path value of "<b>ExplanationOfBenefit:subdetail-udi</b>".
17052   */
17053  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBDETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:subdetail-udi").toLocked();
17054
17055
17056}