001package org.hl7.fhir.r4b.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 Fri, Dec 31, 2021 05:58+1100 for FHIR v4.3.0-snapshot1
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.r4b.model.Enumerations.*;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.exceptions.FHIRException;
042import org.hl7.fhir.instance.model.api.ICompositeType;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
046import ca.uhn.fhir.model.api.annotation.Child;
047import ca.uhn.fhir.model.api.annotation.ChildOrder;
048import ca.uhn.fhir.model.api.annotation.Description;
049import ca.uhn.fhir.model.api.annotation.Block;
050
051/**
052 * This resource provides: the claim details; adjudication details from the processing of a Claim; and optionally account balance information, for informing the subscriber of the benefits provided.
053 */
054@ResourceDef(name="ExplanationOfBenefit", profile="http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit")
055public class ExplanationOfBenefit extends DomainResource {
056
057    public enum ExplanationOfBenefitStatus {
058        /**
059         * The resource instance is currently in-force.
060         */
061        ACTIVE, 
062        /**
063         * The resource instance is withdrawn, rescinded or reversed.
064         */
065        CANCELLED, 
066        /**
067         * A new resource instance the contents of which is not complete.
068         */
069        DRAFT, 
070        /**
071         * The resource instance was entered in error.
072         */
073        ENTEREDINERROR, 
074        /**
075         * added to help the parsers with the generic types
076         */
077        NULL;
078        public static ExplanationOfBenefitStatus fromCode(String codeString) throws FHIRException {
079            if (codeString == null || "".equals(codeString))
080                return null;
081        if ("active".equals(codeString))
082          return ACTIVE;
083        if ("cancelled".equals(codeString))
084          return CANCELLED;
085        if ("draft".equals(codeString))
086          return DRAFT;
087        if ("entered-in-error".equals(codeString))
088          return ENTEREDINERROR;
089        if (Configuration.isAcceptInvalidEnums())
090          return null;
091        else
092          throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
093        }
094        public String toCode() {
095          switch (this) {
096            case ACTIVE: return "active";
097            case CANCELLED: return "cancelled";
098            case DRAFT: return "draft";
099            case ENTEREDINERROR: return "entered-in-error";
100            case NULL: return null;
101            default: return "?";
102          }
103        }
104        public String getSystem() {
105          switch (this) {
106            case ACTIVE: return "http://hl7.org/fhir/explanationofbenefit-status";
107            case CANCELLED: return "http://hl7.org/fhir/explanationofbenefit-status";
108            case DRAFT: return "http://hl7.org/fhir/explanationofbenefit-status";
109            case ENTEREDINERROR: return "http://hl7.org/fhir/explanationofbenefit-status";
110            case NULL: return null;
111            default: return "?";
112          }
113        }
114        public String getDefinition() {
115          switch (this) {
116            case ACTIVE: return "The resource instance is currently in-force.";
117            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
118            case DRAFT: return "A new resource instance the contents of which is not complete.";
119            case ENTEREDINERROR: return "The resource instance was entered in error.";
120            case NULL: return null;
121            default: return "?";
122          }
123        }
124        public String getDisplay() {
125          switch (this) {
126            case ACTIVE: return "Active";
127            case CANCELLED: return "Cancelled";
128            case DRAFT: return "Draft";
129            case ENTEREDINERROR: return "Entered In Error";
130            case NULL: return null;
131            default: return "?";
132          }
133        }
134    }
135
136  public static class ExplanationOfBenefitStatusEnumFactory implements EnumFactory<ExplanationOfBenefitStatus> {
137    public ExplanationOfBenefitStatus fromCode(String codeString) throws IllegalArgumentException {
138      if (codeString == null || "".equals(codeString))
139            if (codeString == null || "".equals(codeString))
140                return null;
141        if ("active".equals(codeString))
142          return ExplanationOfBenefitStatus.ACTIVE;
143        if ("cancelled".equals(codeString))
144          return ExplanationOfBenefitStatus.CANCELLED;
145        if ("draft".equals(codeString))
146          return ExplanationOfBenefitStatus.DRAFT;
147        if ("entered-in-error".equals(codeString))
148          return ExplanationOfBenefitStatus.ENTEREDINERROR;
149        throw new IllegalArgumentException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
150        }
151        public Enumeration<ExplanationOfBenefitStatus> fromType(Base code) throws FHIRException {
152          if (code == null)
153            return null;
154          if (code.isEmpty())
155            return new Enumeration<ExplanationOfBenefitStatus>(this);
156          String codeString = ((PrimitiveType) code).asStringValue();
157          if (codeString == null || "".equals(codeString))
158            return null;
159        if ("active".equals(codeString))
160          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ACTIVE);
161        if ("cancelled".equals(codeString))
162          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.CANCELLED);
163        if ("draft".equals(codeString))
164          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.DRAFT);
165        if ("entered-in-error".equals(codeString))
166          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ENTEREDINERROR);
167        throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
168        }
169    public String toCode(ExplanationOfBenefitStatus code) {
170      if (code == ExplanationOfBenefitStatus.ACTIVE)
171        return "active";
172      if (code == ExplanationOfBenefitStatus.CANCELLED)
173        return "cancelled";
174      if (code == ExplanationOfBenefitStatus.DRAFT)
175        return "draft";
176      if (code == ExplanationOfBenefitStatus.ENTEREDINERROR)
177        return "entered-in-error";
178      return "?";
179      }
180    public String toSystem(ExplanationOfBenefitStatus code) {
181      return code.getSystem();
182      }
183    }
184
185    @Block()
186    public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
187        /**
188         * Reference to a related claim.
189         */
190        @Child(name = "claim", type = {Claim.class}, order=1, min=0, max=1, modifier=false, summary=false)
191        @Description(shortDefinition="Reference to the related claim", formalDefinition="Reference to a related claim." )
192        protected Reference claim;
193
194        /**
195         * A code to convey how the claims are related.
196         */
197        @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
198        @Description(shortDefinition="How the reference claim is related", formalDefinition="A code to convey how the claims are related." )
199        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-claim-relationship")
200        protected CodeableConcept relationship;
201
202        /**
203         * An alternate organizational reference to the case or file to which this particular claim pertains.
204         */
205        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=false)
206        @Description(shortDefinition="File or case reference", formalDefinition="An alternate organizational reference to the case or file to which this particular claim pertains." )
207        protected Identifier reference;
208
209        private static final long serialVersionUID = 1047077926L;
210
211    /**
212     * Constructor
213     */
214      public RelatedClaimComponent() {
215        super();
216      }
217
218        /**
219         * @return {@link #claim} (Reference to a related claim.)
220         */
221        public Reference getClaim() { 
222          if (this.claim == null)
223            if (Configuration.errorOnAutoCreate())
224              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
225            else if (Configuration.doAutoCreate())
226              this.claim = new Reference(); // cc
227          return this.claim;
228        }
229
230        public boolean hasClaim() { 
231          return this.claim != null && !this.claim.isEmpty();
232        }
233
234        /**
235         * @param value {@link #claim} (Reference to a related claim.)
236         */
237        public RelatedClaimComponent setClaim(Reference value) { 
238          this.claim = value;
239          return this;
240        }
241
242        /**
243         * @return {@link #relationship} (A code to convey how the claims are related.)
244         */
245        public CodeableConcept getRelationship() { 
246          if (this.relationship == null)
247            if (Configuration.errorOnAutoCreate())
248              throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
249            else if (Configuration.doAutoCreate())
250              this.relationship = new CodeableConcept(); // cc
251          return this.relationship;
252        }
253
254        public boolean hasRelationship() { 
255          return this.relationship != null && !this.relationship.isEmpty();
256        }
257
258        /**
259         * @param value {@link #relationship} (A code to convey how the claims are related.)
260         */
261        public RelatedClaimComponent setRelationship(CodeableConcept value) { 
262          this.relationship = value;
263          return this;
264        }
265
266        /**
267         * @return {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
268         */
269        public Identifier getReference() { 
270          if (this.reference == null)
271            if (Configuration.errorOnAutoCreate())
272              throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
273            else if (Configuration.doAutoCreate())
274              this.reference = new Identifier(); // cc
275          return this.reference;
276        }
277
278        public boolean hasReference() { 
279          return this.reference != null && !this.reference.isEmpty();
280        }
281
282        /**
283         * @param value {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
284         */
285        public RelatedClaimComponent setReference(Identifier value) { 
286          this.reference = value;
287          return this;
288        }
289
290        protected void listChildren(List<Property> children) {
291          super.listChildren(children);
292          children.add(new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim));
293          children.add(new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship));
294          children.add(new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1, reference));
295        }
296
297        @Override
298        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
299          switch (_hash) {
300          case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim);
301          case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship);
302          case -925155509: /*reference*/  return new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1, reference);
303          default: return super.getNamedProperty(_hash, _name, _checkValid);
304          }
305
306        }
307
308      @Override
309      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
310        switch (hash) {
311        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
312        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
313        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
314        default: return super.getProperty(hash, name, checkValid);
315        }
316
317      }
318
319      @Override
320      public Base setProperty(int hash, String name, Base value) throws FHIRException {
321        switch (hash) {
322        case 94742588: // claim
323          this.claim = TypeConvertor.castToReference(value); // Reference
324          return value;
325        case -261851592: // relationship
326          this.relationship = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
327          return value;
328        case -925155509: // reference
329          this.reference = TypeConvertor.castToIdentifier(value); // Identifier
330          return value;
331        default: return super.setProperty(hash, name, value);
332        }
333
334      }
335
336      @Override
337      public Base setProperty(String name, Base value) throws FHIRException {
338        if (name.equals("claim")) {
339          this.claim = TypeConvertor.castToReference(value); // Reference
340        } else if (name.equals("relationship")) {
341          this.relationship = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
342        } else if (name.equals("reference")) {
343          this.reference = TypeConvertor.castToIdentifier(value); // Identifier
344        } else
345          return super.setProperty(name, value);
346        return value;
347      }
348
349      @Override
350      public Base makeProperty(int hash, String name) throws FHIRException {
351        switch (hash) {
352        case 94742588:  return getClaim();
353        case -261851592:  return getRelationship();
354        case -925155509:  return getReference();
355        default: return super.makeProperty(hash, name);
356        }
357
358      }
359
360      @Override
361      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
362        switch (hash) {
363        case 94742588: /*claim*/ return new String[] {"Reference"};
364        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
365        case -925155509: /*reference*/ return new String[] {"Identifier"};
366        default: return super.getTypesForProperty(hash, name);
367        }
368
369      }
370
371      @Override
372      public Base addChild(String name) throws FHIRException {
373        if (name.equals("claim")) {
374          this.claim = new Reference();
375          return this.claim;
376        }
377        else if (name.equals("relationship")) {
378          this.relationship = new CodeableConcept();
379          return this.relationship;
380        }
381        else if (name.equals("reference")) {
382          this.reference = new Identifier();
383          return this.reference;
384        }
385        else
386          return super.addChild(name);
387      }
388
389      public RelatedClaimComponent copy() {
390        RelatedClaimComponent dst = new RelatedClaimComponent();
391        copyValues(dst);
392        return dst;
393      }
394
395      public void copyValues(RelatedClaimComponent dst) {
396        super.copyValues(dst);
397        dst.claim = claim == null ? null : claim.copy();
398        dst.relationship = relationship == null ? null : relationship.copy();
399        dst.reference = reference == null ? null : reference.copy();
400      }
401
402      @Override
403      public boolean equalsDeep(Base other_) {
404        if (!super.equalsDeep(other_))
405          return false;
406        if (!(other_ instanceof RelatedClaimComponent))
407          return false;
408        RelatedClaimComponent o = (RelatedClaimComponent) other_;
409        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
410          ;
411      }
412
413      @Override
414      public boolean equalsShallow(Base other_) {
415        if (!super.equalsShallow(other_))
416          return false;
417        if (!(other_ instanceof RelatedClaimComponent))
418          return false;
419        RelatedClaimComponent o = (RelatedClaimComponent) other_;
420        return true;
421      }
422
423      public boolean isEmpty() {
424        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference
425          );
426      }
427
428  public String fhirType() {
429    return "ExplanationOfBenefit.related";
430
431  }
432
433  }
434
435    @Block()
436    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
437        /**
438         * Type of Party to be reimbursed: Subscriber, provider, other.
439         */
440        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
441        @Description(shortDefinition="Category of recipient", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
442        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payeetype")
443        protected CodeableConcept type;
444
445        /**
446         * Reference to the individual or organization to whom any payment will be made.
447         */
448        @Child(name = "party", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, RelatedPerson.class}, order=2, min=0, max=1, modifier=false, summary=false)
449        @Description(shortDefinition="Recipient reference", formalDefinition="Reference to the individual or organization to whom any payment will be made." )
450        protected Reference party;
451
452        private static final long serialVersionUID = -1948897146L;
453
454    /**
455     * Constructor
456     */
457      public PayeeComponent() {
458        super();
459      }
460
461        /**
462         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
463         */
464        public CodeableConcept getType() { 
465          if (this.type == null)
466            if (Configuration.errorOnAutoCreate())
467              throw new Error("Attempt to auto-create PayeeComponent.type");
468            else if (Configuration.doAutoCreate())
469              this.type = new CodeableConcept(); // cc
470          return this.type;
471        }
472
473        public boolean hasType() { 
474          return this.type != null && !this.type.isEmpty();
475        }
476
477        /**
478         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
479         */
480        public PayeeComponent setType(CodeableConcept value) { 
481          this.type = value;
482          return this;
483        }
484
485        /**
486         * @return {@link #party} (Reference to the individual or organization to whom any payment will be made.)
487         */
488        public Reference getParty() { 
489          if (this.party == null)
490            if (Configuration.errorOnAutoCreate())
491              throw new Error("Attempt to auto-create PayeeComponent.party");
492            else if (Configuration.doAutoCreate())
493              this.party = new Reference(); // cc
494          return this.party;
495        }
496
497        public boolean hasParty() { 
498          return this.party != null && !this.party.isEmpty();
499        }
500
501        /**
502         * @param value {@link #party} (Reference to the individual or organization to whom any payment will be made.)
503         */
504        public PayeeComponent setParty(Reference value) { 
505          this.party = value;
506          return this;
507        }
508
509        protected void listChildren(List<Property> children) {
510          super.listChildren(children);
511          children.add(new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
512          children.add(new Property("party", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)", "Reference to the individual or organization to whom any payment will be made.", 0, 1, party));
513        }
514
515        @Override
516        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
517          switch (_hash) {
518          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
519          case 106437350: /*party*/  return new Property("party", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)", "Reference to the individual or organization to whom any payment will be made.", 0, 1, party);
520          default: return super.getNamedProperty(_hash, _name, _checkValid);
521          }
522
523        }
524
525      @Override
526      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
527        switch (hash) {
528        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
529        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
530        default: return super.getProperty(hash, name, checkValid);
531        }
532
533      }
534
535      @Override
536      public Base setProperty(int hash, String name, Base value) throws FHIRException {
537        switch (hash) {
538        case 3575610: // type
539          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
540          return value;
541        case 106437350: // party
542          this.party = TypeConvertor.castToReference(value); // Reference
543          return value;
544        default: return super.setProperty(hash, name, value);
545        }
546
547      }
548
549      @Override
550      public Base setProperty(String name, Base value) throws FHIRException {
551        if (name.equals("type")) {
552          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
553        } else if (name.equals("party")) {
554          this.party = TypeConvertor.castToReference(value); // Reference
555        } else
556          return super.setProperty(name, value);
557        return value;
558      }
559
560      @Override
561      public Base makeProperty(int hash, String name) throws FHIRException {
562        switch (hash) {
563        case 3575610:  return getType();
564        case 106437350:  return getParty();
565        default: return super.makeProperty(hash, name);
566        }
567
568      }
569
570      @Override
571      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
572        switch (hash) {
573        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
574        case 106437350: /*party*/ return new String[] {"Reference"};
575        default: return super.getTypesForProperty(hash, name);
576        }
577
578      }
579
580      @Override
581      public Base addChild(String name) throws FHIRException {
582        if (name.equals("type")) {
583          this.type = new CodeableConcept();
584          return this.type;
585        }
586        else if (name.equals("party")) {
587          this.party = new Reference();
588          return this.party;
589        }
590        else
591          return super.addChild(name);
592      }
593
594      public PayeeComponent copy() {
595        PayeeComponent dst = new PayeeComponent();
596        copyValues(dst);
597        return dst;
598      }
599
600      public void copyValues(PayeeComponent dst) {
601        super.copyValues(dst);
602        dst.type = type == null ? null : type.copy();
603        dst.party = party == null ? null : party.copy();
604      }
605
606      @Override
607      public boolean equalsDeep(Base other_) {
608        if (!super.equalsDeep(other_))
609          return false;
610        if (!(other_ instanceof PayeeComponent))
611          return false;
612        PayeeComponent o = (PayeeComponent) other_;
613        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true);
614      }
615
616      @Override
617      public boolean equalsShallow(Base other_) {
618        if (!super.equalsShallow(other_))
619          return false;
620        if (!(other_ instanceof PayeeComponent))
621          return false;
622        PayeeComponent o = (PayeeComponent) other_;
623        return true;
624      }
625
626      public boolean isEmpty() {
627        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party);
628      }
629
630  public String fhirType() {
631    return "ExplanationOfBenefit.payee";
632
633  }
634
635  }
636
637    @Block()
638    public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
639        /**
640         * A number to uniquely identify care team entries.
641         */
642        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
643        @Description(shortDefinition="Order of care team", formalDefinition="A number to uniquely identify care team entries." )
644        protected PositiveIntType sequence;
645
646        /**
647         * Member of the team who provided the product or service.
648         */
649        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=false)
650        @Description(shortDefinition="Practitioner or organization", formalDefinition="Member of the team who provided the product or service." )
651        protected Reference provider;
652
653        /**
654         * The party who is billing and/or responsible for the claimed products or services.
655         */
656        @Child(name = "responsible", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
657        @Description(shortDefinition="Indicator of the lead practitioner", formalDefinition="The party who is billing and/or responsible for the claimed products or services." )
658        protected BooleanType responsible;
659
660        /**
661         * The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.
662         */
663        @Child(name = "role", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
664        @Description(shortDefinition="Function within the team", formalDefinition="The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team." )
665        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-careteamrole")
666        protected CodeableConcept role;
667
668        /**
669         * The qualification of the practitioner which is applicable for this service.
670         */
671        @Child(name = "qualification", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
672        @Description(shortDefinition="Practitioner credential or specialization", formalDefinition="The qualification of the practitioner 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 qualification;
675
676        private static final long serialVersionUID = 1479624238L;
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 #qualification} (The qualification of the practitioner which is applicable for this service.)
834         */
835        public CodeableConcept getQualification() { 
836          if (this.qualification == null)
837            if (Configuration.errorOnAutoCreate())
838              throw new Error("Attempt to auto-create CareTeamComponent.qualification");
839            else if (Configuration.doAutoCreate())
840              this.qualification = new CodeableConcept(); // cc
841          return this.qualification;
842        }
843
844        public boolean hasQualification() { 
845          return this.qualification != null && !this.qualification.isEmpty();
846        }
847
848        /**
849         * @param value {@link #qualification} (The qualification of the practitioner which is applicable for this service.)
850         */
851        public CareTeamComponent setQualification(CodeableConcept value) { 
852          this.qualification = 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("qualification", "CodeableConcept", "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification));
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 -631333393: /*qualification*/  return new Property("qualification", "CodeableConcept", "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification);
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 -631333393: /*qualification*/ return this.qualification == null ? new Base[0] : new Base[] {this.qualification}; // 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 -631333393: // qualification
907          this.qualification = 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("qualification")) {
925          this.qualification = 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 -631333393:  return getQualification();
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 -631333393: /*qualification*/ 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("qualification")) {
974          this.qualification = new CodeableConcept();
975          return this.qualification;
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.qualification = qualification == null ? null : qualification.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(qualification, o.qualification, 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, qualification);
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}, 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        public boolean hasValue() { 
1322          return this.value != null && !this.value.isEmpty();
1323        }
1324
1325        /**
1326         * @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.)
1327         */
1328        public SupportingInformationComponent setValue(DataType value) { 
1329          if (value != null && !(value instanceof BooleanType || value instanceof StringType || value instanceof Quantity || value instanceof Attachment || value instanceof Reference))
1330            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.value[x]: "+value.fhirType());
1331          this.value = value;
1332          return this;
1333        }
1334
1335        /**
1336         * @return {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1337         */
1338        public Coding getReason() { 
1339          if (this.reason == null)
1340            if (Configuration.errorOnAutoCreate())
1341              throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1342            else if (Configuration.doAutoCreate())
1343              this.reason = new Coding(); // cc
1344          return this.reason;
1345        }
1346
1347        public boolean hasReason() { 
1348          return this.reason != null && !this.reason.isEmpty();
1349        }
1350
1351        /**
1352         * @param value {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1353         */
1354        public SupportingInformationComponent setReason(Coding value) { 
1355          this.reason = value;
1356          return this;
1357        }
1358
1359        protected void listChildren(List<Property> children) {
1360          super.listChildren(children);
1361          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence));
1362          children.add(new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category));
1363          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));
1364          children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing));
1365          children.add(new Property("value[x]", "boolean|string|Quantity|Attachment|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));
1366          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));
1367        }
1368
1369        @Override
1370        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1371          switch (_hash) {
1372          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence);
1373          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category);
1374          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);
1375          case 164632566: /*timing[x]*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1376          case -873664438: /*timing*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1377          case 807935768: /*timingDate*/  return new Property("timing[x]", "date", "The date when or period to which this information refers.", 0, 1, timing);
1378          case -615615829: /*timingPeriod*/  return new Property("timing[x]", "Period", "The date when or period to which this information refers.", 0, 1, timing);
1379          case -1410166417: /*value[x]*/  return new Property("value[x]", "boolean|string|Quantity|Attachment|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);
1380          case 111972721: /*value*/  return new Property("value[x]", "boolean|string|Quantity|Attachment|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);
1381          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);
1382          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);
1383          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);
1384          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);
1385          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);
1386          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);
1387          default: return super.getNamedProperty(_hash, _name, _checkValid);
1388          }
1389
1390        }
1391
1392      @Override
1393      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1394        switch (hash) {
1395        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1396        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1397        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1398        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // DataType
1399        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
1400        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
1401        default: return super.getProperty(hash, name, checkValid);
1402        }
1403
1404      }
1405
1406      @Override
1407      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1408        switch (hash) {
1409        case 1349547969: // sequence
1410          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1411          return value;
1412        case 50511102: // category
1413          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1414          return value;
1415        case 3059181: // code
1416          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1417          return value;
1418        case -873664438: // timing
1419          this.timing = TypeConvertor.castToType(value); // DataType
1420          return value;
1421        case 111972721: // value
1422          this.value = TypeConvertor.castToType(value); // DataType
1423          return value;
1424        case -934964668: // reason
1425          this.reason = TypeConvertor.castToCoding(value); // Coding
1426          return value;
1427        default: return super.setProperty(hash, name, value);
1428        }
1429
1430      }
1431
1432      @Override
1433      public Base setProperty(String name, Base value) throws FHIRException {
1434        if (name.equals("sequence")) {
1435          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1436        } else if (name.equals("category")) {
1437          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1438        } else if (name.equals("code")) {
1439          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1440        } else if (name.equals("timing[x]")) {
1441          this.timing = TypeConvertor.castToType(value); // DataType
1442        } else if (name.equals("value[x]")) {
1443          this.value = TypeConvertor.castToType(value); // DataType
1444        } else if (name.equals("reason")) {
1445          this.reason = TypeConvertor.castToCoding(value); // Coding
1446        } else
1447          return super.setProperty(name, value);
1448        return value;
1449      }
1450
1451      @Override
1452      public Base makeProperty(int hash, String name) throws FHIRException {
1453        switch (hash) {
1454        case 1349547969:  return getSequenceElement();
1455        case 50511102:  return getCategory();
1456        case 3059181:  return getCode();
1457        case 164632566:  return getTiming();
1458        case -873664438:  return getTiming();
1459        case -1410166417:  return getValue();
1460        case 111972721:  return getValue();
1461        case -934964668:  return getReason();
1462        default: return super.makeProperty(hash, name);
1463        }
1464
1465      }
1466
1467      @Override
1468      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1469        switch (hash) {
1470        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1471        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1472        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1473        case -873664438: /*timing*/ return new String[] {"date", "Period"};
1474        case 111972721: /*value*/ return new String[] {"boolean", "string", "Quantity", "Attachment", "Reference"};
1475        case -934964668: /*reason*/ return new String[] {"Coding"};
1476        default: return super.getTypesForProperty(hash, name);
1477        }
1478
1479      }
1480
1481      @Override
1482      public Base addChild(String name) throws FHIRException {
1483        if (name.equals("sequence")) {
1484          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.supportingInfo.sequence");
1485        }
1486        else if (name.equals("category")) {
1487          this.category = new CodeableConcept();
1488          return this.category;
1489        }
1490        else if (name.equals("code")) {
1491          this.code = new CodeableConcept();
1492          return this.code;
1493        }
1494        else if (name.equals("timingDate")) {
1495          this.timing = new DateType();
1496          return this.timing;
1497        }
1498        else if (name.equals("timingPeriod")) {
1499          this.timing = new Period();
1500          return this.timing;
1501        }
1502        else if (name.equals("valueBoolean")) {
1503          this.value = new BooleanType();
1504          return this.value;
1505        }
1506        else if (name.equals("valueString")) {
1507          this.value = new StringType();
1508          return this.value;
1509        }
1510        else if (name.equals("valueQuantity")) {
1511          this.value = new Quantity();
1512          return this.value;
1513        }
1514        else if (name.equals("valueAttachment")) {
1515          this.value = new Attachment();
1516          return this.value;
1517        }
1518        else if (name.equals("valueReference")) {
1519          this.value = new Reference();
1520          return this.value;
1521        }
1522        else if (name.equals("reason")) {
1523          this.reason = new Coding();
1524          return this.reason;
1525        }
1526        else
1527          return super.addChild(name);
1528      }
1529
1530      public SupportingInformationComponent copy() {
1531        SupportingInformationComponent dst = new SupportingInformationComponent();
1532        copyValues(dst);
1533        return dst;
1534      }
1535
1536      public void copyValues(SupportingInformationComponent dst) {
1537        super.copyValues(dst);
1538        dst.sequence = sequence == null ? null : sequence.copy();
1539        dst.category = category == null ? null : category.copy();
1540        dst.code = code == null ? null : code.copy();
1541        dst.timing = timing == null ? null : timing.copy();
1542        dst.value = value == null ? null : value.copy();
1543        dst.reason = reason == null ? null : reason.copy();
1544      }
1545
1546      @Override
1547      public boolean equalsDeep(Base other_) {
1548        if (!super.equalsDeep(other_))
1549          return false;
1550        if (!(other_ instanceof SupportingInformationComponent))
1551          return false;
1552        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1553        return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true) && compareDeep(code, o.code, true)
1554           && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true) && compareDeep(reason, o.reason, true)
1555          ;
1556      }
1557
1558      @Override
1559      public boolean equalsShallow(Base other_) {
1560        if (!super.equalsShallow(other_))
1561          return false;
1562        if (!(other_ instanceof SupportingInformationComponent))
1563          return false;
1564        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1565        return compareValues(sequence, o.sequence, true);
1566      }
1567
1568      public boolean isEmpty() {
1569        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code
1570          , timing, value, reason);
1571      }
1572
1573  public String fhirType() {
1574    return "ExplanationOfBenefit.supportingInfo";
1575
1576  }
1577
1578  }
1579
1580    @Block()
1581    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1582        /**
1583         * A number to uniquely identify diagnosis entries.
1584         */
1585        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1586        @Description(shortDefinition="Diagnosis instance identifier", formalDefinition="A number to uniquely identify diagnosis entries." )
1587        protected PositiveIntType sequence;
1588
1589        /**
1590         * The nature of illness or problem in a coded form or as a reference to an external defined Condition.
1591         */
1592        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=2, min=1, max=1, modifier=false, summary=false)
1593        @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." )
1594        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
1595        protected DataType diagnosis;
1596
1597        /**
1598         * When the condition was observed or the relative ranking.
1599         */
1600        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1601        @Description(shortDefinition="Timing or nature of the diagnosis", formalDefinition="When the condition was observed or the relative ranking." )
1602        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosistype")
1603        protected List<CodeableConcept> type;
1604
1605        /**
1606         * Indication of whether the diagnosis was present on admission to a facility.
1607         */
1608        @Child(name = "onAdmission", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1609        @Description(shortDefinition="Present on admission", formalDefinition="Indication of whether the diagnosis was present on admission to a facility." )
1610        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission")
1611        protected CodeableConcept onAdmission;
1612
1613        /**
1614         * 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.
1615         */
1616        @Child(name = "packageCode", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1617        @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." )
1618        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
1619        protected CodeableConcept packageCode;
1620
1621        private static final long serialVersionUID = 550515328L;
1622
1623    /**
1624     * Constructor
1625     */
1626      public DiagnosisComponent() {
1627        super();
1628      }
1629
1630    /**
1631     * Constructor
1632     */
1633      public DiagnosisComponent(int sequence, DataType diagnosis) {
1634        super();
1635        this.setSequence(sequence);
1636        this.setDiagnosis(diagnosis);
1637      }
1638
1639        /**
1640         * @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
1641         */
1642        public PositiveIntType getSequenceElement() { 
1643          if (this.sequence == null)
1644            if (Configuration.errorOnAutoCreate())
1645              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
1646            else if (Configuration.doAutoCreate())
1647              this.sequence = new PositiveIntType(); // bb
1648          return this.sequence;
1649        }
1650
1651        public boolean hasSequenceElement() { 
1652          return this.sequence != null && !this.sequence.isEmpty();
1653        }
1654
1655        public boolean hasSequence() { 
1656          return this.sequence != null && !this.sequence.isEmpty();
1657        }
1658
1659        /**
1660         * @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
1661         */
1662        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
1663          this.sequence = value;
1664          return this;
1665        }
1666
1667        /**
1668         * @return A number to uniquely identify diagnosis entries.
1669         */
1670        public int getSequence() { 
1671          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1672        }
1673
1674        /**
1675         * @param value A number to uniquely identify diagnosis entries.
1676         */
1677        public DiagnosisComponent setSequence(int value) { 
1678            if (this.sequence == null)
1679              this.sequence = new PositiveIntType();
1680            this.sequence.setValue(value);
1681          return this;
1682        }
1683
1684        /**
1685         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1686         */
1687        public DataType getDiagnosis() { 
1688          return this.diagnosis;
1689        }
1690
1691        /**
1692         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1693         */
1694        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
1695          if (this.diagnosis == null)
1696            this.diagnosis = new CodeableConcept();
1697          if (!(this.diagnosis instanceof CodeableConcept))
1698            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1699          return (CodeableConcept) this.diagnosis;
1700        }
1701
1702        public boolean hasDiagnosisCodeableConcept() { 
1703          return this != null && this.diagnosis instanceof CodeableConcept;
1704        }
1705
1706        /**
1707         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1708         */
1709        public Reference getDiagnosisReference() throws FHIRException { 
1710          if (this.diagnosis == null)
1711            this.diagnosis = new Reference();
1712          if (!(this.diagnosis instanceof Reference))
1713            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1714          return (Reference) this.diagnosis;
1715        }
1716
1717        public boolean hasDiagnosisReference() { 
1718          return this != null && this.diagnosis instanceof Reference;
1719        }
1720
1721        public boolean hasDiagnosis() { 
1722          return this.diagnosis != null && !this.diagnosis.isEmpty();
1723        }
1724
1725        /**
1726         * @param value {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1727         */
1728        public DiagnosisComponent setDiagnosis(DataType value) { 
1729          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1730            throw new Error("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: "+value.fhirType());
1731          this.diagnosis = value;
1732          return this;
1733        }
1734
1735        /**
1736         * @return {@link #type} (When the condition was observed or the relative ranking.)
1737         */
1738        public List<CodeableConcept> getType() { 
1739          if (this.type == null)
1740            this.type = new ArrayList<CodeableConcept>();
1741          return this.type;
1742        }
1743
1744        /**
1745         * @return Returns a reference to <code>this</code> for easy method chaining
1746         */
1747        public DiagnosisComponent setType(List<CodeableConcept> theType) { 
1748          this.type = theType;
1749          return this;
1750        }
1751
1752        public boolean hasType() { 
1753          if (this.type == null)
1754            return false;
1755          for (CodeableConcept item : this.type)
1756            if (!item.isEmpty())
1757              return true;
1758          return false;
1759        }
1760
1761        public CodeableConcept addType() { //3
1762          CodeableConcept t = new CodeableConcept();
1763          if (this.type == null)
1764            this.type = new ArrayList<CodeableConcept>();
1765          this.type.add(t);
1766          return t;
1767        }
1768
1769        public DiagnosisComponent addType(CodeableConcept t) { //3
1770          if (t == null)
1771            return this;
1772          if (this.type == null)
1773            this.type = new ArrayList<CodeableConcept>();
1774          this.type.add(t);
1775          return this;
1776        }
1777
1778        /**
1779         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
1780         */
1781        public CodeableConcept getTypeFirstRep() { 
1782          if (getType().isEmpty()) {
1783            addType();
1784          }
1785          return getType().get(0);
1786        }
1787
1788        /**
1789         * @return {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
1790         */
1791        public CodeableConcept getOnAdmission() { 
1792          if (this.onAdmission == null)
1793            if (Configuration.errorOnAutoCreate())
1794              throw new Error("Attempt to auto-create DiagnosisComponent.onAdmission");
1795            else if (Configuration.doAutoCreate())
1796              this.onAdmission = new CodeableConcept(); // cc
1797          return this.onAdmission;
1798        }
1799
1800        public boolean hasOnAdmission() { 
1801          return this.onAdmission != null && !this.onAdmission.isEmpty();
1802        }
1803
1804        /**
1805         * @param value {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
1806         */
1807        public DiagnosisComponent setOnAdmission(CodeableConcept value) { 
1808          this.onAdmission = value;
1809          return this;
1810        }
1811
1812        /**
1813         * @return {@link #packageCode} (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.)
1814         */
1815        public CodeableConcept getPackageCode() { 
1816          if (this.packageCode == null)
1817            if (Configuration.errorOnAutoCreate())
1818              throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
1819            else if (Configuration.doAutoCreate())
1820              this.packageCode = new CodeableConcept(); // cc
1821          return this.packageCode;
1822        }
1823
1824        public boolean hasPackageCode() { 
1825          return this.packageCode != null && !this.packageCode.isEmpty();
1826        }
1827
1828        /**
1829         * @param value {@link #packageCode} (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.)
1830         */
1831        public DiagnosisComponent setPackageCode(CodeableConcept value) { 
1832          this.packageCode = value;
1833          return this;
1834        }
1835
1836        protected void listChildren(List<Property> children) {
1837          super.listChildren(children);
1838          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence));
1839          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));
1840          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
1841          children.add(new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission));
1842          children.add(new Property("packageCode", "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, packageCode));
1843        }
1844
1845        @Override
1846        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1847          switch (_hash) {
1848          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence);
1849          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);
1850          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);
1851          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);
1852          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);
1853          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
1854          case -3386134: /*onAdmission*/  return new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission);
1855          case 908444499: /*packageCode*/  return new Property("packageCode", "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, packageCode);
1856          default: return super.getNamedProperty(_hash, _name, _checkValid);
1857          }
1858
1859        }
1860
1861      @Override
1862      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1863        switch (hash) {
1864        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1865        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // DataType
1866        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
1867        case -3386134: /*onAdmission*/ return this.onAdmission == null ? new Base[0] : new Base[] {this.onAdmission}; // CodeableConcept
1868        case 908444499: /*packageCode*/ return this.packageCode == null ? new Base[0] : new Base[] {this.packageCode}; // CodeableConcept
1869        default: return super.getProperty(hash, name, checkValid);
1870        }
1871
1872      }
1873
1874      @Override
1875      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1876        switch (hash) {
1877        case 1349547969: // sequence
1878          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1879          return value;
1880        case 1196993265: // diagnosis
1881          this.diagnosis = TypeConvertor.castToType(value); // DataType
1882          return value;
1883        case 3575610: // type
1884          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1885          return value;
1886        case -3386134: // onAdmission
1887          this.onAdmission = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1888          return value;
1889        case 908444499: // packageCode
1890          this.packageCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1891          return value;
1892        default: return super.setProperty(hash, name, value);
1893        }
1894
1895      }
1896
1897      @Override
1898      public Base setProperty(String name, Base value) throws FHIRException {
1899        if (name.equals("sequence")) {
1900          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1901        } else if (name.equals("diagnosis[x]")) {
1902          this.diagnosis = TypeConvertor.castToType(value); // DataType
1903        } else if (name.equals("type")) {
1904          this.getType().add(TypeConvertor.castToCodeableConcept(value));
1905        } else if (name.equals("onAdmission")) {
1906          this.onAdmission = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1907        } else if (name.equals("packageCode")) {
1908          this.packageCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1909        } else
1910          return super.setProperty(name, value);
1911        return value;
1912      }
1913
1914      @Override
1915      public Base makeProperty(int hash, String name) throws FHIRException {
1916        switch (hash) {
1917        case 1349547969:  return getSequenceElement();
1918        case -1487009809:  return getDiagnosis();
1919        case 1196993265:  return getDiagnosis();
1920        case 3575610:  return addType(); 
1921        case -3386134:  return getOnAdmission();
1922        case 908444499:  return getPackageCode();
1923        default: return super.makeProperty(hash, name);
1924        }
1925
1926      }
1927
1928      @Override
1929      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1930        switch (hash) {
1931        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1932        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
1933        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1934        case -3386134: /*onAdmission*/ return new String[] {"CodeableConcept"};
1935        case 908444499: /*packageCode*/ return new String[] {"CodeableConcept"};
1936        default: return super.getTypesForProperty(hash, name);
1937        }
1938
1939      }
1940
1941      @Override
1942      public Base addChild(String name) throws FHIRException {
1943        if (name.equals("sequence")) {
1944          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.diagnosis.sequence");
1945        }
1946        else if (name.equals("diagnosisCodeableConcept")) {
1947          this.diagnosis = new CodeableConcept();
1948          return this.diagnosis;
1949        }
1950        else if (name.equals("diagnosisReference")) {
1951          this.diagnosis = new Reference();
1952          return this.diagnosis;
1953        }
1954        else if (name.equals("type")) {
1955          return addType();
1956        }
1957        else if (name.equals("onAdmission")) {
1958          this.onAdmission = new CodeableConcept();
1959          return this.onAdmission;
1960        }
1961        else if (name.equals("packageCode")) {
1962          this.packageCode = new CodeableConcept();
1963          return this.packageCode;
1964        }
1965        else
1966          return super.addChild(name);
1967      }
1968
1969      public DiagnosisComponent copy() {
1970        DiagnosisComponent dst = new DiagnosisComponent();
1971        copyValues(dst);
1972        return dst;
1973      }
1974
1975      public void copyValues(DiagnosisComponent dst) {
1976        super.copyValues(dst);
1977        dst.sequence = sequence == null ? null : sequence.copy();
1978        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
1979        if (type != null) {
1980          dst.type = new ArrayList<CodeableConcept>();
1981          for (CodeableConcept i : type)
1982            dst.type.add(i.copy());
1983        };
1984        dst.onAdmission = onAdmission == null ? null : onAdmission.copy();
1985        dst.packageCode = packageCode == null ? null : packageCode.copy();
1986      }
1987
1988      @Override
1989      public boolean equalsDeep(Base other_) {
1990        if (!super.equalsDeep(other_))
1991          return false;
1992        if (!(other_ instanceof DiagnosisComponent))
1993          return false;
1994        DiagnosisComponent o = (DiagnosisComponent) other_;
1995        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(type, o.type, true)
1996           && compareDeep(onAdmission, o.onAdmission, true) && compareDeep(packageCode, o.packageCode, true)
1997          ;
1998      }
1999
2000      @Override
2001      public boolean equalsShallow(Base other_) {
2002        if (!super.equalsShallow(other_))
2003          return false;
2004        if (!(other_ instanceof DiagnosisComponent))
2005          return false;
2006        DiagnosisComponent o = (DiagnosisComponent) other_;
2007        return compareValues(sequence, o.sequence, true);
2008      }
2009
2010      public boolean isEmpty() {
2011        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type
2012          , onAdmission, packageCode);
2013      }
2014
2015  public String fhirType() {
2016    return "ExplanationOfBenefit.diagnosis";
2017
2018  }
2019
2020  }
2021
2022    @Block()
2023    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2024        /**
2025         * A number to uniquely identify procedure entries.
2026         */
2027        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2028        @Description(shortDefinition="Procedure instance identifier", formalDefinition="A number to uniquely identify procedure entries." )
2029        protected PositiveIntType sequence;
2030
2031        /**
2032         * When the condition was observed or the relative ranking.
2033         */
2034        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2035        @Description(shortDefinition="Category of Procedure", formalDefinition="When the condition was observed or the relative ranking." )
2036        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-procedure-type")
2037        protected List<CodeableConcept> type;
2038
2039        /**
2040         * Date and optionally time the procedure was performed.
2041         */
2042        @Child(name = "date", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2043        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed." )
2044        protected DateTimeType date;
2045
2046        /**
2047         * The code or reference to a Procedure resource which identifies the clinical intervention performed.
2048         */
2049        @Child(name = "procedure", type = {CodeableConcept.class, Procedure.class}, order=4, min=1, max=1, modifier=false, summary=false)
2050        @Description(shortDefinition="Specific clinical procedure", formalDefinition="The code or reference to a Procedure resource which identifies the clinical intervention performed." )
2051        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10-procedures")
2052        protected DataType procedure;
2053
2054        /**
2055         * Unique Device Identifiers associated with this line item.
2056         */
2057        @Child(name = "udi", type = {Device.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2058        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
2059        protected List<Reference> udi;
2060
2061        private static final long serialVersionUID = 1165684715L;
2062
2063    /**
2064     * Constructor
2065     */
2066      public ProcedureComponent() {
2067        super();
2068      }
2069
2070    /**
2071     * Constructor
2072     */
2073      public ProcedureComponent(int sequence, DataType procedure) {
2074        super();
2075        this.setSequence(sequence);
2076        this.setProcedure(procedure);
2077      }
2078
2079        /**
2080         * @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
2081         */
2082        public PositiveIntType getSequenceElement() { 
2083          if (this.sequence == null)
2084            if (Configuration.errorOnAutoCreate())
2085              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2086            else if (Configuration.doAutoCreate())
2087              this.sequence = new PositiveIntType(); // bb
2088          return this.sequence;
2089        }
2090
2091        public boolean hasSequenceElement() { 
2092          return this.sequence != null && !this.sequence.isEmpty();
2093        }
2094
2095        public boolean hasSequence() { 
2096          return this.sequence != null && !this.sequence.isEmpty();
2097        }
2098
2099        /**
2100         * @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
2101         */
2102        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
2103          this.sequence = value;
2104          return this;
2105        }
2106
2107        /**
2108         * @return A number to uniquely identify procedure entries.
2109         */
2110        public int getSequence() { 
2111          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2112        }
2113
2114        /**
2115         * @param value A number to uniquely identify procedure entries.
2116         */
2117        public ProcedureComponent setSequence(int value) { 
2118            if (this.sequence == null)
2119              this.sequence = new PositiveIntType();
2120            this.sequence.setValue(value);
2121          return this;
2122        }
2123
2124        /**
2125         * @return {@link #type} (When the condition was observed or the relative ranking.)
2126         */
2127        public List<CodeableConcept> getType() { 
2128          if (this.type == null)
2129            this.type = new ArrayList<CodeableConcept>();
2130          return this.type;
2131        }
2132
2133        /**
2134         * @return Returns a reference to <code>this</code> for easy method chaining
2135         */
2136        public ProcedureComponent setType(List<CodeableConcept> theType) { 
2137          this.type = theType;
2138          return this;
2139        }
2140
2141        public boolean hasType() { 
2142          if (this.type == null)
2143            return false;
2144          for (CodeableConcept item : this.type)
2145            if (!item.isEmpty())
2146              return true;
2147          return false;
2148        }
2149
2150        public CodeableConcept addType() { //3
2151          CodeableConcept t = new CodeableConcept();
2152          if (this.type == null)
2153            this.type = new ArrayList<CodeableConcept>();
2154          this.type.add(t);
2155          return t;
2156        }
2157
2158        public ProcedureComponent addType(CodeableConcept t) { //3
2159          if (t == null)
2160            return this;
2161          if (this.type == null)
2162            this.type = new ArrayList<CodeableConcept>();
2163          this.type.add(t);
2164          return this;
2165        }
2166
2167        /**
2168         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
2169         */
2170        public CodeableConcept getTypeFirstRep() { 
2171          if (getType().isEmpty()) {
2172            addType();
2173          }
2174          return getType().get(0);
2175        }
2176
2177        /**
2178         * @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
2179         */
2180        public DateTimeType getDateElement() { 
2181          if (this.date == null)
2182            if (Configuration.errorOnAutoCreate())
2183              throw new Error("Attempt to auto-create ProcedureComponent.date");
2184            else if (Configuration.doAutoCreate())
2185              this.date = new DateTimeType(); // bb
2186          return this.date;
2187        }
2188
2189        public boolean hasDateElement() { 
2190          return this.date != null && !this.date.isEmpty();
2191        }
2192
2193        public boolean hasDate() { 
2194          return this.date != null && !this.date.isEmpty();
2195        }
2196
2197        /**
2198         * @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
2199         */
2200        public ProcedureComponent setDateElement(DateTimeType value) { 
2201          this.date = value;
2202          return this;
2203        }
2204
2205        /**
2206         * @return Date and optionally time the procedure was performed.
2207         */
2208        public Date getDate() { 
2209          return this.date == null ? null : this.date.getValue();
2210        }
2211
2212        /**
2213         * @param value Date and optionally time the procedure was performed.
2214         */
2215        public ProcedureComponent setDate(Date value) { 
2216          if (value == null)
2217            this.date = null;
2218          else {
2219            if (this.date == null)
2220              this.date = new DateTimeType();
2221            this.date.setValue(value);
2222          }
2223          return this;
2224        }
2225
2226        /**
2227         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2228         */
2229        public DataType getProcedure() { 
2230          return this.procedure;
2231        }
2232
2233        /**
2234         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2235         */
2236        public CodeableConcept getProcedureCodeableConcept() throws FHIRException { 
2237          if (this.procedure == null)
2238            this.procedure = new CodeableConcept();
2239          if (!(this.procedure instanceof CodeableConcept))
2240            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.procedure.getClass().getName()+" was encountered");
2241          return (CodeableConcept) this.procedure;
2242        }
2243
2244        public boolean hasProcedureCodeableConcept() { 
2245          return this != null && this.procedure instanceof CodeableConcept;
2246        }
2247
2248        /**
2249         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2250         */
2251        public Reference getProcedureReference() throws FHIRException { 
2252          if (this.procedure == null)
2253            this.procedure = new Reference();
2254          if (!(this.procedure instanceof Reference))
2255            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
2256          return (Reference) this.procedure;
2257        }
2258
2259        public boolean hasProcedureReference() { 
2260          return this != null && this.procedure instanceof Reference;
2261        }
2262
2263        public boolean hasProcedure() { 
2264          return this.procedure != null && !this.procedure.isEmpty();
2265        }
2266
2267        /**
2268         * @param value {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2269         */
2270        public ProcedureComponent setProcedure(DataType value) { 
2271          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2272            throw new Error("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: "+value.fhirType());
2273          this.procedure = value;
2274          return this;
2275        }
2276
2277        /**
2278         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
2279         */
2280        public List<Reference> getUdi() { 
2281          if (this.udi == null)
2282            this.udi = new ArrayList<Reference>();
2283          return this.udi;
2284        }
2285
2286        /**
2287         * @return Returns a reference to <code>this</code> for easy method chaining
2288         */
2289        public ProcedureComponent setUdi(List<Reference> theUdi) { 
2290          this.udi = theUdi;
2291          return this;
2292        }
2293
2294        public boolean hasUdi() { 
2295          if (this.udi == null)
2296            return false;
2297          for (Reference item : this.udi)
2298            if (!item.isEmpty())
2299              return true;
2300          return false;
2301        }
2302
2303        public Reference addUdi() { //3
2304          Reference t = new Reference();
2305          if (this.udi == null)
2306            this.udi = new ArrayList<Reference>();
2307          this.udi.add(t);
2308          return t;
2309        }
2310
2311        public ProcedureComponent addUdi(Reference t) { //3
2312          if (t == null)
2313            return this;
2314          if (this.udi == null)
2315            this.udi = new ArrayList<Reference>();
2316          this.udi.add(t);
2317          return this;
2318        }
2319
2320        /**
2321         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
2322         */
2323        public Reference getUdiFirstRep() { 
2324          if (getUdi().isEmpty()) {
2325            addUdi();
2326          }
2327          return getUdi().get(0);
2328        }
2329
2330        protected void listChildren(List<Property> children) {
2331          super.listChildren(children);
2332          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence));
2333          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
2334          children.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date));
2335          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));
2336          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
2337        }
2338
2339        @Override
2340        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2341          switch (_hash) {
2342          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence);
2343          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2344          case 3076014: /*date*/  return new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date);
2345          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);
2346          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);
2347          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);
2348          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);
2349          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
2350          default: return super.getNamedProperty(_hash, _name, _checkValid);
2351          }
2352
2353        }
2354
2355      @Override
2356      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2357        switch (hash) {
2358        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2359        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2360        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2361        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // DataType
2362        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
2363        default: return super.getProperty(hash, name, checkValid);
2364        }
2365
2366      }
2367
2368      @Override
2369      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2370        switch (hash) {
2371        case 1349547969: // sequence
2372          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
2373          return value;
2374        case 3575610: // type
2375          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2376          return value;
2377        case 3076014: // date
2378          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
2379          return value;
2380        case -1095204141: // procedure
2381          this.procedure = TypeConvertor.castToType(value); // DataType
2382          return value;
2383        case 115642: // udi
2384          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
2385          return value;
2386        default: return super.setProperty(hash, name, value);
2387        }
2388
2389      }
2390
2391      @Override
2392      public Base setProperty(String name, Base value) throws FHIRException {
2393        if (name.equals("sequence")) {
2394          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
2395        } else if (name.equals("type")) {
2396          this.getType().add(TypeConvertor.castToCodeableConcept(value));
2397        } else if (name.equals("date")) {
2398          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
2399        } else if (name.equals("procedure[x]")) {
2400          this.procedure = TypeConvertor.castToType(value); // DataType
2401        } else if (name.equals("udi")) {
2402          this.getUdi().add(TypeConvertor.castToReference(value));
2403        } else
2404          return super.setProperty(name, value);
2405        return value;
2406      }
2407
2408      @Override
2409      public Base makeProperty(int hash, String name) throws FHIRException {
2410        switch (hash) {
2411        case 1349547969:  return getSequenceElement();
2412        case 3575610:  return addType(); 
2413        case 3076014:  return getDateElement();
2414        case 1640074445:  return getProcedure();
2415        case -1095204141:  return getProcedure();
2416        case 115642:  return addUdi(); 
2417        default: return super.makeProperty(hash, name);
2418        }
2419
2420      }
2421
2422      @Override
2423      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2424        switch (hash) {
2425        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2426        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2427        case 3076014: /*date*/ return new String[] {"dateTime"};
2428        case -1095204141: /*procedure*/ return new String[] {"CodeableConcept", "Reference"};
2429        case 115642: /*udi*/ return new String[] {"Reference"};
2430        default: return super.getTypesForProperty(hash, name);
2431        }
2432
2433      }
2434
2435      @Override
2436      public Base addChild(String name) throws FHIRException {
2437        if (name.equals("sequence")) {
2438          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedure.sequence");
2439        }
2440        else if (name.equals("type")) {
2441          return addType();
2442        }
2443        else if (name.equals("date")) {
2444          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedure.date");
2445        }
2446        else if (name.equals("procedureCodeableConcept")) {
2447          this.procedure = new CodeableConcept();
2448          return this.procedure;
2449        }
2450        else if (name.equals("procedureReference")) {
2451          this.procedure = new Reference();
2452          return this.procedure;
2453        }
2454        else if (name.equals("udi")) {
2455          return addUdi();
2456        }
2457        else
2458          return super.addChild(name);
2459      }
2460
2461      public ProcedureComponent copy() {
2462        ProcedureComponent dst = new ProcedureComponent();
2463        copyValues(dst);
2464        return dst;
2465      }
2466
2467      public void copyValues(ProcedureComponent dst) {
2468        super.copyValues(dst);
2469        dst.sequence = sequence == null ? null : sequence.copy();
2470        if (type != null) {
2471          dst.type = new ArrayList<CodeableConcept>();
2472          for (CodeableConcept i : type)
2473            dst.type.add(i.copy());
2474        };
2475        dst.date = date == null ? null : date.copy();
2476        dst.procedure = procedure == null ? null : procedure.copy();
2477        if (udi != null) {
2478          dst.udi = new ArrayList<Reference>();
2479          for (Reference i : udi)
2480            dst.udi.add(i.copy());
2481        };
2482      }
2483
2484      @Override
2485      public boolean equalsDeep(Base other_) {
2486        if (!super.equalsDeep(other_))
2487          return false;
2488        if (!(other_ instanceof ProcedureComponent))
2489          return false;
2490        ProcedureComponent o = (ProcedureComponent) other_;
2491        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(date, o.date, true)
2492           && compareDeep(procedure, o.procedure, true) && compareDeep(udi, o.udi, true);
2493      }
2494
2495      @Override
2496      public boolean equalsShallow(Base other_) {
2497        if (!super.equalsShallow(other_))
2498          return false;
2499        if (!(other_ instanceof ProcedureComponent))
2500          return false;
2501        ProcedureComponent o = (ProcedureComponent) other_;
2502        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
2503      }
2504
2505      public boolean isEmpty() {
2506        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, date, procedure
2507          , udi);
2508      }
2509
2510  public String fhirType() {
2511    return "ExplanationOfBenefit.procedure";
2512
2513  }
2514
2515  }
2516
2517    @Block()
2518    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
2519        /**
2520         * A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2521         */
2522        @Child(name = "focal", type = {BooleanType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2523        @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." )
2524        protected BooleanType focal;
2525
2526        /**
2527         * 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.
2528         */
2529        @Child(name = "coverage", type = {Coverage.class}, order=2, min=1, max=1, modifier=false, summary=true)
2530        @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." )
2531        protected Reference coverage;
2532
2533        /**
2534         * 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.
2535         */
2536        @Child(name = "preAuthRef", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2537        @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." )
2538        protected List<StringType> preAuthRef;
2539
2540        private static final long serialVersionUID = 1519900285L;
2541
2542    /**
2543     * Constructor
2544     */
2545      public InsuranceComponent() {
2546        super();
2547      }
2548
2549    /**
2550     * Constructor
2551     */
2552      public InsuranceComponent(boolean focal, Reference coverage) {
2553        super();
2554        this.setFocal(focal);
2555        this.setCoverage(coverage);
2556      }
2557
2558        /**
2559         * @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
2560         */
2561        public BooleanType getFocalElement() { 
2562          if (this.focal == null)
2563            if (Configuration.errorOnAutoCreate())
2564              throw new Error("Attempt to auto-create InsuranceComponent.focal");
2565            else if (Configuration.doAutoCreate())
2566              this.focal = new BooleanType(); // bb
2567          return this.focal;
2568        }
2569
2570        public boolean hasFocalElement() { 
2571          return this.focal != null && !this.focal.isEmpty();
2572        }
2573
2574        public boolean hasFocal() { 
2575          return this.focal != null && !this.focal.isEmpty();
2576        }
2577
2578        /**
2579         * @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
2580         */
2581        public InsuranceComponent setFocalElement(BooleanType value) { 
2582          this.focal = value;
2583          return this;
2584        }
2585
2586        /**
2587         * @return A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2588         */
2589        public boolean getFocal() { 
2590          return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
2591        }
2592
2593        /**
2594         * @param value A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2595         */
2596        public InsuranceComponent setFocal(boolean value) { 
2597            if (this.focal == null)
2598              this.focal = new BooleanType();
2599            this.focal.setValue(value);
2600          return this;
2601        }
2602
2603        /**
2604         * @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.)
2605         */
2606        public Reference getCoverage() { 
2607          if (this.coverage == null)
2608            if (Configuration.errorOnAutoCreate())
2609              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2610            else if (Configuration.doAutoCreate())
2611              this.coverage = new Reference(); // cc
2612          return this.coverage;
2613        }
2614
2615        public boolean hasCoverage() { 
2616          return this.coverage != null && !this.coverage.isEmpty();
2617        }
2618
2619        /**
2620         * @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.)
2621         */
2622        public InsuranceComponent setCoverage(Reference value) { 
2623          this.coverage = value;
2624          return this;
2625        }
2626
2627        /**
2628         * @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.)
2629         */
2630        public List<StringType> getPreAuthRef() { 
2631          if (this.preAuthRef == null)
2632            this.preAuthRef = new ArrayList<StringType>();
2633          return this.preAuthRef;
2634        }
2635
2636        /**
2637         * @return Returns a reference to <code>this</code> for easy method chaining
2638         */
2639        public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) { 
2640          this.preAuthRef = thePreAuthRef;
2641          return this;
2642        }
2643
2644        public boolean hasPreAuthRef() { 
2645          if (this.preAuthRef == null)
2646            return false;
2647          for (StringType item : this.preAuthRef)
2648            if (!item.isEmpty())
2649              return true;
2650          return false;
2651        }
2652
2653        /**
2654         * @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.)
2655         */
2656        public StringType addPreAuthRefElement() {//2 
2657          StringType t = new StringType();
2658          if (this.preAuthRef == null)
2659            this.preAuthRef = new ArrayList<StringType>();
2660          this.preAuthRef.add(t);
2661          return t;
2662        }
2663
2664        /**
2665         * @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.)
2666         */
2667        public InsuranceComponent addPreAuthRef(String value) { //1
2668          StringType t = new StringType();
2669          t.setValue(value);
2670          if (this.preAuthRef == null)
2671            this.preAuthRef = new ArrayList<StringType>();
2672          this.preAuthRef.add(t);
2673          return this;
2674        }
2675
2676        /**
2677         * @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.)
2678         */
2679        public boolean hasPreAuthRef(String value) { 
2680          if (this.preAuthRef == null)
2681            return false;
2682          for (StringType v : this.preAuthRef)
2683            if (v.getValue().equals(value)) // string
2684              return true;
2685          return false;
2686        }
2687
2688        protected void listChildren(List<Property> children) {
2689          super.listChildren(children);
2690          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));
2691          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));
2692          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));
2693        }
2694
2695        @Override
2696        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2697          switch (_hash) {
2698          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);
2699          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);
2700          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);
2701          default: return super.getNamedProperty(_hash, _name, _checkValid);
2702          }
2703
2704        }
2705
2706      @Override
2707      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2708        switch (hash) {
2709        case 97604197: /*focal*/ return this.focal == null ? new Base[0] : new Base[] {this.focal}; // BooleanType
2710        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
2711        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
2712        default: return super.getProperty(hash, name, checkValid);
2713        }
2714
2715      }
2716
2717      @Override
2718      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2719        switch (hash) {
2720        case 97604197: // focal
2721          this.focal = TypeConvertor.castToBoolean(value); // BooleanType
2722          return value;
2723        case -351767064: // coverage
2724          this.coverage = TypeConvertor.castToReference(value); // Reference
2725          return value;
2726        case 522246568: // preAuthRef
2727          this.getPreAuthRef().add(TypeConvertor.castToString(value)); // StringType
2728          return value;
2729        default: return super.setProperty(hash, name, value);
2730        }
2731
2732      }
2733
2734      @Override
2735      public Base setProperty(String name, Base value) throws FHIRException {
2736        if (name.equals("focal")) {
2737          this.focal = TypeConvertor.castToBoolean(value); // BooleanType
2738        } else if (name.equals("coverage")) {
2739          this.coverage = TypeConvertor.castToReference(value); // Reference
2740        } else if (name.equals("preAuthRef")) {
2741          this.getPreAuthRef().add(TypeConvertor.castToString(value));
2742        } else
2743          return super.setProperty(name, value);
2744        return value;
2745      }
2746
2747      @Override
2748      public Base makeProperty(int hash, String name) throws FHIRException {
2749        switch (hash) {
2750        case 97604197:  return getFocalElement();
2751        case -351767064:  return getCoverage();
2752        case 522246568:  return addPreAuthRefElement();
2753        default: return super.makeProperty(hash, name);
2754        }
2755
2756      }
2757
2758      @Override
2759      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2760        switch (hash) {
2761        case 97604197: /*focal*/ return new String[] {"boolean"};
2762        case -351767064: /*coverage*/ return new String[] {"Reference"};
2763        case 522246568: /*preAuthRef*/ return new String[] {"string"};
2764        default: return super.getTypesForProperty(hash, name);
2765        }
2766
2767      }
2768
2769      @Override
2770      public Base addChild(String name) throws FHIRException {
2771        if (name.equals("focal")) {
2772          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.insurance.focal");
2773        }
2774        else if (name.equals("coverage")) {
2775          this.coverage = new Reference();
2776          return this.coverage;
2777        }
2778        else if (name.equals("preAuthRef")) {
2779          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.insurance.preAuthRef");
2780        }
2781        else
2782          return super.addChild(name);
2783      }
2784
2785      public InsuranceComponent copy() {
2786        InsuranceComponent dst = new InsuranceComponent();
2787        copyValues(dst);
2788        return dst;
2789      }
2790
2791      public void copyValues(InsuranceComponent dst) {
2792        super.copyValues(dst);
2793        dst.focal = focal == null ? null : focal.copy();
2794        dst.coverage = coverage == null ? null : coverage.copy();
2795        if (preAuthRef != null) {
2796          dst.preAuthRef = new ArrayList<StringType>();
2797          for (StringType i : preAuthRef)
2798            dst.preAuthRef.add(i.copy());
2799        };
2800      }
2801
2802      @Override
2803      public boolean equalsDeep(Base other_) {
2804        if (!super.equalsDeep(other_))
2805          return false;
2806        if (!(other_ instanceof InsuranceComponent))
2807          return false;
2808        InsuranceComponent o = (InsuranceComponent) other_;
2809        return compareDeep(focal, o.focal, true) && compareDeep(coverage, o.coverage, true) && compareDeep(preAuthRef, o.preAuthRef, true)
2810          ;
2811      }
2812
2813      @Override
2814      public boolean equalsShallow(Base other_) {
2815        if (!super.equalsShallow(other_))
2816          return false;
2817        if (!(other_ instanceof InsuranceComponent))
2818          return false;
2819        InsuranceComponent o = (InsuranceComponent) other_;
2820        return compareValues(focal, o.focal, true) && compareValues(preAuthRef, o.preAuthRef, true);
2821      }
2822
2823      public boolean isEmpty() {
2824        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(focal, coverage, preAuthRef
2825          );
2826      }
2827
2828  public String fhirType() {
2829    return "ExplanationOfBenefit.insurance";
2830
2831  }
2832
2833  }
2834
2835    @Block()
2836    public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
2837        /**
2838         * Date of an accident event  related to the products and services contained in the claim.
2839         */
2840        @Child(name = "date", type = {DateType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2841        @Description(shortDefinition="When the incident occurred", formalDefinition="Date of an accident event  related to the products and services contained in the claim." )
2842        protected DateType date;
2843
2844        /**
2845         * The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.
2846         */
2847        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
2848        @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." )
2849        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActIncidentCode")
2850        protected CodeableConcept type;
2851
2852        /**
2853         * The physical location of the accident event.
2854         */
2855        @Child(name = "location", type = {Address.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=false)
2856        @Description(shortDefinition="Where the event occurred", formalDefinition="The physical location of the accident event." )
2857        protected DataType location;
2858
2859        private static final long serialVersionUID = 11882722L;
2860
2861    /**
2862     * Constructor
2863     */
2864      public AccidentComponent() {
2865        super();
2866      }
2867
2868        /**
2869         * @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
2870         */
2871        public DateType getDateElement() { 
2872          if (this.date == null)
2873            if (Configuration.errorOnAutoCreate())
2874              throw new Error("Attempt to auto-create AccidentComponent.date");
2875            else if (Configuration.doAutoCreate())
2876              this.date = new DateType(); // bb
2877          return this.date;
2878        }
2879
2880        public boolean hasDateElement() { 
2881          return this.date != null && !this.date.isEmpty();
2882        }
2883
2884        public boolean hasDate() { 
2885          return this.date != null && !this.date.isEmpty();
2886        }
2887
2888        /**
2889         * @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
2890         */
2891        public AccidentComponent setDateElement(DateType value) { 
2892          this.date = value;
2893          return this;
2894        }
2895
2896        /**
2897         * @return Date of an accident event  related to the products and services contained in the claim.
2898         */
2899        public Date getDate() { 
2900          return this.date == null ? null : this.date.getValue();
2901        }
2902
2903        /**
2904         * @param value Date of an accident event  related to the products and services contained in the claim.
2905         */
2906        public AccidentComponent setDate(Date value) { 
2907          if (value == null)
2908            this.date = null;
2909          else {
2910            if (this.date == null)
2911              this.date = new DateType();
2912            this.date.setValue(value);
2913          }
2914          return this;
2915        }
2916
2917        /**
2918         * @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.)
2919         */
2920        public CodeableConcept getType() { 
2921          if (this.type == null)
2922            if (Configuration.errorOnAutoCreate())
2923              throw new Error("Attempt to auto-create AccidentComponent.type");
2924            else if (Configuration.doAutoCreate())
2925              this.type = new CodeableConcept(); // cc
2926          return this.type;
2927        }
2928
2929        public boolean hasType() { 
2930          return this.type != null && !this.type.isEmpty();
2931        }
2932
2933        /**
2934         * @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.)
2935         */
2936        public AccidentComponent setType(CodeableConcept value) { 
2937          this.type = value;
2938          return this;
2939        }
2940
2941        /**
2942         * @return {@link #location} (The physical location of the accident event.)
2943         */
2944        public DataType getLocation() { 
2945          return this.location;
2946        }
2947
2948        /**
2949         * @return {@link #location} (The physical location of the accident event.)
2950         */
2951        public Address getLocationAddress() throws FHIRException { 
2952          if (this.location == null)
2953            this.location = new Address();
2954          if (!(this.location instanceof Address))
2955            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
2956          return (Address) this.location;
2957        }
2958
2959        public boolean hasLocationAddress() { 
2960          return this != null && this.location instanceof Address;
2961        }
2962
2963        /**
2964         * @return {@link #location} (The physical location of the accident event.)
2965         */
2966        public Reference getLocationReference() throws FHIRException { 
2967          if (this.location == null)
2968            this.location = new Reference();
2969          if (!(this.location instanceof Reference))
2970            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
2971          return (Reference) this.location;
2972        }
2973
2974        public boolean hasLocationReference() { 
2975          return this != null && this.location instanceof Reference;
2976        }
2977
2978        public boolean hasLocation() { 
2979          return this.location != null && !this.location.isEmpty();
2980        }
2981
2982        /**
2983         * @param value {@link #location} (The physical location of the accident event.)
2984         */
2985        public AccidentComponent setLocation(DataType value) { 
2986          if (value != null && !(value instanceof Address || value instanceof Reference))
2987            throw new Error("Not the right type for ExplanationOfBenefit.accident.location[x]: "+value.fhirType());
2988          this.location = value;
2989          return this;
2990        }
2991
2992        protected void listChildren(List<Property> children) {
2993          super.listChildren(children);
2994          children.add(new Property("date", "date", "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date));
2995          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));
2996          children.add(new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location));
2997        }
2998
2999        @Override
3000        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3001          switch (_hash) {
3002          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);
3003          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);
3004          case 552316075: /*location[x]*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3005          case 1901043637: /*location*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3006          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address", "The physical location of the accident event.", 0, 1, location);
3007          case 755866390: /*locationReference*/  return new Property("location[x]", "Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3008          default: return super.getNamedProperty(_hash, _name, _checkValid);
3009          }
3010
3011        }
3012
3013      @Override
3014      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3015        switch (hash) {
3016        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
3017        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3018        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // DataType
3019        default: return super.getProperty(hash, name, checkValid);
3020        }
3021
3022      }
3023
3024      @Override
3025      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3026        switch (hash) {
3027        case 3076014: // date
3028          this.date = TypeConvertor.castToDate(value); // DateType
3029          return value;
3030        case 3575610: // type
3031          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3032          return value;
3033        case 1901043637: // location
3034          this.location = TypeConvertor.castToType(value); // DataType
3035          return value;
3036        default: return super.setProperty(hash, name, value);
3037        }
3038
3039      }
3040
3041      @Override
3042      public Base setProperty(String name, Base value) throws FHIRException {
3043        if (name.equals("date")) {
3044          this.date = TypeConvertor.castToDate(value); // DateType
3045        } else if (name.equals("type")) {
3046          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3047        } else if (name.equals("location[x]")) {
3048          this.location = TypeConvertor.castToType(value); // DataType
3049        } else
3050          return super.setProperty(name, value);
3051        return value;
3052      }
3053
3054      @Override
3055      public Base makeProperty(int hash, String name) throws FHIRException {
3056        switch (hash) {
3057        case 3076014:  return getDateElement();
3058        case 3575610:  return getType();
3059        case 552316075:  return getLocation();
3060        case 1901043637:  return getLocation();
3061        default: return super.makeProperty(hash, name);
3062        }
3063
3064      }
3065
3066      @Override
3067      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3068        switch (hash) {
3069        case 3076014: /*date*/ return new String[] {"date"};
3070        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3071        case 1901043637: /*location*/ return new String[] {"Address", "Reference"};
3072        default: return super.getTypesForProperty(hash, name);
3073        }
3074
3075      }
3076
3077      @Override
3078      public Base addChild(String name) throws FHIRException {
3079        if (name.equals("date")) {
3080          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.accident.date");
3081        }
3082        else if (name.equals("type")) {
3083          this.type = new CodeableConcept();
3084          return this.type;
3085        }
3086        else if (name.equals("locationAddress")) {
3087          this.location = new Address();
3088          return this.location;
3089        }
3090        else if (name.equals("locationReference")) {
3091          this.location = new Reference();
3092          return this.location;
3093        }
3094        else
3095          return super.addChild(name);
3096      }
3097
3098      public AccidentComponent copy() {
3099        AccidentComponent dst = new AccidentComponent();
3100        copyValues(dst);
3101        return dst;
3102      }
3103
3104      public void copyValues(AccidentComponent dst) {
3105        super.copyValues(dst);
3106        dst.date = date == null ? null : date.copy();
3107        dst.type = type == null ? null : type.copy();
3108        dst.location = location == null ? null : location.copy();
3109      }
3110
3111      @Override
3112      public boolean equalsDeep(Base other_) {
3113        if (!super.equalsDeep(other_))
3114          return false;
3115        if (!(other_ instanceof AccidentComponent))
3116          return false;
3117        AccidentComponent o = (AccidentComponent) other_;
3118        return compareDeep(date, o.date, true) && compareDeep(type, o.type, true) && compareDeep(location, o.location, true)
3119          ;
3120      }
3121
3122      @Override
3123      public boolean equalsShallow(Base other_) {
3124        if (!super.equalsShallow(other_))
3125          return false;
3126        if (!(other_ instanceof AccidentComponent))
3127          return false;
3128        AccidentComponent o = (AccidentComponent) other_;
3129        return compareValues(date, o.date, true);
3130      }
3131
3132      public boolean isEmpty() {
3133        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
3134      }
3135
3136  public String fhirType() {
3137    return "ExplanationOfBenefit.accident";
3138
3139  }
3140
3141  }
3142
3143    @Block()
3144    public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
3145        /**
3146         * A number to uniquely identify item entries.
3147         */
3148        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
3149        @Description(shortDefinition="Item instance identifier", formalDefinition="A number to uniquely identify item entries." )
3150        protected PositiveIntType sequence;
3151
3152        /**
3153         * Care team members related to this service or product.
3154         */
3155        @Child(name = "careTeamSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3156        @Description(shortDefinition="Applicable care team members", formalDefinition="Care team members related to this service or product." )
3157        protected List<PositiveIntType> careTeamSequence;
3158
3159        /**
3160         * Diagnoses applicable for this service or product.
3161         */
3162        @Child(name = "diagnosisSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3163        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnoses applicable for this service or product." )
3164        protected List<PositiveIntType> diagnosisSequence;
3165
3166        /**
3167         * Procedures applicable for this service or product.
3168         */
3169        @Child(name = "procedureSequence", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3170        @Description(shortDefinition="Applicable procedures", formalDefinition="Procedures applicable for this service or product." )
3171        protected List<PositiveIntType> procedureSequence;
3172
3173        /**
3174         * Exceptions, special conditions and supporting information applicable for this service or product.
3175         */
3176        @Child(name = "informationSequence", type = {PositiveIntType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3177        @Description(shortDefinition="Applicable exception and supporting information", formalDefinition="Exceptions, special conditions and supporting information applicable for this service or product." )
3178        protected List<PositiveIntType> informationSequence;
3179
3180        /**
3181         * The type of revenue or cost center providing the product and/or service.
3182         */
3183        @Child(name = "revenue", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
3184        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
3185        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
3186        protected CodeableConcept revenue;
3187
3188        /**
3189         * Code to identify the general type of benefits under which products and services are provided.
3190         */
3191        @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
3192        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
3193        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
3194        protected CodeableConcept category;
3195
3196        /**
3197         * When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.
3198         */
3199        @Child(name = "productOrService", type = {CodeableConcept.class}, order=8, min=1, max=1, modifier=false, summary=false)
3200        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item." )
3201        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
3202        protected CodeableConcept productOrService;
3203
3204        /**
3205         * Item typification or modifiers codes to convey additional context for the product or service.
3206         */
3207        @Child(name = "modifier", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3208        @Description(shortDefinition="Product or service billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
3209        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
3210        protected List<CodeableConcept> modifier;
3211
3212        /**
3213         * Identifies the program under which this may be recovered.
3214         */
3215        @Child(name = "programCode", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3216        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
3217        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
3218        protected List<CodeableConcept> programCode;
3219
3220        /**
3221         * The date or dates when the service or product was supplied, performed or completed.
3222         */
3223        @Child(name = "serviced", type = {DateType.class, Period.class}, order=11, min=0, max=1, modifier=false, summary=false)
3224        @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." )
3225        protected DataType serviced;
3226
3227        /**
3228         * Where the product or service was provided.
3229         */
3230        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
3231        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
3232        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
3233        protected DataType location;
3234
3235        /**
3236         * The number of repetitions of a service or product.
3237         */
3238        @Child(name = "quantity", type = {Quantity.class}, order=13, min=0, max=1, modifier=false, summary=false)
3239        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
3240        protected Quantity quantity;
3241
3242        /**
3243         * 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.
3244         */
3245        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
3246        @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." )
3247        protected Money unitPrice;
3248
3249        /**
3250         * 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.
3251         */
3252        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=false)
3253        @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." )
3254        protected DecimalType factor;
3255
3256        /**
3257         * The quantity times the unit price for an additional service or product or charge.
3258         */
3259        @Child(name = "net", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
3260        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
3261        protected Money net;
3262
3263        /**
3264         * Unique Device Identifiers associated with this line item.
3265         */
3266        @Child(name = "udi", type = {Device.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3267        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
3268        protected List<Reference> udi;
3269
3270        /**
3271         * Physical service site on the patient (limb, tooth, etc.).
3272         */
3273        @Child(name = "bodySite", type = {CodeableConcept.class}, order=18, min=0, max=1, modifier=false, summary=false)
3274        @Description(shortDefinition="Anatomical location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
3275        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
3276        protected CodeableConcept bodySite;
3277
3278        /**
3279         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
3280         */
3281        @Child(name = "subSite", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3282        @Description(shortDefinition="Anatomical sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
3283        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
3284        protected List<CodeableConcept> subSite;
3285
3286        /**
3287         * A billed item may include goods or services provided in multiple encounters.
3288         */
3289        @Child(name = "encounter", type = {Encounter.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3290        @Description(shortDefinition="Encounters related to this billed item", formalDefinition="A billed item may include goods or services provided in multiple encounters." )
3291        protected List<Reference> encounter;
3292
3293        /**
3294         * The numbers associated with notes below which apply to the adjudication of this item.
3295         */
3296        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3297        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
3298        protected List<PositiveIntType> noteNumber;
3299
3300        /**
3301         * 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.
3302         */
3303        @Child(name = "adjudication", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3304        @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." )
3305        protected List<AdjudicationComponent> adjudication;
3306
3307        /**
3308         * Second-tier of goods and services.
3309         */
3310        @Child(name = "detail", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3311        @Description(shortDefinition="Additional items", formalDefinition="Second-tier of goods and services." )
3312        protected List<DetailComponent> detail;
3313
3314        private static final long serialVersionUID = -1350957145L;
3315
3316    /**
3317     * Constructor
3318     */
3319      public ItemComponent() {
3320        super();
3321      }
3322
3323    /**
3324     * Constructor
3325     */
3326      public ItemComponent(int sequence, CodeableConcept productOrService) {
3327        super();
3328        this.setSequence(sequence);
3329        this.setProductOrService(productOrService);
3330      }
3331
3332        /**
3333         * @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
3334         */
3335        public PositiveIntType getSequenceElement() { 
3336          if (this.sequence == null)
3337            if (Configuration.errorOnAutoCreate())
3338              throw new Error("Attempt to auto-create ItemComponent.sequence");
3339            else if (Configuration.doAutoCreate())
3340              this.sequence = new PositiveIntType(); // bb
3341          return this.sequence;
3342        }
3343
3344        public boolean hasSequenceElement() { 
3345          return this.sequence != null && !this.sequence.isEmpty();
3346        }
3347
3348        public boolean hasSequence() { 
3349          return this.sequence != null && !this.sequence.isEmpty();
3350        }
3351
3352        /**
3353         * @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
3354         */
3355        public ItemComponent setSequenceElement(PositiveIntType value) { 
3356          this.sequence = value;
3357          return this;
3358        }
3359
3360        /**
3361         * @return A number to uniquely identify item entries.
3362         */
3363        public int getSequence() { 
3364          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3365        }
3366
3367        /**
3368         * @param value A number to uniquely identify item entries.
3369         */
3370        public ItemComponent setSequence(int value) { 
3371            if (this.sequence == null)
3372              this.sequence = new PositiveIntType();
3373            this.sequence.setValue(value);
3374          return this;
3375        }
3376
3377        /**
3378         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3379         */
3380        public List<PositiveIntType> getCareTeamSequence() { 
3381          if (this.careTeamSequence == null)
3382            this.careTeamSequence = new ArrayList<PositiveIntType>();
3383          return this.careTeamSequence;
3384        }
3385
3386        /**
3387         * @return Returns a reference to <code>this</code> for easy method chaining
3388         */
3389        public ItemComponent setCareTeamSequence(List<PositiveIntType> theCareTeamSequence) { 
3390          this.careTeamSequence = theCareTeamSequence;
3391          return this;
3392        }
3393
3394        public boolean hasCareTeamSequence() { 
3395          if (this.careTeamSequence == null)
3396            return false;
3397          for (PositiveIntType item : this.careTeamSequence)
3398            if (!item.isEmpty())
3399              return true;
3400          return false;
3401        }
3402
3403        /**
3404         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3405         */
3406        public PositiveIntType addCareTeamSequenceElement() {//2 
3407          PositiveIntType t = new PositiveIntType();
3408          if (this.careTeamSequence == null)
3409            this.careTeamSequence = new ArrayList<PositiveIntType>();
3410          this.careTeamSequence.add(t);
3411          return t;
3412        }
3413
3414        /**
3415         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3416         */
3417        public ItemComponent addCareTeamSequence(int value) { //1
3418          PositiveIntType t = new PositiveIntType();
3419          t.setValue(value);
3420          if (this.careTeamSequence == null)
3421            this.careTeamSequence = new ArrayList<PositiveIntType>();
3422          this.careTeamSequence.add(t);
3423          return this;
3424        }
3425
3426        /**
3427         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3428         */
3429        public boolean hasCareTeamSequence(int value) { 
3430          if (this.careTeamSequence == null)
3431            return false;
3432          for (PositiveIntType v : this.careTeamSequence)
3433            if (v.getValue().equals(value)) // positiveInt
3434              return true;
3435          return false;
3436        }
3437
3438        /**
3439         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3440         */
3441        public List<PositiveIntType> getDiagnosisSequence() { 
3442          if (this.diagnosisSequence == null)
3443            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3444          return this.diagnosisSequence;
3445        }
3446
3447        /**
3448         * @return Returns a reference to <code>this</code> for easy method chaining
3449         */
3450        public ItemComponent setDiagnosisSequence(List<PositiveIntType> theDiagnosisSequence) { 
3451          this.diagnosisSequence = theDiagnosisSequence;
3452          return this;
3453        }
3454
3455        public boolean hasDiagnosisSequence() { 
3456          if (this.diagnosisSequence == null)
3457            return false;
3458          for (PositiveIntType item : this.diagnosisSequence)
3459            if (!item.isEmpty())
3460              return true;
3461          return false;
3462        }
3463
3464        /**
3465         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3466         */
3467        public PositiveIntType addDiagnosisSequenceElement() {//2 
3468          PositiveIntType t = new PositiveIntType();
3469          if (this.diagnosisSequence == null)
3470            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3471          this.diagnosisSequence.add(t);
3472          return t;
3473        }
3474
3475        /**
3476         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3477         */
3478        public ItemComponent addDiagnosisSequence(int value) { //1
3479          PositiveIntType t = new PositiveIntType();
3480          t.setValue(value);
3481          if (this.diagnosisSequence == null)
3482            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3483          this.diagnosisSequence.add(t);
3484          return this;
3485        }
3486
3487        /**
3488         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3489         */
3490        public boolean hasDiagnosisSequence(int value) { 
3491          if (this.diagnosisSequence == null)
3492            return false;
3493          for (PositiveIntType v : this.diagnosisSequence)
3494            if (v.getValue().equals(value)) // positiveInt
3495              return true;
3496          return false;
3497        }
3498
3499        /**
3500         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3501         */
3502        public List<PositiveIntType> getProcedureSequence() { 
3503          if (this.procedureSequence == null)
3504            this.procedureSequence = new ArrayList<PositiveIntType>();
3505          return this.procedureSequence;
3506        }
3507
3508        /**
3509         * @return Returns a reference to <code>this</code> for easy method chaining
3510         */
3511        public ItemComponent setProcedureSequence(List<PositiveIntType> theProcedureSequence) { 
3512          this.procedureSequence = theProcedureSequence;
3513          return this;
3514        }
3515
3516        public boolean hasProcedureSequence() { 
3517          if (this.procedureSequence == null)
3518            return false;
3519          for (PositiveIntType item : this.procedureSequence)
3520            if (!item.isEmpty())
3521              return true;
3522          return false;
3523        }
3524
3525        /**
3526         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3527         */
3528        public PositiveIntType addProcedureSequenceElement() {//2 
3529          PositiveIntType t = new PositiveIntType();
3530          if (this.procedureSequence == null)
3531            this.procedureSequence = new ArrayList<PositiveIntType>();
3532          this.procedureSequence.add(t);
3533          return t;
3534        }
3535
3536        /**
3537         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3538         */
3539        public ItemComponent addProcedureSequence(int value) { //1
3540          PositiveIntType t = new PositiveIntType();
3541          t.setValue(value);
3542          if (this.procedureSequence == null)
3543            this.procedureSequence = new ArrayList<PositiveIntType>();
3544          this.procedureSequence.add(t);
3545          return this;
3546        }
3547
3548        /**
3549         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3550         */
3551        public boolean hasProcedureSequence(int value) { 
3552          if (this.procedureSequence == null)
3553            return false;
3554          for (PositiveIntType v : this.procedureSequence)
3555            if (v.getValue().equals(value)) // positiveInt
3556              return true;
3557          return false;
3558        }
3559
3560        /**
3561         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3562         */
3563        public List<PositiveIntType> getInformationSequence() { 
3564          if (this.informationSequence == null)
3565            this.informationSequence = new ArrayList<PositiveIntType>();
3566          return this.informationSequence;
3567        }
3568
3569        /**
3570         * @return Returns a reference to <code>this</code> for easy method chaining
3571         */
3572        public ItemComponent setInformationSequence(List<PositiveIntType> theInformationSequence) { 
3573          this.informationSequence = theInformationSequence;
3574          return this;
3575        }
3576
3577        public boolean hasInformationSequence() { 
3578          if (this.informationSequence == null)
3579            return false;
3580          for (PositiveIntType item : this.informationSequence)
3581            if (!item.isEmpty())
3582              return true;
3583          return false;
3584        }
3585
3586        /**
3587         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3588         */
3589        public PositiveIntType addInformationSequenceElement() {//2 
3590          PositiveIntType t = new PositiveIntType();
3591          if (this.informationSequence == null)
3592            this.informationSequence = new ArrayList<PositiveIntType>();
3593          this.informationSequence.add(t);
3594          return t;
3595        }
3596
3597        /**
3598         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3599         */
3600        public ItemComponent addInformationSequence(int value) { //1
3601          PositiveIntType t = new PositiveIntType();
3602          t.setValue(value);
3603          if (this.informationSequence == null)
3604            this.informationSequence = new ArrayList<PositiveIntType>();
3605          this.informationSequence.add(t);
3606          return this;
3607        }
3608
3609        /**
3610         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3611         */
3612        public boolean hasInformationSequence(int value) { 
3613          if (this.informationSequence == null)
3614            return false;
3615          for (PositiveIntType v : this.informationSequence)
3616            if (v.getValue().equals(value)) // positiveInt
3617              return true;
3618          return false;
3619        }
3620
3621        /**
3622         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3623         */
3624        public CodeableConcept getRevenue() { 
3625          if (this.revenue == null)
3626            if (Configuration.errorOnAutoCreate())
3627              throw new Error("Attempt to auto-create ItemComponent.revenue");
3628            else if (Configuration.doAutoCreate())
3629              this.revenue = new CodeableConcept(); // cc
3630          return this.revenue;
3631        }
3632
3633        public boolean hasRevenue() { 
3634          return this.revenue != null && !this.revenue.isEmpty();
3635        }
3636
3637        /**
3638         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3639         */
3640        public ItemComponent setRevenue(CodeableConcept value) { 
3641          this.revenue = value;
3642          return this;
3643        }
3644
3645        /**
3646         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
3647         */
3648        public CodeableConcept getCategory() { 
3649          if (this.category == null)
3650            if (Configuration.errorOnAutoCreate())
3651              throw new Error("Attempt to auto-create ItemComponent.category");
3652            else if (Configuration.doAutoCreate())
3653              this.category = new CodeableConcept(); // cc
3654          return this.category;
3655        }
3656
3657        public boolean hasCategory() { 
3658          return this.category != null && !this.category.isEmpty();
3659        }
3660
3661        /**
3662         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
3663         */
3664        public ItemComponent setCategory(CodeableConcept value) { 
3665          this.category = value;
3666          return this;
3667        }
3668
3669        /**
3670         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
3671         */
3672        public CodeableConcept getProductOrService() { 
3673          if (this.productOrService == null)
3674            if (Configuration.errorOnAutoCreate())
3675              throw new Error("Attempt to auto-create ItemComponent.productOrService");
3676            else if (Configuration.doAutoCreate())
3677              this.productOrService = new CodeableConcept(); // cc
3678          return this.productOrService;
3679        }
3680
3681        public boolean hasProductOrService() { 
3682          return this.productOrService != null && !this.productOrService.isEmpty();
3683        }
3684
3685        /**
3686         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
3687         */
3688        public ItemComponent setProductOrService(CodeableConcept value) { 
3689          this.productOrService = value;
3690          return this;
3691        }
3692
3693        /**
3694         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
3695         */
3696        public List<CodeableConcept> getModifier() { 
3697          if (this.modifier == null)
3698            this.modifier = new ArrayList<CodeableConcept>();
3699          return this.modifier;
3700        }
3701
3702        /**
3703         * @return Returns a reference to <code>this</code> for easy method chaining
3704         */
3705        public ItemComponent setModifier(List<CodeableConcept> theModifier) { 
3706          this.modifier = theModifier;
3707          return this;
3708        }
3709
3710        public boolean hasModifier() { 
3711          if (this.modifier == null)
3712            return false;
3713          for (CodeableConcept item : this.modifier)
3714            if (!item.isEmpty())
3715              return true;
3716          return false;
3717        }
3718
3719        public CodeableConcept addModifier() { //3
3720          CodeableConcept t = new CodeableConcept();
3721          if (this.modifier == null)
3722            this.modifier = new ArrayList<CodeableConcept>();
3723          this.modifier.add(t);
3724          return t;
3725        }
3726
3727        public ItemComponent addModifier(CodeableConcept t) { //3
3728          if (t == null)
3729            return this;
3730          if (this.modifier == null)
3731            this.modifier = new ArrayList<CodeableConcept>();
3732          this.modifier.add(t);
3733          return this;
3734        }
3735
3736        /**
3737         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
3738         */
3739        public CodeableConcept getModifierFirstRep() { 
3740          if (getModifier().isEmpty()) {
3741            addModifier();
3742          }
3743          return getModifier().get(0);
3744        }
3745
3746        /**
3747         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
3748         */
3749        public List<CodeableConcept> getProgramCode() { 
3750          if (this.programCode == null)
3751            this.programCode = new ArrayList<CodeableConcept>();
3752          return this.programCode;
3753        }
3754
3755        /**
3756         * @return Returns a reference to <code>this</code> for easy method chaining
3757         */
3758        public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
3759          this.programCode = theProgramCode;
3760          return this;
3761        }
3762
3763        public boolean hasProgramCode() { 
3764          if (this.programCode == null)
3765            return false;
3766          for (CodeableConcept item : this.programCode)
3767            if (!item.isEmpty())
3768              return true;
3769          return false;
3770        }
3771
3772        public CodeableConcept addProgramCode() { //3
3773          CodeableConcept t = new CodeableConcept();
3774          if (this.programCode == null)
3775            this.programCode = new ArrayList<CodeableConcept>();
3776          this.programCode.add(t);
3777          return t;
3778        }
3779
3780        public ItemComponent addProgramCode(CodeableConcept t) { //3
3781          if (t == null)
3782            return this;
3783          if (this.programCode == null)
3784            this.programCode = new ArrayList<CodeableConcept>();
3785          this.programCode.add(t);
3786          return this;
3787        }
3788
3789        /**
3790         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
3791         */
3792        public CodeableConcept getProgramCodeFirstRep() { 
3793          if (getProgramCode().isEmpty()) {
3794            addProgramCode();
3795          }
3796          return getProgramCode().get(0);
3797        }
3798
3799        /**
3800         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3801         */
3802        public DataType getServiced() { 
3803          return this.serviced;
3804        }
3805
3806        /**
3807         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3808         */
3809        public DateType getServicedDateType() throws FHIRException { 
3810          if (this.serviced == null)
3811            this.serviced = new DateType();
3812          if (!(this.serviced instanceof DateType))
3813            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
3814          return (DateType) this.serviced;
3815        }
3816
3817        public boolean hasServicedDateType() { 
3818          return this != null && this.serviced instanceof DateType;
3819        }
3820
3821        /**
3822         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3823         */
3824        public Period getServicedPeriod() throws FHIRException { 
3825          if (this.serviced == null)
3826            this.serviced = new Period();
3827          if (!(this.serviced instanceof Period))
3828            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
3829          return (Period) this.serviced;
3830        }
3831
3832        public boolean hasServicedPeriod() { 
3833          return this != null && this.serviced instanceof Period;
3834        }
3835
3836        public boolean hasServiced() { 
3837          return this.serviced != null && !this.serviced.isEmpty();
3838        }
3839
3840        /**
3841         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3842         */
3843        public ItemComponent setServiced(DataType value) { 
3844          if (value != null && !(value instanceof DateType || value instanceof Period))
3845            throw new Error("Not the right type for ExplanationOfBenefit.item.serviced[x]: "+value.fhirType());
3846          this.serviced = value;
3847          return this;
3848        }
3849
3850        /**
3851         * @return {@link #location} (Where the product or service was provided.)
3852         */
3853        public DataType getLocation() { 
3854          return this.location;
3855        }
3856
3857        /**
3858         * @return {@link #location} (Where the product or service was provided.)
3859         */
3860        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
3861          if (this.location == null)
3862            this.location = new CodeableConcept();
3863          if (!(this.location instanceof CodeableConcept))
3864            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
3865          return (CodeableConcept) this.location;
3866        }
3867
3868        public boolean hasLocationCodeableConcept() { 
3869          return this != null && this.location instanceof CodeableConcept;
3870        }
3871
3872        /**
3873         * @return {@link #location} (Where the product or service was provided.)
3874         */
3875        public Address getLocationAddress() throws FHIRException { 
3876          if (this.location == null)
3877            this.location = new Address();
3878          if (!(this.location instanceof Address))
3879            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3880          return (Address) this.location;
3881        }
3882
3883        public boolean hasLocationAddress() { 
3884          return this != null && this.location instanceof Address;
3885        }
3886
3887        /**
3888         * @return {@link #location} (Where the product or service was provided.)
3889         */
3890        public Reference getLocationReference() throws FHIRException { 
3891          if (this.location == null)
3892            this.location = new Reference();
3893          if (!(this.location instanceof Reference))
3894            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3895          return (Reference) this.location;
3896        }
3897
3898        public boolean hasLocationReference() { 
3899          return this != null && this.location instanceof Reference;
3900        }
3901
3902        public boolean hasLocation() { 
3903          return this.location != null && !this.location.isEmpty();
3904        }
3905
3906        /**
3907         * @param value {@link #location} (Where the product or service was provided.)
3908         */
3909        public ItemComponent setLocation(DataType value) { 
3910          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
3911            throw new Error("Not the right type for ExplanationOfBenefit.item.location[x]: "+value.fhirType());
3912          this.location = value;
3913          return this;
3914        }
3915
3916        /**
3917         * @return {@link #quantity} (The number of repetitions of a service or product.)
3918         */
3919        public Quantity getQuantity() { 
3920          if (this.quantity == null)
3921            if (Configuration.errorOnAutoCreate())
3922              throw new Error("Attempt to auto-create ItemComponent.quantity");
3923            else if (Configuration.doAutoCreate())
3924              this.quantity = new Quantity(); // cc
3925          return this.quantity;
3926        }
3927
3928        public boolean hasQuantity() { 
3929          return this.quantity != null && !this.quantity.isEmpty();
3930        }
3931
3932        /**
3933         * @param value {@link #quantity} (The number of repetitions of a service or product.)
3934         */
3935        public ItemComponent setQuantity(Quantity value) { 
3936          this.quantity = value;
3937          return this;
3938        }
3939
3940        /**
3941         * @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.)
3942         */
3943        public Money getUnitPrice() { 
3944          if (this.unitPrice == null)
3945            if (Configuration.errorOnAutoCreate())
3946              throw new Error("Attempt to auto-create ItemComponent.unitPrice");
3947            else if (Configuration.doAutoCreate())
3948              this.unitPrice = new Money(); // cc
3949          return this.unitPrice;
3950        }
3951
3952        public boolean hasUnitPrice() { 
3953          return this.unitPrice != null && !this.unitPrice.isEmpty();
3954        }
3955
3956        /**
3957         * @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.)
3958         */
3959        public ItemComponent setUnitPrice(Money value) { 
3960          this.unitPrice = value;
3961          return this;
3962        }
3963
3964        /**
3965         * @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
3966         */
3967        public DecimalType getFactorElement() { 
3968          if (this.factor == null)
3969            if (Configuration.errorOnAutoCreate())
3970              throw new Error("Attempt to auto-create ItemComponent.factor");
3971            else if (Configuration.doAutoCreate())
3972              this.factor = new DecimalType(); // bb
3973          return this.factor;
3974        }
3975
3976        public boolean hasFactorElement() { 
3977          return this.factor != null && !this.factor.isEmpty();
3978        }
3979
3980        public boolean hasFactor() { 
3981          return this.factor != null && !this.factor.isEmpty();
3982        }
3983
3984        /**
3985         * @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
3986         */
3987        public ItemComponent setFactorElement(DecimalType value) { 
3988          this.factor = value;
3989          return this;
3990        }
3991
3992        /**
3993         * @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.
3994         */
3995        public BigDecimal getFactor() { 
3996          return this.factor == null ? null : this.factor.getValue();
3997        }
3998
3999        /**
4000         * @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.
4001         */
4002        public ItemComponent setFactor(BigDecimal value) { 
4003          if (value == null)
4004            this.factor = null;
4005          else {
4006            if (this.factor == null)
4007              this.factor = new DecimalType();
4008            this.factor.setValue(value);
4009          }
4010          return this;
4011        }
4012
4013        /**
4014         * @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.
4015         */
4016        public ItemComponent setFactor(long value) { 
4017              this.factor = new DecimalType();
4018            this.factor.setValue(value);
4019          return this;
4020        }
4021
4022        /**
4023         * @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.
4024         */
4025        public ItemComponent setFactor(double value) { 
4026              this.factor = new DecimalType();
4027            this.factor.setValue(value);
4028          return this;
4029        }
4030
4031        /**
4032         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4033         */
4034        public Money getNet() { 
4035          if (this.net == null)
4036            if (Configuration.errorOnAutoCreate())
4037              throw new Error("Attempt to auto-create ItemComponent.net");
4038            else if (Configuration.doAutoCreate())
4039              this.net = new Money(); // cc
4040          return this.net;
4041        }
4042
4043        public boolean hasNet() { 
4044          return this.net != null && !this.net.isEmpty();
4045        }
4046
4047        /**
4048         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4049         */
4050        public ItemComponent setNet(Money value) { 
4051          this.net = value;
4052          return this;
4053        }
4054
4055        /**
4056         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
4057         */
4058        public List<Reference> getUdi() { 
4059          if (this.udi == null)
4060            this.udi = new ArrayList<Reference>();
4061          return this.udi;
4062        }
4063
4064        /**
4065         * @return Returns a reference to <code>this</code> for easy method chaining
4066         */
4067        public ItemComponent setUdi(List<Reference> theUdi) { 
4068          this.udi = theUdi;
4069          return this;
4070        }
4071
4072        public boolean hasUdi() { 
4073          if (this.udi == null)
4074            return false;
4075          for (Reference item : this.udi)
4076            if (!item.isEmpty())
4077              return true;
4078          return false;
4079        }
4080
4081        public Reference addUdi() { //3
4082          Reference t = new Reference();
4083          if (this.udi == null)
4084            this.udi = new ArrayList<Reference>();
4085          this.udi.add(t);
4086          return t;
4087        }
4088
4089        public ItemComponent addUdi(Reference t) { //3
4090          if (t == null)
4091            return this;
4092          if (this.udi == null)
4093            this.udi = new ArrayList<Reference>();
4094          this.udi.add(t);
4095          return this;
4096        }
4097
4098        /**
4099         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
4100         */
4101        public Reference getUdiFirstRep() { 
4102          if (getUdi().isEmpty()) {
4103            addUdi();
4104          }
4105          return getUdi().get(0);
4106        }
4107
4108        /**
4109         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4110         */
4111        public CodeableConcept getBodySite() { 
4112          if (this.bodySite == null)
4113            if (Configuration.errorOnAutoCreate())
4114              throw new Error("Attempt to auto-create ItemComponent.bodySite");
4115            else if (Configuration.doAutoCreate())
4116              this.bodySite = new CodeableConcept(); // cc
4117          return this.bodySite;
4118        }
4119
4120        public boolean hasBodySite() { 
4121          return this.bodySite != null && !this.bodySite.isEmpty();
4122        }
4123
4124        /**
4125         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4126         */
4127        public ItemComponent setBodySite(CodeableConcept value) { 
4128          this.bodySite = value;
4129          return this;
4130        }
4131
4132        /**
4133         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
4134         */
4135        public List<CodeableConcept> getSubSite() { 
4136          if (this.subSite == null)
4137            this.subSite = new ArrayList<CodeableConcept>();
4138          return this.subSite;
4139        }
4140
4141        /**
4142         * @return Returns a reference to <code>this</code> for easy method chaining
4143         */
4144        public ItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
4145          this.subSite = theSubSite;
4146          return this;
4147        }
4148
4149        public boolean hasSubSite() { 
4150          if (this.subSite == null)
4151            return false;
4152          for (CodeableConcept item : this.subSite)
4153            if (!item.isEmpty())
4154              return true;
4155          return false;
4156        }
4157
4158        public CodeableConcept addSubSite() { //3
4159          CodeableConcept t = new CodeableConcept();
4160          if (this.subSite == null)
4161            this.subSite = new ArrayList<CodeableConcept>();
4162          this.subSite.add(t);
4163          return t;
4164        }
4165
4166        public ItemComponent addSubSite(CodeableConcept t) { //3
4167          if (t == null)
4168            return this;
4169          if (this.subSite == null)
4170            this.subSite = new ArrayList<CodeableConcept>();
4171          this.subSite.add(t);
4172          return this;
4173        }
4174
4175        /**
4176         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist {3}
4177         */
4178        public CodeableConcept getSubSiteFirstRep() { 
4179          if (getSubSite().isEmpty()) {
4180            addSubSite();
4181          }
4182          return getSubSite().get(0);
4183        }
4184
4185        /**
4186         * @return {@link #encounter} (A billed item may include goods or services provided in multiple encounters.)
4187         */
4188        public List<Reference> getEncounter() { 
4189          if (this.encounter == null)
4190            this.encounter = new ArrayList<Reference>();
4191          return this.encounter;
4192        }
4193
4194        /**
4195         * @return Returns a reference to <code>this</code> for easy method chaining
4196         */
4197        public ItemComponent setEncounter(List<Reference> theEncounter) { 
4198          this.encounter = theEncounter;
4199          return this;
4200        }
4201
4202        public boolean hasEncounter() { 
4203          if (this.encounter == null)
4204            return false;
4205          for (Reference item : this.encounter)
4206            if (!item.isEmpty())
4207              return true;
4208          return false;
4209        }
4210
4211        public Reference addEncounter() { //3
4212          Reference t = new Reference();
4213          if (this.encounter == null)
4214            this.encounter = new ArrayList<Reference>();
4215          this.encounter.add(t);
4216          return t;
4217        }
4218
4219        public ItemComponent addEncounter(Reference t) { //3
4220          if (t == null)
4221            return this;
4222          if (this.encounter == null)
4223            this.encounter = new ArrayList<Reference>();
4224          this.encounter.add(t);
4225          return this;
4226        }
4227
4228        /**
4229         * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist {3}
4230         */
4231        public Reference getEncounterFirstRep() { 
4232          if (getEncounter().isEmpty()) {
4233            addEncounter();
4234          }
4235          return getEncounter().get(0);
4236        }
4237
4238        /**
4239         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4240         */
4241        public List<PositiveIntType> getNoteNumber() { 
4242          if (this.noteNumber == null)
4243            this.noteNumber = new ArrayList<PositiveIntType>();
4244          return this.noteNumber;
4245        }
4246
4247        /**
4248         * @return Returns a reference to <code>this</code> for easy method chaining
4249         */
4250        public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
4251          this.noteNumber = theNoteNumber;
4252          return this;
4253        }
4254
4255        public boolean hasNoteNumber() { 
4256          if (this.noteNumber == null)
4257            return false;
4258          for (PositiveIntType item : this.noteNumber)
4259            if (!item.isEmpty())
4260              return true;
4261          return false;
4262        }
4263
4264        /**
4265         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4266         */
4267        public PositiveIntType addNoteNumberElement() {//2 
4268          PositiveIntType t = new PositiveIntType();
4269          if (this.noteNumber == null)
4270            this.noteNumber = new ArrayList<PositiveIntType>();
4271          this.noteNumber.add(t);
4272          return t;
4273        }
4274
4275        /**
4276         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4277         */
4278        public ItemComponent addNoteNumber(int value) { //1
4279          PositiveIntType t = new PositiveIntType();
4280          t.setValue(value);
4281          if (this.noteNumber == null)
4282            this.noteNumber = new ArrayList<PositiveIntType>();
4283          this.noteNumber.add(t);
4284          return this;
4285        }
4286
4287        /**
4288         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4289         */
4290        public boolean hasNoteNumber(int value) { 
4291          if (this.noteNumber == null)
4292            return false;
4293          for (PositiveIntType v : this.noteNumber)
4294            if (v.getValue().equals(value)) // positiveInt
4295              return true;
4296          return false;
4297        }
4298
4299        /**
4300         * @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.)
4301         */
4302        public List<AdjudicationComponent> getAdjudication() { 
4303          if (this.adjudication == null)
4304            this.adjudication = new ArrayList<AdjudicationComponent>();
4305          return this.adjudication;
4306        }
4307
4308        /**
4309         * @return Returns a reference to <code>this</code> for easy method chaining
4310         */
4311        public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
4312          this.adjudication = theAdjudication;
4313          return this;
4314        }
4315
4316        public boolean hasAdjudication() { 
4317          if (this.adjudication == null)
4318            return false;
4319          for (AdjudicationComponent item : this.adjudication)
4320            if (!item.isEmpty())
4321              return true;
4322          return false;
4323        }
4324
4325        public AdjudicationComponent addAdjudication() { //3
4326          AdjudicationComponent t = new AdjudicationComponent();
4327          if (this.adjudication == null)
4328            this.adjudication = new ArrayList<AdjudicationComponent>();
4329          this.adjudication.add(t);
4330          return t;
4331        }
4332
4333        public ItemComponent addAdjudication(AdjudicationComponent t) { //3
4334          if (t == null)
4335            return this;
4336          if (this.adjudication == null)
4337            this.adjudication = new ArrayList<AdjudicationComponent>();
4338          this.adjudication.add(t);
4339          return this;
4340        }
4341
4342        /**
4343         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
4344         */
4345        public AdjudicationComponent getAdjudicationFirstRep() { 
4346          if (getAdjudication().isEmpty()) {
4347            addAdjudication();
4348          }
4349          return getAdjudication().get(0);
4350        }
4351
4352        /**
4353         * @return {@link #detail} (Second-tier of goods and services.)
4354         */
4355        public List<DetailComponent> getDetail() { 
4356          if (this.detail == null)
4357            this.detail = new ArrayList<DetailComponent>();
4358          return this.detail;
4359        }
4360
4361        /**
4362         * @return Returns a reference to <code>this</code> for easy method chaining
4363         */
4364        public ItemComponent setDetail(List<DetailComponent> theDetail) { 
4365          this.detail = theDetail;
4366          return this;
4367        }
4368
4369        public boolean hasDetail() { 
4370          if (this.detail == null)
4371            return false;
4372          for (DetailComponent item : this.detail)
4373            if (!item.isEmpty())
4374              return true;
4375          return false;
4376        }
4377
4378        public DetailComponent addDetail() { //3
4379          DetailComponent t = new DetailComponent();
4380          if (this.detail == null)
4381            this.detail = new ArrayList<DetailComponent>();
4382          this.detail.add(t);
4383          return t;
4384        }
4385
4386        public ItemComponent addDetail(DetailComponent t) { //3
4387          if (t == null)
4388            return this;
4389          if (this.detail == null)
4390            this.detail = new ArrayList<DetailComponent>();
4391          this.detail.add(t);
4392          return this;
4393        }
4394
4395        /**
4396         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist {3}
4397         */
4398        public DetailComponent getDetailFirstRep() { 
4399          if (getDetail().isEmpty()) {
4400            addDetail();
4401          }
4402          return getDetail().get(0);
4403        }
4404
4405        protected void listChildren(List<Property> children) {
4406          super.listChildren(children);
4407          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
4408          children.add(new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence));
4409          children.add(new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence));
4410          children.add(new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence));
4411          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));
4412          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
4413          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
4414          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService));
4415          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));
4416          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
4417          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));
4418          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
4419          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
4420          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));
4421          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));
4422          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
4423          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
4424          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
4425          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));
4426          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));
4427          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));
4428          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));
4429          children.add(new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
4430        }
4431
4432        @Override
4433        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4434          switch (_hash) {
4435          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence);
4436          case 1070083823: /*careTeamSequence*/  return new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence);
4437          case -909769262: /*diagnosisSequence*/  return new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence);
4438          case -808920140: /*procedureSequence*/  return new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence);
4439          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);
4440          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
4441          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);
4442          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService);
4443          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);
4444          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
4445          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);
4446          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);
4447          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);
4448          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);
4449          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4450          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4451          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept", "Where the product or service was provided.", 0, 1, location);
4452          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address", "Where the product or service was provided.", 0, 1, location);
4453          case 755866390: /*locationReference*/  return new Property("location[x]", "Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4454          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
4455          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);
4456          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);
4457          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);
4458          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
4459          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
4460          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);
4461          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);
4462          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);
4463          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);
4464          case -1335224239: /*detail*/  return new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail);
4465          default: return super.getNamedProperty(_hash, _name, _checkValid);
4466          }
4467
4468        }
4469
4470      @Override
4471      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4472        switch (hash) {
4473        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
4474        case 1070083823: /*careTeamSequence*/ return this.careTeamSequence == null ? new Base[0] : this.careTeamSequence.toArray(new Base[this.careTeamSequence.size()]); // PositiveIntType
4475        case -909769262: /*diagnosisSequence*/ return this.diagnosisSequence == null ? new Base[0] : this.diagnosisSequence.toArray(new Base[this.diagnosisSequence.size()]); // PositiveIntType
4476        case -808920140: /*procedureSequence*/ return this.procedureSequence == null ? new Base[0] : this.procedureSequence.toArray(new Base[this.procedureSequence.size()]); // PositiveIntType
4477        case -702585587: /*informationSequence*/ return this.informationSequence == null ? new Base[0] : this.informationSequence.toArray(new Base[this.informationSequence.size()]); // PositiveIntType
4478        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
4479        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4480        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
4481        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
4482        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
4483        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // DataType
4484        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // DataType
4485        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
4486        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
4487        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
4488        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
4489        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
4490        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
4491        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
4492        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
4493        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
4494        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
4495        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
4496        default: return super.getProperty(hash, name, checkValid);
4497        }
4498
4499      }
4500
4501      @Override
4502      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4503        switch (hash) {
4504        case 1349547969: // sequence
4505          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
4506          return value;
4507        case 1070083823: // careTeamSequence
4508          this.getCareTeamSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4509          return value;
4510        case -909769262: // diagnosisSequence
4511          this.getDiagnosisSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4512          return value;
4513        case -808920140: // procedureSequence
4514          this.getProcedureSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4515          return value;
4516        case -702585587: // informationSequence
4517          this.getInformationSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4518          return value;
4519        case 1099842588: // revenue
4520          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4521          return value;
4522        case 50511102: // category
4523          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4524          return value;
4525        case 1957227299: // productOrService
4526          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4527          return value;
4528        case -615513385: // modifier
4529          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4530          return value;
4531        case 1010065041: // programCode
4532          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4533          return value;
4534        case 1379209295: // serviced
4535          this.serviced = TypeConvertor.castToType(value); // DataType
4536          return value;
4537        case 1901043637: // location
4538          this.location = TypeConvertor.castToType(value); // DataType
4539          return value;
4540        case -1285004149: // quantity
4541          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
4542          return value;
4543        case -486196699: // unitPrice
4544          this.unitPrice = TypeConvertor.castToMoney(value); // Money
4545          return value;
4546        case -1282148017: // factor
4547          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
4548          return value;
4549        case 108957: // net
4550          this.net = TypeConvertor.castToMoney(value); // Money
4551          return value;
4552        case 115642: // udi
4553          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
4554          return value;
4555        case 1702620169: // bodySite
4556          this.bodySite = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4557          return value;
4558        case -1868566105: // subSite
4559          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4560          return value;
4561        case 1524132147: // encounter
4562          this.getEncounter().add(TypeConvertor.castToReference(value)); // Reference
4563          return value;
4564        case -1110033957: // noteNumber
4565          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4566          return value;
4567        case -231349275: // adjudication
4568          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
4569          return value;
4570        case -1335224239: // detail
4571          this.getDetail().add((DetailComponent) value); // DetailComponent
4572          return value;
4573        default: return super.setProperty(hash, name, value);
4574        }
4575
4576      }
4577
4578      @Override
4579      public Base setProperty(String name, Base value) throws FHIRException {
4580        if (name.equals("sequence")) {
4581          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
4582        } else if (name.equals("careTeamSequence")) {
4583          this.getCareTeamSequence().add(TypeConvertor.castToPositiveInt(value));
4584        } else if (name.equals("diagnosisSequence")) {
4585          this.getDiagnosisSequence().add(TypeConvertor.castToPositiveInt(value));
4586        } else if (name.equals("procedureSequence")) {
4587          this.getProcedureSequence().add(TypeConvertor.castToPositiveInt(value));
4588        } else if (name.equals("informationSequence")) {
4589          this.getInformationSequence().add(TypeConvertor.castToPositiveInt(value));
4590        } else if (name.equals("revenue")) {
4591          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4592        } else if (name.equals("category")) {
4593          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4594        } else if (name.equals("productOrService")) {
4595          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4596        } else if (name.equals("modifier")) {
4597          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
4598        } else if (name.equals("programCode")) {
4599          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
4600        } else if (name.equals("serviced[x]")) {
4601          this.serviced = TypeConvertor.castToType(value); // DataType
4602        } else if (name.equals("location[x]")) {
4603          this.location = TypeConvertor.castToType(value); // DataType
4604        } else if (name.equals("quantity")) {
4605          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
4606        } else if (name.equals("unitPrice")) {
4607          this.unitPrice = TypeConvertor.castToMoney(value); // Money
4608        } else if (name.equals("factor")) {
4609          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
4610        } else if (name.equals("net")) {
4611          this.net = TypeConvertor.castToMoney(value); // Money
4612        } else if (name.equals("udi")) {
4613          this.getUdi().add(TypeConvertor.castToReference(value));
4614        } else if (name.equals("bodySite")) {
4615          this.bodySite = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4616        } else if (name.equals("subSite")) {
4617          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value));
4618        } else if (name.equals("encounter")) {
4619          this.getEncounter().add(TypeConvertor.castToReference(value));
4620        } else if (name.equals("noteNumber")) {
4621          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
4622        } else if (name.equals("adjudication")) {
4623          this.getAdjudication().add((AdjudicationComponent) value);
4624        } else if (name.equals("detail")) {
4625          this.getDetail().add((DetailComponent) value);
4626        } else
4627          return super.setProperty(name, value);
4628        return value;
4629      }
4630
4631      @Override
4632      public Base makeProperty(int hash, String name) throws FHIRException {
4633        switch (hash) {
4634        case 1349547969:  return getSequenceElement();
4635        case 1070083823:  return addCareTeamSequenceElement();
4636        case -909769262:  return addDiagnosisSequenceElement();
4637        case -808920140:  return addProcedureSequenceElement();
4638        case -702585587:  return addInformationSequenceElement();
4639        case 1099842588:  return getRevenue();
4640        case 50511102:  return getCategory();
4641        case 1957227299:  return getProductOrService();
4642        case -615513385:  return addModifier(); 
4643        case 1010065041:  return addProgramCode(); 
4644        case -1927922223:  return getServiced();
4645        case 1379209295:  return getServiced();
4646        case 552316075:  return getLocation();
4647        case 1901043637:  return getLocation();
4648        case -1285004149:  return getQuantity();
4649        case -486196699:  return getUnitPrice();
4650        case -1282148017:  return getFactorElement();
4651        case 108957:  return getNet();
4652        case 115642:  return addUdi(); 
4653        case 1702620169:  return getBodySite();
4654        case -1868566105:  return addSubSite(); 
4655        case 1524132147:  return addEncounter(); 
4656        case -1110033957:  return addNoteNumberElement();
4657        case -231349275:  return addAdjudication(); 
4658        case -1335224239:  return addDetail(); 
4659        default: return super.makeProperty(hash, name);
4660        }
4661
4662      }
4663
4664      @Override
4665      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4666        switch (hash) {
4667        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
4668        case 1070083823: /*careTeamSequence*/ return new String[] {"positiveInt"};
4669        case -909769262: /*diagnosisSequence*/ return new String[] {"positiveInt"};
4670        case -808920140: /*procedureSequence*/ return new String[] {"positiveInt"};
4671        case -702585587: /*informationSequence*/ return new String[] {"positiveInt"};
4672        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
4673        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4674        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
4675        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
4676        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
4677        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
4678        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
4679        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
4680        case -486196699: /*unitPrice*/ return new String[] {"Money"};
4681        case -1282148017: /*factor*/ return new String[] {"decimal"};
4682        case 108957: /*net*/ return new String[] {"Money"};
4683        case 115642: /*udi*/ return new String[] {"Reference"};
4684        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
4685        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
4686        case 1524132147: /*encounter*/ return new String[] {"Reference"};
4687        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
4688        case -231349275: /*adjudication*/ return new String[] {};
4689        case -1335224239: /*detail*/ return new String[] {};
4690        default: return super.getTypesForProperty(hash, name);
4691        }
4692
4693      }
4694
4695      @Override
4696      public Base addChild(String name) throws FHIRException {
4697        if (name.equals("sequence")) {
4698          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.sequence");
4699        }
4700        else if (name.equals("careTeamSequence")) {
4701          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.careTeamSequence");
4702        }
4703        else if (name.equals("diagnosisSequence")) {
4704          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.diagnosisSequence");
4705        }
4706        else if (name.equals("procedureSequence")) {
4707          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.procedureSequence");
4708        }
4709        else if (name.equals("informationSequence")) {
4710          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.informationSequence");
4711        }
4712        else if (name.equals("revenue")) {
4713          this.revenue = new CodeableConcept();
4714          return this.revenue;
4715        }
4716        else if (name.equals("category")) {
4717          this.category = new CodeableConcept();
4718          return this.category;
4719        }
4720        else if (name.equals("productOrService")) {
4721          this.productOrService = new CodeableConcept();
4722          return this.productOrService;
4723        }
4724        else if (name.equals("modifier")) {
4725          return addModifier();
4726        }
4727        else if (name.equals("programCode")) {
4728          return addProgramCode();
4729        }
4730        else if (name.equals("servicedDate")) {
4731          this.serviced = new DateType();
4732          return this.serviced;
4733        }
4734        else if (name.equals("servicedPeriod")) {
4735          this.serviced = new Period();
4736          return this.serviced;
4737        }
4738        else if (name.equals("locationCodeableConcept")) {
4739          this.location = new CodeableConcept();
4740          return this.location;
4741        }
4742        else if (name.equals("locationAddress")) {
4743          this.location = new Address();
4744          return this.location;
4745        }
4746        else if (name.equals("locationReference")) {
4747          this.location = new Reference();
4748          return this.location;
4749        }
4750        else if (name.equals("quantity")) {
4751          this.quantity = new Quantity();
4752          return this.quantity;
4753        }
4754        else if (name.equals("unitPrice")) {
4755          this.unitPrice = new Money();
4756          return this.unitPrice;
4757        }
4758        else if (name.equals("factor")) {
4759          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.factor");
4760        }
4761        else if (name.equals("net")) {
4762          this.net = new Money();
4763          return this.net;
4764        }
4765        else if (name.equals("udi")) {
4766          return addUdi();
4767        }
4768        else if (name.equals("bodySite")) {
4769          this.bodySite = new CodeableConcept();
4770          return this.bodySite;
4771        }
4772        else if (name.equals("subSite")) {
4773          return addSubSite();
4774        }
4775        else if (name.equals("encounter")) {
4776          return addEncounter();
4777        }
4778        else if (name.equals("noteNumber")) {
4779          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.noteNumber");
4780        }
4781        else if (name.equals("adjudication")) {
4782          return addAdjudication();
4783        }
4784        else if (name.equals("detail")) {
4785          return addDetail();
4786        }
4787        else
4788          return super.addChild(name);
4789      }
4790
4791      public ItemComponent copy() {
4792        ItemComponent dst = new ItemComponent();
4793        copyValues(dst);
4794        return dst;
4795      }
4796
4797      public void copyValues(ItemComponent dst) {
4798        super.copyValues(dst);
4799        dst.sequence = sequence == null ? null : sequence.copy();
4800        if (careTeamSequence != null) {
4801          dst.careTeamSequence = new ArrayList<PositiveIntType>();
4802          for (PositiveIntType i : careTeamSequence)
4803            dst.careTeamSequence.add(i.copy());
4804        };
4805        if (diagnosisSequence != null) {
4806          dst.diagnosisSequence = new ArrayList<PositiveIntType>();
4807          for (PositiveIntType i : diagnosisSequence)
4808            dst.diagnosisSequence.add(i.copy());
4809        };
4810        if (procedureSequence != null) {
4811          dst.procedureSequence = new ArrayList<PositiveIntType>();
4812          for (PositiveIntType i : procedureSequence)
4813            dst.procedureSequence.add(i.copy());
4814        };
4815        if (informationSequence != null) {
4816          dst.informationSequence = new ArrayList<PositiveIntType>();
4817          for (PositiveIntType i : informationSequence)
4818            dst.informationSequence.add(i.copy());
4819        };
4820        dst.revenue = revenue == null ? null : revenue.copy();
4821        dst.category = category == null ? null : category.copy();
4822        dst.productOrService = productOrService == null ? null : productOrService.copy();
4823        if (modifier != null) {
4824          dst.modifier = new ArrayList<CodeableConcept>();
4825          for (CodeableConcept i : modifier)
4826            dst.modifier.add(i.copy());
4827        };
4828        if (programCode != null) {
4829          dst.programCode = new ArrayList<CodeableConcept>();
4830          for (CodeableConcept i : programCode)
4831            dst.programCode.add(i.copy());
4832        };
4833        dst.serviced = serviced == null ? null : serviced.copy();
4834        dst.location = location == null ? null : location.copy();
4835        dst.quantity = quantity == null ? null : quantity.copy();
4836        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
4837        dst.factor = factor == null ? null : factor.copy();
4838        dst.net = net == null ? null : net.copy();
4839        if (udi != null) {
4840          dst.udi = new ArrayList<Reference>();
4841          for (Reference i : udi)
4842            dst.udi.add(i.copy());
4843        };
4844        dst.bodySite = bodySite == null ? null : bodySite.copy();
4845        if (subSite != null) {
4846          dst.subSite = new ArrayList<CodeableConcept>();
4847          for (CodeableConcept i : subSite)
4848            dst.subSite.add(i.copy());
4849        };
4850        if (encounter != null) {
4851          dst.encounter = new ArrayList<Reference>();
4852          for (Reference i : encounter)
4853            dst.encounter.add(i.copy());
4854        };
4855        if (noteNumber != null) {
4856          dst.noteNumber = new ArrayList<PositiveIntType>();
4857          for (PositiveIntType i : noteNumber)
4858            dst.noteNumber.add(i.copy());
4859        };
4860        if (adjudication != null) {
4861          dst.adjudication = new ArrayList<AdjudicationComponent>();
4862          for (AdjudicationComponent i : adjudication)
4863            dst.adjudication.add(i.copy());
4864        };
4865        if (detail != null) {
4866          dst.detail = new ArrayList<DetailComponent>();
4867          for (DetailComponent i : detail)
4868            dst.detail.add(i.copy());
4869        };
4870      }
4871
4872      @Override
4873      public boolean equalsDeep(Base other_) {
4874        if (!super.equalsDeep(other_))
4875          return false;
4876        if (!(other_ instanceof ItemComponent))
4877          return false;
4878        ItemComponent o = (ItemComponent) other_;
4879        return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamSequence, o.careTeamSequence, true)
4880           && compareDeep(diagnosisSequence, o.diagnosisSequence, true) && compareDeep(procedureSequence, o.procedureSequence, true)
4881           && compareDeep(informationSequence, o.informationSequence, true) && compareDeep(revenue, o.revenue, true)
4882           && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
4883           && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true)
4884           && compareDeep(location, o.location, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
4885           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
4886           && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true) && compareDeep(encounter, o.encounter, true)
4887           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
4888           && compareDeep(detail, o.detail, true);
4889      }
4890
4891      @Override
4892      public boolean equalsShallow(Base other_) {
4893        if (!super.equalsShallow(other_))
4894          return false;
4895        if (!(other_ instanceof ItemComponent))
4896          return false;
4897        ItemComponent o = (ItemComponent) other_;
4898        return compareValues(sequence, o.sequence, true) && compareValues(careTeamSequence, o.careTeamSequence, true)
4899           && compareValues(diagnosisSequence, o.diagnosisSequence, true) && compareValues(procedureSequence, o.procedureSequence, true)
4900           && compareValues(informationSequence, o.informationSequence, true) && compareValues(factor, o.factor, true)
4901           && compareValues(noteNumber, o.noteNumber, true);
4902      }
4903
4904      public boolean isEmpty() {
4905        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamSequence
4906          , diagnosisSequence, procedureSequence, informationSequence, revenue, category, productOrService
4907          , modifier, programCode, serviced, location, quantity, unitPrice, factor, net
4908          , udi, bodySite, subSite, encounter, noteNumber, adjudication, detail);
4909      }
4910
4911  public String fhirType() {
4912    return "ExplanationOfBenefit.item";
4913
4914  }
4915
4916  }
4917
4918    @Block()
4919    public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
4920        /**
4921         * 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.
4922         */
4923        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
4924        @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." )
4925        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
4926        protected CodeableConcept category;
4927
4928        /**
4929         * A code supporting the understanding of the adjudication result and explaining variance from expected amount.
4930         */
4931        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
4932        @Description(shortDefinition="Explanation of adjudication outcome", formalDefinition="A code supporting the understanding of the adjudication result and explaining variance from expected amount." )
4933        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-reason")
4934        protected CodeableConcept reason;
4935
4936        /**
4937         * Monetary amount associated with the category.
4938         */
4939        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
4940        @Description(shortDefinition="Monetary amount", formalDefinition="Monetary amount associated with the category." )
4941        protected Money amount;
4942
4943        /**
4944         * A non-monetary value associated with the category. Mutually exclusive to the amount element above.
4945         */
4946        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
4947        @Description(shortDefinition="Non-monitary value", formalDefinition="A non-monetary value associated with the category. Mutually exclusive to the amount element above." )
4948        protected DecimalType value;
4949
4950        private static final long serialVersionUID = 1559898786L;
4951
4952    /**
4953     * Constructor
4954     */
4955      public AdjudicationComponent() {
4956        super();
4957      }
4958
4959    /**
4960     * Constructor
4961     */
4962      public AdjudicationComponent(CodeableConcept category) {
4963        super();
4964        this.setCategory(category);
4965      }
4966
4967        /**
4968         * @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.)
4969         */
4970        public CodeableConcept getCategory() { 
4971          if (this.category == null)
4972            if (Configuration.errorOnAutoCreate())
4973              throw new Error("Attempt to auto-create AdjudicationComponent.category");
4974            else if (Configuration.doAutoCreate())
4975              this.category = new CodeableConcept(); // cc
4976          return this.category;
4977        }
4978
4979        public boolean hasCategory() { 
4980          return this.category != null && !this.category.isEmpty();
4981        }
4982
4983        /**
4984         * @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.)
4985         */
4986        public AdjudicationComponent setCategory(CodeableConcept value) { 
4987          this.category = value;
4988          return this;
4989        }
4990
4991        /**
4992         * @return {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
4993         */
4994        public CodeableConcept getReason() { 
4995          if (this.reason == null)
4996            if (Configuration.errorOnAutoCreate())
4997              throw new Error("Attempt to auto-create AdjudicationComponent.reason");
4998            else if (Configuration.doAutoCreate())
4999              this.reason = new CodeableConcept(); // cc
5000          return this.reason;
5001        }
5002
5003        public boolean hasReason() { 
5004          return this.reason != null && !this.reason.isEmpty();
5005        }
5006
5007        /**
5008         * @param value {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5009         */
5010        public AdjudicationComponent setReason(CodeableConcept value) { 
5011          this.reason = value;
5012          return this;
5013        }
5014
5015        /**
5016         * @return {@link #amount} (Monetary amount associated with the category.)
5017         */
5018        public Money getAmount() { 
5019          if (this.amount == null)
5020            if (Configuration.errorOnAutoCreate())
5021              throw new Error("Attempt to auto-create AdjudicationComponent.amount");
5022            else if (Configuration.doAutoCreate())
5023              this.amount = new Money(); // cc
5024          return this.amount;
5025        }
5026
5027        public boolean hasAmount() { 
5028          return this.amount != null && !this.amount.isEmpty();
5029        }
5030
5031        /**
5032         * @param value {@link #amount} (Monetary amount associated with the category.)
5033         */
5034        public AdjudicationComponent setAmount(Money value) { 
5035          this.amount = value;
5036          return this;
5037        }
5038
5039        /**
5040         * @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
5041         */
5042        public DecimalType getValueElement() { 
5043          if (this.value == null)
5044            if (Configuration.errorOnAutoCreate())
5045              throw new Error("Attempt to auto-create AdjudicationComponent.value");
5046            else if (Configuration.doAutoCreate())
5047              this.value = new DecimalType(); // bb
5048          return this.value;
5049        }
5050
5051        public boolean hasValueElement() { 
5052          return this.value != null && !this.value.isEmpty();
5053        }
5054
5055        public boolean hasValue() { 
5056          return this.value != null && !this.value.isEmpty();
5057        }
5058
5059        /**
5060         * @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
5061         */
5062        public AdjudicationComponent setValueElement(DecimalType value) { 
5063          this.value = value;
5064          return this;
5065        }
5066
5067        /**
5068         * @return A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5069         */
5070        public BigDecimal getValue() { 
5071          return this.value == null ? null : this.value.getValue();
5072        }
5073
5074        /**
5075         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5076         */
5077        public AdjudicationComponent setValue(BigDecimal value) { 
5078          if (value == null)
5079            this.value = null;
5080          else {
5081            if (this.value == null)
5082              this.value = new DecimalType();
5083            this.value.setValue(value);
5084          }
5085          return this;
5086        }
5087
5088        /**
5089         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5090         */
5091        public AdjudicationComponent setValue(long value) { 
5092              this.value = new DecimalType();
5093            this.value.setValue(value);
5094          return this;
5095        }
5096
5097        /**
5098         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5099         */
5100        public AdjudicationComponent setValue(double value) { 
5101              this.value = new DecimalType();
5102            this.value.setValue(value);
5103          return this;
5104        }
5105
5106        protected void listChildren(List<Property> children) {
5107          super.listChildren(children);
5108          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));
5109          children.add(new Property("reason", "CodeableConcept", "A code supporting the understanding of the adjudication result and explaining variance from expected amount.", 0, 1, reason));
5110          children.add(new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount));
5111          children.add(new Property("value", "decimal", "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1, value));
5112        }
5113
5114        @Override
5115        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5116          switch (_hash) {
5117          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);
5118          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);
5119          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount);
5120          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);
5121          default: return super.getNamedProperty(_hash, _name, _checkValid);
5122          }
5123
5124        }
5125
5126      @Override
5127      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5128        switch (hash) {
5129        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
5130        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
5131        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
5132        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
5133        default: return super.getProperty(hash, name, checkValid);
5134        }
5135
5136      }
5137
5138      @Override
5139      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5140        switch (hash) {
5141        case 50511102: // category
5142          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5143          return value;
5144        case -934964668: // reason
5145          this.reason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5146          return value;
5147        case -1413853096: // amount
5148          this.amount = TypeConvertor.castToMoney(value); // Money
5149          return value;
5150        case 111972721: // value
5151          this.value = TypeConvertor.castToDecimal(value); // DecimalType
5152          return value;
5153        default: return super.setProperty(hash, name, value);
5154        }
5155
5156      }
5157
5158      @Override
5159      public Base setProperty(String name, Base value) throws FHIRException {
5160        if (name.equals("category")) {
5161          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5162        } else if (name.equals("reason")) {
5163          this.reason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5164        } else if (name.equals("amount")) {
5165          this.amount = TypeConvertor.castToMoney(value); // Money
5166        } else if (name.equals("value")) {
5167          this.value = TypeConvertor.castToDecimal(value); // DecimalType
5168        } else
5169          return super.setProperty(name, value);
5170        return value;
5171      }
5172
5173      @Override
5174      public Base makeProperty(int hash, String name) throws FHIRException {
5175        switch (hash) {
5176        case 50511102:  return getCategory();
5177        case -934964668:  return getReason();
5178        case -1413853096:  return getAmount();
5179        case 111972721:  return getValueElement();
5180        default: return super.makeProperty(hash, name);
5181        }
5182
5183      }
5184
5185      @Override
5186      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5187        switch (hash) {
5188        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5189        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
5190        case -1413853096: /*amount*/ return new String[] {"Money"};
5191        case 111972721: /*value*/ return new String[] {"decimal"};
5192        default: return super.getTypesForProperty(hash, name);
5193        }
5194
5195      }
5196
5197      @Override
5198      public Base addChild(String name) throws FHIRException {
5199        if (name.equals("category")) {
5200          this.category = new CodeableConcept();
5201          return this.category;
5202        }
5203        else if (name.equals("reason")) {
5204          this.reason = new CodeableConcept();
5205          return this.reason;
5206        }
5207        else if (name.equals("amount")) {
5208          this.amount = new Money();
5209          return this.amount;
5210        }
5211        else if (name.equals("value")) {
5212          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.adjudication.value");
5213        }
5214        else
5215          return super.addChild(name);
5216      }
5217
5218      public AdjudicationComponent copy() {
5219        AdjudicationComponent dst = new AdjudicationComponent();
5220        copyValues(dst);
5221        return dst;
5222      }
5223
5224      public void copyValues(AdjudicationComponent dst) {
5225        super.copyValues(dst);
5226        dst.category = category == null ? null : category.copy();
5227        dst.reason = reason == null ? null : reason.copy();
5228        dst.amount = amount == null ? null : amount.copy();
5229        dst.value = value == null ? null : value.copy();
5230      }
5231
5232      @Override
5233      public boolean equalsDeep(Base other_) {
5234        if (!super.equalsDeep(other_))
5235          return false;
5236        if (!(other_ instanceof AdjudicationComponent))
5237          return false;
5238        AdjudicationComponent o = (AdjudicationComponent) other_;
5239        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
5240           && compareDeep(value, o.value, true);
5241      }
5242
5243      @Override
5244      public boolean equalsShallow(Base other_) {
5245        if (!super.equalsShallow(other_))
5246          return false;
5247        if (!(other_ instanceof AdjudicationComponent))
5248          return false;
5249        AdjudicationComponent o = (AdjudicationComponent) other_;
5250        return compareValues(value, o.value, true);
5251      }
5252
5253      public boolean isEmpty() {
5254        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount
5255          , value);
5256      }
5257
5258  public String fhirType() {
5259    return "ExplanationOfBenefit.item.adjudication";
5260
5261  }
5262
5263  }
5264
5265    @Block()
5266    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
5267        /**
5268         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5269         */
5270        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
5271        @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." )
5272        protected PositiveIntType sequence;
5273
5274        /**
5275         * The type of revenue or cost center providing the product and/or service.
5276         */
5277        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5278        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
5279        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
5280        protected CodeableConcept revenue;
5281
5282        /**
5283         * Code to identify the general type of benefits under which products and services are provided.
5284         */
5285        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
5286        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
5287        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
5288        protected CodeableConcept category;
5289
5290        /**
5291         * When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.
5292         */
5293        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
5294        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item." )
5295        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
5296        protected CodeableConcept productOrService;
5297
5298        /**
5299         * Item typification or modifiers codes to convey additional context for the product or service.
5300         */
5301        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5302        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
5303        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
5304        protected List<CodeableConcept> modifier;
5305
5306        /**
5307         * Identifies the program under which this may be recovered.
5308         */
5309        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5310        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
5311        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
5312        protected List<CodeableConcept> programCode;
5313
5314        /**
5315         * The number of repetitions of a service or product.
5316         */
5317        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
5318        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
5319        protected Quantity quantity;
5320
5321        /**
5322         * 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.
5323         */
5324        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
5325        @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." )
5326        protected Money unitPrice;
5327
5328        /**
5329         * 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.
5330         */
5331        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
5332        @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." )
5333        protected DecimalType factor;
5334
5335        /**
5336         * The quantity times the unit price for an additional service or product or charge.
5337         */
5338        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
5339        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
5340        protected Money net;
5341
5342        /**
5343         * Unique Device Identifiers associated with this line item.
5344         */
5345        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5346        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
5347        protected List<Reference> udi;
5348
5349        /**
5350         * The numbers associated with notes below which apply to the adjudication of this item.
5351         */
5352        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5353        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
5354        protected List<PositiveIntType> noteNumber;
5355
5356        /**
5357         * The adjudication results.
5358         */
5359        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5360        @Description(shortDefinition="Detail level adjudication details", formalDefinition="The adjudication results." )
5361        protected List<AdjudicationComponent> adjudication;
5362
5363        /**
5364         * Third-tier of goods and services.
5365         */
5366        @Child(name = "subDetail", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5367        @Description(shortDefinition="Additional items", formalDefinition="Third-tier of goods and services." )
5368        protected List<SubDetailComponent> subDetail;
5369
5370        private static final long serialVersionUID = -318460001L;
5371
5372    /**
5373     * Constructor
5374     */
5375      public DetailComponent() {
5376        super();
5377      }
5378
5379    /**
5380     * Constructor
5381     */
5382      public DetailComponent(int sequence, CodeableConcept productOrService) {
5383        super();
5384        this.setSequence(sequence);
5385        this.setProductOrService(productOrService);
5386      }
5387
5388        /**
5389         * @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
5390         */
5391        public PositiveIntType getSequenceElement() { 
5392          if (this.sequence == null)
5393            if (Configuration.errorOnAutoCreate())
5394              throw new Error("Attempt to auto-create DetailComponent.sequence");
5395            else if (Configuration.doAutoCreate())
5396              this.sequence = new PositiveIntType(); // bb
5397          return this.sequence;
5398        }
5399
5400        public boolean hasSequenceElement() { 
5401          return this.sequence != null && !this.sequence.isEmpty();
5402        }
5403
5404        public boolean hasSequence() { 
5405          return this.sequence != null && !this.sequence.isEmpty();
5406        }
5407
5408        /**
5409         * @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
5410         */
5411        public DetailComponent setSequenceElement(PositiveIntType value) { 
5412          this.sequence = value;
5413          return this;
5414        }
5415
5416        /**
5417         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5418         */
5419        public int getSequence() { 
5420          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
5421        }
5422
5423        /**
5424         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5425         */
5426        public DetailComponent setSequence(int value) { 
5427            if (this.sequence == null)
5428              this.sequence = new PositiveIntType();
5429            this.sequence.setValue(value);
5430          return this;
5431        }
5432
5433        /**
5434         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5435         */
5436        public CodeableConcept getRevenue() { 
5437          if (this.revenue == null)
5438            if (Configuration.errorOnAutoCreate())
5439              throw new Error("Attempt to auto-create DetailComponent.revenue");
5440            else if (Configuration.doAutoCreate())
5441              this.revenue = new CodeableConcept(); // cc
5442          return this.revenue;
5443        }
5444
5445        public boolean hasRevenue() { 
5446          return this.revenue != null && !this.revenue.isEmpty();
5447        }
5448
5449        /**
5450         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5451         */
5452        public DetailComponent setRevenue(CodeableConcept value) { 
5453          this.revenue = value;
5454          return this;
5455        }
5456
5457        /**
5458         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5459         */
5460        public CodeableConcept getCategory() { 
5461          if (this.category == null)
5462            if (Configuration.errorOnAutoCreate())
5463              throw new Error("Attempt to auto-create DetailComponent.category");
5464            else if (Configuration.doAutoCreate())
5465              this.category = new CodeableConcept(); // cc
5466          return this.category;
5467        }
5468
5469        public boolean hasCategory() { 
5470          return this.category != null && !this.category.isEmpty();
5471        }
5472
5473        /**
5474         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5475         */
5476        public DetailComponent setCategory(CodeableConcept value) { 
5477          this.category = value;
5478          return this;
5479        }
5480
5481        /**
5482         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
5483         */
5484        public CodeableConcept getProductOrService() { 
5485          if (this.productOrService == null)
5486            if (Configuration.errorOnAutoCreate())
5487              throw new Error("Attempt to auto-create DetailComponent.productOrService");
5488            else if (Configuration.doAutoCreate())
5489              this.productOrService = new CodeableConcept(); // cc
5490          return this.productOrService;
5491        }
5492
5493        public boolean hasProductOrService() { 
5494          return this.productOrService != null && !this.productOrService.isEmpty();
5495        }
5496
5497        /**
5498         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
5499         */
5500        public DetailComponent setProductOrService(CodeableConcept value) { 
5501          this.productOrService = value;
5502          return this;
5503        }
5504
5505        /**
5506         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
5507         */
5508        public List<CodeableConcept> getModifier() { 
5509          if (this.modifier == null)
5510            this.modifier = new ArrayList<CodeableConcept>();
5511          return this.modifier;
5512        }
5513
5514        /**
5515         * @return Returns a reference to <code>this</code> for easy method chaining
5516         */
5517        public DetailComponent setModifier(List<CodeableConcept> theModifier) { 
5518          this.modifier = theModifier;
5519          return this;
5520        }
5521
5522        public boolean hasModifier() { 
5523          if (this.modifier == null)
5524            return false;
5525          for (CodeableConcept item : this.modifier)
5526            if (!item.isEmpty())
5527              return true;
5528          return false;
5529        }
5530
5531        public CodeableConcept addModifier() { //3
5532          CodeableConcept t = new CodeableConcept();
5533          if (this.modifier == null)
5534            this.modifier = new ArrayList<CodeableConcept>();
5535          this.modifier.add(t);
5536          return t;
5537        }
5538
5539        public DetailComponent addModifier(CodeableConcept t) { //3
5540          if (t == null)
5541            return this;
5542          if (this.modifier == null)
5543            this.modifier = new ArrayList<CodeableConcept>();
5544          this.modifier.add(t);
5545          return this;
5546        }
5547
5548        /**
5549         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
5550         */
5551        public CodeableConcept getModifierFirstRep() { 
5552          if (getModifier().isEmpty()) {
5553            addModifier();
5554          }
5555          return getModifier().get(0);
5556        }
5557
5558        /**
5559         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
5560         */
5561        public List<CodeableConcept> getProgramCode() { 
5562          if (this.programCode == null)
5563            this.programCode = new ArrayList<CodeableConcept>();
5564          return this.programCode;
5565        }
5566
5567        /**
5568         * @return Returns a reference to <code>this</code> for easy method chaining
5569         */
5570        public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
5571          this.programCode = theProgramCode;
5572          return this;
5573        }
5574
5575        public boolean hasProgramCode() { 
5576          if (this.programCode == null)
5577            return false;
5578          for (CodeableConcept item : this.programCode)
5579            if (!item.isEmpty())
5580              return true;
5581          return false;
5582        }
5583
5584        public CodeableConcept addProgramCode() { //3
5585          CodeableConcept t = new CodeableConcept();
5586          if (this.programCode == null)
5587            this.programCode = new ArrayList<CodeableConcept>();
5588          this.programCode.add(t);
5589          return t;
5590        }
5591
5592        public DetailComponent addProgramCode(CodeableConcept t) { //3
5593          if (t == null)
5594            return this;
5595          if (this.programCode == null)
5596            this.programCode = new ArrayList<CodeableConcept>();
5597          this.programCode.add(t);
5598          return this;
5599        }
5600
5601        /**
5602         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
5603         */
5604        public CodeableConcept getProgramCodeFirstRep() { 
5605          if (getProgramCode().isEmpty()) {
5606            addProgramCode();
5607          }
5608          return getProgramCode().get(0);
5609        }
5610
5611        /**
5612         * @return {@link #quantity} (The number of repetitions of a service or product.)
5613         */
5614        public Quantity getQuantity() { 
5615          if (this.quantity == null)
5616            if (Configuration.errorOnAutoCreate())
5617              throw new Error("Attempt to auto-create DetailComponent.quantity");
5618            else if (Configuration.doAutoCreate())
5619              this.quantity = new Quantity(); // cc
5620          return this.quantity;
5621        }
5622
5623        public boolean hasQuantity() { 
5624          return this.quantity != null && !this.quantity.isEmpty();
5625        }
5626
5627        /**
5628         * @param value {@link #quantity} (The number of repetitions of a service or product.)
5629         */
5630        public DetailComponent setQuantity(Quantity value) { 
5631          this.quantity = value;
5632          return this;
5633        }
5634
5635        /**
5636         * @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.)
5637         */
5638        public Money getUnitPrice() { 
5639          if (this.unitPrice == null)
5640            if (Configuration.errorOnAutoCreate())
5641              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
5642            else if (Configuration.doAutoCreate())
5643              this.unitPrice = new Money(); // cc
5644          return this.unitPrice;
5645        }
5646
5647        public boolean hasUnitPrice() { 
5648          return this.unitPrice != null && !this.unitPrice.isEmpty();
5649        }
5650
5651        /**
5652         * @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.)
5653         */
5654        public DetailComponent setUnitPrice(Money value) { 
5655          this.unitPrice = value;
5656          return this;
5657        }
5658
5659        /**
5660         * @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
5661         */
5662        public DecimalType getFactorElement() { 
5663          if (this.factor == null)
5664            if (Configuration.errorOnAutoCreate())
5665              throw new Error("Attempt to auto-create DetailComponent.factor");
5666            else if (Configuration.doAutoCreate())
5667              this.factor = new DecimalType(); // bb
5668          return this.factor;
5669        }
5670
5671        public boolean hasFactorElement() { 
5672          return this.factor != null && !this.factor.isEmpty();
5673        }
5674
5675        public boolean hasFactor() { 
5676          return this.factor != null && !this.factor.isEmpty();
5677        }
5678
5679        /**
5680         * @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
5681         */
5682        public DetailComponent setFactorElement(DecimalType value) { 
5683          this.factor = value;
5684          return this;
5685        }
5686
5687        /**
5688         * @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.
5689         */
5690        public BigDecimal getFactor() { 
5691          return this.factor == null ? null : this.factor.getValue();
5692        }
5693
5694        /**
5695         * @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.
5696         */
5697        public DetailComponent setFactor(BigDecimal value) { 
5698          if (value == null)
5699            this.factor = null;
5700          else {
5701            if (this.factor == null)
5702              this.factor = new DecimalType();
5703            this.factor.setValue(value);
5704          }
5705          return this;
5706        }
5707
5708        /**
5709         * @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.
5710         */
5711        public DetailComponent setFactor(long value) { 
5712              this.factor = new DecimalType();
5713            this.factor.setValue(value);
5714          return this;
5715        }
5716
5717        /**
5718         * @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.
5719         */
5720        public DetailComponent setFactor(double value) { 
5721              this.factor = new DecimalType();
5722            this.factor.setValue(value);
5723          return this;
5724        }
5725
5726        /**
5727         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
5728         */
5729        public Money getNet() { 
5730          if (this.net == null)
5731            if (Configuration.errorOnAutoCreate())
5732              throw new Error("Attempt to auto-create DetailComponent.net");
5733            else if (Configuration.doAutoCreate())
5734              this.net = new Money(); // cc
5735          return this.net;
5736        }
5737
5738        public boolean hasNet() { 
5739          return this.net != null && !this.net.isEmpty();
5740        }
5741
5742        /**
5743         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
5744         */
5745        public DetailComponent setNet(Money value) { 
5746          this.net = value;
5747          return this;
5748        }
5749
5750        /**
5751         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
5752         */
5753        public List<Reference> getUdi() { 
5754          if (this.udi == null)
5755            this.udi = new ArrayList<Reference>();
5756          return this.udi;
5757        }
5758
5759        /**
5760         * @return Returns a reference to <code>this</code> for easy method chaining
5761         */
5762        public DetailComponent setUdi(List<Reference> theUdi) { 
5763          this.udi = theUdi;
5764          return this;
5765        }
5766
5767        public boolean hasUdi() { 
5768          if (this.udi == null)
5769            return false;
5770          for (Reference item : this.udi)
5771            if (!item.isEmpty())
5772              return true;
5773          return false;
5774        }
5775
5776        public Reference addUdi() { //3
5777          Reference t = new Reference();
5778          if (this.udi == null)
5779            this.udi = new ArrayList<Reference>();
5780          this.udi.add(t);
5781          return t;
5782        }
5783
5784        public DetailComponent addUdi(Reference t) { //3
5785          if (t == null)
5786            return this;
5787          if (this.udi == null)
5788            this.udi = new ArrayList<Reference>();
5789          this.udi.add(t);
5790          return this;
5791        }
5792
5793        /**
5794         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
5795         */
5796        public Reference getUdiFirstRep() { 
5797          if (getUdi().isEmpty()) {
5798            addUdi();
5799          }
5800          return getUdi().get(0);
5801        }
5802
5803        /**
5804         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
5805         */
5806        public List<PositiveIntType> getNoteNumber() { 
5807          if (this.noteNumber == null)
5808            this.noteNumber = new ArrayList<PositiveIntType>();
5809          return this.noteNumber;
5810        }
5811
5812        /**
5813         * @return Returns a reference to <code>this</code> for easy method chaining
5814         */
5815        public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
5816          this.noteNumber = theNoteNumber;
5817          return this;
5818        }
5819
5820        public boolean hasNoteNumber() { 
5821          if (this.noteNumber == null)
5822            return false;
5823          for (PositiveIntType item : this.noteNumber)
5824            if (!item.isEmpty())
5825              return true;
5826          return false;
5827        }
5828
5829        /**
5830         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
5831         */
5832        public PositiveIntType addNoteNumberElement() {//2 
5833          PositiveIntType t = new PositiveIntType();
5834          if (this.noteNumber == null)
5835            this.noteNumber = new ArrayList<PositiveIntType>();
5836          this.noteNumber.add(t);
5837          return t;
5838        }
5839
5840        /**
5841         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
5842         */
5843        public DetailComponent addNoteNumber(int value) { //1
5844          PositiveIntType t = new PositiveIntType();
5845          t.setValue(value);
5846          if (this.noteNumber == null)
5847            this.noteNumber = new ArrayList<PositiveIntType>();
5848          this.noteNumber.add(t);
5849          return this;
5850        }
5851
5852        /**
5853         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
5854         */
5855        public boolean hasNoteNumber(int value) { 
5856          if (this.noteNumber == null)
5857            return false;
5858          for (PositiveIntType v : this.noteNumber)
5859            if (v.getValue().equals(value)) // positiveInt
5860              return true;
5861          return false;
5862        }
5863
5864        /**
5865         * @return {@link #adjudication} (The adjudication results.)
5866         */
5867        public List<AdjudicationComponent> getAdjudication() { 
5868          if (this.adjudication == null)
5869            this.adjudication = new ArrayList<AdjudicationComponent>();
5870          return this.adjudication;
5871        }
5872
5873        /**
5874         * @return Returns a reference to <code>this</code> for easy method chaining
5875         */
5876        public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
5877          this.adjudication = theAdjudication;
5878          return this;
5879        }
5880
5881        public boolean hasAdjudication() { 
5882          if (this.adjudication == null)
5883            return false;
5884          for (AdjudicationComponent item : this.adjudication)
5885            if (!item.isEmpty())
5886              return true;
5887          return false;
5888        }
5889
5890        public AdjudicationComponent addAdjudication() { //3
5891          AdjudicationComponent t = new AdjudicationComponent();
5892          if (this.adjudication == null)
5893            this.adjudication = new ArrayList<AdjudicationComponent>();
5894          this.adjudication.add(t);
5895          return t;
5896        }
5897
5898        public DetailComponent addAdjudication(AdjudicationComponent t) { //3
5899          if (t == null)
5900            return this;
5901          if (this.adjudication == null)
5902            this.adjudication = new ArrayList<AdjudicationComponent>();
5903          this.adjudication.add(t);
5904          return this;
5905        }
5906
5907        /**
5908         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
5909         */
5910        public AdjudicationComponent getAdjudicationFirstRep() { 
5911          if (getAdjudication().isEmpty()) {
5912            addAdjudication();
5913          }
5914          return getAdjudication().get(0);
5915        }
5916
5917        /**
5918         * @return {@link #subDetail} (Third-tier of goods and services.)
5919         */
5920        public List<SubDetailComponent> getSubDetail() { 
5921          if (this.subDetail == null)
5922            this.subDetail = new ArrayList<SubDetailComponent>();
5923          return this.subDetail;
5924        }
5925
5926        /**
5927         * @return Returns a reference to <code>this</code> for easy method chaining
5928         */
5929        public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) { 
5930          this.subDetail = theSubDetail;
5931          return this;
5932        }
5933
5934        public boolean hasSubDetail() { 
5935          if (this.subDetail == null)
5936            return false;
5937          for (SubDetailComponent item : this.subDetail)
5938            if (!item.isEmpty())
5939              return true;
5940          return false;
5941        }
5942
5943        public SubDetailComponent addSubDetail() { //3
5944          SubDetailComponent t = new SubDetailComponent();
5945          if (this.subDetail == null)
5946            this.subDetail = new ArrayList<SubDetailComponent>();
5947          this.subDetail.add(t);
5948          return t;
5949        }
5950
5951        public DetailComponent addSubDetail(SubDetailComponent t) { //3
5952          if (t == null)
5953            return this;
5954          if (this.subDetail == null)
5955            this.subDetail = new ArrayList<SubDetailComponent>();
5956          this.subDetail.add(t);
5957          return this;
5958        }
5959
5960        /**
5961         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist {3}
5962         */
5963        public SubDetailComponent getSubDetailFirstRep() { 
5964          if (getSubDetail().isEmpty()) {
5965            addSubDetail();
5966          }
5967          return getSubDetail().get(0);
5968        }
5969
5970        protected void listChildren(List<Property> children) {
5971          super.listChildren(children);
5972          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));
5973          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
5974          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
5975          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService));
5976          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));
5977          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
5978          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
5979          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));
5980          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));
5981          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
5982          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
5983          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));
5984          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
5985          children.add(new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
5986        }
5987
5988        @Override
5989        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5990          switch (_hash) {
5991          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);
5992          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
5993          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);
5994          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService);
5995          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);
5996          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
5997          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
5998          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);
5999          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);
6000          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);
6001          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
6002          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);
6003          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6004          case -828829007: /*subDetail*/  return new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
6005          default: return super.getNamedProperty(_hash, _name, _checkValid);
6006          }
6007
6008        }
6009
6010      @Override
6011      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6012        switch (hash) {
6013        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6014        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6015        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6016        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
6017        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6018        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6019        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
6020        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6021        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6022        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6023        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6024        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
6025        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
6026        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
6027        default: return super.getProperty(hash, name, checkValid);
6028        }
6029
6030      }
6031
6032      @Override
6033      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6034        switch (hash) {
6035        case 1349547969: // sequence
6036          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
6037          return value;
6038        case 1099842588: // revenue
6039          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6040          return value;
6041        case 50511102: // category
6042          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6043          return value;
6044        case 1957227299: // productOrService
6045          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6046          return value;
6047        case -615513385: // modifier
6048          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
6049          return value;
6050        case 1010065041: // programCode
6051          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
6052          return value;
6053        case -1285004149: // quantity
6054          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
6055          return value;
6056        case -486196699: // unitPrice
6057          this.unitPrice = TypeConvertor.castToMoney(value); // Money
6058          return value;
6059        case -1282148017: // factor
6060          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
6061          return value;
6062        case 108957: // net
6063          this.net = TypeConvertor.castToMoney(value); // Money
6064          return value;
6065        case 115642: // udi
6066          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
6067          return value;
6068        case -1110033957: // noteNumber
6069          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
6070          return value;
6071        case -231349275: // adjudication
6072          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
6073          return value;
6074        case -828829007: // subDetail
6075          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
6076          return value;
6077        default: return super.setProperty(hash, name, value);
6078        }
6079
6080      }
6081
6082      @Override
6083      public Base setProperty(String name, Base value) throws FHIRException {
6084        if (name.equals("sequence")) {
6085          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
6086        } else if (name.equals("revenue")) {
6087          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6088        } else if (name.equals("category")) {
6089          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6090        } else if (name.equals("productOrService")) {
6091          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6092        } else if (name.equals("modifier")) {
6093          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
6094        } else if (name.equals("programCode")) {
6095          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
6096        } else if (name.equals("quantity")) {
6097          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
6098        } else if (name.equals("unitPrice")) {
6099          this.unitPrice = TypeConvertor.castToMoney(value); // Money
6100        } else if (name.equals("factor")) {
6101          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
6102        } else if (name.equals("net")) {
6103          this.net = TypeConvertor.castToMoney(value); // Money
6104        } else if (name.equals("udi")) {
6105          this.getUdi().add(TypeConvertor.castToReference(value));
6106        } else if (name.equals("noteNumber")) {
6107          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
6108        } else if (name.equals("adjudication")) {
6109          this.getAdjudication().add((AdjudicationComponent) value);
6110        } else if (name.equals("subDetail")) {
6111          this.getSubDetail().add((SubDetailComponent) value);
6112        } else
6113          return super.setProperty(name, value);
6114        return value;
6115      }
6116
6117      @Override
6118      public Base makeProperty(int hash, String name) throws FHIRException {
6119        switch (hash) {
6120        case 1349547969:  return getSequenceElement();
6121        case 1099842588:  return getRevenue();
6122        case 50511102:  return getCategory();
6123        case 1957227299:  return getProductOrService();
6124        case -615513385:  return addModifier(); 
6125        case 1010065041:  return addProgramCode(); 
6126        case -1285004149:  return getQuantity();
6127        case -486196699:  return getUnitPrice();
6128        case -1282148017:  return getFactorElement();
6129        case 108957:  return getNet();
6130        case 115642:  return addUdi(); 
6131        case -1110033957:  return addNoteNumberElement();
6132        case -231349275:  return addAdjudication(); 
6133        case -828829007:  return addSubDetail(); 
6134        default: return super.makeProperty(hash, name);
6135        }
6136
6137      }
6138
6139      @Override
6140      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6141        switch (hash) {
6142        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
6143        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
6144        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
6145        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
6146        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
6147        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
6148        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
6149        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6150        case -1282148017: /*factor*/ return new String[] {"decimal"};
6151        case 108957: /*net*/ return new String[] {"Money"};
6152        case 115642: /*udi*/ return new String[] {"Reference"};
6153        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
6154        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
6155        case -828829007: /*subDetail*/ return new String[] {};
6156        default: return super.getTypesForProperty(hash, name);
6157        }
6158
6159      }
6160
6161      @Override
6162      public Base addChild(String name) throws FHIRException {
6163        if (name.equals("sequence")) {
6164          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.sequence");
6165        }
6166        else if (name.equals("revenue")) {
6167          this.revenue = new CodeableConcept();
6168          return this.revenue;
6169        }
6170        else if (name.equals("category")) {
6171          this.category = new CodeableConcept();
6172          return this.category;
6173        }
6174        else if (name.equals("productOrService")) {
6175          this.productOrService = new CodeableConcept();
6176          return this.productOrService;
6177        }
6178        else if (name.equals("modifier")) {
6179          return addModifier();
6180        }
6181        else if (name.equals("programCode")) {
6182          return addProgramCode();
6183        }
6184        else if (name.equals("quantity")) {
6185          this.quantity = new Quantity();
6186          return this.quantity;
6187        }
6188        else if (name.equals("unitPrice")) {
6189          this.unitPrice = new Money();
6190          return this.unitPrice;
6191        }
6192        else if (name.equals("factor")) {
6193          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.factor");
6194        }
6195        else if (name.equals("net")) {
6196          this.net = new Money();
6197          return this.net;
6198        }
6199        else if (name.equals("udi")) {
6200          return addUdi();
6201        }
6202        else if (name.equals("noteNumber")) {
6203          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.noteNumber");
6204        }
6205        else if (name.equals("adjudication")) {
6206          return addAdjudication();
6207        }
6208        else if (name.equals("subDetail")) {
6209          return addSubDetail();
6210        }
6211        else
6212          return super.addChild(name);
6213      }
6214
6215      public DetailComponent copy() {
6216        DetailComponent dst = new DetailComponent();
6217        copyValues(dst);
6218        return dst;
6219      }
6220
6221      public void copyValues(DetailComponent dst) {
6222        super.copyValues(dst);
6223        dst.sequence = sequence == null ? null : sequence.copy();
6224        dst.revenue = revenue == null ? null : revenue.copy();
6225        dst.category = category == null ? null : category.copy();
6226        dst.productOrService = productOrService == null ? null : productOrService.copy();
6227        if (modifier != null) {
6228          dst.modifier = new ArrayList<CodeableConcept>();
6229          for (CodeableConcept i : modifier)
6230            dst.modifier.add(i.copy());
6231        };
6232        if (programCode != null) {
6233          dst.programCode = new ArrayList<CodeableConcept>();
6234          for (CodeableConcept i : programCode)
6235            dst.programCode.add(i.copy());
6236        };
6237        dst.quantity = quantity == null ? null : quantity.copy();
6238        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6239        dst.factor = factor == null ? null : factor.copy();
6240        dst.net = net == null ? null : net.copy();
6241        if (udi != null) {
6242          dst.udi = new ArrayList<Reference>();
6243          for (Reference i : udi)
6244            dst.udi.add(i.copy());
6245        };
6246        if (noteNumber != null) {
6247          dst.noteNumber = new ArrayList<PositiveIntType>();
6248          for (PositiveIntType i : noteNumber)
6249            dst.noteNumber.add(i.copy());
6250        };
6251        if (adjudication != null) {
6252          dst.adjudication = new ArrayList<AdjudicationComponent>();
6253          for (AdjudicationComponent i : adjudication)
6254            dst.adjudication.add(i.copy());
6255        };
6256        if (subDetail != null) {
6257          dst.subDetail = new ArrayList<SubDetailComponent>();
6258          for (SubDetailComponent i : subDetail)
6259            dst.subDetail.add(i.copy());
6260        };
6261      }
6262
6263      @Override
6264      public boolean equalsDeep(Base other_) {
6265        if (!super.equalsDeep(other_))
6266          return false;
6267        if (!(other_ instanceof DetailComponent))
6268          return false;
6269        DetailComponent o = (DetailComponent) other_;
6270        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
6271           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
6272           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
6273           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6274           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
6275           && compareDeep(subDetail, o.subDetail, true);
6276      }
6277
6278      @Override
6279      public boolean equalsShallow(Base other_) {
6280        if (!super.equalsShallow(other_))
6281          return false;
6282        if (!(other_ instanceof DetailComponent))
6283          return false;
6284        DetailComponent o = (DetailComponent) other_;
6285        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
6286          ;
6287      }
6288
6289      public boolean isEmpty() {
6290        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
6291          , productOrService, modifier, programCode, quantity, unitPrice, factor, net, udi
6292          , noteNumber, adjudication, subDetail);
6293      }
6294
6295  public String fhirType() {
6296    return "ExplanationOfBenefit.item.detail";
6297
6298  }
6299
6300  }
6301
6302    @Block()
6303    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
6304        /**
6305         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6306         */
6307        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
6308        @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." )
6309        protected PositiveIntType sequence;
6310
6311        /**
6312         * The type of revenue or cost center providing the product and/or service.
6313         */
6314        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
6315        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
6316        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
6317        protected CodeableConcept revenue;
6318
6319        /**
6320         * Code to identify the general type of benefits under which products and services are provided.
6321         */
6322        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
6323        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
6324        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
6325        protected CodeableConcept category;
6326
6327        /**
6328         * When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.
6329         */
6330        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
6331        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item." )
6332        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6333        protected CodeableConcept productOrService;
6334
6335        /**
6336         * Item typification or modifiers codes to convey additional context for the product or service.
6337         */
6338        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6339        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
6340        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
6341        protected List<CodeableConcept> modifier;
6342
6343        /**
6344         * Identifies the program under which this may be recovered.
6345         */
6346        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6347        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
6348        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
6349        protected List<CodeableConcept> programCode;
6350
6351        /**
6352         * The number of repetitions of a service or product.
6353         */
6354        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
6355        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
6356        protected Quantity quantity;
6357
6358        /**
6359         * 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.
6360         */
6361        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
6362        @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." )
6363        protected Money unitPrice;
6364
6365        /**
6366         * 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.
6367         */
6368        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
6369        @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." )
6370        protected DecimalType factor;
6371
6372        /**
6373         * The quantity times the unit price for an additional service or product or charge.
6374         */
6375        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
6376        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
6377        protected Money net;
6378
6379        /**
6380         * Unique Device Identifiers associated with this line item.
6381         */
6382        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6383        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
6384        protected List<Reference> udi;
6385
6386        /**
6387         * The numbers associated with notes below which apply to the adjudication of this item.
6388         */
6389        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6390        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
6391        protected List<PositiveIntType> noteNumber;
6392
6393        /**
6394         * The adjudication results.
6395         */
6396        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6397        @Description(shortDefinition="Subdetail level adjudication details", formalDefinition="The adjudication results." )
6398        protected List<AdjudicationComponent> adjudication;
6399
6400        private static final long serialVersionUID = -579551678L;
6401
6402    /**
6403     * Constructor
6404     */
6405      public SubDetailComponent() {
6406        super();
6407      }
6408
6409    /**
6410     * Constructor
6411     */
6412      public SubDetailComponent(int sequence, CodeableConcept productOrService) {
6413        super();
6414        this.setSequence(sequence);
6415        this.setProductOrService(productOrService);
6416      }
6417
6418        /**
6419         * @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
6420         */
6421        public PositiveIntType getSequenceElement() { 
6422          if (this.sequence == null)
6423            if (Configuration.errorOnAutoCreate())
6424              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
6425            else if (Configuration.doAutoCreate())
6426              this.sequence = new PositiveIntType(); // bb
6427          return this.sequence;
6428        }
6429
6430        public boolean hasSequenceElement() { 
6431          return this.sequence != null && !this.sequence.isEmpty();
6432        }
6433
6434        public boolean hasSequence() { 
6435          return this.sequence != null && !this.sequence.isEmpty();
6436        }
6437
6438        /**
6439         * @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
6440         */
6441        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
6442          this.sequence = value;
6443          return this;
6444        }
6445
6446        /**
6447         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6448         */
6449        public int getSequence() { 
6450          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6451        }
6452
6453        /**
6454         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6455         */
6456        public SubDetailComponent setSequence(int value) { 
6457            if (this.sequence == null)
6458              this.sequence = new PositiveIntType();
6459            this.sequence.setValue(value);
6460          return this;
6461        }
6462
6463        /**
6464         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6465         */
6466        public CodeableConcept getRevenue() { 
6467          if (this.revenue == null)
6468            if (Configuration.errorOnAutoCreate())
6469              throw new Error("Attempt to auto-create SubDetailComponent.revenue");
6470            else if (Configuration.doAutoCreate())
6471              this.revenue = new CodeableConcept(); // cc
6472          return this.revenue;
6473        }
6474
6475        public boolean hasRevenue() { 
6476          return this.revenue != null && !this.revenue.isEmpty();
6477        }
6478
6479        /**
6480         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6481         */
6482        public SubDetailComponent setRevenue(CodeableConcept value) { 
6483          this.revenue = value;
6484          return this;
6485        }
6486
6487        /**
6488         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
6489         */
6490        public CodeableConcept getCategory() { 
6491          if (this.category == null)
6492            if (Configuration.errorOnAutoCreate())
6493              throw new Error("Attempt to auto-create SubDetailComponent.category");
6494            else if (Configuration.doAutoCreate())
6495              this.category = new CodeableConcept(); // cc
6496          return this.category;
6497        }
6498
6499        public boolean hasCategory() { 
6500          return this.category != null && !this.category.isEmpty();
6501        }
6502
6503        /**
6504         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
6505         */
6506        public SubDetailComponent setCategory(CodeableConcept value) { 
6507          this.category = value;
6508          return this;
6509        }
6510
6511        /**
6512         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
6513         */
6514        public CodeableConcept getProductOrService() { 
6515          if (this.productOrService == null)
6516            if (Configuration.errorOnAutoCreate())
6517              throw new Error("Attempt to auto-create SubDetailComponent.productOrService");
6518            else if (Configuration.doAutoCreate())
6519              this.productOrService = new CodeableConcept(); // cc
6520          return this.productOrService;
6521        }
6522
6523        public boolean hasProductOrService() { 
6524          return this.productOrService != null && !this.productOrService.isEmpty();
6525        }
6526
6527        /**
6528         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
6529         */
6530        public SubDetailComponent setProductOrService(CodeableConcept value) { 
6531          this.productOrService = value;
6532          return this;
6533        }
6534
6535        /**
6536         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
6537         */
6538        public List<CodeableConcept> getModifier() { 
6539          if (this.modifier == null)
6540            this.modifier = new ArrayList<CodeableConcept>();
6541          return this.modifier;
6542        }
6543
6544        /**
6545         * @return Returns a reference to <code>this</code> for easy method chaining
6546         */
6547        public SubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
6548          this.modifier = theModifier;
6549          return this;
6550        }
6551
6552        public boolean hasModifier() { 
6553          if (this.modifier == null)
6554            return false;
6555          for (CodeableConcept item : this.modifier)
6556            if (!item.isEmpty())
6557              return true;
6558          return false;
6559        }
6560
6561        public CodeableConcept addModifier() { //3
6562          CodeableConcept t = new CodeableConcept();
6563          if (this.modifier == null)
6564            this.modifier = new ArrayList<CodeableConcept>();
6565          this.modifier.add(t);
6566          return t;
6567        }
6568
6569        public SubDetailComponent addModifier(CodeableConcept t) { //3
6570          if (t == null)
6571            return this;
6572          if (this.modifier == null)
6573            this.modifier = new ArrayList<CodeableConcept>();
6574          this.modifier.add(t);
6575          return this;
6576        }
6577
6578        /**
6579         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
6580         */
6581        public CodeableConcept getModifierFirstRep() { 
6582          if (getModifier().isEmpty()) {
6583            addModifier();
6584          }
6585          return getModifier().get(0);
6586        }
6587
6588        /**
6589         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
6590         */
6591        public List<CodeableConcept> getProgramCode() { 
6592          if (this.programCode == null)
6593            this.programCode = new ArrayList<CodeableConcept>();
6594          return this.programCode;
6595        }
6596
6597        /**
6598         * @return Returns a reference to <code>this</code> for easy method chaining
6599         */
6600        public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
6601          this.programCode = theProgramCode;
6602          return this;
6603        }
6604
6605        public boolean hasProgramCode() { 
6606          if (this.programCode == null)
6607            return false;
6608          for (CodeableConcept item : this.programCode)
6609            if (!item.isEmpty())
6610              return true;
6611          return false;
6612        }
6613
6614        public CodeableConcept addProgramCode() { //3
6615          CodeableConcept t = new CodeableConcept();
6616          if (this.programCode == null)
6617            this.programCode = new ArrayList<CodeableConcept>();
6618          this.programCode.add(t);
6619          return t;
6620        }
6621
6622        public SubDetailComponent addProgramCode(CodeableConcept t) { //3
6623          if (t == null)
6624            return this;
6625          if (this.programCode == null)
6626            this.programCode = new ArrayList<CodeableConcept>();
6627          this.programCode.add(t);
6628          return this;
6629        }
6630
6631        /**
6632         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
6633         */
6634        public CodeableConcept getProgramCodeFirstRep() { 
6635          if (getProgramCode().isEmpty()) {
6636            addProgramCode();
6637          }
6638          return getProgramCode().get(0);
6639        }
6640
6641        /**
6642         * @return {@link #quantity} (The number of repetitions of a service or product.)
6643         */
6644        public Quantity getQuantity() { 
6645          if (this.quantity == null)
6646            if (Configuration.errorOnAutoCreate())
6647              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
6648            else if (Configuration.doAutoCreate())
6649              this.quantity = new Quantity(); // cc
6650          return this.quantity;
6651        }
6652
6653        public boolean hasQuantity() { 
6654          return this.quantity != null && !this.quantity.isEmpty();
6655        }
6656
6657        /**
6658         * @param value {@link #quantity} (The number of repetitions of a service or product.)
6659         */
6660        public SubDetailComponent setQuantity(Quantity value) { 
6661          this.quantity = value;
6662          return this;
6663        }
6664
6665        /**
6666         * @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.)
6667         */
6668        public Money getUnitPrice() { 
6669          if (this.unitPrice == null)
6670            if (Configuration.errorOnAutoCreate())
6671              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
6672            else if (Configuration.doAutoCreate())
6673              this.unitPrice = new Money(); // cc
6674          return this.unitPrice;
6675        }
6676
6677        public boolean hasUnitPrice() { 
6678          return this.unitPrice != null && !this.unitPrice.isEmpty();
6679        }
6680
6681        /**
6682         * @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.)
6683         */
6684        public SubDetailComponent setUnitPrice(Money value) { 
6685          this.unitPrice = value;
6686          return this;
6687        }
6688
6689        /**
6690         * @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
6691         */
6692        public DecimalType getFactorElement() { 
6693          if (this.factor == null)
6694            if (Configuration.errorOnAutoCreate())
6695              throw new Error("Attempt to auto-create SubDetailComponent.factor");
6696            else if (Configuration.doAutoCreate())
6697              this.factor = new DecimalType(); // bb
6698          return this.factor;
6699        }
6700
6701        public boolean hasFactorElement() { 
6702          return this.factor != null && !this.factor.isEmpty();
6703        }
6704
6705        public boolean hasFactor() { 
6706          return this.factor != null && !this.factor.isEmpty();
6707        }
6708
6709        /**
6710         * @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
6711         */
6712        public SubDetailComponent setFactorElement(DecimalType value) { 
6713          this.factor = value;
6714          return this;
6715        }
6716
6717        /**
6718         * @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.
6719         */
6720        public BigDecimal getFactor() { 
6721          return this.factor == null ? null : this.factor.getValue();
6722        }
6723
6724        /**
6725         * @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.
6726         */
6727        public SubDetailComponent setFactor(BigDecimal value) { 
6728          if (value == null)
6729            this.factor = null;
6730          else {
6731            if (this.factor == null)
6732              this.factor = new DecimalType();
6733            this.factor.setValue(value);
6734          }
6735          return this;
6736        }
6737
6738        /**
6739         * @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.
6740         */
6741        public SubDetailComponent setFactor(long value) { 
6742              this.factor = new DecimalType();
6743            this.factor.setValue(value);
6744          return this;
6745        }
6746
6747        /**
6748         * @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.
6749         */
6750        public SubDetailComponent setFactor(double value) { 
6751              this.factor = new DecimalType();
6752            this.factor.setValue(value);
6753          return this;
6754        }
6755
6756        /**
6757         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6758         */
6759        public Money getNet() { 
6760          if (this.net == null)
6761            if (Configuration.errorOnAutoCreate())
6762              throw new Error("Attempt to auto-create SubDetailComponent.net");
6763            else if (Configuration.doAutoCreate())
6764              this.net = new Money(); // cc
6765          return this.net;
6766        }
6767
6768        public boolean hasNet() { 
6769          return this.net != null && !this.net.isEmpty();
6770        }
6771
6772        /**
6773         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6774         */
6775        public SubDetailComponent setNet(Money value) { 
6776          this.net = value;
6777          return this;
6778        }
6779
6780        /**
6781         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
6782         */
6783        public List<Reference> getUdi() { 
6784          if (this.udi == null)
6785            this.udi = new ArrayList<Reference>();
6786          return this.udi;
6787        }
6788
6789        /**
6790         * @return Returns a reference to <code>this</code> for easy method chaining
6791         */
6792        public SubDetailComponent setUdi(List<Reference> theUdi) { 
6793          this.udi = theUdi;
6794          return this;
6795        }
6796
6797        public boolean hasUdi() { 
6798          if (this.udi == null)
6799            return false;
6800          for (Reference item : this.udi)
6801            if (!item.isEmpty())
6802              return true;
6803          return false;
6804        }
6805
6806        public Reference addUdi() { //3
6807          Reference t = new Reference();
6808          if (this.udi == null)
6809            this.udi = new ArrayList<Reference>();
6810          this.udi.add(t);
6811          return t;
6812        }
6813
6814        public SubDetailComponent addUdi(Reference t) { //3
6815          if (t == null)
6816            return this;
6817          if (this.udi == null)
6818            this.udi = new ArrayList<Reference>();
6819          this.udi.add(t);
6820          return this;
6821        }
6822
6823        /**
6824         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
6825         */
6826        public Reference getUdiFirstRep() { 
6827          if (getUdi().isEmpty()) {
6828            addUdi();
6829          }
6830          return getUdi().get(0);
6831        }
6832
6833        /**
6834         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6835         */
6836        public List<PositiveIntType> getNoteNumber() { 
6837          if (this.noteNumber == null)
6838            this.noteNumber = new ArrayList<PositiveIntType>();
6839          return this.noteNumber;
6840        }
6841
6842        /**
6843         * @return Returns a reference to <code>this</code> for easy method chaining
6844         */
6845        public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
6846          this.noteNumber = theNoteNumber;
6847          return this;
6848        }
6849
6850        public boolean hasNoteNumber() { 
6851          if (this.noteNumber == null)
6852            return false;
6853          for (PositiveIntType item : this.noteNumber)
6854            if (!item.isEmpty())
6855              return true;
6856          return false;
6857        }
6858
6859        /**
6860         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6861         */
6862        public PositiveIntType addNoteNumberElement() {//2 
6863          PositiveIntType t = new PositiveIntType();
6864          if (this.noteNumber == null)
6865            this.noteNumber = new ArrayList<PositiveIntType>();
6866          this.noteNumber.add(t);
6867          return t;
6868        }
6869
6870        /**
6871         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6872         */
6873        public SubDetailComponent addNoteNumber(int value) { //1
6874          PositiveIntType t = new PositiveIntType();
6875          t.setValue(value);
6876          if (this.noteNumber == null)
6877            this.noteNumber = new ArrayList<PositiveIntType>();
6878          this.noteNumber.add(t);
6879          return this;
6880        }
6881
6882        /**
6883         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6884         */
6885        public boolean hasNoteNumber(int value) { 
6886          if (this.noteNumber == null)
6887            return false;
6888          for (PositiveIntType v : this.noteNumber)
6889            if (v.getValue().equals(value)) // positiveInt
6890              return true;
6891          return false;
6892        }
6893
6894        /**
6895         * @return {@link #adjudication} (The adjudication results.)
6896         */
6897        public List<AdjudicationComponent> getAdjudication() { 
6898          if (this.adjudication == null)
6899            this.adjudication = new ArrayList<AdjudicationComponent>();
6900          return this.adjudication;
6901        }
6902
6903        /**
6904         * @return Returns a reference to <code>this</code> for easy method chaining
6905         */
6906        public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
6907          this.adjudication = theAdjudication;
6908          return this;
6909        }
6910
6911        public boolean hasAdjudication() { 
6912          if (this.adjudication == null)
6913            return false;
6914          for (AdjudicationComponent item : this.adjudication)
6915            if (!item.isEmpty())
6916              return true;
6917          return false;
6918        }
6919
6920        public AdjudicationComponent addAdjudication() { //3
6921          AdjudicationComponent t = new AdjudicationComponent();
6922          if (this.adjudication == null)
6923            this.adjudication = new ArrayList<AdjudicationComponent>();
6924          this.adjudication.add(t);
6925          return t;
6926        }
6927
6928        public SubDetailComponent addAdjudication(AdjudicationComponent t) { //3
6929          if (t == null)
6930            return this;
6931          if (this.adjudication == null)
6932            this.adjudication = new ArrayList<AdjudicationComponent>();
6933          this.adjudication.add(t);
6934          return this;
6935        }
6936
6937        /**
6938         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
6939         */
6940        public AdjudicationComponent getAdjudicationFirstRep() { 
6941          if (getAdjudication().isEmpty()) {
6942            addAdjudication();
6943          }
6944          return getAdjudication().get(0);
6945        }
6946
6947        protected void listChildren(List<Property> children) {
6948          super.listChildren(children);
6949          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));
6950          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
6951          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
6952          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService));
6953          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));
6954          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
6955          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
6956          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));
6957          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));
6958          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
6959          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
6960          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));
6961          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6962        }
6963
6964        @Override
6965        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6966          switch (_hash) {
6967          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);
6968          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
6969          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);
6970          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService);
6971          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);
6972          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
6973          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
6974          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);
6975          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);
6976          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);
6977          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
6978          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);
6979          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6980          default: return super.getNamedProperty(_hash, _name, _checkValid);
6981          }
6982
6983        }
6984
6985      @Override
6986      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6987        switch (hash) {
6988        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6989        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6990        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6991        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
6992        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6993        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6994        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
6995        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6996        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6997        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6998        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6999        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7000        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7001        default: return super.getProperty(hash, name, checkValid);
7002        }
7003
7004      }
7005
7006      @Override
7007      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7008        switch (hash) {
7009        case 1349547969: // sequence
7010          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
7011          return value;
7012        case 1099842588: // revenue
7013          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7014          return value;
7015        case 50511102: // category
7016          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7017          return value;
7018        case 1957227299: // productOrService
7019          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7020          return value;
7021        case -615513385: // modifier
7022          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
7023          return value;
7024        case 1010065041: // programCode
7025          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
7026          return value;
7027        case -1285004149: // quantity
7028          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
7029          return value;
7030        case -486196699: // unitPrice
7031          this.unitPrice = TypeConvertor.castToMoney(value); // Money
7032          return value;
7033        case -1282148017: // factor
7034          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
7035          return value;
7036        case 108957: // net
7037          this.net = TypeConvertor.castToMoney(value); // Money
7038          return value;
7039        case 115642: // udi
7040          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
7041          return value;
7042        case -1110033957: // noteNumber
7043          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
7044          return value;
7045        case -231349275: // adjudication
7046          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7047          return value;
7048        default: return super.setProperty(hash, name, value);
7049        }
7050
7051      }
7052
7053      @Override
7054      public Base setProperty(String name, Base value) throws FHIRException {
7055        if (name.equals("sequence")) {
7056          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
7057        } else if (name.equals("revenue")) {
7058          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7059        } else if (name.equals("category")) {
7060          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7061        } else if (name.equals("productOrService")) {
7062          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7063        } else if (name.equals("modifier")) {
7064          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
7065        } else if (name.equals("programCode")) {
7066          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
7067        } else if (name.equals("quantity")) {
7068          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
7069        } else if (name.equals("unitPrice")) {
7070          this.unitPrice = TypeConvertor.castToMoney(value); // Money
7071        } else if (name.equals("factor")) {
7072          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
7073        } else if (name.equals("net")) {
7074          this.net = TypeConvertor.castToMoney(value); // Money
7075        } else if (name.equals("udi")) {
7076          this.getUdi().add(TypeConvertor.castToReference(value));
7077        } else if (name.equals("noteNumber")) {
7078          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
7079        } else if (name.equals("adjudication")) {
7080          this.getAdjudication().add((AdjudicationComponent) value);
7081        } else
7082          return super.setProperty(name, value);
7083        return value;
7084      }
7085
7086      @Override
7087      public Base makeProperty(int hash, String name) throws FHIRException {
7088        switch (hash) {
7089        case 1349547969:  return getSequenceElement();
7090        case 1099842588:  return getRevenue();
7091        case 50511102:  return getCategory();
7092        case 1957227299:  return getProductOrService();
7093        case -615513385:  return addModifier(); 
7094        case 1010065041:  return addProgramCode(); 
7095        case -1285004149:  return getQuantity();
7096        case -486196699:  return getUnitPrice();
7097        case -1282148017:  return getFactorElement();
7098        case 108957:  return getNet();
7099        case 115642:  return addUdi(); 
7100        case -1110033957:  return addNoteNumberElement();
7101        case -231349275:  return addAdjudication(); 
7102        default: return super.makeProperty(hash, name);
7103        }
7104
7105      }
7106
7107      @Override
7108      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7109        switch (hash) {
7110        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
7111        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7112        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7113        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
7114        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7115        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
7116        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
7117        case -486196699: /*unitPrice*/ return new String[] {"Money"};
7118        case -1282148017: /*factor*/ return new String[] {"decimal"};
7119        case 108957: /*net*/ return new String[] {"Money"};
7120        case 115642: /*udi*/ return new String[] {"Reference"};
7121        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7122        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7123        default: return super.getTypesForProperty(hash, name);
7124        }
7125
7126      }
7127
7128      @Override
7129      public Base addChild(String name) throws FHIRException {
7130        if (name.equals("sequence")) {
7131          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.subDetail.sequence");
7132        }
7133        else if (name.equals("revenue")) {
7134          this.revenue = new CodeableConcept();
7135          return this.revenue;
7136        }
7137        else if (name.equals("category")) {
7138          this.category = new CodeableConcept();
7139          return this.category;
7140        }
7141        else if (name.equals("productOrService")) {
7142          this.productOrService = new CodeableConcept();
7143          return this.productOrService;
7144        }
7145        else if (name.equals("modifier")) {
7146          return addModifier();
7147        }
7148        else if (name.equals("programCode")) {
7149          return addProgramCode();
7150        }
7151        else if (name.equals("quantity")) {
7152          this.quantity = new Quantity();
7153          return this.quantity;
7154        }
7155        else if (name.equals("unitPrice")) {
7156          this.unitPrice = new Money();
7157          return this.unitPrice;
7158        }
7159        else if (name.equals("factor")) {
7160          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.subDetail.factor");
7161        }
7162        else if (name.equals("net")) {
7163          this.net = new Money();
7164          return this.net;
7165        }
7166        else if (name.equals("udi")) {
7167          return addUdi();
7168        }
7169        else if (name.equals("noteNumber")) {
7170          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.subDetail.noteNumber");
7171        }
7172        else if (name.equals("adjudication")) {
7173          return addAdjudication();
7174        }
7175        else
7176          return super.addChild(name);
7177      }
7178
7179      public SubDetailComponent copy() {
7180        SubDetailComponent dst = new SubDetailComponent();
7181        copyValues(dst);
7182        return dst;
7183      }
7184
7185      public void copyValues(SubDetailComponent dst) {
7186        super.copyValues(dst);
7187        dst.sequence = sequence == null ? null : sequence.copy();
7188        dst.revenue = revenue == null ? null : revenue.copy();
7189        dst.category = category == null ? null : category.copy();
7190        dst.productOrService = productOrService == null ? null : productOrService.copy();
7191        if (modifier != null) {
7192          dst.modifier = new ArrayList<CodeableConcept>();
7193          for (CodeableConcept i : modifier)
7194            dst.modifier.add(i.copy());
7195        };
7196        if (programCode != null) {
7197          dst.programCode = new ArrayList<CodeableConcept>();
7198          for (CodeableConcept i : programCode)
7199            dst.programCode.add(i.copy());
7200        };
7201        dst.quantity = quantity == null ? null : quantity.copy();
7202        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7203        dst.factor = factor == null ? null : factor.copy();
7204        dst.net = net == null ? null : net.copy();
7205        if (udi != null) {
7206          dst.udi = new ArrayList<Reference>();
7207          for (Reference i : udi)
7208            dst.udi.add(i.copy());
7209        };
7210        if (noteNumber != null) {
7211          dst.noteNumber = new ArrayList<PositiveIntType>();
7212          for (PositiveIntType i : noteNumber)
7213            dst.noteNumber.add(i.copy());
7214        };
7215        if (adjudication != null) {
7216          dst.adjudication = new ArrayList<AdjudicationComponent>();
7217          for (AdjudicationComponent i : adjudication)
7218            dst.adjudication.add(i.copy());
7219        };
7220      }
7221
7222      @Override
7223      public boolean equalsDeep(Base other_) {
7224        if (!super.equalsDeep(other_))
7225          return false;
7226        if (!(other_ instanceof SubDetailComponent))
7227          return false;
7228        SubDetailComponent o = (SubDetailComponent) other_;
7229        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
7230           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
7231           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
7232           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
7233           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
7234          ;
7235      }
7236
7237      @Override
7238      public boolean equalsShallow(Base other_) {
7239        if (!super.equalsShallow(other_))
7240          return false;
7241        if (!(other_ instanceof SubDetailComponent))
7242          return false;
7243        SubDetailComponent o = (SubDetailComponent) other_;
7244        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
7245          ;
7246      }
7247
7248      public boolean isEmpty() {
7249        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
7250          , productOrService, modifier, programCode, quantity, unitPrice, factor, net, udi
7251          , noteNumber, adjudication);
7252      }
7253
7254  public String fhirType() {
7255    return "ExplanationOfBenefit.item.detail.subDetail";
7256
7257  }
7258
7259  }
7260
7261    @Block()
7262    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
7263        /**
7264         * Claim items which this service line is intended to replace.
7265         */
7266        @Child(name = "itemSequence", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7267        @Description(shortDefinition="Item sequence number", formalDefinition="Claim items which this service line is intended to replace." )
7268        protected List<PositiveIntType> itemSequence;
7269
7270        /**
7271         * The sequence number of the details within the claim item which this line is intended to replace.
7272         */
7273        @Child(name = "detailSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7274        @Description(shortDefinition="Detail sequence number", formalDefinition="The sequence number of the details within the claim item which this line is intended to replace." )
7275        protected List<PositiveIntType> detailSequence;
7276
7277        /**
7278         * The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.
7279         */
7280        @Child(name = "subDetailSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7281        @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." )
7282        protected List<PositiveIntType> subDetailSequence;
7283
7284        /**
7285         * The providers who are authorized for the services rendered to the patient.
7286         */
7287        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7288        @Description(shortDefinition="Authorized providers", formalDefinition="The providers who are authorized for the services rendered to the patient." )
7289        protected List<Reference> provider;
7290
7291        /**
7292         * When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.
7293         */
7294        @Child(name = "productOrService", type = {CodeableConcept.class}, order=5, min=1, max=1, modifier=false, summary=false)
7295        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item." )
7296        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7297        protected CodeableConcept productOrService;
7298
7299        /**
7300         * Item typification or modifiers codes to convey additional context for the product or service.
7301         */
7302        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7303        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
7304        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
7305        protected List<CodeableConcept> modifier;
7306
7307        /**
7308         * Identifies the program under which this may be recovered.
7309         */
7310        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7311        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
7312        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
7313        protected List<CodeableConcept> programCode;
7314
7315        /**
7316         * The date or dates when the service or product was supplied, performed or completed.
7317         */
7318        @Child(name = "serviced", type = {DateType.class, Period.class}, order=8, min=0, max=1, modifier=false, summary=false)
7319        @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." )
7320        protected DataType serviced;
7321
7322        /**
7323         * Where the product or service was provided.
7324         */
7325        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=9, min=0, max=1, modifier=false, summary=false)
7326        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
7327        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
7328        protected DataType location;
7329
7330        /**
7331         * The number of repetitions of a service or product.
7332         */
7333        @Child(name = "quantity", type = {Quantity.class}, order=10, min=0, max=1, modifier=false, summary=false)
7334        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
7335        protected Quantity quantity;
7336
7337        /**
7338         * 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.
7339         */
7340        @Child(name = "unitPrice", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=false)
7341        @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." )
7342        protected Money unitPrice;
7343
7344        /**
7345         * 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.
7346         */
7347        @Child(name = "factor", type = {DecimalType.class}, order=12, min=0, max=1, modifier=false, summary=false)
7348        @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." )
7349        protected DecimalType factor;
7350
7351        /**
7352         * The quantity times the unit price for an additional service or product or charge.
7353         */
7354        @Child(name = "net", type = {Money.class}, order=13, min=0, max=1, modifier=false, summary=false)
7355        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
7356        protected Money net;
7357
7358        /**
7359         * Physical service site on the patient (limb, tooth, etc.).
7360         */
7361        @Child(name = "bodySite", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false)
7362        @Description(shortDefinition="Anatomical location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
7363        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
7364        protected CodeableConcept bodySite;
7365
7366        /**
7367         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
7368         */
7369        @Child(name = "subSite", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7370        @Description(shortDefinition="Anatomical sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
7371        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
7372        protected List<CodeableConcept> subSite;
7373
7374        /**
7375         * The numbers associated with notes below which apply to the adjudication of this item.
7376         */
7377        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7378        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
7379        protected List<PositiveIntType> noteNumber;
7380
7381        /**
7382         * The adjudication results.
7383         */
7384        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7385        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
7386        protected List<AdjudicationComponent> adjudication;
7387
7388        /**
7389         * The second-tier service adjudications for payor added services.
7390         */
7391        @Child(name = "detail", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7392        @Description(shortDefinition="Insurer added line items", formalDefinition="The second-tier service adjudications for payor added services." )
7393        protected List<AddedItemDetailComponent> detail;
7394
7395        private static final long serialVersionUID = 2055842184L;
7396
7397    /**
7398     * Constructor
7399     */
7400      public AddedItemComponent() {
7401        super();
7402      }
7403
7404    /**
7405     * Constructor
7406     */
7407      public AddedItemComponent(CodeableConcept productOrService) {
7408        super();
7409        this.setProductOrService(productOrService);
7410      }
7411
7412        /**
7413         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
7414         */
7415        public List<PositiveIntType> getItemSequence() { 
7416          if (this.itemSequence == null)
7417            this.itemSequence = new ArrayList<PositiveIntType>();
7418          return this.itemSequence;
7419        }
7420
7421        /**
7422         * @return Returns a reference to <code>this</code> for easy method chaining
7423         */
7424        public AddedItemComponent setItemSequence(List<PositiveIntType> theItemSequence) { 
7425          this.itemSequence = theItemSequence;
7426          return this;
7427        }
7428
7429        public boolean hasItemSequence() { 
7430          if (this.itemSequence == null)
7431            return false;
7432          for (PositiveIntType item : this.itemSequence)
7433            if (!item.isEmpty())
7434              return true;
7435          return false;
7436        }
7437
7438        /**
7439         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
7440         */
7441        public PositiveIntType addItemSequenceElement() {//2 
7442          PositiveIntType t = new PositiveIntType();
7443          if (this.itemSequence == null)
7444            this.itemSequence = new ArrayList<PositiveIntType>();
7445          this.itemSequence.add(t);
7446          return t;
7447        }
7448
7449        /**
7450         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
7451         */
7452        public AddedItemComponent addItemSequence(int value) { //1
7453          PositiveIntType t = new PositiveIntType();
7454          t.setValue(value);
7455          if (this.itemSequence == null)
7456            this.itemSequence = new ArrayList<PositiveIntType>();
7457          this.itemSequence.add(t);
7458          return this;
7459        }
7460
7461        /**
7462         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
7463         */
7464        public boolean hasItemSequence(int value) { 
7465          if (this.itemSequence == null)
7466            return false;
7467          for (PositiveIntType v : this.itemSequence)
7468            if (v.getValue().equals(value)) // positiveInt
7469              return true;
7470          return false;
7471        }
7472
7473        /**
7474         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7475         */
7476        public List<PositiveIntType> getDetailSequence() { 
7477          if (this.detailSequence == null)
7478            this.detailSequence = new ArrayList<PositiveIntType>();
7479          return this.detailSequence;
7480        }
7481
7482        /**
7483         * @return Returns a reference to <code>this</code> for easy method chaining
7484         */
7485        public AddedItemComponent setDetailSequence(List<PositiveIntType> theDetailSequence) { 
7486          this.detailSequence = theDetailSequence;
7487          return this;
7488        }
7489
7490        public boolean hasDetailSequence() { 
7491          if (this.detailSequence == null)
7492            return false;
7493          for (PositiveIntType item : this.detailSequence)
7494            if (!item.isEmpty())
7495              return true;
7496          return false;
7497        }
7498
7499        /**
7500         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7501         */
7502        public PositiveIntType addDetailSequenceElement() {//2 
7503          PositiveIntType t = new PositiveIntType();
7504          if (this.detailSequence == null)
7505            this.detailSequence = new ArrayList<PositiveIntType>();
7506          this.detailSequence.add(t);
7507          return t;
7508        }
7509
7510        /**
7511         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7512         */
7513        public AddedItemComponent addDetailSequence(int value) { //1
7514          PositiveIntType t = new PositiveIntType();
7515          t.setValue(value);
7516          if (this.detailSequence == null)
7517            this.detailSequence = new ArrayList<PositiveIntType>();
7518          this.detailSequence.add(t);
7519          return this;
7520        }
7521
7522        /**
7523         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7524         */
7525        public boolean hasDetailSequence(int value) { 
7526          if (this.detailSequence == null)
7527            return false;
7528          for (PositiveIntType v : this.detailSequence)
7529            if (v.getValue().equals(value)) // positiveInt
7530              return true;
7531          return false;
7532        }
7533
7534        /**
7535         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
7536         */
7537        public List<PositiveIntType> getSubDetailSequence() { 
7538          if (this.subDetailSequence == null)
7539            this.subDetailSequence = new ArrayList<PositiveIntType>();
7540          return this.subDetailSequence;
7541        }
7542
7543        /**
7544         * @return Returns a reference to <code>this</code> for easy method chaining
7545         */
7546        public AddedItemComponent setSubDetailSequence(List<PositiveIntType> theSubDetailSequence) { 
7547          this.subDetailSequence = theSubDetailSequence;
7548          return this;
7549        }
7550
7551        public boolean hasSubDetailSequence() { 
7552          if (this.subDetailSequence == null)
7553            return false;
7554          for (PositiveIntType item : this.subDetailSequence)
7555            if (!item.isEmpty())
7556              return true;
7557          return false;
7558        }
7559
7560        /**
7561         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
7562         */
7563        public PositiveIntType addSubDetailSequenceElement() {//2 
7564          PositiveIntType t = new PositiveIntType();
7565          if (this.subDetailSequence == null)
7566            this.subDetailSequence = new ArrayList<PositiveIntType>();
7567          this.subDetailSequence.add(t);
7568          return t;
7569        }
7570
7571        /**
7572         * @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.)
7573         */
7574        public AddedItemComponent addSubDetailSequence(int value) { //1
7575          PositiveIntType t = new PositiveIntType();
7576          t.setValue(value);
7577          if (this.subDetailSequence == null)
7578            this.subDetailSequence = new ArrayList<PositiveIntType>();
7579          this.subDetailSequence.add(t);
7580          return this;
7581        }
7582
7583        /**
7584         * @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.)
7585         */
7586        public boolean hasSubDetailSequence(int value) { 
7587          if (this.subDetailSequence == null)
7588            return false;
7589          for (PositiveIntType v : this.subDetailSequence)
7590            if (v.getValue().equals(value)) // positiveInt
7591              return true;
7592          return false;
7593        }
7594
7595        /**
7596         * @return {@link #provider} (The providers who are authorized for the services rendered to the patient.)
7597         */
7598        public List<Reference> getProvider() { 
7599          if (this.provider == null)
7600            this.provider = new ArrayList<Reference>();
7601          return this.provider;
7602        }
7603
7604        /**
7605         * @return Returns a reference to <code>this</code> for easy method chaining
7606         */
7607        public AddedItemComponent setProvider(List<Reference> theProvider) { 
7608          this.provider = theProvider;
7609          return this;
7610        }
7611
7612        public boolean hasProvider() { 
7613          if (this.provider == null)
7614            return false;
7615          for (Reference item : this.provider)
7616            if (!item.isEmpty())
7617              return true;
7618          return false;
7619        }
7620
7621        public Reference addProvider() { //3
7622          Reference t = new Reference();
7623          if (this.provider == null)
7624            this.provider = new ArrayList<Reference>();
7625          this.provider.add(t);
7626          return t;
7627        }
7628
7629        public AddedItemComponent addProvider(Reference t) { //3
7630          if (t == null)
7631            return this;
7632          if (this.provider == null)
7633            this.provider = new ArrayList<Reference>();
7634          this.provider.add(t);
7635          return this;
7636        }
7637
7638        /**
7639         * @return The first repetition of repeating field {@link #provider}, creating it if it does not already exist {3}
7640         */
7641        public Reference getProviderFirstRep() { 
7642          if (getProvider().isEmpty()) {
7643            addProvider();
7644          }
7645          return getProvider().get(0);
7646        }
7647
7648        /**
7649         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
7650         */
7651        public CodeableConcept getProductOrService() { 
7652          if (this.productOrService == null)
7653            if (Configuration.errorOnAutoCreate())
7654              throw new Error("Attempt to auto-create AddedItemComponent.productOrService");
7655            else if (Configuration.doAutoCreate())
7656              this.productOrService = new CodeableConcept(); // cc
7657          return this.productOrService;
7658        }
7659
7660        public boolean hasProductOrService() { 
7661          return this.productOrService != null && !this.productOrService.isEmpty();
7662        }
7663
7664        /**
7665         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
7666         */
7667        public AddedItemComponent setProductOrService(CodeableConcept value) { 
7668          this.productOrService = value;
7669          return this;
7670        }
7671
7672        /**
7673         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
7674         */
7675        public List<CodeableConcept> getModifier() { 
7676          if (this.modifier == null)
7677            this.modifier = new ArrayList<CodeableConcept>();
7678          return this.modifier;
7679        }
7680
7681        /**
7682         * @return Returns a reference to <code>this</code> for easy method chaining
7683         */
7684        public AddedItemComponent setModifier(List<CodeableConcept> theModifier) { 
7685          this.modifier = theModifier;
7686          return this;
7687        }
7688
7689        public boolean hasModifier() { 
7690          if (this.modifier == null)
7691            return false;
7692          for (CodeableConcept item : this.modifier)
7693            if (!item.isEmpty())
7694              return true;
7695          return false;
7696        }
7697
7698        public CodeableConcept addModifier() { //3
7699          CodeableConcept t = new CodeableConcept();
7700          if (this.modifier == null)
7701            this.modifier = new ArrayList<CodeableConcept>();
7702          this.modifier.add(t);
7703          return t;
7704        }
7705
7706        public AddedItemComponent addModifier(CodeableConcept t) { //3
7707          if (t == null)
7708            return this;
7709          if (this.modifier == null)
7710            this.modifier = new ArrayList<CodeableConcept>();
7711          this.modifier.add(t);
7712          return this;
7713        }
7714
7715        /**
7716         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
7717         */
7718        public CodeableConcept getModifierFirstRep() { 
7719          if (getModifier().isEmpty()) {
7720            addModifier();
7721          }
7722          return getModifier().get(0);
7723        }
7724
7725        /**
7726         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
7727         */
7728        public List<CodeableConcept> getProgramCode() { 
7729          if (this.programCode == null)
7730            this.programCode = new ArrayList<CodeableConcept>();
7731          return this.programCode;
7732        }
7733
7734        /**
7735         * @return Returns a reference to <code>this</code> for easy method chaining
7736         */
7737        public AddedItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
7738          this.programCode = theProgramCode;
7739          return this;
7740        }
7741
7742        public boolean hasProgramCode() { 
7743          if (this.programCode == null)
7744            return false;
7745          for (CodeableConcept item : this.programCode)
7746            if (!item.isEmpty())
7747              return true;
7748          return false;
7749        }
7750
7751        public CodeableConcept addProgramCode() { //3
7752          CodeableConcept t = new CodeableConcept();
7753          if (this.programCode == null)
7754            this.programCode = new ArrayList<CodeableConcept>();
7755          this.programCode.add(t);
7756          return t;
7757        }
7758
7759        public AddedItemComponent addProgramCode(CodeableConcept t) { //3
7760          if (t == null)
7761            return this;
7762          if (this.programCode == null)
7763            this.programCode = new ArrayList<CodeableConcept>();
7764          this.programCode.add(t);
7765          return this;
7766        }
7767
7768        /**
7769         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
7770         */
7771        public CodeableConcept getProgramCodeFirstRep() { 
7772          if (getProgramCode().isEmpty()) {
7773            addProgramCode();
7774          }
7775          return getProgramCode().get(0);
7776        }
7777
7778        /**
7779         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
7780         */
7781        public DataType getServiced() { 
7782          return this.serviced;
7783        }
7784
7785        /**
7786         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
7787         */
7788        public DateType getServicedDateType() throws FHIRException { 
7789          if (this.serviced == null)
7790            this.serviced = new DateType();
7791          if (!(this.serviced instanceof DateType))
7792            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
7793          return (DateType) this.serviced;
7794        }
7795
7796        public boolean hasServicedDateType() { 
7797          return this != null && this.serviced instanceof DateType;
7798        }
7799
7800        /**
7801         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
7802         */
7803        public Period getServicedPeriod() throws FHIRException { 
7804          if (this.serviced == null)
7805            this.serviced = new Period();
7806          if (!(this.serviced instanceof Period))
7807            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
7808          return (Period) this.serviced;
7809        }
7810
7811        public boolean hasServicedPeriod() { 
7812          return this != null && this.serviced instanceof Period;
7813        }
7814
7815        public boolean hasServiced() { 
7816          return this.serviced != null && !this.serviced.isEmpty();
7817        }
7818
7819        /**
7820         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
7821         */
7822        public AddedItemComponent setServiced(DataType value) { 
7823          if (value != null && !(value instanceof DateType || value instanceof Period))
7824            throw new Error("Not the right type for ExplanationOfBenefit.addItem.serviced[x]: "+value.fhirType());
7825          this.serviced = value;
7826          return this;
7827        }
7828
7829        /**
7830         * @return {@link #location} (Where the product or service was provided.)
7831         */
7832        public DataType getLocation() { 
7833          return this.location;
7834        }
7835
7836        /**
7837         * @return {@link #location} (Where the product or service was provided.)
7838         */
7839        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
7840          if (this.location == null)
7841            this.location = new CodeableConcept();
7842          if (!(this.location instanceof CodeableConcept))
7843            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
7844          return (CodeableConcept) this.location;
7845        }
7846
7847        public boolean hasLocationCodeableConcept() { 
7848          return this != null && this.location instanceof CodeableConcept;
7849        }
7850
7851        /**
7852         * @return {@link #location} (Where the product or service was provided.)
7853         */
7854        public Address getLocationAddress() throws FHIRException { 
7855          if (this.location == null)
7856            this.location = new Address();
7857          if (!(this.location instanceof Address))
7858            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
7859          return (Address) this.location;
7860        }
7861
7862        public boolean hasLocationAddress() { 
7863          return this != null && this.location instanceof Address;
7864        }
7865
7866        /**
7867         * @return {@link #location} (Where the product or service was provided.)
7868         */
7869        public Reference getLocationReference() throws FHIRException { 
7870          if (this.location == null)
7871            this.location = new Reference();
7872          if (!(this.location instanceof Reference))
7873            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
7874          return (Reference) this.location;
7875        }
7876
7877        public boolean hasLocationReference() { 
7878          return this != null && this.location instanceof Reference;
7879        }
7880
7881        public boolean hasLocation() { 
7882          return this.location != null && !this.location.isEmpty();
7883        }
7884
7885        /**
7886         * @param value {@link #location} (Where the product or service was provided.)
7887         */
7888        public AddedItemComponent setLocation(DataType value) { 
7889          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
7890            throw new Error("Not the right type for ExplanationOfBenefit.addItem.location[x]: "+value.fhirType());
7891          this.location = value;
7892          return this;
7893        }
7894
7895        /**
7896         * @return {@link #quantity} (The number of repetitions of a service or product.)
7897         */
7898        public Quantity getQuantity() { 
7899          if (this.quantity == null)
7900            if (Configuration.errorOnAutoCreate())
7901              throw new Error("Attempt to auto-create AddedItemComponent.quantity");
7902            else if (Configuration.doAutoCreate())
7903              this.quantity = new Quantity(); // cc
7904          return this.quantity;
7905        }
7906
7907        public boolean hasQuantity() { 
7908          return this.quantity != null && !this.quantity.isEmpty();
7909        }
7910
7911        /**
7912         * @param value {@link #quantity} (The number of repetitions of a service or product.)
7913         */
7914        public AddedItemComponent setQuantity(Quantity value) { 
7915          this.quantity = value;
7916          return this;
7917        }
7918
7919        /**
7920         * @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.)
7921         */
7922        public Money getUnitPrice() { 
7923          if (this.unitPrice == null)
7924            if (Configuration.errorOnAutoCreate())
7925              throw new Error("Attempt to auto-create AddedItemComponent.unitPrice");
7926            else if (Configuration.doAutoCreate())
7927              this.unitPrice = new Money(); // cc
7928          return this.unitPrice;
7929        }
7930
7931        public boolean hasUnitPrice() { 
7932          return this.unitPrice != null && !this.unitPrice.isEmpty();
7933        }
7934
7935        /**
7936         * @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.)
7937         */
7938        public AddedItemComponent setUnitPrice(Money value) { 
7939          this.unitPrice = value;
7940          return this;
7941        }
7942
7943        /**
7944         * @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
7945         */
7946        public DecimalType getFactorElement() { 
7947          if (this.factor == null)
7948            if (Configuration.errorOnAutoCreate())
7949              throw new Error("Attempt to auto-create AddedItemComponent.factor");
7950            else if (Configuration.doAutoCreate())
7951              this.factor = new DecimalType(); // bb
7952          return this.factor;
7953        }
7954
7955        public boolean hasFactorElement() { 
7956          return this.factor != null && !this.factor.isEmpty();
7957        }
7958
7959        public boolean hasFactor() { 
7960          return this.factor != null && !this.factor.isEmpty();
7961        }
7962
7963        /**
7964         * @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
7965         */
7966        public AddedItemComponent setFactorElement(DecimalType value) { 
7967          this.factor = value;
7968          return this;
7969        }
7970
7971        /**
7972         * @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.
7973         */
7974        public BigDecimal getFactor() { 
7975          return this.factor == null ? null : this.factor.getValue();
7976        }
7977
7978        /**
7979         * @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.
7980         */
7981        public AddedItemComponent setFactor(BigDecimal value) { 
7982          if (value == null)
7983            this.factor = null;
7984          else {
7985            if (this.factor == null)
7986              this.factor = new DecimalType();
7987            this.factor.setValue(value);
7988          }
7989          return this;
7990        }
7991
7992        /**
7993         * @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.
7994         */
7995        public AddedItemComponent setFactor(long value) { 
7996              this.factor = new DecimalType();
7997            this.factor.setValue(value);
7998          return this;
7999        }
8000
8001        /**
8002         * @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.
8003         */
8004        public AddedItemComponent setFactor(double value) { 
8005              this.factor = new DecimalType();
8006            this.factor.setValue(value);
8007          return this;
8008        }
8009
8010        /**
8011         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8012         */
8013        public Money getNet() { 
8014          if (this.net == null)
8015            if (Configuration.errorOnAutoCreate())
8016              throw new Error("Attempt to auto-create AddedItemComponent.net");
8017            else if (Configuration.doAutoCreate())
8018              this.net = new Money(); // cc
8019          return this.net;
8020        }
8021
8022        public boolean hasNet() { 
8023          return this.net != null && !this.net.isEmpty();
8024        }
8025
8026        /**
8027         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8028         */
8029        public AddedItemComponent setNet(Money value) { 
8030          this.net = value;
8031          return this;
8032        }
8033
8034        /**
8035         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8036         */
8037        public CodeableConcept getBodySite() { 
8038          if (this.bodySite == null)
8039            if (Configuration.errorOnAutoCreate())
8040              throw new Error("Attempt to auto-create AddedItemComponent.bodySite");
8041            else if (Configuration.doAutoCreate())
8042              this.bodySite = new CodeableConcept(); // cc
8043          return this.bodySite;
8044        }
8045
8046        public boolean hasBodySite() { 
8047          return this.bodySite != null && !this.bodySite.isEmpty();
8048        }
8049
8050        /**
8051         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8052         */
8053        public AddedItemComponent setBodySite(CodeableConcept value) { 
8054          this.bodySite = value;
8055          return this;
8056        }
8057
8058        /**
8059         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
8060         */
8061        public List<CodeableConcept> getSubSite() { 
8062          if (this.subSite == null)
8063            this.subSite = new ArrayList<CodeableConcept>();
8064          return this.subSite;
8065        }
8066
8067        /**
8068         * @return Returns a reference to <code>this</code> for easy method chaining
8069         */
8070        public AddedItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
8071          this.subSite = theSubSite;
8072          return this;
8073        }
8074
8075        public boolean hasSubSite() { 
8076          if (this.subSite == null)
8077            return false;
8078          for (CodeableConcept item : this.subSite)
8079            if (!item.isEmpty())
8080              return true;
8081          return false;
8082        }
8083
8084        public CodeableConcept addSubSite() { //3
8085          CodeableConcept t = new CodeableConcept();
8086          if (this.subSite == null)
8087            this.subSite = new ArrayList<CodeableConcept>();
8088          this.subSite.add(t);
8089          return t;
8090        }
8091
8092        public AddedItemComponent addSubSite(CodeableConcept t) { //3
8093          if (t == null)
8094            return this;
8095          if (this.subSite == null)
8096            this.subSite = new ArrayList<CodeableConcept>();
8097          this.subSite.add(t);
8098          return this;
8099        }
8100
8101        /**
8102         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist {3}
8103         */
8104        public CodeableConcept getSubSiteFirstRep() { 
8105          if (getSubSite().isEmpty()) {
8106            addSubSite();
8107          }
8108          return getSubSite().get(0);
8109        }
8110
8111        /**
8112         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8113         */
8114        public List<PositiveIntType> getNoteNumber() { 
8115          if (this.noteNumber == null)
8116            this.noteNumber = new ArrayList<PositiveIntType>();
8117          return this.noteNumber;
8118        }
8119
8120        /**
8121         * @return Returns a reference to <code>this</code> for easy method chaining
8122         */
8123        public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
8124          this.noteNumber = theNoteNumber;
8125          return this;
8126        }
8127
8128        public boolean hasNoteNumber() { 
8129          if (this.noteNumber == null)
8130            return false;
8131          for (PositiveIntType item : this.noteNumber)
8132            if (!item.isEmpty())
8133              return true;
8134          return false;
8135        }
8136
8137        /**
8138         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8139         */
8140        public PositiveIntType addNoteNumberElement() {//2 
8141          PositiveIntType t = new PositiveIntType();
8142          if (this.noteNumber == null)
8143            this.noteNumber = new ArrayList<PositiveIntType>();
8144          this.noteNumber.add(t);
8145          return t;
8146        }
8147
8148        /**
8149         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8150         */
8151        public AddedItemComponent addNoteNumber(int value) { //1
8152          PositiveIntType t = new PositiveIntType();
8153          t.setValue(value);
8154          if (this.noteNumber == null)
8155            this.noteNumber = new ArrayList<PositiveIntType>();
8156          this.noteNumber.add(t);
8157          return this;
8158        }
8159
8160        /**
8161         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8162         */
8163        public boolean hasNoteNumber(int value) { 
8164          if (this.noteNumber == null)
8165            return false;
8166          for (PositiveIntType v : this.noteNumber)
8167            if (v.getValue().equals(value)) // positiveInt
8168              return true;
8169          return false;
8170        }
8171
8172        /**
8173         * @return {@link #adjudication} (The adjudication results.)
8174         */
8175        public List<AdjudicationComponent> getAdjudication() { 
8176          if (this.adjudication == null)
8177            this.adjudication = new ArrayList<AdjudicationComponent>();
8178          return this.adjudication;
8179        }
8180
8181        /**
8182         * @return Returns a reference to <code>this</code> for easy method chaining
8183         */
8184        public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
8185          this.adjudication = theAdjudication;
8186          return this;
8187        }
8188
8189        public boolean hasAdjudication() { 
8190          if (this.adjudication == null)
8191            return false;
8192          for (AdjudicationComponent item : this.adjudication)
8193            if (!item.isEmpty())
8194              return true;
8195          return false;
8196        }
8197
8198        public AdjudicationComponent addAdjudication() { //3
8199          AdjudicationComponent t = new AdjudicationComponent();
8200          if (this.adjudication == null)
8201            this.adjudication = new ArrayList<AdjudicationComponent>();
8202          this.adjudication.add(t);
8203          return t;
8204        }
8205
8206        public AddedItemComponent addAdjudication(AdjudicationComponent t) { //3
8207          if (t == null)
8208            return this;
8209          if (this.adjudication == null)
8210            this.adjudication = new ArrayList<AdjudicationComponent>();
8211          this.adjudication.add(t);
8212          return this;
8213        }
8214
8215        /**
8216         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
8217         */
8218        public AdjudicationComponent getAdjudicationFirstRep() { 
8219          if (getAdjudication().isEmpty()) {
8220            addAdjudication();
8221          }
8222          return getAdjudication().get(0);
8223        }
8224
8225        /**
8226         * @return {@link #detail} (The second-tier service adjudications for payor added services.)
8227         */
8228        public List<AddedItemDetailComponent> getDetail() { 
8229          if (this.detail == null)
8230            this.detail = new ArrayList<AddedItemDetailComponent>();
8231          return this.detail;
8232        }
8233
8234        /**
8235         * @return Returns a reference to <code>this</code> for easy method chaining
8236         */
8237        public AddedItemComponent setDetail(List<AddedItemDetailComponent> theDetail) { 
8238          this.detail = theDetail;
8239          return this;
8240        }
8241
8242        public boolean hasDetail() { 
8243          if (this.detail == null)
8244            return false;
8245          for (AddedItemDetailComponent item : this.detail)
8246            if (!item.isEmpty())
8247              return true;
8248          return false;
8249        }
8250
8251        public AddedItemDetailComponent addDetail() { //3
8252          AddedItemDetailComponent t = new AddedItemDetailComponent();
8253          if (this.detail == null)
8254            this.detail = new ArrayList<AddedItemDetailComponent>();
8255          this.detail.add(t);
8256          return t;
8257        }
8258
8259        public AddedItemComponent addDetail(AddedItemDetailComponent t) { //3
8260          if (t == null)
8261            return this;
8262          if (this.detail == null)
8263            this.detail = new ArrayList<AddedItemDetailComponent>();
8264          this.detail.add(t);
8265          return this;
8266        }
8267
8268        /**
8269         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist {3}
8270         */
8271        public AddedItemDetailComponent getDetailFirstRep() { 
8272          if (getDetail().isEmpty()) {
8273            addDetail();
8274          }
8275          return getDetail().get(0);
8276        }
8277
8278        protected void listChildren(List<Property> children) {
8279          super.listChildren(children);
8280          children.add(new Property("itemSequence", "positiveInt", "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, itemSequence));
8281          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));
8282          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));
8283          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));
8284          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService));
8285          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));
8286          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
8287          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));
8288          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
8289          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
8290          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));
8291          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));
8292          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
8293          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
8294          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));
8295          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));
8296          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
8297          children.add(new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
8298        }
8299
8300        @Override
8301        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8302          switch (_hash) {
8303          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);
8304          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);
8305          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);
8306          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);
8307          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService);
8308          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);
8309          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
8310          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);
8311          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);
8312          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);
8313          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);
8314          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8315          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8316          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept", "Where the product or service was provided.", 0, 1, location);
8317          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address", "Where the product or service was provided.", 0, 1, location);
8318          case 755866390: /*locationReference*/  return new Property("location[x]", "Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8319          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
8320          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);
8321          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);
8322          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);
8323          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
8324          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);
8325          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);
8326          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
8327          case -1335224239: /*detail*/  return new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail);
8328          default: return super.getNamedProperty(_hash, _name, _checkValid);
8329          }
8330
8331        }
8332
8333      @Override
8334      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8335        switch (hash) {
8336        case 1977979892: /*itemSequence*/ return this.itemSequence == null ? new Base[0] : this.itemSequence.toArray(new Base[this.itemSequence.size()]); // PositiveIntType
8337        case 1321472818: /*detailSequence*/ return this.detailSequence == null ? new Base[0] : this.detailSequence.toArray(new Base[this.detailSequence.size()]); // PositiveIntType
8338        case -855462510: /*subDetailSequence*/ return this.subDetailSequence == null ? new Base[0] : this.subDetailSequence.toArray(new Base[this.subDetailSequence.size()]); // PositiveIntType
8339        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : this.provider.toArray(new Base[this.provider.size()]); // Reference
8340        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
8341        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
8342        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
8343        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // DataType
8344        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // DataType
8345        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
8346        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
8347        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
8348        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
8349        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
8350        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
8351        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
8352        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
8353        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemDetailComponent
8354        default: return super.getProperty(hash, name, checkValid);
8355        }
8356
8357      }
8358
8359      @Override
8360      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8361        switch (hash) {
8362        case 1977979892: // itemSequence
8363          this.getItemSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
8364          return value;
8365        case 1321472818: // detailSequence
8366          this.getDetailSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
8367          return value;
8368        case -855462510: // subDetailSequence
8369          this.getSubDetailSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
8370          return value;
8371        case -987494927: // provider
8372          this.getProvider().add(TypeConvertor.castToReference(value)); // Reference
8373          return value;
8374        case 1957227299: // productOrService
8375          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8376          return value;
8377        case -615513385: // modifier
8378          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
8379          return value;
8380        case 1010065041: // programCode
8381          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
8382          return value;
8383        case 1379209295: // serviced
8384          this.serviced = TypeConvertor.castToType(value); // DataType
8385          return value;
8386        case 1901043637: // location
8387          this.location = TypeConvertor.castToType(value); // DataType
8388          return value;
8389        case -1285004149: // quantity
8390          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
8391          return value;
8392        case -486196699: // unitPrice
8393          this.unitPrice = TypeConvertor.castToMoney(value); // Money
8394          return value;
8395        case -1282148017: // factor
8396          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
8397          return value;
8398        case 108957: // net
8399          this.net = TypeConvertor.castToMoney(value); // Money
8400          return value;
8401        case 1702620169: // bodySite
8402          this.bodySite = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8403          return value;
8404        case -1868566105: // subSite
8405          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
8406          return value;
8407        case -1110033957: // noteNumber
8408          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
8409          return value;
8410        case -231349275: // adjudication
8411          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
8412          return value;
8413        case -1335224239: // detail
8414          this.getDetail().add((AddedItemDetailComponent) value); // AddedItemDetailComponent
8415          return value;
8416        default: return super.setProperty(hash, name, value);
8417        }
8418
8419      }
8420
8421      @Override
8422      public Base setProperty(String name, Base value) throws FHIRException {
8423        if (name.equals("itemSequence")) {
8424          this.getItemSequence().add(TypeConvertor.castToPositiveInt(value));
8425        } else if (name.equals("detailSequence")) {
8426          this.getDetailSequence().add(TypeConvertor.castToPositiveInt(value));
8427        } else if (name.equals("subDetailSequence")) {
8428          this.getSubDetailSequence().add(TypeConvertor.castToPositiveInt(value));
8429        } else if (name.equals("provider")) {
8430          this.getProvider().add(TypeConvertor.castToReference(value));
8431        } else if (name.equals("productOrService")) {
8432          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8433        } else if (name.equals("modifier")) {
8434          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
8435        } else if (name.equals("programCode")) {
8436          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
8437        } else if (name.equals("serviced[x]")) {
8438          this.serviced = TypeConvertor.castToType(value); // DataType
8439        } else if (name.equals("location[x]")) {
8440          this.location = TypeConvertor.castToType(value); // DataType
8441        } else if (name.equals("quantity")) {
8442          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
8443        } else if (name.equals("unitPrice")) {
8444          this.unitPrice = TypeConvertor.castToMoney(value); // Money
8445        } else if (name.equals("factor")) {
8446          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
8447        } else if (name.equals("net")) {
8448          this.net = TypeConvertor.castToMoney(value); // Money
8449        } else if (name.equals("bodySite")) {
8450          this.bodySite = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8451        } else if (name.equals("subSite")) {
8452          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value));
8453        } else if (name.equals("noteNumber")) {
8454          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
8455        } else if (name.equals("adjudication")) {
8456          this.getAdjudication().add((AdjudicationComponent) value);
8457        } else if (name.equals("detail")) {
8458          this.getDetail().add((AddedItemDetailComponent) value);
8459        } else
8460          return super.setProperty(name, value);
8461        return value;
8462      }
8463
8464      @Override
8465      public Base makeProperty(int hash, String name) throws FHIRException {
8466        switch (hash) {
8467        case 1977979892:  return addItemSequenceElement();
8468        case 1321472818:  return addDetailSequenceElement();
8469        case -855462510:  return addSubDetailSequenceElement();
8470        case -987494927:  return addProvider(); 
8471        case 1957227299:  return getProductOrService();
8472        case -615513385:  return addModifier(); 
8473        case 1010065041:  return addProgramCode(); 
8474        case -1927922223:  return getServiced();
8475        case 1379209295:  return getServiced();
8476        case 552316075:  return getLocation();
8477        case 1901043637:  return getLocation();
8478        case -1285004149:  return getQuantity();
8479        case -486196699:  return getUnitPrice();
8480        case -1282148017:  return getFactorElement();
8481        case 108957:  return getNet();
8482        case 1702620169:  return getBodySite();
8483        case -1868566105:  return addSubSite(); 
8484        case -1110033957:  return addNoteNumberElement();
8485        case -231349275:  return addAdjudication(); 
8486        case -1335224239:  return addDetail(); 
8487        default: return super.makeProperty(hash, name);
8488        }
8489
8490      }
8491
8492      @Override
8493      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8494        switch (hash) {
8495        case 1977979892: /*itemSequence*/ return new String[] {"positiveInt"};
8496        case 1321472818: /*detailSequence*/ return new String[] {"positiveInt"};
8497        case -855462510: /*subDetailSequence*/ return new String[] {"positiveInt"};
8498        case -987494927: /*provider*/ return new String[] {"Reference"};
8499        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
8500        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
8501        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
8502        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
8503        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
8504        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
8505        case -486196699: /*unitPrice*/ return new String[] {"Money"};
8506        case -1282148017: /*factor*/ return new String[] {"decimal"};
8507        case 108957: /*net*/ return new String[] {"Money"};
8508        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
8509        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
8510        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
8511        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
8512        case -1335224239: /*detail*/ return new String[] {};
8513        default: return super.getTypesForProperty(hash, name);
8514        }
8515
8516      }
8517
8518      @Override
8519      public Base addChild(String name) throws FHIRException {
8520        if (name.equals("itemSequence")) {
8521          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.itemSequence");
8522        }
8523        else if (name.equals("detailSequence")) {
8524          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detailSequence");
8525        }
8526        else if (name.equals("subDetailSequence")) {
8527          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.subDetailSequence");
8528        }
8529        else if (name.equals("provider")) {
8530          return addProvider();
8531        }
8532        else if (name.equals("productOrService")) {
8533          this.productOrService = new CodeableConcept();
8534          return this.productOrService;
8535        }
8536        else if (name.equals("modifier")) {
8537          return addModifier();
8538        }
8539        else if (name.equals("programCode")) {
8540          return addProgramCode();
8541        }
8542        else if (name.equals("servicedDate")) {
8543          this.serviced = new DateType();
8544          return this.serviced;
8545        }
8546        else if (name.equals("servicedPeriod")) {
8547          this.serviced = new Period();
8548          return this.serviced;
8549        }
8550        else if (name.equals("locationCodeableConcept")) {
8551          this.location = new CodeableConcept();
8552          return this.location;
8553        }
8554        else if (name.equals("locationAddress")) {
8555          this.location = new Address();
8556          return this.location;
8557        }
8558        else if (name.equals("locationReference")) {
8559          this.location = new Reference();
8560          return this.location;
8561        }
8562        else if (name.equals("quantity")) {
8563          this.quantity = new Quantity();
8564          return this.quantity;
8565        }
8566        else if (name.equals("unitPrice")) {
8567          this.unitPrice = new Money();
8568          return this.unitPrice;
8569        }
8570        else if (name.equals("factor")) {
8571          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.factor");
8572        }
8573        else if (name.equals("net")) {
8574          this.net = new Money();
8575          return this.net;
8576        }
8577        else if (name.equals("bodySite")) {
8578          this.bodySite = new CodeableConcept();
8579          return this.bodySite;
8580        }
8581        else if (name.equals("subSite")) {
8582          return addSubSite();
8583        }
8584        else if (name.equals("noteNumber")) {
8585          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.noteNumber");
8586        }
8587        else if (name.equals("adjudication")) {
8588          return addAdjudication();
8589        }
8590        else if (name.equals("detail")) {
8591          return addDetail();
8592        }
8593        else
8594          return super.addChild(name);
8595      }
8596
8597      public AddedItemComponent copy() {
8598        AddedItemComponent dst = new AddedItemComponent();
8599        copyValues(dst);
8600        return dst;
8601      }
8602
8603      public void copyValues(AddedItemComponent dst) {
8604        super.copyValues(dst);
8605        if (itemSequence != null) {
8606          dst.itemSequence = new ArrayList<PositiveIntType>();
8607          for (PositiveIntType i : itemSequence)
8608            dst.itemSequence.add(i.copy());
8609        };
8610        if (detailSequence != null) {
8611          dst.detailSequence = new ArrayList<PositiveIntType>();
8612          for (PositiveIntType i : detailSequence)
8613            dst.detailSequence.add(i.copy());
8614        };
8615        if (subDetailSequence != null) {
8616          dst.subDetailSequence = new ArrayList<PositiveIntType>();
8617          for (PositiveIntType i : subDetailSequence)
8618            dst.subDetailSequence.add(i.copy());
8619        };
8620        if (provider != null) {
8621          dst.provider = new ArrayList<Reference>();
8622          for (Reference i : provider)
8623            dst.provider.add(i.copy());
8624        };
8625        dst.productOrService = productOrService == null ? null : productOrService.copy();
8626        if (modifier != null) {
8627          dst.modifier = new ArrayList<CodeableConcept>();
8628          for (CodeableConcept i : modifier)
8629            dst.modifier.add(i.copy());
8630        };
8631        if (programCode != null) {
8632          dst.programCode = new ArrayList<CodeableConcept>();
8633          for (CodeableConcept i : programCode)
8634            dst.programCode.add(i.copy());
8635        };
8636        dst.serviced = serviced == null ? null : serviced.copy();
8637        dst.location = location == null ? null : location.copy();
8638        dst.quantity = quantity == null ? null : quantity.copy();
8639        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
8640        dst.factor = factor == null ? null : factor.copy();
8641        dst.net = net == null ? null : net.copy();
8642        dst.bodySite = bodySite == null ? null : bodySite.copy();
8643        if (subSite != null) {
8644          dst.subSite = new ArrayList<CodeableConcept>();
8645          for (CodeableConcept i : subSite)
8646            dst.subSite.add(i.copy());
8647        };
8648        if (noteNumber != null) {
8649          dst.noteNumber = new ArrayList<PositiveIntType>();
8650          for (PositiveIntType i : noteNumber)
8651            dst.noteNumber.add(i.copy());
8652        };
8653        if (adjudication != null) {
8654          dst.adjudication = new ArrayList<AdjudicationComponent>();
8655          for (AdjudicationComponent i : adjudication)
8656            dst.adjudication.add(i.copy());
8657        };
8658        if (detail != null) {
8659          dst.detail = new ArrayList<AddedItemDetailComponent>();
8660          for (AddedItemDetailComponent i : detail)
8661            dst.detail.add(i.copy());
8662        };
8663      }
8664
8665      @Override
8666      public boolean equalsDeep(Base other_) {
8667        if (!super.equalsDeep(other_))
8668          return false;
8669        if (!(other_ instanceof AddedItemComponent))
8670          return false;
8671        AddedItemComponent o = (AddedItemComponent) other_;
8672        return compareDeep(itemSequence, o.itemSequence, true) && compareDeep(detailSequence, o.detailSequence, true)
8673           && compareDeep(subDetailSequence, o.subDetailSequence, true) && compareDeep(provider, o.provider, true)
8674           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
8675           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
8676           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
8677           && compareDeep(net, o.net, true) && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true)
8678           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
8679           && compareDeep(detail, o.detail, true);
8680      }
8681
8682      @Override
8683      public boolean equalsShallow(Base other_) {
8684        if (!super.equalsShallow(other_))
8685          return false;
8686        if (!(other_ instanceof AddedItemComponent))
8687          return false;
8688        AddedItemComponent o = (AddedItemComponent) other_;
8689        return compareValues(itemSequence, o.itemSequence, true) && compareValues(detailSequence, o.detailSequence, true)
8690           && compareValues(subDetailSequence, o.subDetailSequence, true) && compareValues(factor, o.factor, true)
8691           && compareValues(noteNumber, o.noteNumber, true);
8692      }
8693
8694      public boolean isEmpty() {
8695        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemSequence, detailSequence
8696          , subDetailSequence, provider, productOrService, modifier, programCode, serviced
8697          , location, quantity, unitPrice, factor, net, bodySite, subSite, noteNumber
8698          , adjudication, detail);
8699      }
8700
8701  public String fhirType() {
8702    return "ExplanationOfBenefit.addItem";
8703
8704  }
8705
8706  }
8707
8708    @Block()
8709    public static class AddedItemDetailComponent extends BackboneElement implements IBaseBackboneElement {
8710        /**
8711         * When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.
8712         */
8713        @Child(name = "productOrService", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
8714        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item." )
8715        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
8716        protected CodeableConcept productOrService;
8717
8718        /**
8719         * Item typification or modifiers codes to convey additional context for the product or service.
8720         */
8721        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8722        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
8723        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
8724        protected List<CodeableConcept> modifier;
8725
8726        /**
8727         * The number of repetitions of a service or product.
8728         */
8729        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
8730        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
8731        protected Quantity quantity;
8732
8733        /**
8734         * 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.
8735         */
8736        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
8737        @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." )
8738        protected Money unitPrice;
8739
8740        /**
8741         * 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.
8742         */
8743        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
8744        @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." )
8745        protected DecimalType factor;
8746
8747        /**
8748         * The quantity times the unit price for an additional service or product or charge.
8749         */
8750        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
8751        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
8752        protected Money net;
8753
8754        /**
8755         * The numbers associated with notes below which apply to the adjudication of this item.
8756         */
8757        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8758        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
8759        protected List<PositiveIntType> noteNumber;
8760
8761        /**
8762         * The adjudication results.
8763         */
8764        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8765        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
8766        protected List<AdjudicationComponent> adjudication;
8767
8768        /**
8769         * The third-tier service adjudications for payor added services.
8770         */
8771        @Child(name = "subDetail", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8772        @Description(shortDefinition="Insurer added line items", formalDefinition="The third-tier service adjudications for payor added services." )
8773        protected List<AddedItemDetailSubDetailComponent> subDetail;
8774
8775        private static final long serialVersionUID = 295910869L;
8776
8777    /**
8778     * Constructor
8779     */
8780      public AddedItemDetailComponent() {
8781        super();
8782      }
8783
8784    /**
8785     * Constructor
8786     */
8787      public AddedItemDetailComponent(CodeableConcept productOrService) {
8788        super();
8789        this.setProductOrService(productOrService);
8790      }
8791
8792        /**
8793         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
8794         */
8795        public CodeableConcept getProductOrService() { 
8796          if (this.productOrService == null)
8797            if (Configuration.errorOnAutoCreate())
8798              throw new Error("Attempt to auto-create AddedItemDetailComponent.productOrService");
8799            else if (Configuration.doAutoCreate())
8800              this.productOrService = new CodeableConcept(); // cc
8801          return this.productOrService;
8802        }
8803
8804        public boolean hasProductOrService() { 
8805          return this.productOrService != null && !this.productOrService.isEmpty();
8806        }
8807
8808        /**
8809         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
8810         */
8811        public AddedItemDetailComponent setProductOrService(CodeableConcept value) { 
8812          this.productOrService = value;
8813          return this;
8814        }
8815
8816        /**
8817         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
8818         */
8819        public List<CodeableConcept> getModifier() { 
8820          if (this.modifier == null)
8821            this.modifier = new ArrayList<CodeableConcept>();
8822          return this.modifier;
8823        }
8824
8825        /**
8826         * @return Returns a reference to <code>this</code> for easy method chaining
8827         */
8828        public AddedItemDetailComponent setModifier(List<CodeableConcept> theModifier) { 
8829          this.modifier = theModifier;
8830          return this;
8831        }
8832
8833        public boolean hasModifier() { 
8834          if (this.modifier == null)
8835            return false;
8836          for (CodeableConcept item : this.modifier)
8837            if (!item.isEmpty())
8838              return true;
8839          return false;
8840        }
8841
8842        public CodeableConcept addModifier() { //3
8843          CodeableConcept t = new CodeableConcept();
8844          if (this.modifier == null)
8845            this.modifier = new ArrayList<CodeableConcept>();
8846          this.modifier.add(t);
8847          return t;
8848        }
8849
8850        public AddedItemDetailComponent addModifier(CodeableConcept t) { //3
8851          if (t == null)
8852            return this;
8853          if (this.modifier == null)
8854            this.modifier = new ArrayList<CodeableConcept>();
8855          this.modifier.add(t);
8856          return this;
8857        }
8858
8859        /**
8860         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
8861         */
8862        public CodeableConcept getModifierFirstRep() { 
8863          if (getModifier().isEmpty()) {
8864            addModifier();
8865          }
8866          return getModifier().get(0);
8867        }
8868
8869        /**
8870         * @return {@link #quantity} (The number of repetitions of a service or product.)
8871         */
8872        public Quantity getQuantity() { 
8873          if (this.quantity == null)
8874            if (Configuration.errorOnAutoCreate())
8875              throw new Error("Attempt to auto-create AddedItemDetailComponent.quantity");
8876            else if (Configuration.doAutoCreate())
8877              this.quantity = new Quantity(); // cc
8878          return this.quantity;
8879        }
8880
8881        public boolean hasQuantity() { 
8882          return this.quantity != null && !this.quantity.isEmpty();
8883        }
8884
8885        /**
8886         * @param value {@link #quantity} (The number of repetitions of a service or product.)
8887         */
8888        public AddedItemDetailComponent setQuantity(Quantity value) { 
8889          this.quantity = value;
8890          return this;
8891        }
8892
8893        /**
8894         * @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.)
8895         */
8896        public Money getUnitPrice() { 
8897          if (this.unitPrice == null)
8898            if (Configuration.errorOnAutoCreate())
8899              throw new Error("Attempt to auto-create AddedItemDetailComponent.unitPrice");
8900            else if (Configuration.doAutoCreate())
8901              this.unitPrice = new Money(); // cc
8902          return this.unitPrice;
8903        }
8904
8905        public boolean hasUnitPrice() { 
8906          return this.unitPrice != null && !this.unitPrice.isEmpty();
8907        }
8908
8909        /**
8910         * @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.)
8911         */
8912        public AddedItemDetailComponent setUnitPrice(Money value) { 
8913          this.unitPrice = value;
8914          return this;
8915        }
8916
8917        /**
8918         * @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
8919         */
8920        public DecimalType getFactorElement() { 
8921          if (this.factor == null)
8922            if (Configuration.errorOnAutoCreate())
8923              throw new Error("Attempt to auto-create AddedItemDetailComponent.factor");
8924            else if (Configuration.doAutoCreate())
8925              this.factor = new DecimalType(); // bb
8926          return this.factor;
8927        }
8928
8929        public boolean hasFactorElement() { 
8930          return this.factor != null && !this.factor.isEmpty();
8931        }
8932
8933        public boolean hasFactor() { 
8934          return this.factor != null && !this.factor.isEmpty();
8935        }
8936
8937        /**
8938         * @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
8939         */
8940        public AddedItemDetailComponent setFactorElement(DecimalType value) { 
8941          this.factor = value;
8942          return this;
8943        }
8944
8945        /**
8946         * @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.
8947         */
8948        public BigDecimal getFactor() { 
8949          return this.factor == null ? null : this.factor.getValue();
8950        }
8951
8952        /**
8953         * @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.
8954         */
8955        public AddedItemDetailComponent setFactor(BigDecimal value) { 
8956          if (value == null)
8957            this.factor = null;
8958          else {
8959            if (this.factor == null)
8960              this.factor = new DecimalType();
8961            this.factor.setValue(value);
8962          }
8963          return this;
8964        }
8965
8966        /**
8967         * @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.
8968         */
8969        public AddedItemDetailComponent setFactor(long value) { 
8970              this.factor = new DecimalType();
8971            this.factor.setValue(value);
8972          return this;
8973        }
8974
8975        /**
8976         * @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.
8977         */
8978        public AddedItemDetailComponent setFactor(double value) { 
8979              this.factor = new DecimalType();
8980            this.factor.setValue(value);
8981          return this;
8982        }
8983
8984        /**
8985         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8986         */
8987        public Money getNet() { 
8988          if (this.net == null)
8989            if (Configuration.errorOnAutoCreate())
8990              throw new Error("Attempt to auto-create AddedItemDetailComponent.net");
8991            else if (Configuration.doAutoCreate())
8992              this.net = new Money(); // cc
8993          return this.net;
8994        }
8995
8996        public boolean hasNet() { 
8997          return this.net != null && !this.net.isEmpty();
8998        }
8999
9000        /**
9001         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9002         */
9003        public AddedItemDetailComponent setNet(Money value) { 
9004          this.net = value;
9005          return this;
9006        }
9007
9008        /**
9009         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9010         */
9011        public List<PositiveIntType> getNoteNumber() { 
9012          if (this.noteNumber == null)
9013            this.noteNumber = new ArrayList<PositiveIntType>();
9014          return this.noteNumber;
9015        }
9016
9017        /**
9018         * @return Returns a reference to <code>this</code> for easy method chaining
9019         */
9020        public AddedItemDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
9021          this.noteNumber = theNoteNumber;
9022          return this;
9023        }
9024
9025        public boolean hasNoteNumber() { 
9026          if (this.noteNumber == null)
9027            return false;
9028          for (PositiveIntType item : this.noteNumber)
9029            if (!item.isEmpty())
9030              return true;
9031          return false;
9032        }
9033
9034        /**
9035         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9036         */
9037        public PositiveIntType addNoteNumberElement() {//2 
9038          PositiveIntType t = new PositiveIntType();
9039          if (this.noteNumber == null)
9040            this.noteNumber = new ArrayList<PositiveIntType>();
9041          this.noteNumber.add(t);
9042          return t;
9043        }
9044
9045        /**
9046         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9047         */
9048        public AddedItemDetailComponent addNoteNumber(int value) { //1
9049          PositiveIntType t = new PositiveIntType();
9050          t.setValue(value);
9051          if (this.noteNumber == null)
9052            this.noteNumber = new ArrayList<PositiveIntType>();
9053          this.noteNumber.add(t);
9054          return this;
9055        }
9056
9057        /**
9058         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9059         */
9060        public boolean hasNoteNumber(int value) { 
9061          if (this.noteNumber == null)
9062            return false;
9063          for (PositiveIntType v : this.noteNumber)
9064            if (v.getValue().equals(value)) // positiveInt
9065              return true;
9066          return false;
9067        }
9068
9069        /**
9070         * @return {@link #adjudication} (The adjudication results.)
9071         */
9072        public List<AdjudicationComponent> getAdjudication() { 
9073          if (this.adjudication == null)
9074            this.adjudication = new ArrayList<AdjudicationComponent>();
9075          return this.adjudication;
9076        }
9077
9078        /**
9079         * @return Returns a reference to <code>this</code> for easy method chaining
9080         */
9081        public AddedItemDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
9082          this.adjudication = theAdjudication;
9083          return this;
9084        }
9085
9086        public boolean hasAdjudication() { 
9087          if (this.adjudication == null)
9088            return false;
9089          for (AdjudicationComponent item : this.adjudication)
9090            if (!item.isEmpty())
9091              return true;
9092          return false;
9093        }
9094
9095        public AdjudicationComponent addAdjudication() { //3
9096          AdjudicationComponent t = new AdjudicationComponent();
9097          if (this.adjudication == null)
9098            this.adjudication = new ArrayList<AdjudicationComponent>();
9099          this.adjudication.add(t);
9100          return t;
9101        }
9102
9103        public AddedItemDetailComponent addAdjudication(AdjudicationComponent t) { //3
9104          if (t == null)
9105            return this;
9106          if (this.adjudication == null)
9107            this.adjudication = new ArrayList<AdjudicationComponent>();
9108          this.adjudication.add(t);
9109          return this;
9110        }
9111
9112        /**
9113         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
9114         */
9115        public AdjudicationComponent getAdjudicationFirstRep() { 
9116          if (getAdjudication().isEmpty()) {
9117            addAdjudication();
9118          }
9119          return getAdjudication().get(0);
9120        }
9121
9122        /**
9123         * @return {@link #subDetail} (The third-tier service adjudications for payor added services.)
9124         */
9125        public List<AddedItemDetailSubDetailComponent> getSubDetail() { 
9126          if (this.subDetail == null)
9127            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9128          return this.subDetail;
9129        }
9130
9131        /**
9132         * @return Returns a reference to <code>this</code> for easy method chaining
9133         */
9134        public AddedItemDetailComponent setSubDetail(List<AddedItemDetailSubDetailComponent> theSubDetail) { 
9135          this.subDetail = theSubDetail;
9136          return this;
9137        }
9138
9139        public boolean hasSubDetail() { 
9140          if (this.subDetail == null)
9141            return false;
9142          for (AddedItemDetailSubDetailComponent item : this.subDetail)
9143            if (!item.isEmpty())
9144              return true;
9145          return false;
9146        }
9147
9148        public AddedItemDetailSubDetailComponent addSubDetail() { //3
9149          AddedItemDetailSubDetailComponent t = new AddedItemDetailSubDetailComponent();
9150          if (this.subDetail == null)
9151            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9152          this.subDetail.add(t);
9153          return t;
9154        }
9155
9156        public AddedItemDetailComponent addSubDetail(AddedItemDetailSubDetailComponent t) { //3
9157          if (t == null)
9158            return this;
9159          if (this.subDetail == null)
9160            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9161          this.subDetail.add(t);
9162          return this;
9163        }
9164
9165        /**
9166         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist {3}
9167         */
9168        public AddedItemDetailSubDetailComponent getSubDetailFirstRep() { 
9169          if (getSubDetail().isEmpty()) {
9170            addSubDetail();
9171          }
9172          return getSubDetail().get(0);
9173        }
9174
9175        protected void listChildren(List<Property> children) {
9176          super.listChildren(children);
9177          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService));
9178          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));
9179          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
9180          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));
9181          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));
9182          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
9183          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));
9184          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
9185          children.add(new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
9186        }
9187
9188        @Override
9189        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9190          switch (_hash) {
9191          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService);
9192          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);
9193          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
9194          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);
9195          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);
9196          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);
9197          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);
9198          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
9199          case -828829007: /*subDetail*/  return new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
9200          default: return super.getNamedProperty(_hash, _name, _checkValid);
9201          }
9202
9203        }
9204
9205      @Override
9206      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9207        switch (hash) {
9208        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
9209        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
9210        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
9211        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
9212        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
9213        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
9214        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
9215        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
9216        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // AddedItemDetailSubDetailComponent
9217        default: return super.getProperty(hash, name, checkValid);
9218        }
9219
9220      }
9221
9222      @Override
9223      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9224        switch (hash) {
9225        case 1957227299: // productOrService
9226          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9227          return value;
9228        case -615513385: // modifier
9229          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
9230          return value;
9231        case -1285004149: // quantity
9232          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
9233          return value;
9234        case -486196699: // unitPrice
9235          this.unitPrice = TypeConvertor.castToMoney(value); // Money
9236          return value;
9237        case -1282148017: // factor
9238          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
9239          return value;
9240        case 108957: // net
9241          this.net = TypeConvertor.castToMoney(value); // Money
9242          return value;
9243        case -1110033957: // noteNumber
9244          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
9245          return value;
9246        case -231349275: // adjudication
9247          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
9248          return value;
9249        case -828829007: // subDetail
9250          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value); // AddedItemDetailSubDetailComponent
9251          return value;
9252        default: return super.setProperty(hash, name, value);
9253        }
9254
9255      }
9256
9257      @Override
9258      public Base setProperty(String name, Base value) throws FHIRException {
9259        if (name.equals("productOrService")) {
9260          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9261        } else if (name.equals("modifier")) {
9262          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
9263        } else if (name.equals("quantity")) {
9264          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
9265        } else if (name.equals("unitPrice")) {
9266          this.unitPrice = TypeConvertor.castToMoney(value); // Money
9267        } else if (name.equals("factor")) {
9268          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
9269        } else if (name.equals("net")) {
9270          this.net = TypeConvertor.castToMoney(value); // Money
9271        } else if (name.equals("noteNumber")) {
9272          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
9273        } else if (name.equals("adjudication")) {
9274          this.getAdjudication().add((AdjudicationComponent) value);
9275        } else if (name.equals("subDetail")) {
9276          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value);
9277        } else
9278          return super.setProperty(name, value);
9279        return value;
9280      }
9281
9282      @Override
9283      public Base makeProperty(int hash, String name) throws FHIRException {
9284        switch (hash) {
9285        case 1957227299:  return getProductOrService();
9286        case -615513385:  return addModifier(); 
9287        case -1285004149:  return getQuantity();
9288        case -486196699:  return getUnitPrice();
9289        case -1282148017:  return getFactorElement();
9290        case 108957:  return getNet();
9291        case -1110033957:  return addNoteNumberElement();
9292        case -231349275:  return addAdjudication(); 
9293        case -828829007:  return addSubDetail(); 
9294        default: return super.makeProperty(hash, name);
9295        }
9296
9297      }
9298
9299      @Override
9300      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9301        switch (hash) {
9302        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
9303        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
9304        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
9305        case -486196699: /*unitPrice*/ return new String[] {"Money"};
9306        case -1282148017: /*factor*/ return new String[] {"decimal"};
9307        case 108957: /*net*/ return new String[] {"Money"};
9308        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
9309        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
9310        case -828829007: /*subDetail*/ return new String[] {};
9311        default: return super.getTypesForProperty(hash, name);
9312        }
9313
9314      }
9315
9316      @Override
9317      public Base addChild(String name) throws FHIRException {
9318        if (name.equals("productOrService")) {
9319          this.productOrService = new CodeableConcept();
9320          return this.productOrService;
9321        }
9322        else if (name.equals("modifier")) {
9323          return addModifier();
9324        }
9325        else if (name.equals("quantity")) {
9326          this.quantity = new Quantity();
9327          return this.quantity;
9328        }
9329        else if (name.equals("unitPrice")) {
9330          this.unitPrice = new Money();
9331          return this.unitPrice;
9332        }
9333        else if (name.equals("factor")) {
9334          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detail.factor");
9335        }
9336        else if (name.equals("net")) {
9337          this.net = new Money();
9338          return this.net;
9339        }
9340        else if (name.equals("noteNumber")) {
9341          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detail.noteNumber");
9342        }
9343        else if (name.equals("adjudication")) {
9344          return addAdjudication();
9345        }
9346        else if (name.equals("subDetail")) {
9347          return addSubDetail();
9348        }
9349        else
9350          return super.addChild(name);
9351      }
9352
9353      public AddedItemDetailComponent copy() {
9354        AddedItemDetailComponent dst = new AddedItemDetailComponent();
9355        copyValues(dst);
9356        return dst;
9357      }
9358
9359      public void copyValues(AddedItemDetailComponent dst) {
9360        super.copyValues(dst);
9361        dst.productOrService = productOrService == null ? null : productOrService.copy();
9362        if (modifier != null) {
9363          dst.modifier = new ArrayList<CodeableConcept>();
9364          for (CodeableConcept i : modifier)
9365            dst.modifier.add(i.copy());
9366        };
9367        dst.quantity = quantity == null ? null : quantity.copy();
9368        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
9369        dst.factor = factor == null ? null : factor.copy();
9370        dst.net = net == null ? null : net.copy();
9371        if (noteNumber != null) {
9372          dst.noteNumber = new ArrayList<PositiveIntType>();
9373          for (PositiveIntType i : noteNumber)
9374            dst.noteNumber.add(i.copy());
9375        };
9376        if (adjudication != null) {
9377          dst.adjudication = new ArrayList<AdjudicationComponent>();
9378          for (AdjudicationComponent i : adjudication)
9379            dst.adjudication.add(i.copy());
9380        };
9381        if (subDetail != null) {
9382          dst.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9383          for (AddedItemDetailSubDetailComponent i : subDetail)
9384            dst.subDetail.add(i.copy());
9385        };
9386      }
9387
9388      @Override
9389      public boolean equalsDeep(Base other_) {
9390        if (!super.equalsDeep(other_))
9391          return false;
9392        if (!(other_ instanceof AddedItemDetailComponent))
9393          return false;
9394        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9395        return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
9396           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
9397           && compareDeep(net, o.net, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
9398           && compareDeep(subDetail, o.subDetail, true);
9399      }
9400
9401      @Override
9402      public boolean equalsShallow(Base other_) {
9403        if (!super.equalsShallow(other_))
9404          return false;
9405        if (!(other_ instanceof AddedItemDetailComponent))
9406          return false;
9407        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9408        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
9409      }
9410
9411      public boolean isEmpty() {
9412        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier
9413          , quantity, unitPrice, factor, net, noteNumber, adjudication, subDetail);
9414      }
9415
9416  public String fhirType() {
9417    return "ExplanationOfBenefit.addItem.detail";
9418
9419  }
9420
9421  }
9422
9423    @Block()
9424    public static class AddedItemDetailSubDetailComponent extends BackboneElement implements IBaseBackboneElement {
9425        /**
9426         * When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.
9427         */
9428        @Child(name = "productOrService", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9429        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item." )
9430        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
9431        protected CodeableConcept productOrService;
9432
9433        /**
9434         * Item typification or modifiers codes to convey additional context for the product or service.
9435         */
9436        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9437        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
9438        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
9439        protected List<CodeableConcept> modifier;
9440
9441        /**
9442         * The number of repetitions of a service or product.
9443         */
9444        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
9445        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
9446        protected Quantity quantity;
9447
9448        /**
9449         * 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.
9450         */
9451        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
9452        @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." )
9453        protected Money unitPrice;
9454
9455        /**
9456         * 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.
9457         */
9458        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
9459        @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." )
9460        protected DecimalType factor;
9461
9462        /**
9463         * The quantity times the unit price for an additional service or product or charge.
9464         */
9465        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
9466        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
9467        protected Money net;
9468
9469        /**
9470         * The numbers associated with notes below which apply to the adjudication of this item.
9471         */
9472        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9473        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
9474        protected List<PositiveIntType> noteNumber;
9475
9476        /**
9477         * The adjudication results.
9478         */
9479        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9480        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
9481        protected List<AdjudicationComponent> adjudication;
9482
9483        private static final long serialVersionUID = 1301363592L;
9484
9485    /**
9486     * Constructor
9487     */
9488      public AddedItemDetailSubDetailComponent() {
9489        super();
9490      }
9491
9492    /**
9493     * Constructor
9494     */
9495      public AddedItemDetailSubDetailComponent(CodeableConcept productOrService) {
9496        super();
9497        this.setProductOrService(productOrService);
9498      }
9499
9500        /**
9501         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
9502         */
9503        public CodeableConcept getProductOrService() { 
9504          if (this.productOrService == null)
9505            if (Configuration.errorOnAutoCreate())
9506              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.productOrService");
9507            else if (Configuration.doAutoCreate())
9508              this.productOrService = new CodeableConcept(); // cc
9509          return this.productOrService;
9510        }
9511
9512        public boolean hasProductOrService() { 
9513          return this.productOrService != null && !this.productOrService.isEmpty();
9514        }
9515
9516        /**
9517         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
9518         */
9519        public AddedItemDetailSubDetailComponent setProductOrService(CodeableConcept value) { 
9520          this.productOrService = value;
9521          return this;
9522        }
9523
9524        /**
9525         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
9526         */
9527        public List<CodeableConcept> getModifier() { 
9528          if (this.modifier == null)
9529            this.modifier = new ArrayList<CodeableConcept>();
9530          return this.modifier;
9531        }
9532
9533        /**
9534         * @return Returns a reference to <code>this</code> for easy method chaining
9535         */
9536        public AddedItemDetailSubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
9537          this.modifier = theModifier;
9538          return this;
9539        }
9540
9541        public boolean hasModifier() { 
9542          if (this.modifier == null)
9543            return false;
9544          for (CodeableConcept item : this.modifier)
9545            if (!item.isEmpty())
9546              return true;
9547          return false;
9548        }
9549
9550        public CodeableConcept addModifier() { //3
9551          CodeableConcept t = new CodeableConcept();
9552          if (this.modifier == null)
9553            this.modifier = new ArrayList<CodeableConcept>();
9554          this.modifier.add(t);
9555          return t;
9556        }
9557
9558        public AddedItemDetailSubDetailComponent addModifier(CodeableConcept t) { //3
9559          if (t == null)
9560            return this;
9561          if (this.modifier == null)
9562            this.modifier = new ArrayList<CodeableConcept>();
9563          this.modifier.add(t);
9564          return this;
9565        }
9566
9567        /**
9568         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
9569         */
9570        public CodeableConcept getModifierFirstRep() { 
9571          if (getModifier().isEmpty()) {
9572            addModifier();
9573          }
9574          return getModifier().get(0);
9575        }
9576
9577        /**
9578         * @return {@link #quantity} (The number of repetitions of a service or product.)
9579         */
9580        public Quantity getQuantity() { 
9581          if (this.quantity == null)
9582            if (Configuration.errorOnAutoCreate())
9583              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.quantity");
9584            else if (Configuration.doAutoCreate())
9585              this.quantity = new Quantity(); // cc
9586          return this.quantity;
9587        }
9588
9589        public boolean hasQuantity() { 
9590          return this.quantity != null && !this.quantity.isEmpty();
9591        }
9592
9593        /**
9594         * @param value {@link #quantity} (The number of repetitions of a service or product.)
9595         */
9596        public AddedItemDetailSubDetailComponent setQuantity(Quantity value) { 
9597          this.quantity = value;
9598          return this;
9599        }
9600
9601        /**
9602         * @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.)
9603         */
9604        public Money getUnitPrice() { 
9605          if (this.unitPrice == null)
9606            if (Configuration.errorOnAutoCreate())
9607              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.unitPrice");
9608            else if (Configuration.doAutoCreate())
9609              this.unitPrice = new Money(); // cc
9610          return this.unitPrice;
9611        }
9612
9613        public boolean hasUnitPrice() { 
9614          return this.unitPrice != null && !this.unitPrice.isEmpty();
9615        }
9616
9617        /**
9618         * @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.)
9619         */
9620        public AddedItemDetailSubDetailComponent setUnitPrice(Money value) { 
9621          this.unitPrice = value;
9622          return this;
9623        }
9624
9625        /**
9626         * @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
9627         */
9628        public DecimalType getFactorElement() { 
9629          if (this.factor == null)
9630            if (Configuration.errorOnAutoCreate())
9631              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.factor");
9632            else if (Configuration.doAutoCreate())
9633              this.factor = new DecimalType(); // bb
9634          return this.factor;
9635        }
9636
9637        public boolean hasFactorElement() { 
9638          return this.factor != null && !this.factor.isEmpty();
9639        }
9640
9641        public boolean hasFactor() { 
9642          return this.factor != null && !this.factor.isEmpty();
9643        }
9644
9645        /**
9646         * @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
9647         */
9648        public AddedItemDetailSubDetailComponent setFactorElement(DecimalType value) { 
9649          this.factor = value;
9650          return this;
9651        }
9652
9653        /**
9654         * @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.
9655         */
9656        public BigDecimal getFactor() { 
9657          return this.factor == null ? null : this.factor.getValue();
9658        }
9659
9660        /**
9661         * @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.
9662         */
9663        public AddedItemDetailSubDetailComponent setFactor(BigDecimal value) { 
9664          if (value == null)
9665            this.factor = null;
9666          else {
9667            if (this.factor == null)
9668              this.factor = new DecimalType();
9669            this.factor.setValue(value);
9670          }
9671          return this;
9672        }
9673
9674        /**
9675         * @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.
9676         */
9677        public AddedItemDetailSubDetailComponent setFactor(long value) { 
9678              this.factor = new DecimalType();
9679            this.factor.setValue(value);
9680          return this;
9681        }
9682
9683        /**
9684         * @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.
9685         */
9686        public AddedItemDetailSubDetailComponent setFactor(double value) { 
9687              this.factor = new DecimalType();
9688            this.factor.setValue(value);
9689          return this;
9690        }
9691
9692        /**
9693         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9694         */
9695        public Money getNet() { 
9696          if (this.net == null)
9697            if (Configuration.errorOnAutoCreate())
9698              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.net");
9699            else if (Configuration.doAutoCreate())
9700              this.net = new Money(); // cc
9701          return this.net;
9702        }
9703
9704        public boolean hasNet() { 
9705          return this.net != null && !this.net.isEmpty();
9706        }
9707
9708        /**
9709         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9710         */
9711        public AddedItemDetailSubDetailComponent setNet(Money value) { 
9712          this.net = value;
9713          return this;
9714        }
9715
9716        /**
9717         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9718         */
9719        public List<PositiveIntType> getNoteNumber() { 
9720          if (this.noteNumber == null)
9721            this.noteNumber = new ArrayList<PositiveIntType>();
9722          return this.noteNumber;
9723        }
9724
9725        /**
9726         * @return Returns a reference to <code>this</code> for easy method chaining
9727         */
9728        public AddedItemDetailSubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
9729          this.noteNumber = theNoteNumber;
9730          return this;
9731        }
9732
9733        public boolean hasNoteNumber() { 
9734          if (this.noteNumber == null)
9735            return false;
9736          for (PositiveIntType item : this.noteNumber)
9737            if (!item.isEmpty())
9738              return true;
9739          return false;
9740        }
9741
9742        /**
9743         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9744         */
9745        public PositiveIntType addNoteNumberElement() {//2 
9746          PositiveIntType t = new PositiveIntType();
9747          if (this.noteNumber == null)
9748            this.noteNumber = new ArrayList<PositiveIntType>();
9749          this.noteNumber.add(t);
9750          return t;
9751        }
9752
9753        /**
9754         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9755         */
9756        public AddedItemDetailSubDetailComponent addNoteNumber(int value) { //1
9757          PositiveIntType t = new PositiveIntType();
9758          t.setValue(value);
9759          if (this.noteNumber == null)
9760            this.noteNumber = new ArrayList<PositiveIntType>();
9761          this.noteNumber.add(t);
9762          return this;
9763        }
9764
9765        /**
9766         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9767         */
9768        public boolean hasNoteNumber(int value) { 
9769          if (this.noteNumber == null)
9770            return false;
9771          for (PositiveIntType v : this.noteNumber)
9772            if (v.getValue().equals(value)) // positiveInt
9773              return true;
9774          return false;
9775        }
9776
9777        /**
9778         * @return {@link #adjudication} (The adjudication results.)
9779         */
9780        public List<AdjudicationComponent> getAdjudication() { 
9781          if (this.adjudication == null)
9782            this.adjudication = new ArrayList<AdjudicationComponent>();
9783          return this.adjudication;
9784        }
9785
9786        /**
9787         * @return Returns a reference to <code>this</code> for easy method chaining
9788         */
9789        public AddedItemDetailSubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
9790          this.adjudication = theAdjudication;
9791          return this;
9792        }
9793
9794        public boolean hasAdjudication() { 
9795          if (this.adjudication == null)
9796            return false;
9797          for (AdjudicationComponent item : this.adjudication)
9798            if (!item.isEmpty())
9799              return true;
9800          return false;
9801        }
9802
9803        public AdjudicationComponent addAdjudication() { //3
9804          AdjudicationComponent t = new AdjudicationComponent();
9805          if (this.adjudication == null)
9806            this.adjudication = new ArrayList<AdjudicationComponent>();
9807          this.adjudication.add(t);
9808          return t;
9809        }
9810
9811        public AddedItemDetailSubDetailComponent addAdjudication(AdjudicationComponent t) { //3
9812          if (t == null)
9813            return this;
9814          if (this.adjudication == null)
9815            this.adjudication = new ArrayList<AdjudicationComponent>();
9816          this.adjudication.add(t);
9817          return this;
9818        }
9819
9820        /**
9821         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
9822         */
9823        public AdjudicationComponent getAdjudicationFirstRep() { 
9824          if (getAdjudication().isEmpty()) {
9825            addAdjudication();
9826          }
9827          return getAdjudication().get(0);
9828        }
9829
9830        protected void listChildren(List<Property> children) {
9831          super.listChildren(children);
9832          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService));
9833          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));
9834          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
9835          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));
9836          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));
9837          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
9838          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));
9839          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
9840        }
9841
9842        @Override
9843        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9844          switch (_hash) {
9845          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService);
9846          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);
9847          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
9848          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);
9849          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);
9850          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);
9851          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);
9852          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
9853          default: return super.getNamedProperty(_hash, _name, _checkValid);
9854          }
9855
9856        }
9857
9858      @Override
9859      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9860        switch (hash) {
9861        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
9862        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
9863        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
9864        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
9865        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
9866        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
9867        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
9868        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
9869        default: return super.getProperty(hash, name, checkValid);
9870        }
9871
9872      }
9873
9874      @Override
9875      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9876        switch (hash) {
9877        case 1957227299: // productOrService
9878          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9879          return value;
9880        case -615513385: // modifier
9881          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
9882          return value;
9883        case -1285004149: // quantity
9884          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
9885          return value;
9886        case -486196699: // unitPrice
9887          this.unitPrice = TypeConvertor.castToMoney(value); // Money
9888          return value;
9889        case -1282148017: // factor
9890          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
9891          return value;
9892        case 108957: // net
9893          this.net = TypeConvertor.castToMoney(value); // Money
9894          return value;
9895        case -1110033957: // noteNumber
9896          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
9897          return value;
9898        case -231349275: // adjudication
9899          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
9900          return value;
9901        default: return super.setProperty(hash, name, value);
9902        }
9903
9904      }
9905
9906      @Override
9907      public Base setProperty(String name, Base value) throws FHIRException {
9908        if (name.equals("productOrService")) {
9909          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9910        } else if (name.equals("modifier")) {
9911          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
9912        } else if (name.equals("quantity")) {
9913          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
9914        } else if (name.equals("unitPrice")) {
9915          this.unitPrice = TypeConvertor.castToMoney(value); // Money
9916        } else if (name.equals("factor")) {
9917          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
9918        } else if (name.equals("net")) {
9919          this.net = TypeConvertor.castToMoney(value); // Money
9920        } else if (name.equals("noteNumber")) {
9921          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
9922        } else if (name.equals("adjudication")) {
9923          this.getAdjudication().add((AdjudicationComponent) value);
9924        } else
9925          return super.setProperty(name, value);
9926        return value;
9927      }
9928
9929      @Override
9930      public Base makeProperty(int hash, String name) throws FHIRException {
9931        switch (hash) {
9932        case 1957227299:  return getProductOrService();
9933        case -615513385:  return addModifier(); 
9934        case -1285004149:  return getQuantity();
9935        case -486196699:  return getUnitPrice();
9936        case -1282148017:  return getFactorElement();
9937        case 108957:  return getNet();
9938        case -1110033957:  return addNoteNumberElement();
9939        case -231349275:  return addAdjudication(); 
9940        default: return super.makeProperty(hash, name);
9941        }
9942
9943      }
9944
9945      @Override
9946      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9947        switch (hash) {
9948        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
9949        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
9950        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
9951        case -486196699: /*unitPrice*/ return new String[] {"Money"};
9952        case -1282148017: /*factor*/ return new String[] {"decimal"};
9953        case 108957: /*net*/ return new String[] {"Money"};
9954        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
9955        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
9956        default: return super.getTypesForProperty(hash, name);
9957        }
9958
9959      }
9960
9961      @Override
9962      public Base addChild(String name) throws FHIRException {
9963        if (name.equals("productOrService")) {
9964          this.productOrService = new CodeableConcept();
9965          return this.productOrService;
9966        }
9967        else if (name.equals("modifier")) {
9968          return addModifier();
9969        }
9970        else if (name.equals("quantity")) {
9971          this.quantity = new Quantity();
9972          return this.quantity;
9973        }
9974        else if (name.equals("unitPrice")) {
9975          this.unitPrice = new Money();
9976          return this.unitPrice;
9977        }
9978        else if (name.equals("factor")) {
9979          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detail.subDetail.factor");
9980        }
9981        else if (name.equals("net")) {
9982          this.net = new Money();
9983          return this.net;
9984        }
9985        else if (name.equals("noteNumber")) {
9986          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detail.subDetail.noteNumber");
9987        }
9988        else if (name.equals("adjudication")) {
9989          return addAdjudication();
9990        }
9991        else
9992          return super.addChild(name);
9993      }
9994
9995      public AddedItemDetailSubDetailComponent copy() {
9996        AddedItemDetailSubDetailComponent dst = new AddedItemDetailSubDetailComponent();
9997        copyValues(dst);
9998        return dst;
9999      }
10000
10001      public void copyValues(AddedItemDetailSubDetailComponent dst) {
10002        super.copyValues(dst);
10003        dst.productOrService = productOrService == null ? null : productOrService.copy();
10004        if (modifier != null) {
10005          dst.modifier = new ArrayList<CodeableConcept>();
10006          for (CodeableConcept i : modifier)
10007            dst.modifier.add(i.copy());
10008        };
10009        dst.quantity = quantity == null ? null : quantity.copy();
10010        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
10011        dst.factor = factor == null ? null : factor.copy();
10012        dst.net = net == null ? null : net.copy();
10013        if (noteNumber != null) {
10014          dst.noteNumber = new ArrayList<PositiveIntType>();
10015          for (PositiveIntType i : noteNumber)
10016            dst.noteNumber.add(i.copy());
10017        };
10018        if (adjudication != null) {
10019          dst.adjudication = new ArrayList<AdjudicationComponent>();
10020          for (AdjudicationComponent i : adjudication)
10021            dst.adjudication.add(i.copy());
10022        };
10023      }
10024
10025      @Override
10026      public boolean equalsDeep(Base other_) {
10027        if (!super.equalsDeep(other_))
10028          return false;
10029        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10030          return false;
10031        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10032        return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
10033           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
10034           && compareDeep(net, o.net, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
10035          ;
10036      }
10037
10038      @Override
10039      public boolean equalsShallow(Base other_) {
10040        if (!super.equalsShallow(other_))
10041          return false;
10042        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10043          return false;
10044        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10045        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
10046      }
10047
10048      public boolean isEmpty() {
10049        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier
10050          , quantity, unitPrice, factor, net, noteNumber, adjudication);
10051      }
10052
10053  public String fhirType() {
10054    return "ExplanationOfBenefit.addItem.detail.subDetail";
10055
10056  }
10057
10058  }
10059
10060    @Block()
10061    public static class TotalComponent extends BackboneElement implements IBaseBackboneElement {
10062        /**
10063         * 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.
10064         */
10065        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
10066        @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." )
10067        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
10068        protected CodeableConcept category;
10069
10070        /**
10071         * Monetary total amount associated with the category.
10072         */
10073        @Child(name = "amount", type = {Money.class}, order=2, min=1, max=1, modifier=false, summary=true)
10074        @Description(shortDefinition="Financial total for the category", formalDefinition="Monetary total amount associated with the category." )
10075        protected Money amount;
10076
10077        private static final long serialVersionUID = 2012310309L;
10078
10079    /**
10080     * Constructor
10081     */
10082      public TotalComponent() {
10083        super();
10084      }
10085
10086    /**
10087     * Constructor
10088     */
10089      public TotalComponent(CodeableConcept category, Money amount) {
10090        super();
10091        this.setCategory(category);
10092        this.setAmount(amount);
10093      }
10094
10095        /**
10096         * @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.)
10097         */
10098        public CodeableConcept getCategory() { 
10099          if (this.category == null)
10100            if (Configuration.errorOnAutoCreate())
10101              throw new Error("Attempt to auto-create TotalComponent.category");
10102            else if (Configuration.doAutoCreate())
10103              this.category = new CodeableConcept(); // cc
10104          return this.category;
10105        }
10106
10107        public boolean hasCategory() { 
10108          return this.category != null && !this.category.isEmpty();
10109        }
10110
10111        /**
10112         * @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.)
10113         */
10114        public TotalComponent setCategory(CodeableConcept value) { 
10115          this.category = value;
10116          return this;
10117        }
10118
10119        /**
10120         * @return {@link #amount} (Monetary total amount associated with the category.)
10121         */
10122        public Money getAmount() { 
10123          if (this.amount == null)
10124            if (Configuration.errorOnAutoCreate())
10125              throw new Error("Attempt to auto-create TotalComponent.amount");
10126            else if (Configuration.doAutoCreate())
10127              this.amount = new Money(); // cc
10128          return this.amount;
10129        }
10130
10131        public boolean hasAmount() { 
10132          return this.amount != null && !this.amount.isEmpty();
10133        }
10134
10135        /**
10136         * @param value {@link #amount} (Monetary total amount associated with the category.)
10137         */
10138        public TotalComponent setAmount(Money value) { 
10139          this.amount = value;
10140          return this;
10141        }
10142
10143        protected void listChildren(List<Property> children) {
10144          super.listChildren(children);
10145          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));
10146          children.add(new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount));
10147        }
10148
10149        @Override
10150        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10151          switch (_hash) {
10152          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);
10153          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount);
10154          default: return super.getNamedProperty(_hash, _name, _checkValid);
10155          }
10156
10157        }
10158
10159      @Override
10160      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10161        switch (hash) {
10162        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
10163        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
10164        default: return super.getProperty(hash, name, checkValid);
10165        }
10166
10167      }
10168
10169      @Override
10170      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10171        switch (hash) {
10172        case 50511102: // category
10173          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10174          return value;
10175        case -1413853096: // amount
10176          this.amount = TypeConvertor.castToMoney(value); // Money
10177          return value;
10178        default: return super.setProperty(hash, name, value);
10179        }
10180
10181      }
10182
10183      @Override
10184      public Base setProperty(String name, Base value) throws FHIRException {
10185        if (name.equals("category")) {
10186          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10187        } else if (name.equals("amount")) {
10188          this.amount = TypeConvertor.castToMoney(value); // Money
10189        } else
10190          return super.setProperty(name, value);
10191        return value;
10192      }
10193
10194      @Override
10195      public Base makeProperty(int hash, String name) throws FHIRException {
10196        switch (hash) {
10197        case 50511102:  return getCategory();
10198        case -1413853096:  return getAmount();
10199        default: return super.makeProperty(hash, name);
10200        }
10201
10202      }
10203
10204      @Override
10205      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10206        switch (hash) {
10207        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
10208        case -1413853096: /*amount*/ return new String[] {"Money"};
10209        default: return super.getTypesForProperty(hash, name);
10210        }
10211
10212      }
10213
10214      @Override
10215      public Base addChild(String name) throws FHIRException {
10216        if (name.equals("category")) {
10217          this.category = new CodeableConcept();
10218          return this.category;
10219        }
10220        else if (name.equals("amount")) {
10221          this.amount = new Money();
10222          return this.amount;
10223        }
10224        else
10225          return super.addChild(name);
10226      }
10227
10228      public TotalComponent copy() {
10229        TotalComponent dst = new TotalComponent();
10230        copyValues(dst);
10231        return dst;
10232      }
10233
10234      public void copyValues(TotalComponent dst) {
10235        super.copyValues(dst);
10236        dst.category = category == null ? null : category.copy();
10237        dst.amount = amount == null ? null : amount.copy();
10238      }
10239
10240      @Override
10241      public boolean equalsDeep(Base other_) {
10242        if (!super.equalsDeep(other_))
10243          return false;
10244        if (!(other_ instanceof TotalComponent))
10245          return false;
10246        TotalComponent o = (TotalComponent) other_;
10247        return compareDeep(category, o.category, true) && compareDeep(amount, o.amount, true);
10248      }
10249
10250      @Override
10251      public boolean equalsShallow(Base other_) {
10252        if (!super.equalsShallow(other_))
10253          return false;
10254        if (!(other_ instanceof TotalComponent))
10255          return false;
10256        TotalComponent o = (TotalComponent) other_;
10257        return true;
10258      }
10259
10260      public boolean isEmpty() {
10261        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, amount);
10262      }
10263
10264  public String fhirType() {
10265    return "ExplanationOfBenefit.total";
10266
10267  }
10268
10269  }
10270
10271    @Block()
10272    public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
10273        /**
10274         * Whether this represents partial or complete payment of the benefits payable.
10275         */
10276        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
10277        @Description(shortDefinition="Partial or complete payment", formalDefinition="Whether this represents partial or complete payment of the benefits payable." )
10278        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-paymenttype")
10279        protected CodeableConcept type;
10280
10281        /**
10282         * Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.
10283         */
10284        @Child(name = "adjustment", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
10285        @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." )
10286        protected Money adjustment;
10287
10288        /**
10289         * Reason for the payment adjustment.
10290         */
10291        @Child(name = "adjustmentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
10292        @Description(shortDefinition="Explanation for the variance", formalDefinition="Reason for the payment adjustment." )
10293        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
10294        protected CodeableConcept adjustmentReason;
10295
10296        /**
10297         * Estimated date the payment will be issued or the actual issue date of payment.
10298         */
10299        @Child(name = "date", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=false)
10300        @Description(shortDefinition="Expected date of payment", formalDefinition="Estimated date the payment will be issued or the actual issue date of payment." )
10301        protected DateType date;
10302
10303        /**
10304         * Benefits payable less any payment adjustment.
10305         */
10306        @Child(name = "amount", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
10307        @Description(shortDefinition="Payable amount after adjustment", formalDefinition="Benefits payable less any payment adjustment." )
10308        protected Money amount;
10309
10310        /**
10311         * Issuer's unique identifier for the payment instrument.
10312         */
10313        @Child(name = "identifier", type = {Identifier.class}, order=6, min=0, max=1, modifier=false, summary=false)
10314        @Description(shortDefinition="Business identifier for the payment", formalDefinition="Issuer's unique identifier for the payment instrument." )
10315        protected Identifier identifier;
10316
10317        private static final long serialVersionUID = 1539906026L;
10318
10319    /**
10320     * Constructor
10321     */
10322      public PaymentComponent() {
10323        super();
10324      }
10325
10326        /**
10327         * @return {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
10328         */
10329        public CodeableConcept getType() { 
10330          if (this.type == null)
10331            if (Configuration.errorOnAutoCreate())
10332              throw new Error("Attempt to auto-create PaymentComponent.type");
10333            else if (Configuration.doAutoCreate())
10334              this.type = new CodeableConcept(); // cc
10335          return this.type;
10336        }
10337
10338        public boolean hasType() { 
10339          return this.type != null && !this.type.isEmpty();
10340        }
10341
10342        /**
10343         * @param value {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
10344         */
10345        public PaymentComponent setType(CodeableConcept value) { 
10346          this.type = value;
10347          return this;
10348        }
10349
10350        /**
10351         * @return {@link #adjustment} (Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.)
10352         */
10353        public Money getAdjustment() { 
10354          if (this.adjustment == null)
10355            if (Configuration.errorOnAutoCreate())
10356              throw new Error("Attempt to auto-create PaymentComponent.adjustment");
10357            else if (Configuration.doAutoCreate())
10358              this.adjustment = new Money(); // cc
10359          return this.adjustment;
10360        }
10361
10362        public boolean hasAdjustment() { 
10363          return this.adjustment != null && !this.adjustment.isEmpty();
10364        }
10365
10366        /**
10367         * @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.)
10368         */
10369        public PaymentComponent setAdjustment(Money value) { 
10370          this.adjustment = value;
10371          return this;
10372        }
10373
10374        /**
10375         * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
10376         */
10377        public CodeableConcept getAdjustmentReason() { 
10378          if (this.adjustmentReason == null)
10379            if (Configuration.errorOnAutoCreate())
10380              throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
10381            else if (Configuration.doAutoCreate())
10382              this.adjustmentReason = new CodeableConcept(); // cc
10383          return this.adjustmentReason;
10384        }
10385
10386        public boolean hasAdjustmentReason() { 
10387          return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
10388        }
10389
10390        /**
10391         * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
10392         */
10393        public PaymentComponent setAdjustmentReason(CodeableConcept value) { 
10394          this.adjustmentReason = value;
10395          return this;
10396        }
10397
10398        /**
10399         * @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
10400         */
10401        public DateType getDateElement() { 
10402          if (this.date == null)
10403            if (Configuration.errorOnAutoCreate())
10404              throw new Error("Attempt to auto-create PaymentComponent.date");
10405            else if (Configuration.doAutoCreate())
10406              this.date = new DateType(); // bb
10407          return this.date;
10408        }
10409
10410        public boolean hasDateElement() { 
10411          return this.date != null && !this.date.isEmpty();
10412        }
10413
10414        public boolean hasDate() { 
10415          return this.date != null && !this.date.isEmpty();
10416        }
10417
10418        /**
10419         * @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
10420         */
10421        public PaymentComponent setDateElement(DateType value) { 
10422          this.date = value;
10423          return this;
10424        }
10425
10426        /**
10427         * @return Estimated date the payment will be issued or the actual issue date of payment.
10428         */
10429        public Date getDate() { 
10430          return this.date == null ? null : this.date.getValue();
10431        }
10432
10433        /**
10434         * @param value Estimated date the payment will be issued or the actual issue date of payment.
10435         */
10436        public PaymentComponent setDate(Date value) { 
10437          if (value == null)
10438            this.date = null;
10439          else {
10440            if (this.date == null)
10441              this.date = new DateType();
10442            this.date.setValue(value);
10443          }
10444          return this;
10445        }
10446
10447        /**
10448         * @return {@link #amount} (Benefits payable less any payment adjustment.)
10449         */
10450        public Money getAmount() { 
10451          if (this.amount == null)
10452            if (Configuration.errorOnAutoCreate())
10453              throw new Error("Attempt to auto-create PaymentComponent.amount");
10454            else if (Configuration.doAutoCreate())
10455              this.amount = new Money(); // cc
10456          return this.amount;
10457        }
10458
10459        public boolean hasAmount() { 
10460          return this.amount != null && !this.amount.isEmpty();
10461        }
10462
10463        /**
10464         * @param value {@link #amount} (Benefits payable less any payment adjustment.)
10465         */
10466        public PaymentComponent setAmount(Money value) { 
10467          this.amount = value;
10468          return this;
10469        }
10470
10471        /**
10472         * @return {@link #identifier} (Issuer's unique identifier for the payment instrument.)
10473         */
10474        public Identifier getIdentifier() { 
10475          if (this.identifier == null)
10476            if (Configuration.errorOnAutoCreate())
10477              throw new Error("Attempt to auto-create PaymentComponent.identifier");
10478            else if (Configuration.doAutoCreate())
10479              this.identifier = new Identifier(); // cc
10480          return this.identifier;
10481        }
10482
10483        public boolean hasIdentifier() { 
10484          return this.identifier != null && !this.identifier.isEmpty();
10485        }
10486
10487        /**
10488         * @param value {@link #identifier} (Issuer's unique identifier for the payment instrument.)
10489         */
10490        public PaymentComponent setIdentifier(Identifier value) { 
10491          this.identifier = value;
10492          return this;
10493        }
10494
10495        protected void listChildren(List<Property> children) {
10496          super.listChildren(children);
10497          children.add(new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type));
10498          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));
10499          children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason));
10500          children.add(new Property("date", "date", "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date));
10501          children.add(new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount));
10502          children.add(new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier));
10503        }
10504
10505        @Override
10506        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10507          switch (_hash) {
10508          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type);
10509          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);
10510          case -1255938543: /*adjustmentReason*/  return new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason);
10511          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);
10512          case -1413853096: /*amount*/  return new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount);
10513          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier);
10514          default: return super.getNamedProperty(_hash, _name, _checkValid);
10515          }
10516
10517        }
10518
10519      @Override
10520      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10521        switch (hash) {
10522        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
10523        case 1977085293: /*adjustment*/ return this.adjustment == null ? new Base[0] : new Base[] {this.adjustment}; // Money
10524        case -1255938543: /*adjustmentReason*/ return this.adjustmentReason == null ? new Base[0] : new Base[] {this.adjustmentReason}; // CodeableConcept
10525        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
10526        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
10527        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
10528        default: return super.getProperty(hash, name, checkValid);
10529        }
10530
10531      }
10532
10533      @Override
10534      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10535        switch (hash) {
10536        case 3575610: // type
10537          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10538          return value;
10539        case 1977085293: // adjustment
10540          this.adjustment = TypeConvertor.castToMoney(value); // Money
10541          return value;
10542        case -1255938543: // adjustmentReason
10543          this.adjustmentReason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10544          return value;
10545        case 3076014: // date
10546          this.date = TypeConvertor.castToDate(value); // DateType
10547          return value;
10548        case -1413853096: // amount
10549          this.amount = TypeConvertor.castToMoney(value); // Money
10550          return value;
10551        case -1618432855: // identifier
10552          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
10553          return value;
10554        default: return super.setProperty(hash, name, value);
10555        }
10556
10557      }
10558
10559      @Override
10560      public Base setProperty(String name, Base value) throws FHIRException {
10561        if (name.equals("type")) {
10562          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10563        } else if (name.equals("adjustment")) {
10564          this.adjustment = TypeConvertor.castToMoney(value); // Money
10565        } else if (name.equals("adjustmentReason")) {
10566          this.adjustmentReason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10567        } else if (name.equals("date")) {
10568          this.date = TypeConvertor.castToDate(value); // DateType
10569        } else if (name.equals("amount")) {
10570          this.amount = TypeConvertor.castToMoney(value); // Money
10571        } else if (name.equals("identifier")) {
10572          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
10573        } else
10574          return super.setProperty(name, value);
10575        return value;
10576      }
10577
10578      @Override
10579      public Base makeProperty(int hash, String name) throws FHIRException {
10580        switch (hash) {
10581        case 3575610:  return getType();
10582        case 1977085293:  return getAdjustment();
10583        case -1255938543:  return getAdjustmentReason();
10584        case 3076014:  return getDateElement();
10585        case -1413853096:  return getAmount();
10586        case -1618432855:  return getIdentifier();
10587        default: return super.makeProperty(hash, name);
10588        }
10589
10590      }
10591
10592      @Override
10593      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10594        switch (hash) {
10595        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
10596        case 1977085293: /*adjustment*/ return new String[] {"Money"};
10597        case -1255938543: /*adjustmentReason*/ return new String[] {"CodeableConcept"};
10598        case 3076014: /*date*/ return new String[] {"date"};
10599        case -1413853096: /*amount*/ return new String[] {"Money"};
10600        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
10601        default: return super.getTypesForProperty(hash, name);
10602        }
10603
10604      }
10605
10606      @Override
10607      public Base addChild(String name) throws FHIRException {
10608        if (name.equals("type")) {
10609          this.type = new CodeableConcept();
10610          return this.type;
10611        }
10612        else if (name.equals("adjustment")) {
10613          this.adjustment = new Money();
10614          return this.adjustment;
10615        }
10616        else if (name.equals("adjustmentReason")) {
10617          this.adjustmentReason = new CodeableConcept();
10618          return this.adjustmentReason;
10619        }
10620        else if (name.equals("date")) {
10621          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.payment.date");
10622        }
10623        else if (name.equals("amount")) {
10624          this.amount = new Money();
10625          return this.amount;
10626        }
10627        else if (name.equals("identifier")) {
10628          this.identifier = new Identifier();
10629          return this.identifier;
10630        }
10631        else
10632          return super.addChild(name);
10633      }
10634
10635      public PaymentComponent copy() {
10636        PaymentComponent dst = new PaymentComponent();
10637        copyValues(dst);
10638        return dst;
10639      }
10640
10641      public void copyValues(PaymentComponent dst) {
10642        super.copyValues(dst);
10643        dst.type = type == null ? null : type.copy();
10644        dst.adjustment = adjustment == null ? null : adjustment.copy();
10645        dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
10646        dst.date = date == null ? null : date.copy();
10647        dst.amount = amount == null ? null : amount.copy();
10648        dst.identifier = identifier == null ? null : identifier.copy();
10649      }
10650
10651      @Override
10652      public boolean equalsDeep(Base other_) {
10653        if (!super.equalsDeep(other_))
10654          return false;
10655        if (!(other_ instanceof PaymentComponent))
10656          return false;
10657        PaymentComponent o = (PaymentComponent) other_;
10658        return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true) && compareDeep(adjustmentReason, o.adjustmentReason, true)
10659           && compareDeep(date, o.date, true) && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true)
10660          ;
10661      }
10662
10663      @Override
10664      public boolean equalsShallow(Base other_) {
10665        if (!super.equalsShallow(other_))
10666          return false;
10667        if (!(other_ instanceof PaymentComponent))
10668          return false;
10669        PaymentComponent o = (PaymentComponent) other_;
10670        return compareValues(date, o.date, true);
10671      }
10672
10673      public boolean isEmpty() {
10674        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason
10675          , date, amount, identifier);
10676      }
10677
10678  public String fhirType() {
10679    return "ExplanationOfBenefit.payment";
10680
10681  }
10682
10683  }
10684
10685    @Block()
10686    public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
10687        /**
10688         * A number to uniquely identify a note entry.
10689         */
10690        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
10691        @Description(shortDefinition="Note instance identifier", formalDefinition="A number to uniquely identify a note entry." )
10692        protected PositiveIntType number;
10693
10694        /**
10695         * The business purpose of the note text.
10696         */
10697        @Child(name = "type", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
10698        @Description(shortDefinition="display | print | printoper", formalDefinition="The business purpose of the note text." )
10699        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
10700        protected Enumeration<NoteType> type;
10701
10702        /**
10703         * The explanation or description associated with the processing.
10704         */
10705        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
10706        @Description(shortDefinition="Note explanatory text", formalDefinition="The explanation or description associated with the processing." )
10707        protected StringType text;
10708
10709        /**
10710         * A code to define the language used in the text of the note.
10711         */
10712        @Child(name = "language", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
10713        @Description(shortDefinition="Language of the text", formalDefinition="A code to define the language used in the text of the note." )
10714        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
10715        protected CodeableConcept language;
10716
10717        private static final long serialVersionUID = -385184277L;
10718
10719    /**
10720     * Constructor
10721     */
10722      public NoteComponent() {
10723        super();
10724      }
10725
10726        /**
10727         * @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
10728         */
10729        public PositiveIntType getNumberElement() { 
10730          if (this.number == null)
10731            if (Configuration.errorOnAutoCreate())
10732              throw new Error("Attempt to auto-create NoteComponent.number");
10733            else if (Configuration.doAutoCreate())
10734              this.number = new PositiveIntType(); // bb
10735          return this.number;
10736        }
10737
10738        public boolean hasNumberElement() { 
10739          return this.number != null && !this.number.isEmpty();
10740        }
10741
10742        public boolean hasNumber() { 
10743          return this.number != null && !this.number.isEmpty();
10744        }
10745
10746        /**
10747         * @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
10748         */
10749        public NoteComponent setNumberElement(PositiveIntType value) { 
10750          this.number = value;
10751          return this;
10752        }
10753
10754        /**
10755         * @return A number to uniquely identify a note entry.
10756         */
10757        public int getNumber() { 
10758          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
10759        }
10760
10761        /**
10762         * @param value A number to uniquely identify a note entry.
10763         */
10764        public NoteComponent setNumber(int value) { 
10765            if (this.number == null)
10766              this.number = new PositiveIntType();
10767            this.number.setValue(value);
10768          return this;
10769        }
10770
10771        /**
10772         * @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
10773         */
10774        public Enumeration<NoteType> getTypeElement() { 
10775          if (this.type == null)
10776            if (Configuration.errorOnAutoCreate())
10777              throw new Error("Attempt to auto-create NoteComponent.type");
10778            else if (Configuration.doAutoCreate())
10779              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory()); // bb
10780          return this.type;
10781        }
10782
10783        public boolean hasTypeElement() { 
10784          return this.type != null && !this.type.isEmpty();
10785        }
10786
10787        public boolean hasType() { 
10788          return this.type != null && !this.type.isEmpty();
10789        }
10790
10791        /**
10792         * @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
10793         */
10794        public NoteComponent setTypeElement(Enumeration<NoteType> value) { 
10795          this.type = value;
10796          return this;
10797        }
10798
10799        /**
10800         * @return The business purpose of the note text.
10801         */
10802        public NoteType getType() { 
10803          return this.type == null ? null : this.type.getValue();
10804        }
10805
10806        /**
10807         * @param value The business purpose of the note text.
10808         */
10809        public NoteComponent setType(NoteType value) { 
10810          if (value == null)
10811            this.type = null;
10812          else {
10813            if (this.type == null)
10814              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory());
10815            this.type.setValue(value);
10816          }
10817          return this;
10818        }
10819
10820        /**
10821         * @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
10822         */
10823        public StringType getTextElement() { 
10824          if (this.text == null)
10825            if (Configuration.errorOnAutoCreate())
10826              throw new Error("Attempt to auto-create NoteComponent.text");
10827            else if (Configuration.doAutoCreate())
10828              this.text = new StringType(); // bb
10829          return this.text;
10830        }
10831
10832        public boolean hasTextElement() { 
10833          return this.text != null && !this.text.isEmpty();
10834        }
10835
10836        public boolean hasText() { 
10837          return this.text != null && !this.text.isEmpty();
10838        }
10839
10840        /**
10841         * @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
10842         */
10843        public NoteComponent setTextElement(StringType value) { 
10844          this.text = value;
10845          return this;
10846        }
10847
10848        /**
10849         * @return The explanation or description associated with the processing.
10850         */
10851        public String getText() { 
10852          return this.text == null ? null : this.text.getValue();
10853        }
10854
10855        /**
10856         * @param value The explanation or description associated with the processing.
10857         */
10858        public NoteComponent setText(String value) { 
10859          if (Utilities.noString(value))
10860            this.text = null;
10861          else {
10862            if (this.text == null)
10863              this.text = new StringType();
10864            this.text.setValue(value);
10865          }
10866          return this;
10867        }
10868
10869        /**
10870         * @return {@link #language} (A code to define the language used in the text of the note.)
10871         */
10872        public CodeableConcept getLanguage() { 
10873          if (this.language == null)
10874            if (Configuration.errorOnAutoCreate())
10875              throw new Error("Attempt to auto-create NoteComponent.language");
10876            else if (Configuration.doAutoCreate())
10877              this.language = new CodeableConcept(); // cc
10878          return this.language;
10879        }
10880
10881        public boolean hasLanguage() { 
10882          return this.language != null && !this.language.isEmpty();
10883        }
10884
10885        /**
10886         * @param value {@link #language} (A code to define the language used in the text of the note.)
10887         */
10888        public NoteComponent setLanguage(CodeableConcept value) { 
10889          this.language = value;
10890          return this;
10891        }
10892
10893        protected void listChildren(List<Property> children) {
10894          super.listChildren(children);
10895          children.add(new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number));
10896          children.add(new Property("type", "code", "The business purpose of the note text.", 0, 1, type));
10897          children.add(new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text));
10898          children.add(new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language));
10899        }
10900
10901        @Override
10902        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10903          switch (_hash) {
10904          case -1034364087: /*number*/  return new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number);
10905          case 3575610: /*type*/  return new Property("type", "code", "The business purpose of the note text.", 0, 1, type);
10906          case 3556653: /*text*/  return new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text);
10907          case -1613589672: /*language*/  return new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language);
10908          default: return super.getNamedProperty(_hash, _name, _checkValid);
10909          }
10910
10911        }
10912
10913      @Override
10914      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10915        switch (hash) {
10916        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
10917        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<NoteType>
10918        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
10919        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
10920        default: return super.getProperty(hash, name, checkValid);
10921        }
10922
10923      }
10924
10925      @Override
10926      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10927        switch (hash) {
10928        case -1034364087: // number
10929          this.number = TypeConvertor.castToPositiveInt(value); // PositiveIntType
10930          return value;
10931        case 3575610: // type
10932          value = new NoteTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
10933          this.type = (Enumeration) value; // Enumeration<NoteType>
10934          return value;
10935        case 3556653: // text
10936          this.text = TypeConvertor.castToString(value); // StringType
10937          return value;
10938        case -1613589672: // language
10939          this.language = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10940          return value;
10941        default: return super.setProperty(hash, name, value);
10942        }
10943
10944      }
10945
10946      @Override
10947      public Base setProperty(String name, Base value) throws FHIRException {
10948        if (name.equals("number")) {
10949          this.number = TypeConvertor.castToPositiveInt(value); // PositiveIntType
10950        } else if (name.equals("type")) {
10951          value = new NoteTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
10952          this.type = (Enumeration) value; // Enumeration<NoteType>
10953        } else if (name.equals("text")) {
10954          this.text = TypeConvertor.castToString(value); // StringType
10955        } else if (name.equals("language")) {
10956          this.language = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10957        } else
10958          return super.setProperty(name, value);
10959        return value;
10960      }
10961
10962      @Override
10963      public Base makeProperty(int hash, String name) throws FHIRException {
10964        switch (hash) {
10965        case -1034364087:  return getNumberElement();
10966        case 3575610:  return getTypeElement();
10967        case 3556653:  return getTextElement();
10968        case -1613589672:  return getLanguage();
10969        default: return super.makeProperty(hash, name);
10970        }
10971
10972      }
10973
10974      @Override
10975      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10976        switch (hash) {
10977        case -1034364087: /*number*/ return new String[] {"positiveInt"};
10978        case 3575610: /*type*/ return new String[] {"code"};
10979        case 3556653: /*text*/ return new String[] {"string"};
10980        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
10981        default: return super.getTypesForProperty(hash, name);
10982        }
10983
10984      }
10985
10986      @Override
10987      public Base addChild(String name) throws FHIRException {
10988        if (name.equals("number")) {
10989          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.processNote.number");
10990        }
10991        else if (name.equals("type")) {
10992          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.processNote.type");
10993        }
10994        else if (name.equals("text")) {
10995          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.processNote.text");
10996        }
10997        else if (name.equals("language")) {
10998          this.language = new CodeableConcept();
10999          return this.language;
11000        }
11001        else
11002          return super.addChild(name);
11003      }
11004
11005      public NoteComponent copy() {
11006        NoteComponent dst = new NoteComponent();
11007        copyValues(dst);
11008        return dst;
11009      }
11010
11011      public void copyValues(NoteComponent dst) {
11012        super.copyValues(dst);
11013        dst.number = number == null ? null : number.copy();
11014        dst.type = type == null ? null : type.copy();
11015        dst.text = text == null ? null : text.copy();
11016        dst.language = language == null ? null : language.copy();
11017      }
11018
11019      @Override
11020      public boolean equalsDeep(Base other_) {
11021        if (!super.equalsDeep(other_))
11022          return false;
11023        if (!(other_ instanceof NoteComponent))
11024          return false;
11025        NoteComponent o = (NoteComponent) other_;
11026        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
11027           && compareDeep(language, o.language, true);
11028      }
11029
11030      @Override
11031      public boolean equalsShallow(Base other_) {
11032        if (!super.equalsShallow(other_))
11033          return false;
11034        if (!(other_ instanceof NoteComponent))
11035          return false;
11036        NoteComponent o = (NoteComponent) other_;
11037        return compareValues(number, o.number, true) && compareValues(type, o.type, true) && compareValues(text, o.text, true)
11038          ;
11039      }
11040
11041      public boolean isEmpty() {
11042        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language
11043          );
11044      }
11045
11046  public String fhirType() {
11047    return "ExplanationOfBenefit.processNote";
11048
11049  }
11050
11051  }
11052
11053    @Block()
11054    public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
11055        /**
11056         * Code to identify the general type of benefits under which products and services are provided.
11057         */
11058        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
11059        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
11060        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
11061        protected CodeableConcept category;
11062
11063        /**
11064         * 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.
11065         */
11066        @Child(name = "excluded", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
11067        @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." )
11068        protected BooleanType excluded;
11069
11070        /**
11071         * A short name or tag for the benefit.
11072         */
11073        @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
11074        @Description(shortDefinition="Short name for the benefit", formalDefinition="A short name or tag for the benefit." )
11075        protected StringType name;
11076
11077        /**
11078         * A richer description of the benefit or services covered.
11079         */
11080        @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
11081        @Description(shortDefinition="Description of the benefit or services covered", formalDefinition="A richer description of the benefit or services covered." )
11082        protected StringType description;
11083
11084        /**
11085         * Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.
11086         */
11087        @Child(name = "network", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
11088        @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." )
11089        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-network")
11090        protected CodeableConcept network;
11091
11092        /**
11093         * Indicates if the benefits apply to an individual or to the family.
11094         */
11095        @Child(name = "unit", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
11096        @Description(shortDefinition="Individual or family", formalDefinition="Indicates if the benefits apply to an individual or to the family." )
11097        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-unit")
11098        protected CodeableConcept unit;
11099
11100        /**
11101         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.
11102         */
11103        @Child(name = "term", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
11104        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'." )
11105        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-term")
11106        protected CodeableConcept term;
11107
11108        /**
11109         * Benefits Used to date.
11110         */
11111        @Child(name = "financial", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
11112        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
11113        protected List<BenefitComponent> financial;
11114
11115        private static final long serialVersionUID = -1889655824L;
11116
11117    /**
11118     * Constructor
11119     */
11120      public BenefitBalanceComponent() {
11121        super();
11122      }
11123
11124    /**
11125     * Constructor
11126     */
11127      public BenefitBalanceComponent(CodeableConcept category) {
11128        super();
11129        this.setCategory(category);
11130      }
11131
11132        /**
11133         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
11134         */
11135        public CodeableConcept getCategory() { 
11136          if (this.category == null)
11137            if (Configuration.errorOnAutoCreate())
11138              throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
11139            else if (Configuration.doAutoCreate())
11140              this.category = new CodeableConcept(); // cc
11141          return this.category;
11142        }
11143
11144        public boolean hasCategory() { 
11145          return this.category != null && !this.category.isEmpty();
11146        }
11147
11148        /**
11149         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
11150         */
11151        public BenefitBalanceComponent setCategory(CodeableConcept value) { 
11152          this.category = value;
11153          return this;
11154        }
11155
11156        /**
11157         * @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
11158         */
11159        public BooleanType getExcludedElement() { 
11160          if (this.excluded == null)
11161            if (Configuration.errorOnAutoCreate())
11162              throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
11163            else if (Configuration.doAutoCreate())
11164              this.excluded = new BooleanType(); // bb
11165          return this.excluded;
11166        }
11167
11168        public boolean hasExcludedElement() { 
11169          return this.excluded != null && !this.excluded.isEmpty();
11170        }
11171
11172        public boolean hasExcluded() { 
11173          return this.excluded != null && !this.excluded.isEmpty();
11174        }
11175
11176        /**
11177         * @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
11178         */
11179        public BenefitBalanceComponent setExcludedElement(BooleanType value) { 
11180          this.excluded = value;
11181          return this;
11182        }
11183
11184        /**
11185         * @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.
11186         */
11187        public boolean getExcluded() { 
11188          return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
11189        }
11190
11191        /**
11192         * @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.
11193         */
11194        public BenefitBalanceComponent setExcluded(boolean value) { 
11195            if (this.excluded == null)
11196              this.excluded = new BooleanType();
11197            this.excluded.setValue(value);
11198          return this;
11199        }
11200
11201        /**
11202         * @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
11203         */
11204        public StringType getNameElement() { 
11205          if (this.name == null)
11206            if (Configuration.errorOnAutoCreate())
11207              throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
11208            else if (Configuration.doAutoCreate())
11209              this.name = new StringType(); // bb
11210          return this.name;
11211        }
11212
11213        public boolean hasNameElement() { 
11214          return this.name != null && !this.name.isEmpty();
11215        }
11216
11217        public boolean hasName() { 
11218          return this.name != null && !this.name.isEmpty();
11219        }
11220
11221        /**
11222         * @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
11223         */
11224        public BenefitBalanceComponent setNameElement(StringType value) { 
11225          this.name = value;
11226          return this;
11227        }
11228
11229        /**
11230         * @return A short name or tag for the benefit.
11231         */
11232        public String getName() { 
11233          return this.name == null ? null : this.name.getValue();
11234        }
11235
11236        /**
11237         * @param value A short name or tag for the benefit.
11238         */
11239        public BenefitBalanceComponent setName(String value) { 
11240          if (Utilities.noString(value))
11241            this.name = null;
11242          else {
11243            if (this.name == null)
11244              this.name = new StringType();
11245            this.name.setValue(value);
11246          }
11247          return this;
11248        }
11249
11250        /**
11251         * @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
11252         */
11253        public StringType getDescriptionElement() { 
11254          if (this.description == null)
11255            if (Configuration.errorOnAutoCreate())
11256              throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
11257            else if (Configuration.doAutoCreate())
11258              this.description = new StringType(); // bb
11259          return this.description;
11260        }
11261
11262        public boolean hasDescriptionElement() { 
11263          return this.description != null && !this.description.isEmpty();
11264        }
11265
11266        public boolean hasDescription() { 
11267          return this.description != null && !this.description.isEmpty();
11268        }
11269
11270        /**
11271         * @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
11272         */
11273        public BenefitBalanceComponent setDescriptionElement(StringType value) { 
11274          this.description = value;
11275          return this;
11276        }
11277
11278        /**
11279         * @return A richer description of the benefit or services covered.
11280         */
11281        public String getDescription() { 
11282          return this.description == null ? null : this.description.getValue();
11283        }
11284
11285        /**
11286         * @param value A richer description of the benefit or services covered.
11287         */
11288        public BenefitBalanceComponent setDescription(String value) { 
11289          if (Utilities.noString(value))
11290            this.description = null;
11291          else {
11292            if (this.description == null)
11293              this.description = new StringType();
11294            this.description.setValue(value);
11295          }
11296          return this;
11297        }
11298
11299        /**
11300         * @return {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
11301         */
11302        public CodeableConcept getNetwork() { 
11303          if (this.network == null)
11304            if (Configuration.errorOnAutoCreate())
11305              throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
11306            else if (Configuration.doAutoCreate())
11307              this.network = new CodeableConcept(); // cc
11308          return this.network;
11309        }
11310
11311        public boolean hasNetwork() { 
11312          return this.network != null && !this.network.isEmpty();
11313        }
11314
11315        /**
11316         * @param value {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
11317         */
11318        public BenefitBalanceComponent setNetwork(CodeableConcept value) { 
11319          this.network = value;
11320          return this;
11321        }
11322
11323        /**
11324         * @return {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
11325         */
11326        public CodeableConcept getUnit() { 
11327          if (this.unit == null)
11328            if (Configuration.errorOnAutoCreate())
11329              throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
11330            else if (Configuration.doAutoCreate())
11331              this.unit = new CodeableConcept(); // cc
11332          return this.unit;
11333        }
11334
11335        public boolean hasUnit() { 
11336          return this.unit != null && !this.unit.isEmpty();
11337        }
11338
11339        /**
11340         * @param value {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
11341         */
11342        public BenefitBalanceComponent setUnit(CodeableConcept value) { 
11343          this.unit = value;
11344          return this;
11345        }
11346
11347        /**
11348         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
11349         */
11350        public CodeableConcept getTerm() { 
11351          if (this.term == null)
11352            if (Configuration.errorOnAutoCreate())
11353              throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
11354            else if (Configuration.doAutoCreate())
11355              this.term = new CodeableConcept(); // cc
11356          return this.term;
11357        }
11358
11359        public boolean hasTerm() { 
11360          return this.term != null && !this.term.isEmpty();
11361        }
11362
11363        /**
11364         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
11365         */
11366        public BenefitBalanceComponent setTerm(CodeableConcept value) { 
11367          this.term = value;
11368          return this;
11369        }
11370
11371        /**
11372         * @return {@link #financial} (Benefits Used to date.)
11373         */
11374        public List<BenefitComponent> getFinancial() { 
11375          if (this.financial == null)
11376            this.financial = new ArrayList<BenefitComponent>();
11377          return this.financial;
11378        }
11379
11380        /**
11381         * @return Returns a reference to <code>this</code> for easy method chaining
11382         */
11383        public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) { 
11384          this.financial = theFinancial;
11385          return this;
11386        }
11387
11388        public boolean hasFinancial() { 
11389          if (this.financial == null)
11390            return false;
11391          for (BenefitComponent item : this.financial)
11392            if (!item.isEmpty())
11393              return true;
11394          return false;
11395        }
11396
11397        public BenefitComponent addFinancial() { //3
11398          BenefitComponent t = new BenefitComponent();
11399          if (this.financial == null)
11400            this.financial = new ArrayList<BenefitComponent>();
11401          this.financial.add(t);
11402          return t;
11403        }
11404
11405        public BenefitBalanceComponent addFinancial(BenefitComponent t) { //3
11406          if (t == null)
11407            return this;
11408          if (this.financial == null)
11409            this.financial = new ArrayList<BenefitComponent>();
11410          this.financial.add(t);
11411          return this;
11412        }
11413
11414        /**
11415         * @return The first repetition of repeating field {@link #financial}, creating it if it does not already exist {3}
11416         */
11417        public BenefitComponent getFinancialFirstRep() { 
11418          if (getFinancial().isEmpty()) {
11419            addFinancial();
11420          }
11421          return getFinancial().get(0);
11422        }
11423
11424        protected void listChildren(List<Property> children) {
11425          super.listChildren(children);
11426          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
11427          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));
11428          children.add(new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name));
11429          children.add(new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description));
11430          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));
11431          children.add(new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit));
11432          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));
11433          children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
11434        }
11435
11436        @Override
11437        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11438          switch (_hash) {
11439          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);
11440          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);
11441          case 3373707: /*name*/  return new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name);
11442          case -1724546052: /*description*/  return new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description);
11443          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);
11444          case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit);
11445          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);
11446          case 357555337: /*financial*/  return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial);
11447          default: return super.getNamedProperty(_hash, _name, _checkValid);
11448          }
11449
11450        }
11451
11452      @Override
11453      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11454        switch (hash) {
11455        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
11456        case 1994055114: /*excluded*/ return this.excluded == null ? new Base[0] : new Base[] {this.excluded}; // BooleanType
11457        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
11458        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
11459        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // CodeableConcept
11460        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
11461        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // CodeableConcept
11462        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
11463        default: return super.getProperty(hash, name, checkValid);
11464        }
11465
11466      }
11467
11468      @Override
11469      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11470        switch (hash) {
11471        case 50511102: // category
11472          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11473          return value;
11474        case 1994055114: // excluded
11475          this.excluded = TypeConvertor.castToBoolean(value); // BooleanType
11476          return value;
11477        case 3373707: // name
11478          this.name = TypeConvertor.castToString(value); // StringType
11479          return value;
11480        case -1724546052: // description
11481          this.description = TypeConvertor.castToString(value); // StringType
11482          return value;
11483        case 1843485230: // network
11484          this.network = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11485          return value;
11486        case 3594628: // unit
11487          this.unit = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11488          return value;
11489        case 3556460: // term
11490          this.term = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11491          return value;
11492        case 357555337: // financial
11493          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
11494          return value;
11495        default: return super.setProperty(hash, name, value);
11496        }
11497
11498      }
11499
11500      @Override
11501      public Base setProperty(String name, Base value) throws FHIRException {
11502        if (name.equals("category")) {
11503          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11504        } else if (name.equals("excluded")) {
11505          this.excluded = TypeConvertor.castToBoolean(value); // BooleanType
11506        } else if (name.equals("name")) {
11507          this.name = TypeConvertor.castToString(value); // StringType
11508        } else if (name.equals("description")) {
11509          this.description = TypeConvertor.castToString(value); // StringType
11510        } else if (name.equals("network")) {
11511          this.network = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11512        } else if (name.equals("unit")) {
11513          this.unit = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11514        } else if (name.equals("term")) {
11515          this.term = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11516        } else if (name.equals("financial")) {
11517          this.getFinancial().add((BenefitComponent) value);
11518        } else
11519          return super.setProperty(name, value);
11520        return value;
11521      }
11522
11523      @Override
11524      public Base makeProperty(int hash, String name) throws FHIRException {
11525        switch (hash) {
11526        case 50511102:  return getCategory();
11527        case 1994055114:  return getExcludedElement();
11528        case 3373707:  return getNameElement();
11529        case -1724546052:  return getDescriptionElement();
11530        case 1843485230:  return getNetwork();
11531        case 3594628:  return getUnit();
11532        case 3556460:  return getTerm();
11533        case 357555337:  return addFinancial(); 
11534        default: return super.makeProperty(hash, name);
11535        }
11536
11537      }
11538
11539      @Override
11540      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11541        switch (hash) {
11542        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
11543        case 1994055114: /*excluded*/ return new String[] {"boolean"};
11544        case 3373707: /*name*/ return new String[] {"string"};
11545        case -1724546052: /*description*/ return new String[] {"string"};
11546        case 1843485230: /*network*/ return new String[] {"CodeableConcept"};
11547        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
11548        case 3556460: /*term*/ return new String[] {"CodeableConcept"};
11549        case 357555337: /*financial*/ return new String[] {};
11550        default: return super.getTypesForProperty(hash, name);
11551        }
11552
11553      }
11554
11555      @Override
11556      public Base addChild(String name) throws FHIRException {
11557        if (name.equals("category")) {
11558          this.category = new CodeableConcept();
11559          return this.category;
11560        }
11561        else if (name.equals("excluded")) {
11562          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.benefitBalance.excluded");
11563        }
11564        else if (name.equals("name")) {
11565          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.benefitBalance.name");
11566        }
11567        else if (name.equals("description")) {
11568          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.benefitBalance.description");
11569        }
11570        else if (name.equals("network")) {
11571          this.network = new CodeableConcept();
11572          return this.network;
11573        }
11574        else if (name.equals("unit")) {
11575          this.unit = new CodeableConcept();
11576          return this.unit;
11577        }
11578        else if (name.equals("term")) {
11579          this.term = new CodeableConcept();
11580          return this.term;
11581        }
11582        else if (name.equals("financial")) {
11583          return addFinancial();
11584        }
11585        else
11586          return super.addChild(name);
11587      }
11588
11589      public BenefitBalanceComponent copy() {
11590        BenefitBalanceComponent dst = new BenefitBalanceComponent();
11591        copyValues(dst);
11592        return dst;
11593      }
11594
11595      public void copyValues(BenefitBalanceComponent dst) {
11596        super.copyValues(dst);
11597        dst.category = category == null ? null : category.copy();
11598        dst.excluded = excluded == null ? null : excluded.copy();
11599        dst.name = name == null ? null : name.copy();
11600        dst.description = description == null ? null : description.copy();
11601        dst.network = network == null ? null : network.copy();
11602        dst.unit = unit == null ? null : unit.copy();
11603        dst.term = term == null ? null : term.copy();
11604        if (financial != null) {
11605          dst.financial = new ArrayList<BenefitComponent>();
11606          for (BenefitComponent i : financial)
11607            dst.financial.add(i.copy());
11608        };
11609      }
11610
11611      @Override
11612      public boolean equalsDeep(Base other_) {
11613        if (!super.equalsDeep(other_))
11614          return false;
11615        if (!(other_ instanceof BenefitBalanceComponent))
11616          return false;
11617        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
11618        return compareDeep(category, o.category, true) && compareDeep(excluded, o.excluded, true) && compareDeep(name, o.name, true)
11619           && compareDeep(description, o.description, true) && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true)
11620           && compareDeep(term, o.term, true) && compareDeep(financial, o.financial, true);
11621      }
11622
11623      @Override
11624      public boolean equalsShallow(Base other_) {
11625        if (!super.equalsShallow(other_))
11626          return false;
11627        if (!(other_ instanceof BenefitBalanceComponent))
11628          return false;
11629        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
11630        return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
11631          ;
11632      }
11633
11634      public boolean isEmpty() {
11635        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, excluded, name
11636          , description, network, unit, term, financial);
11637      }
11638
11639  public String fhirType() {
11640    return "ExplanationOfBenefit.benefitBalance";
11641
11642  }
11643
11644  }
11645
11646    @Block()
11647    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
11648        /**
11649         * Classification of benefit being provided.
11650         */
11651        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
11652        @Description(shortDefinition="Benefit classification", formalDefinition="Classification of benefit being provided." )
11653        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-type")
11654        protected CodeableConcept type;
11655
11656        /**
11657         * The quantity of the benefit which is permitted under the coverage.
11658         */
11659        @Child(name = "allowed", type = {UnsignedIntType.class, StringType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
11660        @Description(shortDefinition="Benefits allowed", formalDefinition="The quantity of the benefit which is permitted under the coverage." )
11661        protected DataType allowed;
11662
11663        /**
11664         * The quantity of the benefit which have been consumed to date.
11665         */
11666        @Child(name = "used", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
11667        @Description(shortDefinition="Benefits used", formalDefinition="The quantity of the benefit which have been consumed to date." )
11668        protected DataType used;
11669
11670        private static final long serialVersionUID = 1900247614L;
11671
11672    /**
11673     * Constructor
11674     */
11675      public BenefitComponent() {
11676        super();
11677      }
11678
11679    /**
11680     * Constructor
11681     */
11682      public BenefitComponent(CodeableConcept type) {
11683        super();
11684        this.setType(type);
11685      }
11686
11687        /**
11688         * @return {@link #type} (Classification of benefit being provided.)
11689         */
11690        public CodeableConcept getType() { 
11691          if (this.type == null)
11692            if (Configuration.errorOnAutoCreate())
11693              throw new Error("Attempt to auto-create BenefitComponent.type");
11694            else if (Configuration.doAutoCreate())
11695              this.type = new CodeableConcept(); // cc
11696          return this.type;
11697        }
11698
11699        public boolean hasType() { 
11700          return this.type != null && !this.type.isEmpty();
11701        }
11702
11703        /**
11704         * @param value {@link #type} (Classification of benefit being provided.)
11705         */
11706        public BenefitComponent setType(CodeableConcept value) { 
11707          this.type = value;
11708          return this;
11709        }
11710
11711        /**
11712         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11713         */
11714        public DataType getAllowed() { 
11715          return this.allowed;
11716        }
11717
11718        /**
11719         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11720         */
11721        public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException { 
11722          if (this.allowed == null)
11723            this.allowed = new UnsignedIntType();
11724          if (!(this.allowed instanceof UnsignedIntType))
11725            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.allowed.getClass().getName()+" was encountered");
11726          return (UnsignedIntType) this.allowed;
11727        }
11728
11729        public boolean hasAllowedUnsignedIntType() { 
11730          return this != null && this.allowed instanceof UnsignedIntType;
11731        }
11732
11733        /**
11734         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11735         */
11736        public StringType getAllowedStringType() throws FHIRException { 
11737          if (this.allowed == null)
11738            this.allowed = new StringType();
11739          if (!(this.allowed instanceof StringType))
11740            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.allowed.getClass().getName()+" was encountered");
11741          return (StringType) this.allowed;
11742        }
11743
11744        public boolean hasAllowedStringType() { 
11745          return this != null && this.allowed instanceof StringType;
11746        }
11747
11748        /**
11749         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11750         */
11751        public Money getAllowedMoney() throws FHIRException { 
11752          if (this.allowed == null)
11753            this.allowed = new Money();
11754          if (!(this.allowed instanceof Money))
11755            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.allowed.getClass().getName()+" was encountered");
11756          return (Money) this.allowed;
11757        }
11758
11759        public boolean hasAllowedMoney() { 
11760          return this != null && this.allowed instanceof Money;
11761        }
11762
11763        public boolean hasAllowed() { 
11764          return this.allowed != null && !this.allowed.isEmpty();
11765        }
11766
11767        /**
11768         * @param value {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11769         */
11770        public BenefitComponent setAllowed(DataType value) { 
11771          if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
11772            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.allowed[x]: "+value.fhirType());
11773          this.allowed = value;
11774          return this;
11775        }
11776
11777        /**
11778         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
11779         */
11780        public DataType getUsed() { 
11781          return this.used;
11782        }
11783
11784        /**
11785         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
11786         */
11787        public UnsignedIntType getUsedUnsignedIntType() throws FHIRException { 
11788          if (this.used == null)
11789            this.used = new UnsignedIntType();
11790          if (!(this.used instanceof UnsignedIntType))
11791            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.used.getClass().getName()+" was encountered");
11792          return (UnsignedIntType) this.used;
11793        }
11794
11795        public boolean hasUsedUnsignedIntType() { 
11796          return this != null && this.used instanceof UnsignedIntType;
11797        }
11798
11799        /**
11800         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
11801         */
11802        public Money getUsedMoney() throws FHIRException { 
11803          if (this.used == null)
11804            this.used = new Money();
11805          if (!(this.used instanceof Money))
11806            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.used.getClass().getName()+" was encountered");
11807          return (Money) this.used;
11808        }
11809
11810        public boolean hasUsedMoney() { 
11811          return this != null && this.used instanceof Money;
11812        }
11813
11814        public boolean hasUsed() { 
11815          return this.used != null && !this.used.isEmpty();
11816        }
11817
11818        /**
11819         * @param value {@link #used} (The quantity of the benefit which have been consumed to date.)
11820         */
11821        public BenefitComponent setUsed(DataType value) { 
11822          if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
11823            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.used[x]: "+value.fhirType());
11824          this.used = value;
11825          return this;
11826        }
11827
11828        protected void listChildren(List<Property> children) {
11829          super.listChildren(children);
11830          children.add(new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type));
11831          children.add(new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed));
11832          children.add(new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used));
11833        }
11834
11835        @Override
11836        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11837          switch (_hash) {
11838          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type);
11839          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);
11840          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);
11841          case 1668802034: /*allowedUnsignedInt*/  return new Property("allowed[x]", "unsignedInt", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
11842          case -2135265319: /*allowedString*/  return new Property("allowed[x]", "string", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
11843          case -351668232: /*allowedMoney*/  return new Property("allowed[x]", "Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
11844          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);
11845          case 3599293: /*used*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
11846          case 1252740285: /*usedUnsignedInt*/  return new Property("used[x]", "unsignedInt", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
11847          case -78048509: /*usedMoney*/  return new Property("used[x]", "Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
11848          default: return super.getNamedProperty(_hash, _name, _checkValid);
11849          }
11850
11851        }
11852
11853      @Override
11854      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11855        switch (hash) {
11856        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
11857        case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // DataType
11858        case 3599293: /*used*/ return this.used == null ? new Base[0] : new Base[] {this.used}; // DataType
11859        default: return super.getProperty(hash, name, checkValid);
11860        }
11861
11862      }
11863
11864      @Override
11865      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11866        switch (hash) {
11867        case 3575610: // type
11868          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11869          return value;
11870        case -911343192: // allowed
11871          this.allowed = TypeConvertor.castToType(value); // DataType
11872          return value;
11873        case 3599293: // used
11874          this.used = TypeConvertor.castToType(value); // DataType
11875          return value;
11876        default: return super.setProperty(hash, name, value);
11877        }
11878
11879      }
11880
11881      @Override
11882      public Base setProperty(String name, Base value) throws FHIRException {
11883        if (name.equals("type")) {
11884          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11885        } else if (name.equals("allowed[x]")) {
11886          this.allowed = TypeConvertor.castToType(value); // DataType
11887        } else if (name.equals("used[x]")) {
11888          this.used = TypeConvertor.castToType(value); // DataType
11889        } else
11890          return super.setProperty(name, value);
11891        return value;
11892      }
11893
11894      @Override
11895      public Base makeProperty(int hash, String name) throws FHIRException {
11896        switch (hash) {
11897        case 3575610:  return getType();
11898        case -1336663592:  return getAllowed();
11899        case -911343192:  return getAllowed();
11900        case -147553373:  return getUsed();
11901        case 3599293:  return getUsed();
11902        default: return super.makeProperty(hash, name);
11903        }
11904
11905      }
11906
11907      @Override
11908      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11909        switch (hash) {
11910        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
11911        case -911343192: /*allowed*/ return new String[] {"unsignedInt", "string", "Money"};
11912        case 3599293: /*used*/ return new String[] {"unsignedInt", "Money"};
11913        default: return super.getTypesForProperty(hash, name);
11914        }
11915
11916      }
11917
11918      @Override
11919      public Base addChild(String name) throws FHIRException {
11920        if (name.equals("type")) {
11921          this.type = new CodeableConcept();
11922          return this.type;
11923        }
11924        else if (name.equals("allowedUnsignedInt")) {
11925          this.allowed = new UnsignedIntType();
11926          return this.allowed;
11927        }
11928        else if (name.equals("allowedString")) {
11929          this.allowed = new StringType();
11930          return this.allowed;
11931        }
11932        else if (name.equals("allowedMoney")) {
11933          this.allowed = new Money();
11934          return this.allowed;
11935        }
11936        else if (name.equals("usedUnsignedInt")) {
11937          this.used = new UnsignedIntType();
11938          return this.used;
11939        }
11940        else if (name.equals("usedMoney")) {
11941          this.used = new Money();
11942          return this.used;
11943        }
11944        else
11945          return super.addChild(name);
11946      }
11947
11948      public BenefitComponent copy() {
11949        BenefitComponent dst = new BenefitComponent();
11950        copyValues(dst);
11951        return dst;
11952      }
11953
11954      public void copyValues(BenefitComponent dst) {
11955        super.copyValues(dst);
11956        dst.type = type == null ? null : type.copy();
11957        dst.allowed = allowed == null ? null : allowed.copy();
11958        dst.used = used == null ? null : used.copy();
11959      }
11960
11961      @Override
11962      public boolean equalsDeep(Base other_) {
11963        if (!super.equalsDeep(other_))
11964          return false;
11965        if (!(other_ instanceof BenefitComponent))
11966          return false;
11967        BenefitComponent o = (BenefitComponent) other_;
11968        return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true) && compareDeep(used, o.used, true)
11969          ;
11970      }
11971
11972      @Override
11973      public boolean equalsShallow(Base other_) {
11974        if (!super.equalsShallow(other_))
11975          return false;
11976        if (!(other_ instanceof BenefitComponent))
11977          return false;
11978        BenefitComponent o = (BenefitComponent) other_;
11979        return true;
11980      }
11981
11982      public boolean isEmpty() {
11983        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
11984      }
11985
11986  public String fhirType() {
11987    return "ExplanationOfBenefit.benefitBalance.financial";
11988
11989  }
11990
11991  }
11992
11993    /**
11994     * A unique identifier assigned to this explanation of benefit.
11995     */
11996    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
11997    @Description(shortDefinition="Business Identifier for the resource", formalDefinition="A unique identifier assigned to this explanation of benefit." )
11998    protected List<Identifier> identifier;
11999
12000    /**
12001     * The status of the resource instance.
12002     */
12003    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
12004    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
12005    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
12006    protected Enumeration<ExplanationOfBenefitStatus> status;
12007
12008    /**
12009     * The category of claim, e.g. oral, pharmacy, vision, institutional, professional.
12010     */
12011    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
12012    @Description(shortDefinition="Category or discipline", formalDefinition="The category of claim, e.g. oral, pharmacy, vision, institutional, professional." )
12013    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-type")
12014    protected CodeableConcept type;
12015
12016    /**
12017     * A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.
12018     */
12019    @Child(name = "subType", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
12020    @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." )
12021    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-subtype")
12022    protected CodeableConcept subType;
12023
12024    /**
12025     * A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future.
12026     */
12027    @Child(name = "use", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
12028    @Description(shortDefinition="claim | preauthorization | predetermination", formalDefinition="A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future." )
12029    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-use")
12030    protected Enumeration<Use> use;
12031
12032    /**
12033     * 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.
12034     */
12035    @Child(name = "patient", type = {Patient.class}, order=5, min=1, max=1, modifier=false, summary=true)
12036    @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." )
12037    protected Reference patient;
12038
12039    /**
12040     * The period for which charges are being submitted.
12041     */
12042    @Child(name = "billablePeriod", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=true)
12043    @Description(shortDefinition="Relevant time frame for the claim", formalDefinition="The period for which charges are being submitted." )
12044    protected Period billablePeriod;
12045
12046    /**
12047     * The date this resource was created.
12048     */
12049    @Child(name = "created", type = {DateTimeType.class}, order=7, min=1, max=1, modifier=false, summary=true)
12050    @Description(shortDefinition="Response creation date", formalDefinition="The date this resource was created." )
12051    protected DateTimeType created;
12052
12053    /**
12054     * Individual who created the claim, predetermination or preauthorization.
12055     */
12056    @Child(name = "enterer", type = {Practitioner.class, PractitionerRole.class}, order=8, min=0, max=1, modifier=false, summary=false)
12057    @Description(shortDefinition="Author of the claim", formalDefinition="Individual who created the claim, predetermination or preauthorization." )
12058    protected Reference enterer;
12059
12060    /**
12061     * The party responsible for authorization, adjudication and reimbursement.
12062     */
12063    @Child(name = "insurer", type = {Organization.class}, order=9, min=1, max=1, modifier=false, summary=true)
12064    @Description(shortDefinition="Party responsible for reimbursement", formalDefinition="The party responsible for authorization, adjudication and reimbursement." )
12065    protected Reference insurer;
12066
12067    /**
12068     * The provider which is responsible for the claim, predetermination or preauthorization.
12069     */
12070    @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=10, min=1, max=1, modifier=false, summary=true)
12071    @Description(shortDefinition="Party responsible for the claim", formalDefinition="The provider which is responsible for the claim, predetermination or preauthorization." )
12072    protected Reference provider;
12073
12074    /**
12075     * The provider-required urgency of processing the request. Typical values include: stat, routine deferred.
12076     */
12077    @Child(name = "priority", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=false)
12078    @Description(shortDefinition="Desired processing urgency", formalDefinition="The provider-required urgency of processing the request. Typical values include: stat, routine deferred." )
12079    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/CodeSystem/processpriority")
12080    protected CodeableConcept priority;
12081
12082    /**
12083     * A code to indicate whether and for whom funds are to be reserved for future claims.
12084     */
12085    @Child(name = "fundsReserveRequested", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
12086    @Description(shortDefinition="For whom to reserve funds", formalDefinition="A code to indicate whether and for whom funds are to be reserved for future claims." )
12087    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
12088    protected CodeableConcept fundsReserveRequested;
12089
12090    /**
12091     * A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.
12092     */
12093    @Child(name = "fundsReserve", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
12094    @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." )
12095    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
12096    protected CodeableConcept fundsReserve;
12097
12098    /**
12099     * Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.
12100     */
12101    @Child(name = "related", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12102    @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." )
12103    protected List<RelatedClaimComponent> related;
12104
12105    /**
12106     * Prescription to support the dispensing of pharmacy, device or vision products.
12107     */
12108    @Child(name = "prescription", type = {MedicationRequest.class, VisionPrescription.class}, order=15, min=0, max=1, modifier=false, summary=false)
12109    @Description(shortDefinition="Prescription authorizing services or products", formalDefinition="Prescription to support the dispensing of pharmacy, device or vision products." )
12110    protected Reference prescription;
12111
12112    /**
12113     * Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.
12114     */
12115    @Child(name = "originalPrescription", type = {MedicationRequest.class}, order=16, min=0, max=1, modifier=false, summary=false)
12116    @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." )
12117    protected Reference originalPrescription;
12118
12119    /**
12120     * The party to be reimbursed for cost of the products and services according to the terms of the policy.
12121     */
12122    @Child(name = "payee", type = {}, order=17, min=0, max=1, modifier=false, summary=false)
12123    @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." )
12124    protected PayeeComponent payee;
12125
12126    /**
12127     * A reference to a referral resource.
12128     */
12129    @Child(name = "referral", type = {ServiceRequest.class}, order=18, min=0, max=1, modifier=false, summary=false)
12130    @Description(shortDefinition="Treatment Referral", formalDefinition="A reference to a referral resource." )
12131    protected Reference referral;
12132
12133    /**
12134     * Facility where the services were provided.
12135     */
12136    @Child(name = "facility", type = {Location.class}, order=19, min=0, max=1, modifier=false, summary=false)
12137    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
12138    protected Reference facility;
12139
12140    /**
12141     * The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.
12142     */
12143    @Child(name = "claim", type = {Claim.class}, order=20, min=0, max=1, modifier=false, summary=false)
12144    @Description(shortDefinition="Claim reference", formalDefinition="The business identifier for the instance of the adjudication request: claim predetermination or preauthorization." )
12145    protected Reference claim;
12146
12147    /**
12148     * The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.
12149     */
12150    @Child(name = "claimResponse", type = {ClaimResponse.class}, order=21, min=0, max=1, modifier=false, summary=false)
12151    @Description(shortDefinition="Claim response reference", formalDefinition="The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response." )
12152    protected Reference claimResponse;
12153
12154    /**
12155     * The outcome of the claim, predetermination, or preauthorization processing.
12156     */
12157    @Child(name = "outcome", type = {CodeType.class}, order=22, min=1, max=1, modifier=false, summary=true)
12158    @Description(shortDefinition="queued | complete | error | partial", formalDefinition="The outcome of the claim, predetermination, or preauthorization processing." )
12159    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
12160    protected Enumeration<RemittanceOutcome> outcome;
12161
12162    /**
12163     * A human readable description of the status of the adjudication.
12164     */
12165    @Child(name = "disposition", type = {StringType.class}, order=23, min=0, max=1, modifier=false, summary=false)
12166    @Description(shortDefinition="Disposition Message", formalDefinition="A human readable description of the status of the adjudication." )
12167    protected StringType disposition;
12168
12169    /**
12170     * Reference from the Insurer which is used in later communications which refers to this adjudication.
12171     */
12172    @Child(name = "preAuthRef", type = {StringType.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12173    @Description(shortDefinition="Preauthorization reference", formalDefinition="Reference from the Insurer which is used in later communications which refers to this adjudication." )
12174    protected List<StringType> preAuthRef;
12175
12176    /**
12177     * The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.
12178     */
12179    @Child(name = "preAuthRefPeriod", type = {Period.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12180    @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." )
12181    protected List<Period> preAuthRefPeriod;
12182
12183    /**
12184     * The members of the team who provided the products and services.
12185     */
12186    @Child(name = "careTeam", type = {}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12187    @Description(shortDefinition="Care Team members", formalDefinition="The members of the team who provided the products and services." )
12188    protected List<CareTeamComponent> careTeam;
12189
12190    /**
12191     * Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.
12192     */
12193    @Child(name = "supportingInfo", type = {}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12194    @Description(shortDefinition="Supporting information", formalDefinition="Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues." )
12195    protected List<SupportingInformationComponent> supportingInfo;
12196
12197    /**
12198     * Information about diagnoses relevant to the claim items.
12199     */
12200    @Child(name = "diagnosis", type = {}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12201    @Description(shortDefinition="Pertinent diagnosis information", formalDefinition="Information about diagnoses relevant to the claim items." )
12202    protected List<DiagnosisComponent> diagnosis;
12203
12204    /**
12205     * Procedures performed on the patient relevant to the billing items with the claim.
12206     */
12207    @Child(name = "procedure", type = {}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12208    @Description(shortDefinition="Clinical procedures performed", formalDefinition="Procedures performed on the patient relevant to the billing items with the claim." )
12209    protected List<ProcedureComponent> procedure;
12210
12211    /**
12212     * This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
12213     */
12214    @Child(name = "precedence", type = {PositiveIntType.class}, order=30, min=0, max=1, modifier=false, summary=false)
12215    @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." )
12216    protected PositiveIntType precedence;
12217
12218    /**
12219     * Financial instruments for reimbursement for the health care products and services specified on the claim.
12220     */
12221    @Child(name = "insurance", type = {}, order=31, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
12222    @Description(shortDefinition="Patient insurance information", formalDefinition="Financial instruments for reimbursement for the health care products and services specified on the claim." )
12223    protected List<InsuranceComponent> insurance;
12224
12225    /**
12226     * Details of a accident which resulted in injuries which required the products and services listed in the claim.
12227     */
12228    @Child(name = "accident", type = {}, order=32, min=0, max=1, modifier=false, summary=false)
12229    @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." )
12230    protected AccidentComponent accident;
12231
12232    /**
12233     * 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.
12234     */
12235    @Child(name = "item", type = {}, order=33, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12236    @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." )
12237    protected List<ItemComponent> item;
12238
12239    /**
12240     * The first-tier service adjudications for payor added product or service lines.
12241     */
12242    @Child(name = "addItem", type = {}, order=34, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12243    @Description(shortDefinition="Insurer added line items", formalDefinition="The first-tier service adjudications for payor added product or service lines." )
12244    protected List<AddedItemComponent> addItem;
12245
12246    /**
12247     * The adjudication results which are presented at the header level rather than at the line-item or add-item levels.
12248     */
12249    @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=35, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12250    @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." )
12251    protected List<AdjudicationComponent> adjudication;
12252
12253    /**
12254     * Categorized monetary totals for the adjudication.
12255     */
12256    @Child(name = "total", type = {}, order=36, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
12257    @Description(shortDefinition="Adjudication totals", formalDefinition="Categorized monetary totals for the adjudication." )
12258    protected List<TotalComponent> total;
12259
12260    /**
12261     * Payment details for the adjudication of the claim.
12262     */
12263    @Child(name = "payment", type = {}, order=37, min=0, max=1, modifier=false, summary=false)
12264    @Description(shortDefinition="Payment Details", formalDefinition="Payment details for the adjudication of the claim." )
12265    protected PaymentComponent payment;
12266
12267    /**
12268     * A code for the form to be used for printing the content.
12269     */
12270    @Child(name = "formCode", type = {CodeableConcept.class}, order=38, min=0, max=1, modifier=false, summary=false)
12271    @Description(shortDefinition="Printed form identifier", formalDefinition="A code for the form to be used for printing the content." )
12272    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
12273    protected CodeableConcept formCode;
12274
12275    /**
12276     * The actual form, by reference or inclusion, for printing the content or an EOB.
12277     */
12278    @Child(name = "form", type = {Attachment.class}, order=39, min=0, max=1, modifier=false, summary=false)
12279    @Description(shortDefinition="Printed reference or actual form", formalDefinition="The actual form, by reference or inclusion, for printing the content or an EOB." )
12280    protected Attachment form;
12281
12282    /**
12283     * A note that describes or explains adjudication results in a human readable form.
12284     */
12285    @Child(name = "processNote", type = {}, order=40, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12286    @Description(shortDefinition="Note concerning adjudication", formalDefinition="A note that describes or explains adjudication results in a human readable form." )
12287    protected List<NoteComponent> processNote;
12288
12289    /**
12290     * The term of the benefits documented in this response.
12291     */
12292    @Child(name = "benefitPeriod", type = {Period.class}, order=41, min=0, max=1, modifier=false, summary=false)
12293    @Description(shortDefinition="When the benefits are applicable", formalDefinition="The term of the benefits documented in this response." )
12294    protected Period benefitPeriod;
12295
12296    /**
12297     * Balance by Benefit Category.
12298     */
12299    @Child(name = "benefitBalance", type = {}, order=42, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12300    @Description(shortDefinition="Balance by Benefit Category", formalDefinition="Balance by Benefit Category." )
12301    protected List<BenefitBalanceComponent> benefitBalance;
12302
12303    private static final long serialVersionUID = 1403248694L;
12304
12305  /**
12306   * Constructor
12307   */
12308    public ExplanationOfBenefit() {
12309      super();
12310    }
12311
12312  /**
12313   * Constructor
12314   */
12315    public ExplanationOfBenefit(ExplanationOfBenefitStatus status, CodeableConcept type, Use use, Reference patient, Date created, Reference insurer, Reference provider, RemittanceOutcome outcome, InsuranceComponent insurance) {
12316      super();
12317      this.setStatus(status);
12318      this.setType(type);
12319      this.setUse(use);
12320      this.setPatient(patient);
12321      this.setCreated(created);
12322      this.setInsurer(insurer);
12323      this.setProvider(provider);
12324      this.setOutcome(outcome);
12325      this.addInsurance(insurance);
12326    }
12327
12328    /**
12329     * @return {@link #identifier} (A unique identifier assigned to this explanation of benefit.)
12330     */
12331    public List<Identifier> getIdentifier() { 
12332      if (this.identifier == null)
12333        this.identifier = new ArrayList<Identifier>();
12334      return this.identifier;
12335    }
12336
12337    /**
12338     * @return Returns a reference to <code>this</code> for easy method chaining
12339     */
12340    public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) { 
12341      this.identifier = theIdentifier;
12342      return this;
12343    }
12344
12345    public boolean hasIdentifier() { 
12346      if (this.identifier == null)
12347        return false;
12348      for (Identifier item : this.identifier)
12349        if (!item.isEmpty())
12350          return true;
12351      return false;
12352    }
12353
12354    public Identifier addIdentifier() { //3
12355      Identifier t = new Identifier();
12356      if (this.identifier == null)
12357        this.identifier = new ArrayList<Identifier>();
12358      this.identifier.add(t);
12359      return t;
12360    }
12361
12362    public ExplanationOfBenefit addIdentifier(Identifier t) { //3
12363      if (t == null)
12364        return this;
12365      if (this.identifier == null)
12366        this.identifier = new ArrayList<Identifier>();
12367      this.identifier.add(t);
12368      return this;
12369    }
12370
12371    /**
12372     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
12373     */
12374    public Identifier getIdentifierFirstRep() { 
12375      if (getIdentifier().isEmpty()) {
12376        addIdentifier();
12377      }
12378      return getIdentifier().get(0);
12379    }
12380
12381    /**
12382     * @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
12383     */
12384    public Enumeration<ExplanationOfBenefitStatus> getStatusElement() { 
12385      if (this.status == null)
12386        if (Configuration.errorOnAutoCreate())
12387          throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
12388        else if (Configuration.doAutoCreate())
12389          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
12390      return this.status;
12391    }
12392
12393    public boolean hasStatusElement() { 
12394      return this.status != null && !this.status.isEmpty();
12395    }
12396
12397    public boolean hasStatus() { 
12398      return this.status != null && !this.status.isEmpty();
12399    }
12400
12401    /**
12402     * @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
12403     */
12404    public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) { 
12405      this.status = value;
12406      return this;
12407    }
12408
12409    /**
12410     * @return The status of the resource instance.
12411     */
12412    public ExplanationOfBenefitStatus getStatus() { 
12413      return this.status == null ? null : this.status.getValue();
12414    }
12415
12416    /**
12417     * @param value The status of the resource instance.
12418     */
12419    public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) { 
12420        if (this.status == null)
12421          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
12422        this.status.setValue(value);
12423      return this;
12424    }
12425
12426    /**
12427     * @return {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
12428     */
12429    public CodeableConcept getType() { 
12430      if (this.type == null)
12431        if (Configuration.errorOnAutoCreate())
12432          throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
12433        else if (Configuration.doAutoCreate())
12434          this.type = new CodeableConcept(); // cc
12435      return this.type;
12436    }
12437
12438    public boolean hasType() { 
12439      return this.type != null && !this.type.isEmpty();
12440    }
12441
12442    /**
12443     * @param value {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
12444     */
12445    public ExplanationOfBenefit setType(CodeableConcept value) { 
12446      this.type = value;
12447      return this;
12448    }
12449
12450    /**
12451     * @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.)
12452     */
12453    public CodeableConcept getSubType() { 
12454      if (this.subType == null)
12455        if (Configuration.errorOnAutoCreate())
12456          throw new Error("Attempt to auto-create ExplanationOfBenefit.subType");
12457        else if (Configuration.doAutoCreate())
12458          this.subType = new CodeableConcept(); // cc
12459      return this.subType;
12460    }
12461
12462    public boolean hasSubType() { 
12463      return this.subType != null && !this.subType.isEmpty();
12464    }
12465
12466    /**
12467     * @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.)
12468     */
12469    public ExplanationOfBenefit setSubType(CodeableConcept value) { 
12470      this.subType = value;
12471      return this;
12472    }
12473
12474    /**
12475     * @return {@link #use} (A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
12476     */
12477    public Enumeration<Use> getUseElement() { 
12478      if (this.use == null)
12479        if (Configuration.errorOnAutoCreate())
12480          throw new Error("Attempt to auto-create ExplanationOfBenefit.use");
12481        else if (Configuration.doAutoCreate())
12482          this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
12483      return this.use;
12484    }
12485
12486    public boolean hasUseElement() { 
12487      return this.use != null && !this.use.isEmpty();
12488    }
12489
12490    public boolean hasUse() { 
12491      return this.use != null && !this.use.isEmpty();
12492    }
12493
12494    /**
12495     * @param value {@link #use} (A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
12496     */
12497    public ExplanationOfBenefit setUseElement(Enumeration<Use> value) { 
12498      this.use = value;
12499      return this;
12500    }
12501
12502    /**
12503     * @return A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future.
12504     */
12505    public Use getUse() { 
12506      return this.use == null ? null : this.use.getValue();
12507    }
12508
12509    /**
12510     * @param value A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future.
12511     */
12512    public ExplanationOfBenefit setUse(Use value) { 
12513        if (this.use == null)
12514          this.use = new Enumeration<Use>(new UseEnumFactory());
12515        this.use.setValue(value);
12516      return this;
12517    }
12518
12519    /**
12520     * @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.)
12521     */
12522    public Reference getPatient() { 
12523      if (this.patient == null)
12524        if (Configuration.errorOnAutoCreate())
12525          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
12526        else if (Configuration.doAutoCreate())
12527          this.patient = new Reference(); // cc
12528      return this.patient;
12529    }
12530
12531    public boolean hasPatient() { 
12532      return this.patient != null && !this.patient.isEmpty();
12533    }
12534
12535    /**
12536     * @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.)
12537     */
12538    public ExplanationOfBenefit setPatient(Reference value) { 
12539      this.patient = value;
12540      return this;
12541    }
12542
12543    /**
12544     * @return {@link #billablePeriod} (The period for which charges are being submitted.)
12545     */
12546    public Period getBillablePeriod() { 
12547      if (this.billablePeriod == null)
12548        if (Configuration.errorOnAutoCreate())
12549          throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
12550        else if (Configuration.doAutoCreate())
12551          this.billablePeriod = new Period(); // cc
12552      return this.billablePeriod;
12553    }
12554
12555    public boolean hasBillablePeriod() { 
12556      return this.billablePeriod != null && !this.billablePeriod.isEmpty();
12557    }
12558
12559    /**
12560     * @param value {@link #billablePeriod} (The period for which charges are being submitted.)
12561     */
12562    public ExplanationOfBenefit setBillablePeriod(Period value) { 
12563      this.billablePeriod = value;
12564      return this;
12565    }
12566
12567    /**
12568     * @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
12569     */
12570    public DateTimeType getCreatedElement() { 
12571      if (this.created == null)
12572        if (Configuration.errorOnAutoCreate())
12573          throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
12574        else if (Configuration.doAutoCreate())
12575          this.created = new DateTimeType(); // bb
12576      return this.created;
12577    }
12578
12579    public boolean hasCreatedElement() { 
12580      return this.created != null && !this.created.isEmpty();
12581    }
12582
12583    public boolean hasCreated() { 
12584      return this.created != null && !this.created.isEmpty();
12585    }
12586
12587    /**
12588     * @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
12589     */
12590    public ExplanationOfBenefit setCreatedElement(DateTimeType value) { 
12591      this.created = value;
12592      return this;
12593    }
12594
12595    /**
12596     * @return The date this resource was created.
12597     */
12598    public Date getCreated() { 
12599      return this.created == null ? null : this.created.getValue();
12600    }
12601
12602    /**
12603     * @param value The date this resource was created.
12604     */
12605    public ExplanationOfBenefit setCreated(Date value) { 
12606        if (this.created == null)
12607          this.created = new DateTimeType();
12608        this.created.setValue(value);
12609      return this;
12610    }
12611
12612    /**
12613     * @return {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
12614     */
12615    public Reference getEnterer() { 
12616      if (this.enterer == null)
12617        if (Configuration.errorOnAutoCreate())
12618          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
12619        else if (Configuration.doAutoCreate())
12620          this.enterer = new Reference(); // cc
12621      return this.enterer;
12622    }
12623
12624    public boolean hasEnterer() { 
12625      return this.enterer != null && !this.enterer.isEmpty();
12626    }
12627
12628    /**
12629     * @param value {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
12630     */
12631    public ExplanationOfBenefit setEnterer(Reference value) { 
12632      this.enterer = value;
12633      return this;
12634    }
12635
12636    /**
12637     * @return {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
12638     */
12639    public Reference getInsurer() { 
12640      if (this.insurer == null)
12641        if (Configuration.errorOnAutoCreate())
12642          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
12643        else if (Configuration.doAutoCreate())
12644          this.insurer = new Reference(); // cc
12645      return this.insurer;
12646    }
12647
12648    public boolean hasInsurer() { 
12649      return this.insurer != null && !this.insurer.isEmpty();
12650    }
12651
12652    /**
12653     * @param value {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
12654     */
12655    public ExplanationOfBenefit setInsurer(Reference value) { 
12656      this.insurer = value;
12657      return this;
12658    }
12659
12660    /**
12661     * @return {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
12662     */
12663    public Reference getProvider() { 
12664      if (this.provider == null)
12665        if (Configuration.errorOnAutoCreate())
12666          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
12667        else if (Configuration.doAutoCreate())
12668          this.provider = new Reference(); // cc
12669      return this.provider;
12670    }
12671
12672    public boolean hasProvider() { 
12673      return this.provider != null && !this.provider.isEmpty();
12674    }
12675
12676    /**
12677     * @param value {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
12678     */
12679    public ExplanationOfBenefit setProvider(Reference value) { 
12680      this.provider = value;
12681      return this;
12682    }
12683
12684    /**
12685     * @return {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, routine deferred.)
12686     */
12687    public CodeableConcept getPriority() { 
12688      if (this.priority == null)
12689        if (Configuration.errorOnAutoCreate())
12690          throw new Error("Attempt to auto-create ExplanationOfBenefit.priority");
12691        else if (Configuration.doAutoCreate())
12692          this.priority = new CodeableConcept(); // cc
12693      return this.priority;
12694    }
12695
12696    public boolean hasPriority() { 
12697      return this.priority != null && !this.priority.isEmpty();
12698    }
12699
12700    /**
12701     * @param value {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, routine deferred.)
12702     */
12703    public ExplanationOfBenefit setPriority(CodeableConcept value) { 
12704      this.priority = value;
12705      return this;
12706    }
12707
12708    /**
12709     * @return {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
12710     */
12711    public CodeableConcept getFundsReserveRequested() { 
12712      if (this.fundsReserveRequested == null)
12713        if (Configuration.errorOnAutoCreate())
12714          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserveRequested");
12715        else if (Configuration.doAutoCreate())
12716          this.fundsReserveRequested = new CodeableConcept(); // cc
12717      return this.fundsReserveRequested;
12718    }
12719
12720    public boolean hasFundsReserveRequested() { 
12721      return this.fundsReserveRequested != null && !this.fundsReserveRequested.isEmpty();
12722    }
12723
12724    /**
12725     * @param value {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
12726     */
12727    public ExplanationOfBenefit setFundsReserveRequested(CodeableConcept value) { 
12728      this.fundsReserveRequested = value;
12729      return this;
12730    }
12731
12732    /**
12733     * @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.)
12734     */
12735    public CodeableConcept getFundsReserve() { 
12736      if (this.fundsReserve == null)
12737        if (Configuration.errorOnAutoCreate())
12738          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserve");
12739        else if (Configuration.doAutoCreate())
12740          this.fundsReserve = new CodeableConcept(); // cc
12741      return this.fundsReserve;
12742    }
12743
12744    public boolean hasFundsReserve() { 
12745      return this.fundsReserve != null && !this.fundsReserve.isEmpty();
12746    }
12747
12748    /**
12749     * @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.)
12750     */
12751    public ExplanationOfBenefit setFundsReserve(CodeableConcept value) { 
12752      this.fundsReserve = value;
12753      return this;
12754    }
12755
12756    /**
12757     * @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.)
12758     */
12759    public List<RelatedClaimComponent> getRelated() { 
12760      if (this.related == null)
12761        this.related = new ArrayList<RelatedClaimComponent>();
12762      return this.related;
12763    }
12764
12765    /**
12766     * @return Returns a reference to <code>this</code> for easy method chaining
12767     */
12768    public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) { 
12769      this.related = theRelated;
12770      return this;
12771    }
12772
12773    public boolean hasRelated() { 
12774      if (this.related == null)
12775        return false;
12776      for (RelatedClaimComponent item : this.related)
12777        if (!item.isEmpty())
12778          return true;
12779      return false;
12780    }
12781
12782    public RelatedClaimComponent addRelated() { //3
12783      RelatedClaimComponent t = new RelatedClaimComponent();
12784      if (this.related == null)
12785        this.related = new ArrayList<RelatedClaimComponent>();
12786      this.related.add(t);
12787      return t;
12788    }
12789
12790    public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { //3
12791      if (t == null)
12792        return this;
12793      if (this.related == null)
12794        this.related = new ArrayList<RelatedClaimComponent>();
12795      this.related.add(t);
12796      return this;
12797    }
12798
12799    /**
12800     * @return The first repetition of repeating field {@link #related}, creating it if it does not already exist {3}
12801     */
12802    public RelatedClaimComponent getRelatedFirstRep() { 
12803      if (getRelated().isEmpty()) {
12804        addRelated();
12805      }
12806      return getRelated().get(0);
12807    }
12808
12809    /**
12810     * @return {@link #prescription} (Prescription to support the dispensing of pharmacy, device or vision products.)
12811     */
12812    public Reference getPrescription() { 
12813      if (this.prescription == null)
12814        if (Configuration.errorOnAutoCreate())
12815          throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
12816        else if (Configuration.doAutoCreate())
12817          this.prescription = new Reference(); // cc
12818      return this.prescription;
12819    }
12820
12821    public boolean hasPrescription() { 
12822      return this.prescription != null && !this.prescription.isEmpty();
12823    }
12824
12825    /**
12826     * @param value {@link #prescription} (Prescription to support the dispensing of pharmacy, device or vision products.)
12827     */
12828    public ExplanationOfBenefit setPrescription(Reference value) { 
12829      this.prescription = value;
12830      return this;
12831    }
12832
12833    /**
12834     * @return {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
12835     */
12836    public Reference getOriginalPrescription() { 
12837      if (this.originalPrescription == null)
12838        if (Configuration.errorOnAutoCreate())
12839          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
12840        else if (Configuration.doAutoCreate())
12841          this.originalPrescription = new Reference(); // cc
12842      return this.originalPrescription;
12843    }
12844
12845    public boolean hasOriginalPrescription() { 
12846      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
12847    }
12848
12849    /**
12850     * @param value {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
12851     */
12852    public ExplanationOfBenefit setOriginalPrescription(Reference value) { 
12853      this.originalPrescription = value;
12854      return this;
12855    }
12856
12857    /**
12858     * @return {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
12859     */
12860    public PayeeComponent getPayee() { 
12861      if (this.payee == null)
12862        if (Configuration.errorOnAutoCreate())
12863          throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
12864        else if (Configuration.doAutoCreate())
12865          this.payee = new PayeeComponent(); // cc
12866      return this.payee;
12867    }
12868
12869    public boolean hasPayee() { 
12870      return this.payee != null && !this.payee.isEmpty();
12871    }
12872
12873    /**
12874     * @param value {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
12875     */
12876    public ExplanationOfBenefit setPayee(PayeeComponent value) { 
12877      this.payee = value;
12878      return this;
12879    }
12880
12881    /**
12882     * @return {@link #referral} (A reference to a referral resource.)
12883     */
12884    public Reference getReferral() { 
12885      if (this.referral == null)
12886        if (Configuration.errorOnAutoCreate())
12887          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
12888        else if (Configuration.doAutoCreate())
12889          this.referral = new Reference(); // cc
12890      return this.referral;
12891    }
12892
12893    public boolean hasReferral() { 
12894      return this.referral != null && !this.referral.isEmpty();
12895    }
12896
12897    /**
12898     * @param value {@link #referral} (A reference to a referral resource.)
12899     */
12900    public ExplanationOfBenefit setReferral(Reference value) { 
12901      this.referral = value;
12902      return this;
12903    }
12904
12905    /**
12906     * @return {@link #facility} (Facility where the services were provided.)
12907     */
12908    public Reference getFacility() { 
12909      if (this.facility == null)
12910        if (Configuration.errorOnAutoCreate())
12911          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
12912        else if (Configuration.doAutoCreate())
12913          this.facility = new Reference(); // cc
12914      return this.facility;
12915    }
12916
12917    public boolean hasFacility() { 
12918      return this.facility != null && !this.facility.isEmpty();
12919    }
12920
12921    /**
12922     * @param value {@link #facility} (Facility where the services were provided.)
12923     */
12924    public ExplanationOfBenefit setFacility(Reference value) { 
12925      this.facility = value;
12926      return this;
12927    }
12928
12929    /**
12930     * @return {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
12931     */
12932    public Reference getClaim() { 
12933      if (this.claim == null)
12934        if (Configuration.errorOnAutoCreate())
12935          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
12936        else if (Configuration.doAutoCreate())
12937          this.claim = new Reference(); // cc
12938      return this.claim;
12939    }
12940
12941    public boolean hasClaim() { 
12942      return this.claim != null && !this.claim.isEmpty();
12943    }
12944
12945    /**
12946     * @param value {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
12947     */
12948    public ExplanationOfBenefit setClaim(Reference value) { 
12949      this.claim = value;
12950      return this;
12951    }
12952
12953    /**
12954     * @return {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
12955     */
12956    public Reference getClaimResponse() { 
12957      if (this.claimResponse == null)
12958        if (Configuration.errorOnAutoCreate())
12959          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
12960        else if (Configuration.doAutoCreate())
12961          this.claimResponse = new Reference(); // cc
12962      return this.claimResponse;
12963    }
12964
12965    public boolean hasClaimResponse() { 
12966      return this.claimResponse != null && !this.claimResponse.isEmpty();
12967    }
12968
12969    /**
12970     * @param value {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
12971     */
12972    public ExplanationOfBenefit setClaimResponse(Reference value) { 
12973      this.claimResponse = value;
12974      return this;
12975    }
12976
12977    /**
12978     * @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
12979     */
12980    public Enumeration<RemittanceOutcome> getOutcomeElement() { 
12981      if (this.outcome == null)
12982        if (Configuration.errorOnAutoCreate())
12983          throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
12984        else if (Configuration.doAutoCreate())
12985          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
12986      return this.outcome;
12987    }
12988
12989    public boolean hasOutcomeElement() { 
12990      return this.outcome != null && !this.outcome.isEmpty();
12991    }
12992
12993    public boolean hasOutcome() { 
12994      return this.outcome != null && !this.outcome.isEmpty();
12995    }
12996
12997    /**
12998     * @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
12999     */
13000    public ExplanationOfBenefit setOutcomeElement(Enumeration<RemittanceOutcome> value) { 
13001      this.outcome = value;
13002      return this;
13003    }
13004
13005    /**
13006     * @return The outcome of the claim, predetermination, or preauthorization processing.
13007     */
13008    public RemittanceOutcome getOutcome() { 
13009      return this.outcome == null ? null : this.outcome.getValue();
13010    }
13011
13012    /**
13013     * @param value The outcome of the claim, predetermination, or preauthorization processing.
13014     */
13015    public ExplanationOfBenefit setOutcome(RemittanceOutcome value) { 
13016        if (this.outcome == null)
13017          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
13018        this.outcome.setValue(value);
13019      return this;
13020    }
13021
13022    /**
13023     * @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
13024     */
13025    public StringType getDispositionElement() { 
13026      if (this.disposition == null)
13027        if (Configuration.errorOnAutoCreate())
13028          throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
13029        else if (Configuration.doAutoCreate())
13030          this.disposition = new StringType(); // bb
13031      return this.disposition;
13032    }
13033
13034    public boolean hasDispositionElement() { 
13035      return this.disposition != null && !this.disposition.isEmpty();
13036    }
13037
13038    public boolean hasDisposition() { 
13039      return this.disposition != null && !this.disposition.isEmpty();
13040    }
13041
13042    /**
13043     * @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
13044     */
13045    public ExplanationOfBenefit setDispositionElement(StringType value) { 
13046      this.disposition = value;
13047      return this;
13048    }
13049
13050    /**
13051     * @return A human readable description of the status of the adjudication.
13052     */
13053    public String getDisposition() { 
13054      return this.disposition == null ? null : this.disposition.getValue();
13055    }
13056
13057    /**
13058     * @param value A human readable description of the status of the adjudication.
13059     */
13060    public ExplanationOfBenefit setDisposition(String value) { 
13061      if (Utilities.noString(value))
13062        this.disposition = null;
13063      else {
13064        if (this.disposition == null)
13065          this.disposition = new StringType();
13066        this.disposition.setValue(value);
13067      }
13068      return this;
13069    }
13070
13071    /**
13072     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13073     */
13074    public List<StringType> getPreAuthRef() { 
13075      if (this.preAuthRef == null)
13076        this.preAuthRef = new ArrayList<StringType>();
13077      return this.preAuthRef;
13078    }
13079
13080    /**
13081     * @return Returns a reference to <code>this</code> for easy method chaining
13082     */
13083    public ExplanationOfBenefit setPreAuthRef(List<StringType> thePreAuthRef) { 
13084      this.preAuthRef = thePreAuthRef;
13085      return this;
13086    }
13087
13088    public boolean hasPreAuthRef() { 
13089      if (this.preAuthRef == null)
13090        return false;
13091      for (StringType item : this.preAuthRef)
13092        if (!item.isEmpty())
13093          return true;
13094      return false;
13095    }
13096
13097    /**
13098     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13099     */
13100    public StringType addPreAuthRefElement() {//2 
13101      StringType t = new StringType();
13102      if (this.preAuthRef == null)
13103        this.preAuthRef = new ArrayList<StringType>();
13104      this.preAuthRef.add(t);
13105      return t;
13106    }
13107
13108    /**
13109     * @param value {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13110     */
13111    public ExplanationOfBenefit addPreAuthRef(String value) { //1
13112      StringType t = new StringType();
13113      t.setValue(value);
13114      if (this.preAuthRef == null)
13115        this.preAuthRef = new ArrayList<StringType>();
13116      this.preAuthRef.add(t);
13117      return this;
13118    }
13119
13120    /**
13121     * @param value {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13122     */
13123    public boolean hasPreAuthRef(String value) { 
13124      if (this.preAuthRef == null)
13125        return false;
13126      for (StringType v : this.preAuthRef)
13127        if (v.getValue().equals(value)) // string
13128          return true;
13129      return false;
13130    }
13131
13132    /**
13133     * @return {@link #preAuthRefPeriod} (The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.)
13134     */
13135    public List<Period> getPreAuthRefPeriod() { 
13136      if (this.preAuthRefPeriod == null)
13137        this.preAuthRefPeriod = new ArrayList<Period>();
13138      return this.preAuthRefPeriod;
13139    }
13140
13141    /**
13142     * @return Returns a reference to <code>this</code> for easy method chaining
13143     */
13144    public ExplanationOfBenefit setPreAuthRefPeriod(List<Period> thePreAuthRefPeriod) { 
13145      this.preAuthRefPeriod = thePreAuthRefPeriod;
13146      return this;
13147    }
13148
13149    public boolean hasPreAuthRefPeriod() { 
13150      if (this.preAuthRefPeriod == null)
13151        return false;
13152      for (Period item : this.preAuthRefPeriod)
13153        if (!item.isEmpty())
13154          return true;
13155      return false;
13156    }
13157
13158    public Period addPreAuthRefPeriod() { //3
13159      Period t = new Period();
13160      if (this.preAuthRefPeriod == null)
13161        this.preAuthRefPeriod = new ArrayList<Period>();
13162      this.preAuthRefPeriod.add(t);
13163      return t;
13164    }
13165
13166    public ExplanationOfBenefit addPreAuthRefPeriod(Period t) { //3
13167      if (t == null)
13168        return this;
13169      if (this.preAuthRefPeriod == null)
13170        this.preAuthRefPeriod = new ArrayList<Period>();
13171      this.preAuthRefPeriod.add(t);
13172      return this;
13173    }
13174
13175    /**
13176     * @return The first repetition of repeating field {@link #preAuthRefPeriod}, creating it if it does not already exist {3}
13177     */
13178    public Period getPreAuthRefPeriodFirstRep() { 
13179      if (getPreAuthRefPeriod().isEmpty()) {
13180        addPreAuthRefPeriod();
13181      }
13182      return getPreAuthRefPeriod().get(0);
13183    }
13184
13185    /**
13186     * @return {@link #careTeam} (The members of the team who provided the products and services.)
13187     */
13188    public List<CareTeamComponent> getCareTeam() { 
13189      if (this.careTeam == null)
13190        this.careTeam = new ArrayList<CareTeamComponent>();
13191      return this.careTeam;
13192    }
13193
13194    /**
13195     * @return Returns a reference to <code>this</code> for easy method chaining
13196     */
13197    public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) { 
13198      this.careTeam = theCareTeam;
13199      return this;
13200    }
13201
13202    public boolean hasCareTeam() { 
13203      if (this.careTeam == null)
13204        return false;
13205      for (CareTeamComponent item : this.careTeam)
13206        if (!item.isEmpty())
13207          return true;
13208      return false;
13209    }
13210
13211    public CareTeamComponent addCareTeam() { //3
13212      CareTeamComponent t = new CareTeamComponent();
13213      if (this.careTeam == null)
13214        this.careTeam = new ArrayList<CareTeamComponent>();
13215      this.careTeam.add(t);
13216      return t;
13217    }
13218
13219    public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { //3
13220      if (t == null)
13221        return this;
13222      if (this.careTeam == null)
13223        this.careTeam = new ArrayList<CareTeamComponent>();
13224      this.careTeam.add(t);
13225      return this;
13226    }
13227
13228    /**
13229     * @return The first repetition of repeating field {@link #careTeam}, creating it if it does not already exist {3}
13230     */
13231    public CareTeamComponent getCareTeamFirstRep() { 
13232      if (getCareTeam().isEmpty()) {
13233        addCareTeam();
13234      }
13235      return getCareTeam().get(0);
13236    }
13237
13238    /**
13239     * @return {@link #supportingInfo} (Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.)
13240     */
13241    public List<SupportingInformationComponent> getSupportingInfo() { 
13242      if (this.supportingInfo == null)
13243        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13244      return this.supportingInfo;
13245    }
13246
13247    /**
13248     * @return Returns a reference to <code>this</code> for easy method chaining
13249     */
13250    public ExplanationOfBenefit setSupportingInfo(List<SupportingInformationComponent> theSupportingInfo) { 
13251      this.supportingInfo = theSupportingInfo;
13252      return this;
13253    }
13254
13255    public boolean hasSupportingInfo() { 
13256      if (this.supportingInfo == null)
13257        return false;
13258      for (SupportingInformationComponent item : this.supportingInfo)
13259        if (!item.isEmpty())
13260          return true;
13261      return false;
13262    }
13263
13264    public SupportingInformationComponent addSupportingInfo() { //3
13265      SupportingInformationComponent t = new SupportingInformationComponent();
13266      if (this.supportingInfo == null)
13267        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13268      this.supportingInfo.add(t);
13269      return t;
13270    }
13271
13272    public ExplanationOfBenefit addSupportingInfo(SupportingInformationComponent t) { //3
13273      if (t == null)
13274        return this;
13275      if (this.supportingInfo == null)
13276        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13277      this.supportingInfo.add(t);
13278      return this;
13279    }
13280
13281    /**
13282     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist {3}
13283     */
13284    public SupportingInformationComponent getSupportingInfoFirstRep() { 
13285      if (getSupportingInfo().isEmpty()) {
13286        addSupportingInfo();
13287      }
13288      return getSupportingInfo().get(0);
13289    }
13290
13291    /**
13292     * @return {@link #diagnosis} (Information about diagnoses relevant to the claim items.)
13293     */
13294    public List<DiagnosisComponent> getDiagnosis() { 
13295      if (this.diagnosis == null)
13296        this.diagnosis = new ArrayList<DiagnosisComponent>();
13297      return this.diagnosis;
13298    }
13299
13300    /**
13301     * @return Returns a reference to <code>this</code> for easy method chaining
13302     */
13303    public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
13304      this.diagnosis = theDiagnosis;
13305      return this;
13306    }
13307
13308    public boolean hasDiagnosis() { 
13309      if (this.diagnosis == null)
13310        return false;
13311      for (DiagnosisComponent item : this.diagnosis)
13312        if (!item.isEmpty())
13313          return true;
13314      return false;
13315    }
13316
13317    public DiagnosisComponent addDiagnosis() { //3
13318      DiagnosisComponent t = new DiagnosisComponent();
13319      if (this.diagnosis == null)
13320        this.diagnosis = new ArrayList<DiagnosisComponent>();
13321      this.diagnosis.add(t);
13322      return t;
13323    }
13324
13325    public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { //3
13326      if (t == null)
13327        return this;
13328      if (this.diagnosis == null)
13329        this.diagnosis = new ArrayList<DiagnosisComponent>();
13330      this.diagnosis.add(t);
13331      return this;
13332    }
13333
13334    /**
13335     * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist {3}
13336     */
13337    public DiagnosisComponent getDiagnosisFirstRep() { 
13338      if (getDiagnosis().isEmpty()) {
13339        addDiagnosis();
13340      }
13341      return getDiagnosis().get(0);
13342    }
13343
13344    /**
13345     * @return {@link #procedure} (Procedures performed on the patient relevant to the billing items with the claim.)
13346     */
13347    public List<ProcedureComponent> getProcedure() { 
13348      if (this.procedure == null)
13349        this.procedure = new ArrayList<ProcedureComponent>();
13350      return this.procedure;
13351    }
13352
13353    /**
13354     * @return Returns a reference to <code>this</code> for easy method chaining
13355     */
13356    public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) { 
13357      this.procedure = theProcedure;
13358      return this;
13359    }
13360
13361    public boolean hasProcedure() { 
13362      if (this.procedure == null)
13363        return false;
13364      for (ProcedureComponent item : this.procedure)
13365        if (!item.isEmpty())
13366          return true;
13367      return false;
13368    }
13369
13370    public ProcedureComponent addProcedure() { //3
13371      ProcedureComponent t = new ProcedureComponent();
13372      if (this.procedure == null)
13373        this.procedure = new ArrayList<ProcedureComponent>();
13374      this.procedure.add(t);
13375      return t;
13376    }
13377
13378    public ExplanationOfBenefit addProcedure(ProcedureComponent t) { //3
13379      if (t == null)
13380        return this;
13381      if (this.procedure == null)
13382        this.procedure = new ArrayList<ProcedureComponent>();
13383      this.procedure.add(t);
13384      return this;
13385    }
13386
13387    /**
13388     * @return The first repetition of repeating field {@link #procedure}, creating it if it does not already exist {3}
13389     */
13390    public ProcedureComponent getProcedureFirstRep() { 
13391      if (getProcedure().isEmpty()) {
13392        addProcedure();
13393      }
13394      return getProcedure().get(0);
13395    }
13396
13397    /**
13398     * @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
13399     */
13400    public PositiveIntType getPrecedenceElement() { 
13401      if (this.precedence == null)
13402        if (Configuration.errorOnAutoCreate())
13403          throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
13404        else if (Configuration.doAutoCreate())
13405          this.precedence = new PositiveIntType(); // bb
13406      return this.precedence;
13407    }
13408
13409    public boolean hasPrecedenceElement() { 
13410      return this.precedence != null && !this.precedence.isEmpty();
13411    }
13412
13413    public boolean hasPrecedence() { 
13414      return this.precedence != null && !this.precedence.isEmpty();
13415    }
13416
13417    /**
13418     * @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
13419     */
13420    public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) { 
13421      this.precedence = value;
13422      return this;
13423    }
13424
13425    /**
13426     * @return This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
13427     */
13428    public int getPrecedence() { 
13429      return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
13430    }
13431
13432    /**
13433     * @param value This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
13434     */
13435    public ExplanationOfBenefit setPrecedence(int value) { 
13436        if (this.precedence == null)
13437          this.precedence = new PositiveIntType();
13438        this.precedence.setValue(value);
13439      return this;
13440    }
13441
13442    /**
13443     * @return {@link #insurance} (Financial instruments for reimbursement for the health care products and services specified on the claim.)
13444     */
13445    public List<InsuranceComponent> getInsurance() { 
13446      if (this.insurance == null)
13447        this.insurance = new ArrayList<InsuranceComponent>();
13448      return this.insurance;
13449    }
13450
13451    /**
13452     * @return Returns a reference to <code>this</code> for easy method chaining
13453     */
13454    public ExplanationOfBenefit setInsurance(List<InsuranceComponent> theInsurance) { 
13455      this.insurance = theInsurance;
13456      return this;
13457    }
13458
13459    public boolean hasInsurance() { 
13460      if (this.insurance == null)
13461        return false;
13462      for (InsuranceComponent item : this.insurance)
13463        if (!item.isEmpty())
13464          return true;
13465      return false;
13466    }
13467
13468    public InsuranceComponent addInsurance() { //3
13469      InsuranceComponent t = new InsuranceComponent();
13470      if (this.insurance == null)
13471        this.insurance = new ArrayList<InsuranceComponent>();
13472      this.insurance.add(t);
13473      return t;
13474    }
13475
13476    public ExplanationOfBenefit addInsurance(InsuranceComponent t) { //3
13477      if (t == null)
13478        return this;
13479      if (this.insurance == null)
13480        this.insurance = new ArrayList<InsuranceComponent>();
13481      this.insurance.add(t);
13482      return this;
13483    }
13484
13485    /**
13486     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist {3}
13487     */
13488    public InsuranceComponent getInsuranceFirstRep() { 
13489      if (getInsurance().isEmpty()) {
13490        addInsurance();
13491      }
13492      return getInsurance().get(0);
13493    }
13494
13495    /**
13496     * @return {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
13497     */
13498    public AccidentComponent getAccident() { 
13499      if (this.accident == null)
13500        if (Configuration.errorOnAutoCreate())
13501          throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
13502        else if (Configuration.doAutoCreate())
13503          this.accident = new AccidentComponent(); // cc
13504      return this.accident;
13505    }
13506
13507    public boolean hasAccident() { 
13508      return this.accident != null && !this.accident.isEmpty();
13509    }
13510
13511    /**
13512     * @param value {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
13513     */
13514    public ExplanationOfBenefit setAccident(AccidentComponent value) { 
13515      this.accident = value;
13516      return this;
13517    }
13518
13519    /**
13520     * @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.)
13521     */
13522    public List<ItemComponent> getItem() { 
13523      if (this.item == null)
13524        this.item = new ArrayList<ItemComponent>();
13525      return this.item;
13526    }
13527
13528    /**
13529     * @return Returns a reference to <code>this</code> for easy method chaining
13530     */
13531    public ExplanationOfBenefit setItem(List<ItemComponent> theItem) { 
13532      this.item = theItem;
13533      return this;
13534    }
13535
13536    public boolean hasItem() { 
13537      if (this.item == null)
13538        return false;
13539      for (ItemComponent item : this.item)
13540        if (!item.isEmpty())
13541          return true;
13542      return false;
13543    }
13544
13545    public ItemComponent addItem() { //3
13546      ItemComponent t = new ItemComponent();
13547      if (this.item == null)
13548        this.item = new ArrayList<ItemComponent>();
13549      this.item.add(t);
13550      return t;
13551    }
13552
13553    public ExplanationOfBenefit addItem(ItemComponent t) { //3
13554      if (t == null)
13555        return this;
13556      if (this.item == null)
13557        this.item = new ArrayList<ItemComponent>();
13558      this.item.add(t);
13559      return this;
13560    }
13561
13562    /**
13563     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist {3}
13564     */
13565    public ItemComponent getItemFirstRep() { 
13566      if (getItem().isEmpty()) {
13567        addItem();
13568      }
13569      return getItem().get(0);
13570    }
13571
13572    /**
13573     * @return {@link #addItem} (The first-tier service adjudications for payor added product or service lines.)
13574     */
13575    public List<AddedItemComponent> getAddItem() { 
13576      if (this.addItem == null)
13577        this.addItem = new ArrayList<AddedItemComponent>();
13578      return this.addItem;
13579    }
13580
13581    /**
13582     * @return Returns a reference to <code>this</code> for easy method chaining
13583     */
13584    public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) { 
13585      this.addItem = theAddItem;
13586      return this;
13587    }
13588
13589    public boolean hasAddItem() { 
13590      if (this.addItem == null)
13591        return false;
13592      for (AddedItemComponent item : this.addItem)
13593        if (!item.isEmpty())
13594          return true;
13595      return false;
13596    }
13597
13598    public AddedItemComponent addAddItem() { //3
13599      AddedItemComponent t = new AddedItemComponent();
13600      if (this.addItem == null)
13601        this.addItem = new ArrayList<AddedItemComponent>();
13602      this.addItem.add(t);
13603      return t;
13604    }
13605
13606    public ExplanationOfBenefit addAddItem(AddedItemComponent t) { //3
13607      if (t == null)
13608        return this;
13609      if (this.addItem == null)
13610        this.addItem = new ArrayList<AddedItemComponent>();
13611      this.addItem.add(t);
13612      return this;
13613    }
13614
13615    /**
13616     * @return The first repetition of repeating field {@link #addItem}, creating it if it does not already exist {3}
13617     */
13618    public AddedItemComponent getAddItemFirstRep() { 
13619      if (getAddItem().isEmpty()) {
13620        addAddItem();
13621      }
13622      return getAddItem().get(0);
13623    }
13624
13625    /**
13626     * @return {@link #adjudication} (The adjudication results which are presented at the header level rather than at the line-item or add-item levels.)
13627     */
13628    public List<AdjudicationComponent> getAdjudication() { 
13629      if (this.adjudication == null)
13630        this.adjudication = new ArrayList<AdjudicationComponent>();
13631      return this.adjudication;
13632    }
13633
13634    /**
13635     * @return Returns a reference to <code>this</code> for easy method chaining
13636     */
13637    public ExplanationOfBenefit setAdjudication(List<AdjudicationComponent> theAdjudication) { 
13638      this.adjudication = theAdjudication;
13639      return this;
13640    }
13641
13642    public boolean hasAdjudication() { 
13643      if (this.adjudication == null)
13644        return false;
13645      for (AdjudicationComponent item : this.adjudication)
13646        if (!item.isEmpty())
13647          return true;
13648      return false;
13649    }
13650
13651    public AdjudicationComponent addAdjudication() { //3
13652      AdjudicationComponent t = new AdjudicationComponent();
13653      if (this.adjudication == null)
13654        this.adjudication = new ArrayList<AdjudicationComponent>();
13655      this.adjudication.add(t);
13656      return t;
13657    }
13658
13659    public ExplanationOfBenefit addAdjudication(AdjudicationComponent t) { //3
13660      if (t == null)
13661        return this;
13662      if (this.adjudication == null)
13663        this.adjudication = new ArrayList<AdjudicationComponent>();
13664      this.adjudication.add(t);
13665      return this;
13666    }
13667
13668    /**
13669     * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
13670     */
13671    public AdjudicationComponent getAdjudicationFirstRep() { 
13672      if (getAdjudication().isEmpty()) {
13673        addAdjudication();
13674      }
13675      return getAdjudication().get(0);
13676    }
13677
13678    /**
13679     * @return {@link #total} (Categorized monetary totals for the adjudication.)
13680     */
13681    public List<TotalComponent> getTotal() { 
13682      if (this.total == null)
13683        this.total = new ArrayList<TotalComponent>();
13684      return this.total;
13685    }
13686
13687    /**
13688     * @return Returns a reference to <code>this</code> for easy method chaining
13689     */
13690    public ExplanationOfBenefit setTotal(List<TotalComponent> theTotal) { 
13691      this.total = theTotal;
13692      return this;
13693    }
13694
13695    public boolean hasTotal() { 
13696      if (this.total == null)
13697        return false;
13698      for (TotalComponent item : this.total)
13699        if (!item.isEmpty())
13700          return true;
13701      return false;
13702    }
13703
13704    public TotalComponent addTotal() { //3
13705      TotalComponent t = new TotalComponent();
13706      if (this.total == null)
13707        this.total = new ArrayList<TotalComponent>();
13708      this.total.add(t);
13709      return t;
13710    }
13711
13712    public ExplanationOfBenefit addTotal(TotalComponent t) { //3
13713      if (t == null)
13714        return this;
13715      if (this.total == null)
13716        this.total = new ArrayList<TotalComponent>();
13717      this.total.add(t);
13718      return this;
13719    }
13720
13721    /**
13722     * @return The first repetition of repeating field {@link #total}, creating it if it does not already exist {3}
13723     */
13724    public TotalComponent getTotalFirstRep() { 
13725      if (getTotal().isEmpty()) {
13726        addTotal();
13727      }
13728      return getTotal().get(0);
13729    }
13730
13731    /**
13732     * @return {@link #payment} (Payment details for the adjudication of the claim.)
13733     */
13734    public PaymentComponent getPayment() { 
13735      if (this.payment == null)
13736        if (Configuration.errorOnAutoCreate())
13737          throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
13738        else if (Configuration.doAutoCreate())
13739          this.payment = new PaymentComponent(); // cc
13740      return this.payment;
13741    }
13742
13743    public boolean hasPayment() { 
13744      return this.payment != null && !this.payment.isEmpty();
13745    }
13746
13747    /**
13748     * @param value {@link #payment} (Payment details for the adjudication of the claim.)
13749     */
13750    public ExplanationOfBenefit setPayment(PaymentComponent value) { 
13751      this.payment = value;
13752      return this;
13753    }
13754
13755    /**
13756     * @return {@link #formCode} (A code for the form to be used for printing the content.)
13757     */
13758    public CodeableConcept getFormCode() { 
13759      if (this.formCode == null)
13760        if (Configuration.errorOnAutoCreate())
13761          throw new Error("Attempt to auto-create ExplanationOfBenefit.formCode");
13762        else if (Configuration.doAutoCreate())
13763          this.formCode = new CodeableConcept(); // cc
13764      return this.formCode;
13765    }
13766
13767    public boolean hasFormCode() { 
13768      return this.formCode != null && !this.formCode.isEmpty();
13769    }
13770
13771    /**
13772     * @param value {@link #formCode} (A code for the form to be used for printing the content.)
13773     */
13774    public ExplanationOfBenefit setFormCode(CodeableConcept value) { 
13775      this.formCode = value;
13776      return this;
13777    }
13778
13779    /**
13780     * @return {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
13781     */
13782    public Attachment getForm() { 
13783      if (this.form == null)
13784        if (Configuration.errorOnAutoCreate())
13785          throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
13786        else if (Configuration.doAutoCreate())
13787          this.form = new Attachment(); // cc
13788      return this.form;
13789    }
13790
13791    public boolean hasForm() { 
13792      return this.form != null && !this.form.isEmpty();
13793    }
13794
13795    /**
13796     * @param value {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
13797     */
13798    public ExplanationOfBenefit setForm(Attachment value) { 
13799      this.form = value;
13800      return this;
13801    }
13802
13803    /**
13804     * @return {@link #processNote} (A note that describes or explains adjudication results in a human readable form.)
13805     */
13806    public List<NoteComponent> getProcessNote() { 
13807      if (this.processNote == null)
13808        this.processNote = new ArrayList<NoteComponent>();
13809      return this.processNote;
13810    }
13811
13812    /**
13813     * @return Returns a reference to <code>this</code> for easy method chaining
13814     */
13815    public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) { 
13816      this.processNote = theProcessNote;
13817      return this;
13818    }
13819
13820    public boolean hasProcessNote() { 
13821      if (this.processNote == null)
13822        return false;
13823      for (NoteComponent item : this.processNote)
13824        if (!item.isEmpty())
13825          return true;
13826      return false;
13827    }
13828
13829    public NoteComponent addProcessNote() { //3
13830      NoteComponent t = new NoteComponent();
13831      if (this.processNote == null)
13832        this.processNote = new ArrayList<NoteComponent>();
13833      this.processNote.add(t);
13834      return t;
13835    }
13836
13837    public ExplanationOfBenefit addProcessNote(NoteComponent t) { //3
13838      if (t == null)
13839        return this;
13840      if (this.processNote == null)
13841        this.processNote = new ArrayList<NoteComponent>();
13842      this.processNote.add(t);
13843      return this;
13844    }
13845
13846    /**
13847     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist {3}
13848     */
13849    public NoteComponent getProcessNoteFirstRep() { 
13850      if (getProcessNote().isEmpty()) {
13851        addProcessNote();
13852      }
13853      return getProcessNote().get(0);
13854    }
13855
13856    /**
13857     * @return {@link #benefitPeriod} (The term of the benefits documented in this response.)
13858     */
13859    public Period getBenefitPeriod() { 
13860      if (this.benefitPeriod == null)
13861        if (Configuration.errorOnAutoCreate())
13862          throw new Error("Attempt to auto-create ExplanationOfBenefit.benefitPeriod");
13863        else if (Configuration.doAutoCreate())
13864          this.benefitPeriod = new Period(); // cc
13865      return this.benefitPeriod;
13866    }
13867
13868    public boolean hasBenefitPeriod() { 
13869      return this.benefitPeriod != null && !this.benefitPeriod.isEmpty();
13870    }
13871
13872    /**
13873     * @param value {@link #benefitPeriod} (The term of the benefits documented in this response.)
13874     */
13875    public ExplanationOfBenefit setBenefitPeriod(Period value) { 
13876      this.benefitPeriod = value;
13877      return this;
13878    }
13879
13880    /**
13881     * @return {@link #benefitBalance} (Balance by Benefit Category.)
13882     */
13883    public List<BenefitBalanceComponent> getBenefitBalance() { 
13884      if (this.benefitBalance == null)
13885        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
13886      return this.benefitBalance;
13887    }
13888
13889    /**
13890     * @return Returns a reference to <code>this</code> for easy method chaining
13891     */
13892    public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) { 
13893      this.benefitBalance = theBenefitBalance;
13894      return this;
13895    }
13896
13897    public boolean hasBenefitBalance() { 
13898      if (this.benefitBalance == null)
13899        return false;
13900      for (BenefitBalanceComponent item : this.benefitBalance)
13901        if (!item.isEmpty())
13902          return true;
13903      return false;
13904    }
13905
13906    public BenefitBalanceComponent addBenefitBalance() { //3
13907      BenefitBalanceComponent t = new BenefitBalanceComponent();
13908      if (this.benefitBalance == null)
13909        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
13910      this.benefitBalance.add(t);
13911      return t;
13912    }
13913
13914    public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { //3
13915      if (t == null)
13916        return this;
13917      if (this.benefitBalance == null)
13918        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
13919      this.benefitBalance.add(t);
13920      return this;
13921    }
13922
13923    /**
13924     * @return The first repetition of repeating field {@link #benefitBalance}, creating it if it does not already exist {3}
13925     */
13926    public BenefitBalanceComponent getBenefitBalanceFirstRep() { 
13927      if (getBenefitBalance().isEmpty()) {
13928        addBenefitBalance();
13929      }
13930      return getBenefitBalance().get(0);
13931    }
13932
13933      protected void listChildren(List<Property> children) {
13934        super.listChildren(children);
13935        children.add(new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier));
13936        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
13937        children.add(new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type));
13938        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));
13939        children.add(new Property("use", "code", "A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future.", 0, 1, use));
13940        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));
13941        children.add(new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod));
13942        children.add(new Property("created", "dateTime", "The date this resource was created.", 0, 1, created));
13943        children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer));
13944        children.add(new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer));
13945        children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider));
13946        children.add(new Property("priority", "CodeableConcept", "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0, 1, priority));
13947        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));
13948        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));
13949        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));
13950        children.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription));
13951        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));
13952        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));
13953        children.add(new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral));
13954        children.add(new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
13955        children.add(new Property("claim", "Reference(Claim)", "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.", 0, 1, claim));
13956        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));
13957        children.add(new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome));
13958        children.add(new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition));
13959        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));
13960        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));
13961        children.add(new Property("careTeam", "", "The members of the team who provided the products and services.", 0, java.lang.Integer.MAX_VALUE, careTeam));
13962        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));
13963        children.add(new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
13964        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));
13965        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));
13966        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));
13967        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));
13968        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));
13969        children.add(new Property("addItem", "", "The first-tier service adjudications for payor added product or service lines.", 0, java.lang.Integer.MAX_VALUE, addItem));
13970        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));
13971        children.add(new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total));
13972        children.add(new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment));
13973        children.add(new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode));
13974        children.add(new Property("form", "Attachment", "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form));
13975        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));
13976        children.add(new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod));
13977        children.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
13978      }
13979
13980      @Override
13981      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
13982        switch (_hash) {
13983        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier);
13984        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
13985        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type);
13986        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);
13987        case 116103: /*use*/  return new Property("use", "code", "A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future.", 0, 1, use);
13988        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);
13989        case -332066046: /*billablePeriod*/  return new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod);
13990        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date this resource was created.", 0, 1, created);
13991        case -1591951995: /*enterer*/  return new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer);
13992        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer);
13993        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);
13994        case -1165461084: /*priority*/  return new Property("priority", "CodeableConcept", "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0, 1, priority);
13995        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);
13996        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);
13997        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);
13998        case 460301338: /*prescription*/  return new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription);
13999        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);
14000        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);
14001        case -722568291: /*referral*/  return new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral);
14002        case 501116579: /*facility*/  return new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility);
14003        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);
14004        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);
14005        case -1106507950: /*outcome*/  return new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome);
14006        case 583380919: /*disposition*/  return new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition);
14007        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);
14008        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);
14009        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);
14010        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);
14011        case 1196993265: /*diagnosis*/  return new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis);
14012        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);
14013        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);
14014        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);
14015        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);
14016        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);
14017        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);
14018        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);
14019        case 110549828: /*total*/  return new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total);
14020        case -786681338: /*payment*/  return new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment);
14021        case 473181393: /*formCode*/  return new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode);
14022        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);
14023        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);
14024        case -407369416: /*benefitPeriod*/  return new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod);
14025        case 596003397: /*benefitBalance*/  return new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance);
14026        default: return super.getNamedProperty(_hash, _name, _checkValid);
14027        }
14028
14029      }
14030
14031      @Override
14032      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
14033        switch (hash) {
14034        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
14035        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ExplanationOfBenefitStatus>
14036        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
14037        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
14038        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<Use>
14039        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
14040        case -332066046: /*billablePeriod*/ return this.billablePeriod == null ? new Base[0] : new Base[] {this.billablePeriod}; // Period
14041        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
14042        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
14043        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
14044        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
14045        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
14046        case -1688904576: /*fundsReserveRequested*/ return this.fundsReserveRequested == null ? new Base[0] : new Base[] {this.fundsReserveRequested}; // CodeableConcept
14047        case 1314609806: /*fundsReserve*/ return this.fundsReserve == null ? new Base[0] : new Base[] {this.fundsReserve}; // CodeableConcept
14048        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
14049        case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Reference
14050        case -1814015861: /*originalPrescription*/ return this.originalPrescription == null ? new Base[0] : new Base[] {this.originalPrescription}; // Reference
14051        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // PayeeComponent
14052        case -722568291: /*referral*/ return this.referral == null ? new Base[0] : new Base[] {this.referral}; // Reference
14053        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
14054        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
14055        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Reference
14056        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // Enumeration<RemittanceOutcome>
14057        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
14058        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
14059        case -1262920311: /*preAuthRefPeriod*/ return this.preAuthRefPeriod == null ? new Base[0] : this.preAuthRefPeriod.toArray(new Base[this.preAuthRefPeriod.size()]); // Period
14060        case -7323378: /*careTeam*/ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
14061        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // SupportingInformationComponent
14062        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
14063        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
14064        case 159695370: /*precedence*/ return this.precedence == null ? new Base[0] : new Base[] {this.precedence}; // PositiveIntType
14065        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
14066        case -2143202801: /*accident*/ return this.accident == null ? new Base[0] : new Base[] {this.accident}; // AccidentComponent
14067        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
14068        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
14069        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
14070        case 110549828: /*total*/ return this.total == null ? new Base[0] : this.total.toArray(new Base[this.total.size()]); // TotalComponent
14071        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // PaymentComponent
14072        case 473181393: /*formCode*/ return this.formCode == null ? new Base[0] : new Base[] {this.formCode}; // CodeableConcept
14073        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // Attachment
14074        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
14075        case -407369416: /*benefitPeriod*/ return this.benefitPeriod == null ? new Base[0] : new Base[] {this.benefitPeriod}; // Period
14076        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
14077        default: return super.getProperty(hash, name, checkValid);
14078        }
14079
14080      }
14081
14082      @Override
14083      public Base setProperty(int hash, String name, Base value) throws FHIRException {
14084        switch (hash) {
14085        case -1618432855: // identifier
14086          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
14087          return value;
14088        case -892481550: // status
14089          value = new ExplanationOfBenefitStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
14090          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14091          return value;
14092        case 3575610: // type
14093          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14094          return value;
14095        case -1868521062: // subType
14096          this.subType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14097          return value;
14098        case 116103: // use
14099          value = new UseEnumFactory().fromType(TypeConvertor.castToCode(value));
14100          this.use = (Enumeration) value; // Enumeration<Use>
14101          return value;
14102        case -791418107: // patient
14103          this.patient = TypeConvertor.castToReference(value); // Reference
14104          return value;
14105        case -332066046: // billablePeriod
14106          this.billablePeriod = TypeConvertor.castToPeriod(value); // Period
14107          return value;
14108        case 1028554472: // created
14109          this.created = TypeConvertor.castToDateTime(value); // DateTimeType
14110          return value;
14111        case -1591951995: // enterer
14112          this.enterer = TypeConvertor.castToReference(value); // Reference
14113          return value;
14114        case 1957615864: // insurer
14115          this.insurer = TypeConvertor.castToReference(value); // Reference
14116          return value;
14117        case -987494927: // provider
14118          this.provider = TypeConvertor.castToReference(value); // Reference
14119          return value;
14120        case -1165461084: // priority
14121          this.priority = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14122          return value;
14123        case -1688904576: // fundsReserveRequested
14124          this.fundsReserveRequested = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14125          return value;
14126        case 1314609806: // fundsReserve
14127          this.fundsReserve = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14128          return value;
14129        case 1090493483: // related
14130          this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
14131          return value;
14132        case 460301338: // prescription
14133          this.prescription = TypeConvertor.castToReference(value); // Reference
14134          return value;
14135        case -1814015861: // originalPrescription
14136          this.originalPrescription = TypeConvertor.castToReference(value); // Reference
14137          return value;
14138        case 106443592: // payee
14139          this.payee = (PayeeComponent) value; // PayeeComponent
14140          return value;
14141        case -722568291: // referral
14142          this.referral = TypeConvertor.castToReference(value); // Reference
14143          return value;
14144        case 501116579: // facility
14145          this.facility = TypeConvertor.castToReference(value); // Reference
14146          return value;
14147        case 94742588: // claim
14148          this.claim = TypeConvertor.castToReference(value); // Reference
14149          return value;
14150        case 689513629: // claimResponse
14151          this.claimResponse = TypeConvertor.castToReference(value); // Reference
14152          return value;
14153        case -1106507950: // outcome
14154          value = new RemittanceOutcomeEnumFactory().fromType(TypeConvertor.castToCode(value));
14155          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
14156          return value;
14157        case 583380919: // disposition
14158          this.disposition = TypeConvertor.castToString(value); // StringType
14159          return value;
14160        case 522246568: // preAuthRef
14161          this.getPreAuthRef().add(TypeConvertor.castToString(value)); // StringType
14162          return value;
14163        case -1262920311: // preAuthRefPeriod
14164          this.getPreAuthRefPeriod().add(TypeConvertor.castToPeriod(value)); // Period
14165          return value;
14166        case -7323378: // careTeam
14167          this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
14168          return value;
14169        case 1922406657: // supportingInfo
14170          this.getSupportingInfo().add((SupportingInformationComponent) value); // SupportingInformationComponent
14171          return value;
14172        case 1196993265: // diagnosis
14173          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
14174          return value;
14175        case -1095204141: // procedure
14176          this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
14177          return value;
14178        case 159695370: // precedence
14179          this.precedence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
14180          return value;
14181        case 73049818: // insurance
14182          this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
14183          return value;
14184        case -2143202801: // accident
14185          this.accident = (AccidentComponent) value; // AccidentComponent
14186          return value;
14187        case 3242771: // item
14188          this.getItem().add((ItemComponent) value); // ItemComponent
14189          return value;
14190        case -1148899500: // addItem
14191          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
14192          return value;
14193        case -231349275: // adjudication
14194          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
14195          return value;
14196        case 110549828: // total
14197          this.getTotal().add((TotalComponent) value); // TotalComponent
14198          return value;
14199        case -786681338: // payment
14200          this.payment = (PaymentComponent) value; // PaymentComponent
14201          return value;
14202        case 473181393: // formCode
14203          this.formCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14204          return value;
14205        case 3148996: // form
14206          this.form = TypeConvertor.castToAttachment(value); // Attachment
14207          return value;
14208        case 202339073: // processNote
14209          this.getProcessNote().add((NoteComponent) value); // NoteComponent
14210          return value;
14211        case -407369416: // benefitPeriod
14212          this.benefitPeriod = TypeConvertor.castToPeriod(value); // Period
14213          return value;
14214        case 596003397: // benefitBalance
14215          this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
14216          return value;
14217        default: return super.setProperty(hash, name, value);
14218        }
14219
14220      }
14221
14222      @Override
14223      public Base setProperty(String name, Base value) throws FHIRException {
14224        if (name.equals("identifier")) {
14225          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
14226        } else if (name.equals("status")) {
14227          value = new ExplanationOfBenefitStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
14228          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14229        } else if (name.equals("type")) {
14230          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14231        } else if (name.equals("subType")) {
14232          this.subType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14233        } else if (name.equals("use")) {
14234          value = new UseEnumFactory().fromType(TypeConvertor.castToCode(value));
14235          this.use = (Enumeration) value; // Enumeration<Use>
14236        } else if (name.equals("patient")) {
14237          this.patient = TypeConvertor.castToReference(value); // Reference
14238        } else if (name.equals("billablePeriod")) {
14239          this.billablePeriod = TypeConvertor.castToPeriod(value); // Period
14240        } else if (name.equals("created")) {
14241          this.created = TypeConvertor.castToDateTime(value); // DateTimeType
14242        } else if (name.equals("enterer")) {
14243          this.enterer = TypeConvertor.castToReference(value); // Reference
14244        } else if (name.equals("insurer")) {
14245          this.insurer = TypeConvertor.castToReference(value); // Reference
14246        } else if (name.equals("provider")) {
14247          this.provider = TypeConvertor.castToReference(value); // Reference
14248        } else if (name.equals("priority")) {
14249          this.priority = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14250        } else if (name.equals("fundsReserveRequested")) {
14251          this.fundsReserveRequested = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14252        } else if (name.equals("fundsReserve")) {
14253          this.fundsReserve = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14254        } else if (name.equals("related")) {
14255          this.getRelated().add((RelatedClaimComponent) value);
14256        } else if (name.equals("prescription")) {
14257          this.prescription = TypeConvertor.castToReference(value); // Reference
14258        } else if (name.equals("originalPrescription")) {
14259          this.originalPrescription = TypeConvertor.castToReference(value); // Reference
14260        } else if (name.equals("payee")) {
14261          this.payee = (PayeeComponent) value; // PayeeComponent
14262        } else if (name.equals("referral")) {
14263          this.referral = TypeConvertor.castToReference(value); // Reference
14264        } else if (name.equals("facility")) {
14265          this.facility = TypeConvertor.castToReference(value); // Reference
14266        } else if (name.equals("claim")) {
14267          this.claim = TypeConvertor.castToReference(value); // Reference
14268        } else if (name.equals("claimResponse")) {
14269          this.claimResponse = TypeConvertor.castToReference(value); // Reference
14270        } else if (name.equals("outcome")) {
14271          value = new RemittanceOutcomeEnumFactory().fromType(TypeConvertor.castToCode(value));
14272          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
14273        } else if (name.equals("disposition")) {
14274          this.disposition = TypeConvertor.castToString(value); // StringType
14275        } else if (name.equals("preAuthRef")) {
14276          this.getPreAuthRef().add(TypeConvertor.castToString(value));
14277        } else if (name.equals("preAuthRefPeriod")) {
14278          this.getPreAuthRefPeriod().add(TypeConvertor.castToPeriod(value));
14279        } else if (name.equals("careTeam")) {
14280          this.getCareTeam().add((CareTeamComponent) value);
14281        } else if (name.equals("supportingInfo")) {
14282          this.getSupportingInfo().add((SupportingInformationComponent) value);
14283        } else if (name.equals("diagnosis")) {
14284          this.getDiagnosis().add((DiagnosisComponent) value);
14285        } else if (name.equals("procedure")) {
14286          this.getProcedure().add((ProcedureComponent) value);
14287        } else if (name.equals("precedence")) {
14288          this.precedence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
14289        } else if (name.equals("insurance")) {
14290          this.getInsurance().add((InsuranceComponent) value);
14291        } else if (name.equals("accident")) {
14292          this.accident = (AccidentComponent) value; // AccidentComponent
14293        } else if (name.equals("item")) {
14294          this.getItem().add((ItemComponent) value);
14295        } else if (name.equals("addItem")) {
14296          this.getAddItem().add((AddedItemComponent) value);
14297        } else if (name.equals("adjudication")) {
14298          this.getAdjudication().add((AdjudicationComponent) value);
14299        } else if (name.equals("total")) {
14300          this.getTotal().add((TotalComponent) value);
14301        } else if (name.equals("payment")) {
14302          this.payment = (PaymentComponent) value; // PaymentComponent
14303        } else if (name.equals("formCode")) {
14304          this.formCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14305        } else if (name.equals("form")) {
14306          this.form = TypeConvertor.castToAttachment(value); // Attachment
14307        } else if (name.equals("processNote")) {
14308          this.getProcessNote().add((NoteComponent) value);
14309        } else if (name.equals("benefitPeriod")) {
14310          this.benefitPeriod = TypeConvertor.castToPeriod(value); // Period
14311        } else if (name.equals("benefitBalance")) {
14312          this.getBenefitBalance().add((BenefitBalanceComponent) value);
14313        } else
14314          return super.setProperty(name, value);
14315        return value;
14316      }
14317
14318      @Override
14319      public Base makeProperty(int hash, String name) throws FHIRException {
14320        switch (hash) {
14321        case -1618432855:  return addIdentifier(); 
14322        case -892481550:  return getStatusElement();
14323        case 3575610:  return getType();
14324        case -1868521062:  return getSubType();
14325        case 116103:  return getUseElement();
14326        case -791418107:  return getPatient();
14327        case -332066046:  return getBillablePeriod();
14328        case 1028554472:  return getCreatedElement();
14329        case -1591951995:  return getEnterer();
14330        case 1957615864:  return getInsurer();
14331        case -987494927:  return getProvider();
14332        case -1165461084:  return getPriority();
14333        case -1688904576:  return getFundsReserveRequested();
14334        case 1314609806:  return getFundsReserve();
14335        case 1090493483:  return addRelated(); 
14336        case 460301338:  return getPrescription();
14337        case -1814015861:  return getOriginalPrescription();
14338        case 106443592:  return getPayee();
14339        case -722568291:  return getReferral();
14340        case 501116579:  return getFacility();
14341        case 94742588:  return getClaim();
14342        case 689513629:  return getClaimResponse();
14343        case -1106507950:  return getOutcomeElement();
14344        case 583380919:  return getDispositionElement();
14345        case 522246568:  return addPreAuthRefElement();
14346        case -1262920311:  return addPreAuthRefPeriod(); 
14347        case -7323378:  return addCareTeam(); 
14348        case 1922406657:  return addSupportingInfo(); 
14349        case 1196993265:  return addDiagnosis(); 
14350        case -1095204141:  return addProcedure(); 
14351        case 159695370:  return getPrecedenceElement();
14352        case 73049818:  return addInsurance(); 
14353        case -2143202801:  return getAccident();
14354        case 3242771:  return addItem(); 
14355        case -1148899500:  return addAddItem(); 
14356        case -231349275:  return addAdjudication(); 
14357        case 110549828:  return addTotal(); 
14358        case -786681338:  return getPayment();
14359        case 473181393:  return getFormCode();
14360        case 3148996:  return getForm();
14361        case 202339073:  return addProcessNote(); 
14362        case -407369416:  return getBenefitPeriod();
14363        case 596003397:  return addBenefitBalance(); 
14364        default: return super.makeProperty(hash, name);
14365        }
14366
14367      }
14368
14369      @Override
14370      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
14371        switch (hash) {
14372        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
14373        case -892481550: /*status*/ return new String[] {"code"};
14374        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
14375        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
14376        case 116103: /*use*/ return new String[] {"code"};
14377        case -791418107: /*patient*/ return new String[] {"Reference"};
14378        case -332066046: /*billablePeriod*/ return new String[] {"Period"};
14379        case 1028554472: /*created*/ return new String[] {"dateTime"};
14380        case -1591951995: /*enterer*/ return new String[] {"Reference"};
14381        case 1957615864: /*insurer*/ return new String[] {"Reference"};
14382        case -987494927: /*provider*/ return new String[] {"Reference"};
14383        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
14384        case -1688904576: /*fundsReserveRequested*/ return new String[] {"CodeableConcept"};
14385        case 1314609806: /*fundsReserve*/ return new String[] {"CodeableConcept"};
14386        case 1090493483: /*related*/ return new String[] {};
14387        case 460301338: /*prescription*/ return new String[] {"Reference"};
14388        case -1814015861: /*originalPrescription*/ return new String[] {"Reference"};
14389        case 106443592: /*payee*/ return new String[] {};
14390        case -722568291: /*referral*/ return new String[] {"Reference"};
14391        case 501116579: /*facility*/ return new String[] {"Reference"};
14392        case 94742588: /*claim*/ return new String[] {"Reference"};
14393        case 689513629: /*claimResponse*/ return new String[] {"Reference"};
14394        case -1106507950: /*outcome*/ return new String[] {"code"};
14395        case 583380919: /*disposition*/ return new String[] {"string"};
14396        case 522246568: /*preAuthRef*/ return new String[] {"string"};
14397        case -1262920311: /*preAuthRefPeriod*/ return new String[] {"Period"};
14398        case -7323378: /*careTeam*/ return new String[] {};
14399        case 1922406657: /*supportingInfo*/ return new String[] {};
14400        case 1196993265: /*diagnosis*/ return new String[] {};
14401        case -1095204141: /*procedure*/ return new String[] {};
14402        case 159695370: /*precedence*/ return new String[] {"positiveInt"};
14403        case 73049818: /*insurance*/ return new String[] {};
14404        case -2143202801: /*accident*/ return new String[] {};
14405        case 3242771: /*item*/ return new String[] {};
14406        case -1148899500: /*addItem*/ return new String[] {};
14407        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
14408        case 110549828: /*total*/ return new String[] {};
14409        case -786681338: /*payment*/ return new String[] {};
14410        case 473181393: /*formCode*/ return new String[] {"CodeableConcept"};
14411        case 3148996: /*form*/ return new String[] {"Attachment"};
14412        case 202339073: /*processNote*/ return new String[] {};
14413        case -407369416: /*benefitPeriod*/ return new String[] {"Period"};
14414        case 596003397: /*benefitBalance*/ return new String[] {};
14415        default: return super.getTypesForProperty(hash, name);
14416        }
14417
14418      }
14419
14420      @Override
14421      public Base addChild(String name) throws FHIRException {
14422        if (name.equals("identifier")) {
14423          return addIdentifier();
14424        }
14425        else if (name.equals("status")) {
14426          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.status");
14427        }
14428        else if (name.equals("type")) {
14429          this.type = new CodeableConcept();
14430          return this.type;
14431        }
14432        else if (name.equals("subType")) {
14433          this.subType = new CodeableConcept();
14434          return this.subType;
14435        }
14436        else if (name.equals("use")) {
14437          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.use");
14438        }
14439        else if (name.equals("patient")) {
14440          this.patient = new Reference();
14441          return this.patient;
14442        }
14443        else if (name.equals("billablePeriod")) {
14444          this.billablePeriod = new Period();
14445          return this.billablePeriod;
14446        }
14447        else if (name.equals("created")) {
14448          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.created");
14449        }
14450        else if (name.equals("enterer")) {
14451          this.enterer = new Reference();
14452          return this.enterer;
14453        }
14454        else if (name.equals("insurer")) {
14455          this.insurer = new Reference();
14456          return this.insurer;
14457        }
14458        else if (name.equals("provider")) {
14459          this.provider = new Reference();
14460          return this.provider;
14461        }
14462        else if (name.equals("priority")) {
14463          this.priority = new CodeableConcept();
14464          return this.priority;
14465        }
14466        else if (name.equals("fundsReserveRequested")) {
14467          this.fundsReserveRequested = new CodeableConcept();
14468          return this.fundsReserveRequested;
14469        }
14470        else if (name.equals("fundsReserve")) {
14471          this.fundsReserve = new CodeableConcept();
14472          return this.fundsReserve;
14473        }
14474        else if (name.equals("related")) {
14475          return addRelated();
14476        }
14477        else if (name.equals("prescription")) {
14478          this.prescription = new Reference();
14479          return this.prescription;
14480        }
14481        else if (name.equals("originalPrescription")) {
14482          this.originalPrescription = new Reference();
14483          return this.originalPrescription;
14484        }
14485        else if (name.equals("payee")) {
14486          this.payee = new PayeeComponent();
14487          return this.payee;
14488        }
14489        else if (name.equals("referral")) {
14490          this.referral = new Reference();
14491          return this.referral;
14492        }
14493        else if (name.equals("facility")) {
14494          this.facility = new Reference();
14495          return this.facility;
14496        }
14497        else if (name.equals("claim")) {
14498          this.claim = new Reference();
14499          return this.claim;
14500        }
14501        else if (name.equals("claimResponse")) {
14502          this.claimResponse = new Reference();
14503          return this.claimResponse;
14504        }
14505        else if (name.equals("outcome")) {
14506          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.outcome");
14507        }
14508        else if (name.equals("disposition")) {
14509          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.disposition");
14510        }
14511        else if (name.equals("preAuthRef")) {
14512          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
14513        }
14514        else if (name.equals("preAuthRefPeriod")) {
14515          return addPreAuthRefPeriod();
14516        }
14517        else if (name.equals("careTeam")) {
14518          return addCareTeam();
14519        }
14520        else if (name.equals("supportingInfo")) {
14521          return addSupportingInfo();
14522        }
14523        else if (name.equals("diagnosis")) {
14524          return addDiagnosis();
14525        }
14526        else if (name.equals("procedure")) {
14527          return addProcedure();
14528        }
14529        else if (name.equals("precedence")) {
14530          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.precedence");
14531        }
14532        else if (name.equals("insurance")) {
14533          return addInsurance();
14534        }
14535        else if (name.equals("accident")) {
14536          this.accident = new AccidentComponent();
14537          return this.accident;
14538        }
14539        else if (name.equals("item")) {
14540          return addItem();
14541        }
14542        else if (name.equals("addItem")) {
14543          return addAddItem();
14544        }
14545        else if (name.equals("adjudication")) {
14546          return addAdjudication();
14547        }
14548        else if (name.equals("total")) {
14549          return addTotal();
14550        }
14551        else if (name.equals("payment")) {
14552          this.payment = new PaymentComponent();
14553          return this.payment;
14554        }
14555        else if (name.equals("formCode")) {
14556          this.formCode = new CodeableConcept();
14557          return this.formCode;
14558        }
14559        else if (name.equals("form")) {
14560          this.form = new Attachment();
14561          return this.form;
14562        }
14563        else if (name.equals("processNote")) {
14564          return addProcessNote();
14565        }
14566        else if (name.equals("benefitPeriod")) {
14567          this.benefitPeriod = new Period();
14568          return this.benefitPeriod;
14569        }
14570        else if (name.equals("benefitBalance")) {
14571          return addBenefitBalance();
14572        }
14573        else
14574          return super.addChild(name);
14575      }
14576
14577  public String fhirType() {
14578    return "ExplanationOfBenefit";
14579
14580  }
14581
14582      public ExplanationOfBenefit copy() {
14583        ExplanationOfBenefit dst = new ExplanationOfBenefit();
14584        copyValues(dst);
14585        return dst;
14586      }
14587
14588      public void copyValues(ExplanationOfBenefit dst) {
14589        super.copyValues(dst);
14590        if (identifier != null) {
14591          dst.identifier = new ArrayList<Identifier>();
14592          for (Identifier i : identifier)
14593            dst.identifier.add(i.copy());
14594        };
14595        dst.status = status == null ? null : status.copy();
14596        dst.type = type == null ? null : type.copy();
14597        dst.subType = subType == null ? null : subType.copy();
14598        dst.use = use == null ? null : use.copy();
14599        dst.patient = patient == null ? null : patient.copy();
14600        dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
14601        dst.created = created == null ? null : created.copy();
14602        dst.enterer = enterer == null ? null : enterer.copy();
14603        dst.insurer = insurer == null ? null : insurer.copy();
14604        dst.provider = provider == null ? null : provider.copy();
14605        dst.priority = priority == null ? null : priority.copy();
14606        dst.fundsReserveRequested = fundsReserveRequested == null ? null : fundsReserveRequested.copy();
14607        dst.fundsReserve = fundsReserve == null ? null : fundsReserve.copy();
14608        if (related != null) {
14609          dst.related = new ArrayList<RelatedClaimComponent>();
14610          for (RelatedClaimComponent i : related)
14611            dst.related.add(i.copy());
14612        };
14613        dst.prescription = prescription == null ? null : prescription.copy();
14614        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
14615        dst.payee = payee == null ? null : payee.copy();
14616        dst.referral = referral == null ? null : referral.copy();
14617        dst.facility = facility == null ? null : facility.copy();
14618        dst.claim = claim == null ? null : claim.copy();
14619        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
14620        dst.outcome = outcome == null ? null : outcome.copy();
14621        dst.disposition = disposition == null ? null : disposition.copy();
14622        if (preAuthRef != null) {
14623          dst.preAuthRef = new ArrayList<StringType>();
14624          for (StringType i : preAuthRef)
14625            dst.preAuthRef.add(i.copy());
14626        };
14627        if (preAuthRefPeriod != null) {
14628          dst.preAuthRefPeriod = new ArrayList<Period>();
14629          for (Period i : preAuthRefPeriod)
14630            dst.preAuthRefPeriod.add(i.copy());
14631        };
14632        if (careTeam != null) {
14633          dst.careTeam = new ArrayList<CareTeamComponent>();
14634          for (CareTeamComponent i : careTeam)
14635            dst.careTeam.add(i.copy());
14636        };
14637        if (supportingInfo != null) {
14638          dst.supportingInfo = new ArrayList<SupportingInformationComponent>();
14639          for (SupportingInformationComponent i : supportingInfo)
14640            dst.supportingInfo.add(i.copy());
14641        };
14642        if (diagnosis != null) {
14643          dst.diagnosis = new ArrayList<DiagnosisComponent>();
14644          for (DiagnosisComponent i : diagnosis)
14645            dst.diagnosis.add(i.copy());
14646        };
14647        if (procedure != null) {
14648          dst.procedure = new ArrayList<ProcedureComponent>();
14649          for (ProcedureComponent i : procedure)
14650            dst.procedure.add(i.copy());
14651        };
14652        dst.precedence = precedence == null ? null : precedence.copy();
14653        if (insurance != null) {
14654          dst.insurance = new ArrayList<InsuranceComponent>();
14655          for (InsuranceComponent i : insurance)
14656            dst.insurance.add(i.copy());
14657        };
14658        dst.accident = accident == null ? null : accident.copy();
14659        if (item != null) {
14660          dst.item = new ArrayList<ItemComponent>();
14661          for (ItemComponent i : item)
14662            dst.item.add(i.copy());
14663        };
14664        if (addItem != null) {
14665          dst.addItem = new ArrayList<AddedItemComponent>();
14666          for (AddedItemComponent i : addItem)
14667            dst.addItem.add(i.copy());
14668        };
14669        if (adjudication != null) {
14670          dst.adjudication = new ArrayList<AdjudicationComponent>();
14671          for (AdjudicationComponent i : adjudication)
14672            dst.adjudication.add(i.copy());
14673        };
14674        if (total != null) {
14675          dst.total = new ArrayList<TotalComponent>();
14676          for (TotalComponent i : total)
14677            dst.total.add(i.copy());
14678        };
14679        dst.payment = payment == null ? null : payment.copy();
14680        dst.formCode = formCode == null ? null : formCode.copy();
14681        dst.form = form == null ? null : form.copy();
14682        if (processNote != null) {
14683          dst.processNote = new ArrayList<NoteComponent>();
14684          for (NoteComponent i : processNote)
14685            dst.processNote.add(i.copy());
14686        };
14687        dst.benefitPeriod = benefitPeriod == null ? null : benefitPeriod.copy();
14688        if (benefitBalance != null) {
14689          dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14690          for (BenefitBalanceComponent i : benefitBalance)
14691            dst.benefitBalance.add(i.copy());
14692        };
14693      }
14694
14695      protected ExplanationOfBenefit typedCopy() {
14696        return copy();
14697      }
14698
14699      @Override
14700      public boolean equalsDeep(Base other_) {
14701        if (!super.equalsDeep(other_))
14702          return false;
14703        if (!(other_ instanceof ExplanationOfBenefit))
14704          return false;
14705        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
14706        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
14707           && compareDeep(subType, o.subType, true) && compareDeep(use, o.use, true) && compareDeep(patient, o.patient, true)
14708           && compareDeep(billablePeriod, o.billablePeriod, true) && compareDeep(created, o.created, true)
14709           && compareDeep(enterer, o.enterer, true) && compareDeep(insurer, o.insurer, true) && compareDeep(provider, o.provider, true)
14710           && compareDeep(priority, o.priority, true) && compareDeep(fundsReserveRequested, o.fundsReserveRequested, true)
14711           && compareDeep(fundsReserve, o.fundsReserve, true) && compareDeep(related, o.related, true) && compareDeep(prescription, o.prescription, true)
14712           && compareDeep(originalPrescription, o.originalPrescription, true) && compareDeep(payee, o.payee, true)
14713           && compareDeep(referral, o.referral, true) && compareDeep(facility, o.facility, true) && compareDeep(claim, o.claim, true)
14714           && compareDeep(claimResponse, o.claimResponse, true) && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true)
14715           && compareDeep(preAuthRef, o.preAuthRef, true) && compareDeep(preAuthRefPeriod, o.preAuthRefPeriod, true)
14716           && compareDeep(careTeam, o.careTeam, true) && compareDeep(supportingInfo, o.supportingInfo, true)
14717           && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true) && compareDeep(precedence, o.precedence, true)
14718           && compareDeep(insurance, o.insurance, true) && compareDeep(accident, o.accident, true) && compareDeep(item, o.item, true)
14719           && compareDeep(addItem, o.addItem, true) && compareDeep(adjudication, o.adjudication, true) && compareDeep(total, o.total, true)
14720           && compareDeep(payment, o.payment, true) && compareDeep(formCode, o.formCode, true) && compareDeep(form, o.form, true)
14721           && compareDeep(processNote, o.processNote, true) && compareDeep(benefitPeriod, o.benefitPeriod, true)
14722           && compareDeep(benefitBalance, o.benefitBalance, true);
14723      }
14724
14725      @Override
14726      public boolean equalsShallow(Base other_) {
14727        if (!super.equalsShallow(other_))
14728          return false;
14729        if (!(other_ instanceof ExplanationOfBenefit))
14730          return false;
14731        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
14732        return compareValues(status, o.status, true) && compareValues(use, o.use, true) && compareValues(created, o.created, true)
14733           && compareValues(outcome, o.outcome, true) && compareValues(disposition, o.disposition, true) && compareValues(preAuthRef, o.preAuthRef, true)
14734           && compareValues(precedence, o.precedence, true);
14735      }
14736
14737      public boolean isEmpty() {
14738        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
14739          , subType, use, patient, billablePeriod, created, enterer, insurer, provider
14740          , priority, fundsReserveRequested, fundsReserve, related, prescription, originalPrescription
14741          , payee, referral, facility, claim, claimResponse, outcome, disposition, preAuthRef
14742          , preAuthRefPeriod, careTeam, supportingInfo, diagnosis, procedure, precedence, insurance
14743          , accident, item, addItem, adjudication, total, payment, formCode, form, processNote
14744          , benefitPeriod, benefitBalance);
14745      }
14746
14747  @Override
14748  public ResourceType getResourceType() {
14749    return ResourceType.ExplanationOfBenefit;
14750   }
14751
14752 /**
14753   * Search parameter: <b>care-team</b>
14754   * <p>
14755   * Description: <b>Member of the CareTeam</b><br>
14756   * Type: <b>reference</b><br>
14757   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
14758   * </p>
14759   */
14760  @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 } )
14761  public static final String SP_CARE_TEAM = "care-team";
14762 /**
14763   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
14764   * <p>
14765   * Description: <b>Member of the CareTeam</b><br>
14766   * Type: <b>reference</b><br>
14767   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
14768   * </p>
14769   */
14770  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_TEAM);
14771
14772/**
14773   * Constant for fluent queries to be used to add include statements. Specifies
14774   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
14775   */
14776  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:care-team").toLocked();
14777
14778 /**
14779   * Search parameter: <b>claim</b>
14780   * <p>
14781   * Description: <b>The reference to the claim</b><br>
14782   * Type: <b>reference</b><br>
14783   * Path: <b>ExplanationOfBenefit.claim</b><br>
14784   * </p>
14785   */
14786  @SearchParamDefinition(name="claim", path="ExplanationOfBenefit.claim", description="The reference to the claim", type="reference", target={Claim.class } )
14787  public static final String SP_CLAIM = "claim";
14788 /**
14789   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
14790   * <p>
14791   * Description: <b>The reference to the claim</b><br>
14792   * Type: <b>reference</b><br>
14793   * Path: <b>ExplanationOfBenefit.claim</b><br>
14794   * </p>
14795   */
14796  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CLAIM);
14797
14798/**
14799   * Constant for fluent queries to be used to add include statements. Specifies
14800   * the path value of "<b>ExplanationOfBenefit:claim</b>".
14801   */
14802  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:claim").toLocked();
14803
14804 /**
14805   * Search parameter: <b>coverage</b>
14806   * <p>
14807   * Description: <b>The plan under which the claim was adjudicated</b><br>
14808   * Type: <b>reference</b><br>
14809   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
14810   * </p>
14811   */
14812  @SearchParamDefinition(name="coverage", path="ExplanationOfBenefit.insurance.coverage", description="The plan under which the claim was adjudicated", type="reference", target={Coverage.class } )
14813  public static final String SP_COVERAGE = "coverage";
14814 /**
14815   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
14816   * <p>
14817   * Description: <b>The plan under which the claim was adjudicated</b><br>
14818   * Type: <b>reference</b><br>
14819   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
14820   * </p>
14821   */
14822  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COVERAGE);
14823
14824/**
14825   * Constant for fluent queries to be used to add include statements. Specifies
14826   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
14827   */
14828  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:coverage").toLocked();
14829
14830 /**
14831   * Search parameter: <b>created</b>
14832   * <p>
14833   * Description: <b>The creation date for the EOB</b><br>
14834   * Type: <b>date</b><br>
14835   * Path: <b>ExplanationOfBenefit.created</b><br>
14836   * </p>
14837   */
14838  @SearchParamDefinition(name="created", path="ExplanationOfBenefit.created", description="The creation date for the EOB", type="date" )
14839  public static final String SP_CREATED = "created";
14840 /**
14841   * <b>Fluent Client</b> search parameter constant for <b>created</b>
14842   * <p>
14843   * Description: <b>The creation date for the EOB</b><br>
14844   * Type: <b>date</b><br>
14845   * Path: <b>ExplanationOfBenefit.created</b><br>
14846   * </p>
14847   */
14848  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
14849
14850 /**
14851   * Search parameter: <b>detail-udi</b>
14852   * <p>
14853   * Description: <b>UDI associated with a line item detail product or service</b><br>
14854   * Type: <b>reference</b><br>
14855   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
14856   * </p>
14857   */
14858  @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 } )
14859  public static final String SP_DETAIL_UDI = "detail-udi";
14860 /**
14861   * <b>Fluent Client</b> search parameter constant for <b>detail-udi</b>
14862   * <p>
14863   * Description: <b>UDI associated with a line item detail product or service</b><br>
14864   * Type: <b>reference</b><br>
14865   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
14866   * </p>
14867   */
14868  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DETAIL_UDI);
14869
14870/**
14871   * Constant for fluent queries to be used to add include statements. Specifies
14872   * the path value of "<b>ExplanationOfBenefit:detail-udi</b>".
14873   */
14874  public static final ca.uhn.fhir.model.api.Include INCLUDE_DETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:detail-udi").toLocked();
14875
14876 /**
14877   * Search parameter: <b>disposition</b>
14878   * <p>
14879   * Description: <b>The contents of the disposition message</b><br>
14880   * Type: <b>string</b><br>
14881   * Path: <b>ExplanationOfBenefit.disposition</b><br>
14882   * </p>
14883   */
14884  @SearchParamDefinition(name="disposition", path="ExplanationOfBenefit.disposition", description="The contents of the disposition message", type="string" )
14885  public static final String SP_DISPOSITION = "disposition";
14886 /**
14887   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
14888   * <p>
14889   * Description: <b>The contents of the disposition message</b><br>
14890   * Type: <b>string</b><br>
14891   * Path: <b>ExplanationOfBenefit.disposition</b><br>
14892   * </p>
14893   */
14894  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
14895
14896 /**
14897   * Search parameter: <b>encounter</b>
14898   * <p>
14899   * Description: <b>Encounters associated with a billed line item</b><br>
14900   * Type: <b>reference</b><br>
14901   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
14902   * </p>
14903   */
14904  @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 } )
14905  public static final String SP_ENCOUNTER = "encounter";
14906 /**
14907   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
14908   * <p>
14909   * Description: <b>Encounters associated with a billed line item</b><br>
14910   * Type: <b>reference</b><br>
14911   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
14912   * </p>
14913   */
14914  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
14915
14916/**
14917   * Constant for fluent queries to be used to add include statements. Specifies
14918   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
14919   */
14920  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:encounter").toLocked();
14921
14922 /**
14923   * Search parameter: <b>enterer</b>
14924   * <p>
14925   * Description: <b>The party responsible for the entry of the Claim</b><br>
14926   * Type: <b>reference</b><br>
14927   * Path: <b>ExplanationOfBenefit.enterer</b><br>
14928   * </p>
14929   */
14930  @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={Practitioner.class, PractitionerRole.class } )
14931  public static final String SP_ENTERER = "enterer";
14932 /**
14933   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
14934   * <p>
14935   * Description: <b>The party responsible for the entry of the Claim</b><br>
14936   * Type: <b>reference</b><br>
14937   * Path: <b>ExplanationOfBenefit.enterer</b><br>
14938   * </p>
14939   */
14940  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
14941
14942/**
14943   * Constant for fluent queries to be used to add include statements. Specifies
14944   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
14945   */
14946  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:enterer").toLocked();
14947
14948 /**
14949   * Search parameter: <b>facility</b>
14950   * <p>
14951   * Description: <b>Facility responsible for the goods and services</b><br>
14952   * Type: <b>reference</b><br>
14953   * Path: <b>ExplanationOfBenefit.facility</b><br>
14954   * </p>
14955   */
14956  @SearchParamDefinition(name="facility", path="ExplanationOfBenefit.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class } )
14957  public static final String SP_FACILITY = "facility";
14958 /**
14959   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
14960   * <p>
14961   * Description: <b>Facility responsible for the goods and services</b><br>
14962   * Type: <b>reference</b><br>
14963   * Path: <b>ExplanationOfBenefit.facility</b><br>
14964   * </p>
14965   */
14966  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
14967
14968/**
14969   * Constant for fluent queries to be used to add include statements. Specifies
14970   * the path value of "<b>ExplanationOfBenefit:facility</b>".
14971   */
14972  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:facility").toLocked();
14973
14974 /**
14975   * Search parameter: <b>identifier</b>
14976   * <p>
14977   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
14978   * Type: <b>token</b><br>
14979   * Path: <b>ExplanationOfBenefit.identifier</b><br>
14980   * </p>
14981   */
14982  @SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
14983  public static final String SP_IDENTIFIER = "identifier";
14984 /**
14985   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
14986   * <p>
14987   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
14988   * Type: <b>token</b><br>
14989   * Path: <b>ExplanationOfBenefit.identifier</b><br>
14990   * </p>
14991   */
14992  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
14993
14994 /**
14995   * Search parameter: <b>item-udi</b>
14996   * <p>
14997   * Description: <b>UDI associated with a line item product or service</b><br>
14998   * Type: <b>reference</b><br>
14999   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
15000   * </p>
15001   */
15002  @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 } )
15003  public static final String SP_ITEM_UDI = "item-udi";
15004 /**
15005   * <b>Fluent Client</b> search parameter constant for <b>item-udi</b>
15006   * <p>
15007   * Description: <b>UDI associated with a line item product or service</b><br>
15008   * Type: <b>reference</b><br>
15009   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
15010   * </p>
15011   */
15012  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ITEM_UDI);
15013
15014/**
15015   * Constant for fluent queries to be used to add include statements. Specifies
15016   * the path value of "<b>ExplanationOfBenefit:item-udi</b>".
15017   */
15018  public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:item-udi").toLocked();
15019
15020 /**
15021   * Search parameter: <b>patient</b>
15022   * <p>
15023   * Description: <b>The reference to the patient</b><br>
15024   * Type: <b>reference</b><br>
15025   * Path: <b>ExplanationOfBenefit.patient</b><br>
15026   * </p>
15027   */
15028  @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 } )
15029  public static final String SP_PATIENT = "patient";
15030 /**
15031   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
15032   * <p>
15033   * Description: <b>The reference to the patient</b><br>
15034   * Type: <b>reference</b><br>
15035   * Path: <b>ExplanationOfBenefit.patient</b><br>
15036   * </p>
15037   */
15038  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
15039
15040/**
15041   * Constant for fluent queries to be used to add include statements. Specifies
15042   * the path value of "<b>ExplanationOfBenefit:patient</b>".
15043   */
15044  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:patient").toLocked();
15045
15046 /**
15047   * Search parameter: <b>payee</b>
15048   * <p>
15049   * Description: <b>The party receiving any payment for the Claim</b><br>
15050   * Type: <b>reference</b><br>
15051   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
15052   * </p>
15053   */
15054  @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 } )
15055  public static final String SP_PAYEE = "payee";
15056 /**
15057   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
15058   * <p>
15059   * Description: <b>The party receiving any payment for the Claim</b><br>
15060   * Type: <b>reference</b><br>
15061   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
15062   * </p>
15063   */
15064  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PAYEE);
15065
15066/**
15067   * Constant for fluent queries to be used to add include statements. Specifies
15068   * the path value of "<b>ExplanationOfBenefit:payee</b>".
15069   */
15070  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:payee").toLocked();
15071
15072 /**
15073   * Search parameter: <b>procedure-udi</b>
15074   * <p>
15075   * Description: <b>UDI associated with a procedure</b><br>
15076   * Type: <b>reference</b><br>
15077   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
15078   * </p>
15079   */
15080  @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 } )
15081  public static final String SP_PROCEDURE_UDI = "procedure-udi";
15082 /**
15083   * <b>Fluent Client</b> search parameter constant for <b>procedure-udi</b>
15084   * <p>
15085   * Description: <b>UDI associated with a procedure</b><br>
15086   * Type: <b>reference</b><br>
15087   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
15088   * </p>
15089   */
15090  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROCEDURE_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROCEDURE_UDI);
15091
15092/**
15093   * Constant for fluent queries to be used to add include statements. Specifies
15094   * the path value of "<b>ExplanationOfBenefit:procedure-udi</b>".
15095   */
15096  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROCEDURE_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:procedure-udi").toLocked();
15097
15098 /**
15099   * Search parameter: <b>provider</b>
15100   * <p>
15101   * Description: <b>The reference to the provider</b><br>
15102   * Type: <b>reference</b><br>
15103   * Path: <b>ExplanationOfBenefit.provider</b><br>
15104   * </p>
15105   */
15106  @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 } )
15107  public static final String SP_PROVIDER = "provider";
15108 /**
15109   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
15110   * <p>
15111   * Description: <b>The reference to the provider</b><br>
15112   * Type: <b>reference</b><br>
15113   * Path: <b>ExplanationOfBenefit.provider</b><br>
15114   * </p>
15115   */
15116  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
15117
15118/**
15119   * Constant for fluent queries to be used to add include statements. Specifies
15120   * the path value of "<b>ExplanationOfBenefit:provider</b>".
15121   */
15122  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:provider").toLocked();
15123
15124 /**
15125   * Search parameter: <b>status</b>
15126   * <p>
15127   * Description: <b>Status of the instance</b><br>
15128   * Type: <b>token</b><br>
15129   * Path: <b>ExplanationOfBenefit.status</b><br>
15130   * </p>
15131   */
15132  @SearchParamDefinition(name="status", path="ExplanationOfBenefit.status", description="Status of the instance", type="token" )
15133  public static final String SP_STATUS = "status";
15134 /**
15135   * <b>Fluent Client</b> search parameter constant for <b>status</b>
15136   * <p>
15137   * Description: <b>Status of the instance</b><br>
15138   * Type: <b>token</b><br>
15139   * Path: <b>ExplanationOfBenefit.status</b><br>
15140   * </p>
15141   */
15142  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
15143
15144 /**
15145   * Search parameter: <b>subdetail-udi</b>
15146   * <p>
15147   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
15148   * Type: <b>reference</b><br>
15149   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
15150   * </p>
15151   */
15152  @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 } )
15153  public static final String SP_SUBDETAIL_UDI = "subdetail-udi";
15154 /**
15155   * <b>Fluent Client</b> search parameter constant for <b>subdetail-udi</b>
15156   * <p>
15157   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
15158   * Type: <b>reference</b><br>
15159   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
15160   * </p>
15161   */
15162  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBDETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBDETAIL_UDI);
15163
15164/**
15165   * Constant for fluent queries to be used to add include statements. Specifies
15166   * the path value of "<b>ExplanationOfBenefit:subdetail-udi</b>".
15167   */
15168  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBDETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:subdetail-udi").toLocked();
15169
15170
15171}
15172