001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 28, 2021 07:16+1100 for FHIR v5.0.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.r5.model.Enumerations.*;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.exceptions.FHIRException;
042import org.hl7.fhir.instance.model.api.ICompositeType;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
046import ca.uhn.fhir.model.api.annotation.Child;
047import ca.uhn.fhir.model.api.annotation.ChildOrder;
048import ca.uhn.fhir.model.api.annotation.Description;
049import ca.uhn.fhir.model.api.annotation.Block;
050
051/**
052 * This resource provides: the claim details; adjudication details from the processing of a Claim; and optionally account balance information, for informing the subscriber of the benefits provided.
053 */
054@ResourceDef(name="ExplanationOfBenefit", profile="http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit")
055public class ExplanationOfBenefit extends DomainResource {
056
057    public enum ExplanationOfBenefitStatus {
058        /**
059         * The resource instance is currently in-force.
060         */
061        ACTIVE, 
062        /**
063         * The resource instance is withdrawn, rescinded or reversed.
064         */
065        CANCELLED, 
066        /**
067         * A new resource instance the contents of which is not complete.
068         */
069        DRAFT, 
070        /**
071         * The resource instance was entered in error.
072         */
073        ENTEREDINERROR, 
074        /**
075         * added to help the parsers with the generic types
076         */
077        NULL;
078        public static ExplanationOfBenefitStatus fromCode(String codeString) throws FHIRException {
079            if (codeString == null || "".equals(codeString))
080                return null;
081        if ("active".equals(codeString))
082          return ACTIVE;
083        if ("cancelled".equals(codeString))
084          return CANCELLED;
085        if ("draft".equals(codeString))
086          return DRAFT;
087        if ("entered-in-error".equals(codeString))
088          return ENTEREDINERROR;
089        if (Configuration.isAcceptInvalidEnums())
090          return null;
091        else
092          throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
093        }
094        public String toCode() {
095          switch (this) {
096            case ACTIVE: return "active";
097            case CANCELLED: return "cancelled";
098            case DRAFT: return "draft";
099            case ENTEREDINERROR: return "entered-in-error";
100            default: return "?";
101          }
102        }
103        public String getSystem() {
104          switch (this) {
105            case ACTIVE: return "http://hl7.org/fhir/explanationofbenefit-status";
106            case CANCELLED: return "http://hl7.org/fhir/explanationofbenefit-status";
107            case DRAFT: return "http://hl7.org/fhir/explanationofbenefit-status";
108            case ENTEREDINERROR: return "http://hl7.org/fhir/explanationofbenefit-status";
109            default: return "?";
110          }
111        }
112        public String getDefinition() {
113          switch (this) {
114            case ACTIVE: return "The resource instance is currently in-force.";
115            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
116            case DRAFT: return "A new resource instance the contents of which is not complete.";
117            case ENTEREDINERROR: return "The resource instance was entered in error.";
118            default: return "?";
119          }
120        }
121        public String getDisplay() {
122          switch (this) {
123            case ACTIVE: return "Active";
124            case CANCELLED: return "Cancelled";
125            case DRAFT: return "Draft";
126            case ENTEREDINERROR: return "Entered In Error";
127            default: return "?";
128          }
129        }
130    }
131
132  public static class ExplanationOfBenefitStatusEnumFactory implements EnumFactory<ExplanationOfBenefitStatus> {
133    public ExplanationOfBenefitStatus fromCode(String codeString) throws IllegalArgumentException {
134      if (codeString == null || "".equals(codeString))
135            if (codeString == null || "".equals(codeString))
136                return null;
137        if ("active".equals(codeString))
138          return ExplanationOfBenefitStatus.ACTIVE;
139        if ("cancelled".equals(codeString))
140          return ExplanationOfBenefitStatus.CANCELLED;
141        if ("draft".equals(codeString))
142          return ExplanationOfBenefitStatus.DRAFT;
143        if ("entered-in-error".equals(codeString))
144          return ExplanationOfBenefitStatus.ENTEREDINERROR;
145        throw new IllegalArgumentException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
146        }
147        public Enumeration<ExplanationOfBenefitStatus> fromType(Base code) throws FHIRException {
148          if (code == null)
149            return null;
150          if (code.isEmpty())
151            return new Enumeration<ExplanationOfBenefitStatus>(this);
152          String codeString = ((PrimitiveType) code).asStringValue();
153          if (codeString == null || "".equals(codeString))
154            return null;
155        if ("active".equals(codeString))
156          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ACTIVE);
157        if ("cancelled".equals(codeString))
158          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.CANCELLED);
159        if ("draft".equals(codeString))
160          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.DRAFT);
161        if ("entered-in-error".equals(codeString))
162          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ENTEREDINERROR);
163        throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
164        }
165    public String toCode(ExplanationOfBenefitStatus code) {
166      if (code == ExplanationOfBenefitStatus.ACTIVE)
167        return "active";
168      if (code == ExplanationOfBenefitStatus.CANCELLED)
169        return "cancelled";
170      if (code == ExplanationOfBenefitStatus.DRAFT)
171        return "draft";
172      if (code == ExplanationOfBenefitStatus.ENTEREDINERROR)
173        return "entered-in-error";
174      return "?";
175      }
176    public String toSystem(ExplanationOfBenefitStatus code) {
177      return code.getSystem();
178      }
179    }
180
181    @Block()
182    public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
183        /**
184         * Reference to a related claim.
185         */
186        @Child(name = "claim", type = {Claim.class}, order=1, min=0, max=1, modifier=false, summary=false)
187        @Description(shortDefinition="Reference to the related claim", formalDefinition="Reference to a related claim." )
188        protected Reference claim;
189
190        /**
191         * A code to convey how the claims are related.
192         */
193        @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
194        @Description(shortDefinition="How the reference claim is related", formalDefinition="A code to convey how the claims are related." )
195        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-claim-relationship")
196        protected CodeableConcept relationship;
197
198        /**
199         * An alternate organizational reference to the case or file to which this particular claim pertains.
200         */
201        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=false)
202        @Description(shortDefinition="File or case reference", formalDefinition="An alternate organizational reference to the case or file to which this particular claim pertains." )
203        protected Identifier reference;
204
205        private static final long serialVersionUID = 1047077926L;
206
207    /**
208     * Constructor
209     */
210      public RelatedClaimComponent() {
211        super();
212      }
213
214        /**
215         * @return {@link #claim} (Reference to a related claim.)
216         */
217        public Reference getClaim() { 
218          if (this.claim == null)
219            if (Configuration.errorOnAutoCreate())
220              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
221            else if (Configuration.doAutoCreate())
222              this.claim = new Reference(); // cc
223          return this.claim;
224        }
225
226        public boolean hasClaim() { 
227          return this.claim != null && !this.claim.isEmpty();
228        }
229
230        /**
231         * @param value {@link #claim} (Reference to a related claim.)
232         */
233        public RelatedClaimComponent setClaim(Reference value) { 
234          this.claim = value;
235          return this;
236        }
237
238        /**
239         * @return {@link #relationship} (A code to convey how the claims are related.)
240         */
241        public CodeableConcept getRelationship() { 
242          if (this.relationship == null)
243            if (Configuration.errorOnAutoCreate())
244              throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
245            else if (Configuration.doAutoCreate())
246              this.relationship = new CodeableConcept(); // cc
247          return this.relationship;
248        }
249
250        public boolean hasRelationship() { 
251          return this.relationship != null && !this.relationship.isEmpty();
252        }
253
254        /**
255         * @param value {@link #relationship} (A code to convey how the claims are related.)
256         */
257        public RelatedClaimComponent setRelationship(CodeableConcept value) { 
258          this.relationship = value;
259          return this;
260        }
261
262        /**
263         * @return {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
264         */
265        public Identifier getReference() { 
266          if (this.reference == null)
267            if (Configuration.errorOnAutoCreate())
268              throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
269            else if (Configuration.doAutoCreate())
270              this.reference = new Identifier(); // cc
271          return this.reference;
272        }
273
274        public boolean hasReference() { 
275          return this.reference != null && !this.reference.isEmpty();
276        }
277
278        /**
279         * @param value {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
280         */
281        public RelatedClaimComponent setReference(Identifier value) { 
282          this.reference = value;
283          return this;
284        }
285
286        protected void listChildren(List<Property> children) {
287          super.listChildren(children);
288          children.add(new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim));
289          children.add(new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship));
290          children.add(new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1, reference));
291        }
292
293        @Override
294        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
295          switch (_hash) {
296          case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim);
297          case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship);
298          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);
299          default: return super.getNamedProperty(_hash, _name, _checkValid);
300          }
301
302        }
303
304      @Override
305      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
306        switch (hash) {
307        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
308        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
309        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
310        default: return super.getProperty(hash, name, checkValid);
311        }
312
313      }
314
315      @Override
316      public Base setProperty(int hash, String name, Base value) throws FHIRException {
317        switch (hash) {
318        case 94742588: // claim
319          this.claim = TypeConvertor.castToReference(value); // Reference
320          return value;
321        case -261851592: // relationship
322          this.relationship = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
323          return value;
324        case -925155509: // reference
325          this.reference = TypeConvertor.castToIdentifier(value); // Identifier
326          return value;
327        default: return super.setProperty(hash, name, value);
328        }
329
330      }
331
332      @Override
333      public Base setProperty(String name, Base value) throws FHIRException {
334        if (name.equals("claim")) {
335          this.claim = TypeConvertor.castToReference(value); // Reference
336        } else if (name.equals("relationship")) {
337          this.relationship = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
338        } else if (name.equals("reference")) {
339          this.reference = TypeConvertor.castToIdentifier(value); // Identifier
340        } else
341          return super.setProperty(name, value);
342        return value;
343      }
344
345      @Override
346      public Base makeProperty(int hash, String name) throws FHIRException {
347        switch (hash) {
348        case 94742588:  return getClaim();
349        case -261851592:  return getRelationship();
350        case -925155509:  return getReference();
351        default: return super.makeProperty(hash, name);
352        }
353
354      }
355
356      @Override
357      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
358        switch (hash) {
359        case 94742588: /*claim*/ return new String[] {"Reference"};
360        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
361        case -925155509: /*reference*/ return new String[] {"Identifier"};
362        default: return super.getTypesForProperty(hash, name);
363        }
364
365      }
366
367      @Override
368      public Base addChild(String name) throws FHIRException {
369        if (name.equals("claim")) {
370          this.claim = new Reference();
371          return this.claim;
372        }
373        else if (name.equals("relationship")) {
374          this.relationship = new CodeableConcept();
375          return this.relationship;
376        }
377        else if (name.equals("reference")) {
378          this.reference = new Identifier();
379          return this.reference;
380        }
381        else
382          return super.addChild(name);
383      }
384
385      public RelatedClaimComponent copy() {
386        RelatedClaimComponent dst = new RelatedClaimComponent();
387        copyValues(dst);
388        return dst;
389      }
390
391      public void copyValues(RelatedClaimComponent dst) {
392        super.copyValues(dst);
393        dst.claim = claim == null ? null : claim.copy();
394        dst.relationship = relationship == null ? null : relationship.copy();
395        dst.reference = reference == null ? null : reference.copy();
396      }
397
398      @Override
399      public boolean equalsDeep(Base other_) {
400        if (!super.equalsDeep(other_))
401          return false;
402        if (!(other_ instanceof RelatedClaimComponent))
403          return false;
404        RelatedClaimComponent o = (RelatedClaimComponent) other_;
405        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
406          ;
407      }
408
409      @Override
410      public boolean equalsShallow(Base other_) {
411        if (!super.equalsShallow(other_))
412          return false;
413        if (!(other_ instanceof RelatedClaimComponent))
414          return false;
415        RelatedClaimComponent o = (RelatedClaimComponent) other_;
416        return true;
417      }
418
419      public boolean isEmpty() {
420        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference
421          );
422      }
423
424  public String fhirType() {
425    return "ExplanationOfBenefit.related";
426
427  }
428
429  }
430
431    @Block()
432    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
433        /**
434         * Type of Party to be reimbursed: Subscriber, provider, other.
435         */
436        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
437        @Description(shortDefinition="Category of recipient", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
438        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payeetype")
439        protected CodeableConcept type;
440
441        /**
442         * Reference to the individual or organization to whom any payment will be made.
443         */
444        @Child(name = "party", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, RelatedPerson.class}, order=2, min=0, max=1, modifier=false, summary=false)
445        @Description(shortDefinition="Recipient reference", formalDefinition="Reference to the individual or organization to whom any payment will be made." )
446        protected Reference party;
447
448        private static final long serialVersionUID = -1948897146L;
449
450    /**
451     * Constructor
452     */
453      public PayeeComponent() {
454        super();
455      }
456
457        /**
458         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
459         */
460        public CodeableConcept getType() { 
461          if (this.type == null)
462            if (Configuration.errorOnAutoCreate())
463              throw new Error("Attempt to auto-create PayeeComponent.type");
464            else if (Configuration.doAutoCreate())
465              this.type = new CodeableConcept(); // cc
466          return this.type;
467        }
468
469        public boolean hasType() { 
470          return this.type != null && !this.type.isEmpty();
471        }
472
473        /**
474         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
475         */
476        public PayeeComponent setType(CodeableConcept value) { 
477          this.type = value;
478          return this;
479        }
480
481        /**
482         * @return {@link #party} (Reference to the individual or organization to whom any payment will be made.)
483         */
484        public Reference getParty() { 
485          if (this.party == null)
486            if (Configuration.errorOnAutoCreate())
487              throw new Error("Attempt to auto-create PayeeComponent.party");
488            else if (Configuration.doAutoCreate())
489              this.party = new Reference(); // cc
490          return this.party;
491        }
492
493        public boolean hasParty() { 
494          return this.party != null && !this.party.isEmpty();
495        }
496
497        /**
498         * @param value {@link #party} (Reference to the individual or organization to whom any payment will be made.)
499         */
500        public PayeeComponent setParty(Reference value) { 
501          this.party = value;
502          return this;
503        }
504
505        protected void listChildren(List<Property> children) {
506          super.listChildren(children);
507          children.add(new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
508          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));
509        }
510
511        @Override
512        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
513          switch (_hash) {
514          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
515          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);
516          default: return super.getNamedProperty(_hash, _name, _checkValid);
517          }
518
519        }
520
521      @Override
522      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
523        switch (hash) {
524        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
525        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
526        default: return super.getProperty(hash, name, checkValid);
527        }
528
529      }
530
531      @Override
532      public Base setProperty(int hash, String name, Base value) throws FHIRException {
533        switch (hash) {
534        case 3575610: // type
535          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
536          return value;
537        case 106437350: // party
538          this.party = TypeConvertor.castToReference(value); // Reference
539          return value;
540        default: return super.setProperty(hash, name, value);
541        }
542
543      }
544
545      @Override
546      public Base setProperty(String name, Base value) throws FHIRException {
547        if (name.equals("type")) {
548          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
549        } else if (name.equals("party")) {
550          this.party = TypeConvertor.castToReference(value); // Reference
551        } else
552          return super.setProperty(name, value);
553        return value;
554      }
555
556      @Override
557      public Base makeProperty(int hash, String name) throws FHIRException {
558        switch (hash) {
559        case 3575610:  return getType();
560        case 106437350:  return getParty();
561        default: return super.makeProperty(hash, name);
562        }
563
564      }
565
566      @Override
567      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
568        switch (hash) {
569        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
570        case 106437350: /*party*/ return new String[] {"Reference"};
571        default: return super.getTypesForProperty(hash, name);
572        }
573
574      }
575
576      @Override
577      public Base addChild(String name) throws FHIRException {
578        if (name.equals("type")) {
579          this.type = new CodeableConcept();
580          return this.type;
581        }
582        else if (name.equals("party")) {
583          this.party = new Reference();
584          return this.party;
585        }
586        else
587          return super.addChild(name);
588      }
589
590      public PayeeComponent copy() {
591        PayeeComponent dst = new PayeeComponent();
592        copyValues(dst);
593        return dst;
594      }
595
596      public void copyValues(PayeeComponent dst) {
597        super.copyValues(dst);
598        dst.type = type == null ? null : type.copy();
599        dst.party = party == null ? null : party.copy();
600      }
601
602      @Override
603      public boolean equalsDeep(Base other_) {
604        if (!super.equalsDeep(other_))
605          return false;
606        if (!(other_ instanceof PayeeComponent))
607          return false;
608        PayeeComponent o = (PayeeComponent) other_;
609        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true);
610      }
611
612      @Override
613      public boolean equalsShallow(Base other_) {
614        if (!super.equalsShallow(other_))
615          return false;
616        if (!(other_ instanceof PayeeComponent))
617          return false;
618        PayeeComponent o = (PayeeComponent) other_;
619        return true;
620      }
621
622      public boolean isEmpty() {
623        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party);
624      }
625
626  public String fhirType() {
627    return "ExplanationOfBenefit.payee";
628
629  }
630
631  }
632
633    @Block()
634    public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
635        /**
636         * A number to uniquely identify care team entries.
637         */
638        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
639        @Description(shortDefinition="Order of care team", formalDefinition="A number to uniquely identify care team entries." )
640        protected PositiveIntType sequence;
641
642        /**
643         * Member of the team who provided the product or service.
644         */
645        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=false)
646        @Description(shortDefinition="Practitioner or organization", formalDefinition="Member of the team who provided the product or service." )
647        protected Reference provider;
648
649        /**
650         * The party who is billing and/or responsible for the claimed products or services.
651         */
652        @Child(name = "responsible", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
653        @Description(shortDefinition="Indicator of the lead practitioner", formalDefinition="The party who is billing and/or responsible for the claimed products or services." )
654        protected BooleanType responsible;
655
656        /**
657         * The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.
658         */
659        @Child(name = "role", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
660        @Description(shortDefinition="Function within the team", formalDefinition="The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team." )
661        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-careteamrole")
662        protected CodeableConcept role;
663
664        /**
665         * The qualification of the practitioner which is applicable for this service.
666         */
667        @Child(name = "qualification", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
668        @Description(shortDefinition="Practitioner credential or specialization", formalDefinition="The qualification of the practitioner which is applicable for this service." )
669        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provider-qualification")
670        protected CodeableConcept qualification;
671
672        private static final long serialVersionUID = 1479624238L;
673
674    /**
675     * Constructor
676     */
677      public CareTeamComponent() {
678        super();
679      }
680
681    /**
682     * Constructor
683     */
684      public CareTeamComponent(int sequence, Reference provider) {
685        super();
686        this.setSequence(sequence);
687        this.setProvider(provider);
688      }
689
690        /**
691         * @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
692         */
693        public PositiveIntType getSequenceElement() { 
694          if (this.sequence == null)
695            if (Configuration.errorOnAutoCreate())
696              throw new Error("Attempt to auto-create CareTeamComponent.sequence");
697            else if (Configuration.doAutoCreate())
698              this.sequence = new PositiveIntType(); // bb
699          return this.sequence;
700        }
701
702        public boolean hasSequenceElement() { 
703          return this.sequence != null && !this.sequence.isEmpty();
704        }
705
706        public boolean hasSequence() { 
707          return this.sequence != null && !this.sequence.isEmpty();
708        }
709
710        /**
711         * @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
712         */
713        public CareTeamComponent setSequenceElement(PositiveIntType value) { 
714          this.sequence = value;
715          return this;
716        }
717
718        /**
719         * @return A number to uniquely identify care team entries.
720         */
721        public int getSequence() { 
722          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
723        }
724
725        /**
726         * @param value A number to uniquely identify care team entries.
727         */
728        public CareTeamComponent setSequence(int value) { 
729            if (this.sequence == null)
730              this.sequence = new PositiveIntType();
731            this.sequence.setValue(value);
732          return this;
733        }
734
735        /**
736         * @return {@link #provider} (Member of the team who provided the product or service.)
737         */
738        public Reference getProvider() { 
739          if (this.provider == null)
740            if (Configuration.errorOnAutoCreate())
741              throw new Error("Attempt to auto-create CareTeamComponent.provider");
742            else if (Configuration.doAutoCreate())
743              this.provider = new Reference(); // cc
744          return this.provider;
745        }
746
747        public boolean hasProvider() { 
748          return this.provider != null && !this.provider.isEmpty();
749        }
750
751        /**
752         * @param value {@link #provider} (Member of the team who provided the product or service.)
753         */
754        public CareTeamComponent setProvider(Reference value) { 
755          this.provider = value;
756          return this;
757        }
758
759        /**
760         * @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
761         */
762        public BooleanType getResponsibleElement() { 
763          if (this.responsible == null)
764            if (Configuration.errorOnAutoCreate())
765              throw new Error("Attempt to auto-create CareTeamComponent.responsible");
766            else if (Configuration.doAutoCreate())
767              this.responsible = new BooleanType(); // bb
768          return this.responsible;
769        }
770
771        public boolean hasResponsibleElement() { 
772          return this.responsible != null && !this.responsible.isEmpty();
773        }
774
775        public boolean hasResponsible() { 
776          return this.responsible != null && !this.responsible.isEmpty();
777        }
778
779        /**
780         * @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
781         */
782        public CareTeamComponent setResponsibleElement(BooleanType value) { 
783          this.responsible = value;
784          return this;
785        }
786
787        /**
788         * @return The party who is billing and/or responsible for the claimed products or services.
789         */
790        public boolean getResponsible() { 
791          return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
792        }
793
794        /**
795         * @param value The party who is billing and/or responsible for the claimed products or services.
796         */
797        public CareTeamComponent setResponsible(boolean value) { 
798            if (this.responsible == null)
799              this.responsible = new BooleanType();
800            this.responsible.setValue(value);
801          return this;
802        }
803
804        /**
805         * @return {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
806         */
807        public CodeableConcept getRole() { 
808          if (this.role == null)
809            if (Configuration.errorOnAutoCreate())
810              throw new Error("Attempt to auto-create CareTeamComponent.role");
811            else if (Configuration.doAutoCreate())
812              this.role = new CodeableConcept(); // cc
813          return this.role;
814        }
815
816        public boolean hasRole() { 
817          return this.role != null && !this.role.isEmpty();
818        }
819
820        /**
821         * @param value {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
822         */
823        public CareTeamComponent setRole(CodeableConcept value) { 
824          this.role = value;
825          return this;
826        }
827
828        /**
829         * @return {@link #qualification} (The qualification of the practitioner which is applicable for this service.)
830         */
831        public CodeableConcept getQualification() { 
832          if (this.qualification == null)
833            if (Configuration.errorOnAutoCreate())
834              throw new Error("Attempt to auto-create CareTeamComponent.qualification");
835            else if (Configuration.doAutoCreate())
836              this.qualification = new CodeableConcept(); // cc
837          return this.qualification;
838        }
839
840        public boolean hasQualification() { 
841          return this.qualification != null && !this.qualification.isEmpty();
842        }
843
844        /**
845         * @param value {@link #qualification} (The qualification of the practitioner which is applicable for this service.)
846         */
847        public CareTeamComponent setQualification(CodeableConcept value) { 
848          this.qualification = value;
849          return this;
850        }
851
852        protected void listChildren(List<Property> children) {
853          super.listChildren(children);
854          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence));
855          children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider));
856          children.add(new Property("responsible", "boolean", "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible));
857          children.add(new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role));
858          children.add(new Property("qualification", "CodeableConcept", "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification));
859        }
860
861        @Override
862        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
863          switch (_hash) {
864          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence);
865          case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider);
866          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);
867          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role);
868          case -631333393: /*qualification*/  return new Property("qualification", "CodeableConcept", "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification);
869          default: return super.getNamedProperty(_hash, _name, _checkValid);
870          }
871
872        }
873
874      @Override
875      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
876        switch (hash) {
877        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
878        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
879        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // BooleanType
880        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
881        case -631333393: /*qualification*/ return this.qualification == null ? new Base[0] : new Base[] {this.qualification}; // CodeableConcept
882        default: return super.getProperty(hash, name, checkValid);
883        }
884
885      }
886
887      @Override
888      public Base setProperty(int hash, String name, Base value) throws FHIRException {
889        switch (hash) {
890        case 1349547969: // sequence
891          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
892          return value;
893        case -987494927: // provider
894          this.provider = TypeConvertor.castToReference(value); // Reference
895          return value;
896        case 1847674614: // responsible
897          this.responsible = TypeConvertor.castToBoolean(value); // BooleanType
898          return value;
899        case 3506294: // role
900          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
901          return value;
902        case -631333393: // qualification
903          this.qualification = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
904          return value;
905        default: return super.setProperty(hash, name, value);
906        }
907
908      }
909
910      @Override
911      public Base setProperty(String name, Base value) throws FHIRException {
912        if (name.equals("sequence")) {
913          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
914        } else if (name.equals("provider")) {
915          this.provider = TypeConvertor.castToReference(value); // Reference
916        } else if (name.equals("responsible")) {
917          this.responsible = TypeConvertor.castToBoolean(value); // BooleanType
918        } else if (name.equals("role")) {
919          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
920        } else if (name.equals("qualification")) {
921          this.qualification = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
922        } else
923          return super.setProperty(name, value);
924        return value;
925      }
926
927      @Override
928      public Base makeProperty(int hash, String name) throws FHIRException {
929        switch (hash) {
930        case 1349547969:  return getSequenceElement();
931        case -987494927:  return getProvider();
932        case 1847674614:  return getResponsibleElement();
933        case 3506294:  return getRole();
934        case -631333393:  return getQualification();
935        default: return super.makeProperty(hash, name);
936        }
937
938      }
939
940      @Override
941      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
942        switch (hash) {
943        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
944        case -987494927: /*provider*/ return new String[] {"Reference"};
945        case 1847674614: /*responsible*/ return new String[] {"boolean"};
946        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
947        case -631333393: /*qualification*/ return new String[] {"CodeableConcept"};
948        default: return super.getTypesForProperty(hash, name);
949        }
950
951      }
952
953      @Override
954      public Base addChild(String name) throws FHIRException {
955        if (name.equals("sequence")) {
956          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeam.sequence");
957        }
958        else if (name.equals("provider")) {
959          this.provider = new Reference();
960          return this.provider;
961        }
962        else if (name.equals("responsible")) {
963          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeam.responsible");
964        }
965        else if (name.equals("role")) {
966          this.role = new CodeableConcept();
967          return this.role;
968        }
969        else if (name.equals("qualification")) {
970          this.qualification = new CodeableConcept();
971          return this.qualification;
972        }
973        else
974          return super.addChild(name);
975      }
976
977      public CareTeamComponent copy() {
978        CareTeamComponent dst = new CareTeamComponent();
979        copyValues(dst);
980        return dst;
981      }
982
983      public void copyValues(CareTeamComponent dst) {
984        super.copyValues(dst);
985        dst.sequence = sequence == null ? null : sequence.copy();
986        dst.provider = provider == null ? null : provider.copy();
987        dst.responsible = responsible == null ? null : responsible.copy();
988        dst.role = role == null ? null : role.copy();
989        dst.qualification = qualification == null ? null : qualification.copy();
990      }
991
992      @Override
993      public boolean equalsDeep(Base other_) {
994        if (!super.equalsDeep(other_))
995          return false;
996        if (!(other_ instanceof CareTeamComponent))
997          return false;
998        CareTeamComponent o = (CareTeamComponent) other_;
999        return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true) && compareDeep(responsible, o.responsible, true)
1000           && compareDeep(role, o.role, true) && compareDeep(qualification, o.qualification, true);
1001      }
1002
1003      @Override
1004      public boolean equalsShallow(Base other_) {
1005        if (!super.equalsShallow(other_))
1006          return false;
1007        if (!(other_ instanceof CareTeamComponent))
1008          return false;
1009        CareTeamComponent o = (CareTeamComponent) other_;
1010        return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true)
1011          ;
1012      }
1013
1014      public boolean isEmpty() {
1015        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible
1016          , role, qualification);
1017      }
1018
1019  public String fhirType() {
1020    return "ExplanationOfBenefit.careTeam";
1021
1022  }
1023
1024  }
1025
1026    @Block()
1027    public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
1028        /**
1029         * A number to uniquely identify supporting information entries.
1030         */
1031        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1032        @Description(shortDefinition="Information instance identifier", formalDefinition="A number to uniquely identify supporting information entries." )
1033        protected PositiveIntType sequence;
1034
1035        /**
1036         * The general class of the information supplied: information; exception; accident, employment; onset, etc.
1037         */
1038        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
1039        @Description(shortDefinition="Classification of the supplied information", formalDefinition="The general class of the information supplied: information; exception; accident, employment; onset, etc." )
1040        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-informationcategory")
1041        protected CodeableConcept category;
1042
1043        /**
1044         * System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.
1045         */
1046        @Child(name = "code", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1047        @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." )
1048        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-exception")
1049        protected CodeableConcept code;
1050
1051        /**
1052         * The date when or period to which this information refers.
1053         */
1054        @Child(name = "timing", type = {DateType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
1055        @Description(shortDefinition="When it occurred", formalDefinition="The date when or period to which this information refers." )
1056        protected DataType timing;
1057
1058        /**
1059         * Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.
1060         */
1061        @Child(name = "value", type = {BooleanType.class, StringType.class, Quantity.class, Attachment.class, Reference.class}, order=5, min=0, max=1, modifier=false, summary=false)
1062        @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." )
1063        protected DataType value;
1064
1065        /**
1066         * Provides the reason in the situation where a reason code is required in addition to the content.
1067         */
1068        @Child(name = "reason", type = {Coding.class}, order=6, min=0, max=1, modifier=false, summary=false)
1069        @Description(shortDefinition="Explanation for the information", formalDefinition="Provides the reason in the situation where a reason code is required in addition to the content." )
1070        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/missing-tooth-reason")
1071        protected Coding reason;
1072
1073        private static final long serialVersionUID = 1577205655L;
1074
1075    /**
1076     * Constructor
1077     */
1078      public SupportingInformationComponent() {
1079        super();
1080      }
1081
1082    /**
1083     * Constructor
1084     */
1085      public SupportingInformationComponent(int sequence, CodeableConcept category) {
1086        super();
1087        this.setSequence(sequence);
1088        this.setCategory(category);
1089      }
1090
1091        /**
1092         * @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
1093         */
1094        public PositiveIntType getSequenceElement() { 
1095          if (this.sequence == null)
1096            if (Configuration.errorOnAutoCreate())
1097              throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
1098            else if (Configuration.doAutoCreate())
1099              this.sequence = new PositiveIntType(); // bb
1100          return this.sequence;
1101        }
1102
1103        public boolean hasSequenceElement() { 
1104          return this.sequence != null && !this.sequence.isEmpty();
1105        }
1106
1107        public boolean hasSequence() { 
1108          return this.sequence != null && !this.sequence.isEmpty();
1109        }
1110
1111        /**
1112         * @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
1113         */
1114        public SupportingInformationComponent setSequenceElement(PositiveIntType value) { 
1115          this.sequence = value;
1116          return this;
1117        }
1118
1119        /**
1120         * @return A number to uniquely identify supporting information entries.
1121         */
1122        public int getSequence() { 
1123          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1124        }
1125
1126        /**
1127         * @param value A number to uniquely identify supporting information entries.
1128         */
1129        public SupportingInformationComponent setSequence(int value) { 
1130            if (this.sequence == null)
1131              this.sequence = new PositiveIntType();
1132            this.sequence.setValue(value);
1133          return this;
1134        }
1135
1136        /**
1137         * @return {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1138         */
1139        public CodeableConcept getCategory() { 
1140          if (this.category == null)
1141            if (Configuration.errorOnAutoCreate())
1142              throw new Error("Attempt to auto-create SupportingInformationComponent.category");
1143            else if (Configuration.doAutoCreate())
1144              this.category = new CodeableConcept(); // cc
1145          return this.category;
1146        }
1147
1148        public boolean hasCategory() { 
1149          return this.category != null && !this.category.isEmpty();
1150        }
1151
1152        /**
1153         * @param value {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1154         */
1155        public SupportingInformationComponent setCategory(CodeableConcept value) { 
1156          this.category = value;
1157          return this;
1158        }
1159
1160        /**
1161         * @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.)
1162         */
1163        public CodeableConcept getCode() { 
1164          if (this.code == null)
1165            if (Configuration.errorOnAutoCreate())
1166              throw new Error("Attempt to auto-create SupportingInformationComponent.code");
1167            else if (Configuration.doAutoCreate())
1168              this.code = new CodeableConcept(); // cc
1169          return this.code;
1170        }
1171
1172        public boolean hasCode() { 
1173          return this.code != null && !this.code.isEmpty();
1174        }
1175
1176        /**
1177         * @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.)
1178         */
1179        public SupportingInformationComponent setCode(CodeableConcept value) { 
1180          this.code = value;
1181          return this;
1182        }
1183
1184        /**
1185         * @return {@link #timing} (The date when or period to which this information refers.)
1186         */
1187        public DataType getTiming() { 
1188          return this.timing;
1189        }
1190
1191        /**
1192         * @return {@link #timing} (The date when or period to which this information refers.)
1193         */
1194        public DateType getTimingDateType() throws FHIRException { 
1195          if (this.timing == null)
1196            this.timing = new DateType();
1197          if (!(this.timing instanceof DateType))
1198            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.timing.getClass().getName()+" was encountered");
1199          return (DateType) this.timing;
1200        }
1201
1202        public boolean hasTimingDateType() { 
1203          return this != null && this.timing instanceof DateType;
1204        }
1205
1206        /**
1207         * @return {@link #timing} (The date when or period to which this information refers.)
1208         */
1209        public Period getTimingPeriod() throws FHIRException { 
1210          if (this.timing == null)
1211            this.timing = new Period();
1212          if (!(this.timing instanceof Period))
1213            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
1214          return (Period) this.timing;
1215        }
1216
1217        public boolean hasTimingPeriod() { 
1218          return this != null && this.timing instanceof Period;
1219        }
1220
1221        public boolean hasTiming() { 
1222          return this.timing != null && !this.timing.isEmpty();
1223        }
1224
1225        /**
1226         * @param value {@link #timing} (The date when or period to which this information refers.)
1227         */
1228        public SupportingInformationComponent setTiming(DataType value) { 
1229          if (value != null && !(value instanceof DateType || value instanceof Period))
1230            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.timing[x]: "+value.fhirType());
1231          this.timing = value;
1232          return this;
1233        }
1234
1235        /**
1236         * @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.)
1237         */
1238        public DataType getValue() { 
1239          return this.value;
1240        }
1241
1242        /**
1243         * @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.)
1244         */
1245        public BooleanType getValueBooleanType() throws FHIRException { 
1246          if (this.value == null)
1247            this.value = new BooleanType();
1248          if (!(this.value instanceof BooleanType))
1249            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
1250          return (BooleanType) this.value;
1251        }
1252
1253        public boolean hasValueBooleanType() { 
1254          return this != null && this.value instanceof BooleanType;
1255        }
1256
1257        /**
1258         * @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.)
1259         */
1260        public StringType getValueStringType() throws FHIRException { 
1261          if (this.value == null)
1262            this.value = new StringType();
1263          if (!(this.value instanceof StringType))
1264            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
1265          return (StringType) this.value;
1266        }
1267
1268        public boolean hasValueStringType() { 
1269          return this != null && this.value instanceof StringType;
1270        }
1271
1272        /**
1273         * @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.)
1274         */
1275        public Quantity getValueQuantity() throws FHIRException { 
1276          if (this.value == null)
1277            this.value = new Quantity();
1278          if (!(this.value instanceof Quantity))
1279            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
1280          return (Quantity) this.value;
1281        }
1282
1283        public boolean hasValueQuantity() { 
1284          return this != null && this.value instanceof Quantity;
1285        }
1286
1287        /**
1288         * @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.)
1289         */
1290        public Attachment getValueAttachment() throws FHIRException { 
1291          if (this.value == null)
1292            this.value = new Attachment();
1293          if (!(this.value instanceof Attachment))
1294            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
1295          return (Attachment) this.value;
1296        }
1297
1298        public boolean hasValueAttachment() { 
1299          return this != null && this.value instanceof Attachment;
1300        }
1301
1302        /**
1303         * @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.)
1304         */
1305        public Reference getValueReference() throws FHIRException { 
1306          if (this.value == null)
1307            this.value = new Reference();
1308          if (!(this.value instanceof Reference))
1309            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
1310          return (Reference) this.value;
1311        }
1312
1313        public boolean hasValueReference() { 
1314          return this != null && this.value instanceof Reference;
1315        }
1316
1317        public boolean hasValue() { 
1318          return this.value != null && !this.value.isEmpty();
1319        }
1320
1321        /**
1322         * @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.)
1323         */
1324        public SupportingInformationComponent setValue(DataType value) { 
1325          if (value != null && !(value instanceof BooleanType || value instanceof StringType || value instanceof Quantity || value instanceof Attachment || value instanceof Reference))
1326            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.value[x]: "+value.fhirType());
1327          this.value = value;
1328          return this;
1329        }
1330
1331        /**
1332         * @return {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1333         */
1334        public Coding getReason() { 
1335          if (this.reason == null)
1336            if (Configuration.errorOnAutoCreate())
1337              throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1338            else if (Configuration.doAutoCreate())
1339              this.reason = new Coding(); // cc
1340          return this.reason;
1341        }
1342
1343        public boolean hasReason() { 
1344          return this.reason != null && !this.reason.isEmpty();
1345        }
1346
1347        /**
1348         * @param value {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1349         */
1350        public SupportingInformationComponent setReason(Coding value) { 
1351          this.reason = value;
1352          return this;
1353        }
1354
1355        protected void listChildren(List<Property> children) {
1356          super.listChildren(children);
1357          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence));
1358          children.add(new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category));
1359          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));
1360          children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing));
1361          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));
1362          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));
1363        }
1364
1365        @Override
1366        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1367          switch (_hash) {
1368          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence);
1369          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category);
1370          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);
1371          case 164632566: /*timing[x]*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1372          case -873664438: /*timing*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1373          case 807935768: /*timingDate*/  return new Property("timing[x]", "date", "The date when or period to which this information refers.", 0, 1, timing);
1374          case -615615829: /*timingPeriod*/  return new Property("timing[x]", "Period", "The date when or period to which this information refers.", 0, 1, timing);
1375          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);
1376          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);
1377          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);
1378          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);
1379          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);
1380          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);
1381          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);
1382          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);
1383          default: return super.getNamedProperty(_hash, _name, _checkValid);
1384          }
1385
1386        }
1387
1388      @Override
1389      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1390        switch (hash) {
1391        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1392        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1393        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1394        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // DataType
1395        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
1396        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
1397        default: return super.getProperty(hash, name, checkValid);
1398        }
1399
1400      }
1401
1402      @Override
1403      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1404        switch (hash) {
1405        case 1349547969: // sequence
1406          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1407          return value;
1408        case 50511102: // category
1409          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1410          return value;
1411        case 3059181: // code
1412          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1413          return value;
1414        case -873664438: // timing
1415          this.timing = TypeConvertor.castToType(value); // DataType
1416          return value;
1417        case 111972721: // value
1418          this.value = TypeConvertor.castToType(value); // DataType
1419          return value;
1420        case -934964668: // reason
1421          this.reason = TypeConvertor.castToCoding(value); // Coding
1422          return value;
1423        default: return super.setProperty(hash, name, value);
1424        }
1425
1426      }
1427
1428      @Override
1429      public Base setProperty(String name, Base value) throws FHIRException {
1430        if (name.equals("sequence")) {
1431          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1432        } else if (name.equals("category")) {
1433          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1434        } else if (name.equals("code")) {
1435          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1436        } else if (name.equals("timing[x]")) {
1437          this.timing = TypeConvertor.castToType(value); // DataType
1438        } else if (name.equals("value[x]")) {
1439          this.value = TypeConvertor.castToType(value); // DataType
1440        } else if (name.equals("reason")) {
1441          this.reason = TypeConvertor.castToCoding(value); // Coding
1442        } else
1443          return super.setProperty(name, value);
1444        return value;
1445      }
1446
1447      @Override
1448      public Base makeProperty(int hash, String name) throws FHIRException {
1449        switch (hash) {
1450        case 1349547969:  return getSequenceElement();
1451        case 50511102:  return getCategory();
1452        case 3059181:  return getCode();
1453        case 164632566:  return getTiming();
1454        case -873664438:  return getTiming();
1455        case -1410166417:  return getValue();
1456        case 111972721:  return getValue();
1457        case -934964668:  return getReason();
1458        default: return super.makeProperty(hash, name);
1459        }
1460
1461      }
1462
1463      @Override
1464      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1465        switch (hash) {
1466        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1467        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1468        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1469        case -873664438: /*timing*/ return new String[] {"date", "Period"};
1470        case 111972721: /*value*/ return new String[] {"boolean", "string", "Quantity", "Attachment", "Reference"};
1471        case -934964668: /*reason*/ return new String[] {"Coding"};
1472        default: return super.getTypesForProperty(hash, name);
1473        }
1474
1475      }
1476
1477      @Override
1478      public Base addChild(String name) throws FHIRException {
1479        if (name.equals("sequence")) {
1480          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.supportingInfo.sequence");
1481        }
1482        else if (name.equals("category")) {
1483          this.category = new CodeableConcept();
1484          return this.category;
1485        }
1486        else if (name.equals("code")) {
1487          this.code = new CodeableConcept();
1488          return this.code;
1489        }
1490        else if (name.equals("timingDate")) {
1491          this.timing = new DateType();
1492          return this.timing;
1493        }
1494        else if (name.equals("timingPeriod")) {
1495          this.timing = new Period();
1496          return this.timing;
1497        }
1498        else if (name.equals("valueBoolean")) {
1499          this.value = new BooleanType();
1500          return this.value;
1501        }
1502        else if (name.equals("valueString")) {
1503          this.value = new StringType();
1504          return this.value;
1505        }
1506        else if (name.equals("valueQuantity")) {
1507          this.value = new Quantity();
1508          return this.value;
1509        }
1510        else if (name.equals("valueAttachment")) {
1511          this.value = new Attachment();
1512          return this.value;
1513        }
1514        else if (name.equals("valueReference")) {
1515          this.value = new Reference();
1516          return this.value;
1517        }
1518        else if (name.equals("reason")) {
1519          this.reason = new Coding();
1520          return this.reason;
1521        }
1522        else
1523          return super.addChild(name);
1524      }
1525
1526      public SupportingInformationComponent copy() {
1527        SupportingInformationComponent dst = new SupportingInformationComponent();
1528        copyValues(dst);
1529        return dst;
1530      }
1531
1532      public void copyValues(SupportingInformationComponent dst) {
1533        super.copyValues(dst);
1534        dst.sequence = sequence == null ? null : sequence.copy();
1535        dst.category = category == null ? null : category.copy();
1536        dst.code = code == null ? null : code.copy();
1537        dst.timing = timing == null ? null : timing.copy();
1538        dst.value = value == null ? null : value.copy();
1539        dst.reason = reason == null ? null : reason.copy();
1540      }
1541
1542      @Override
1543      public boolean equalsDeep(Base other_) {
1544        if (!super.equalsDeep(other_))
1545          return false;
1546        if (!(other_ instanceof SupportingInformationComponent))
1547          return false;
1548        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1549        return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true) && compareDeep(code, o.code, true)
1550           && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true) && compareDeep(reason, o.reason, true)
1551          ;
1552      }
1553
1554      @Override
1555      public boolean equalsShallow(Base other_) {
1556        if (!super.equalsShallow(other_))
1557          return false;
1558        if (!(other_ instanceof SupportingInformationComponent))
1559          return false;
1560        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1561        return compareValues(sequence, o.sequence, true);
1562      }
1563
1564      public boolean isEmpty() {
1565        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code
1566          , timing, value, reason);
1567      }
1568
1569  public String fhirType() {
1570    return "ExplanationOfBenefit.supportingInfo";
1571
1572  }
1573
1574  }
1575
1576    @Block()
1577    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1578        /**
1579         * A number to uniquely identify diagnosis entries.
1580         */
1581        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1582        @Description(shortDefinition="Diagnosis instance identifier", formalDefinition="A number to uniquely identify diagnosis entries." )
1583        protected PositiveIntType sequence;
1584
1585        /**
1586         * The nature of illness or problem in a coded form or as a reference to an external defined Condition.
1587         */
1588        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=2, min=1, max=1, modifier=false, summary=false)
1589        @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." )
1590        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
1591        protected DataType diagnosis;
1592
1593        /**
1594         * When the condition was observed or the relative ranking.
1595         */
1596        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1597        @Description(shortDefinition="Timing or nature of the diagnosis", formalDefinition="When the condition was observed or the relative ranking." )
1598        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosistype")
1599        protected List<CodeableConcept> type;
1600
1601        /**
1602         * Indication of whether the diagnosis was present on admission to a facility.
1603         */
1604        @Child(name = "onAdmission", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1605        @Description(shortDefinition="Present on admission", formalDefinition="Indication of whether the diagnosis was present on admission to a facility." )
1606        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission")
1607        protected CodeableConcept onAdmission;
1608
1609        /**
1610         * 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.
1611         */
1612        @Child(name = "packageCode", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1613        @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." )
1614        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
1615        protected CodeableConcept packageCode;
1616
1617        private static final long serialVersionUID = 550515328L;
1618
1619    /**
1620     * Constructor
1621     */
1622      public DiagnosisComponent() {
1623        super();
1624      }
1625
1626    /**
1627     * Constructor
1628     */
1629      public DiagnosisComponent(int sequence, DataType diagnosis) {
1630        super();
1631        this.setSequence(sequence);
1632        this.setDiagnosis(diagnosis);
1633      }
1634
1635        /**
1636         * @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
1637         */
1638        public PositiveIntType getSequenceElement() { 
1639          if (this.sequence == null)
1640            if (Configuration.errorOnAutoCreate())
1641              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
1642            else if (Configuration.doAutoCreate())
1643              this.sequence = new PositiveIntType(); // bb
1644          return this.sequence;
1645        }
1646
1647        public boolean hasSequenceElement() { 
1648          return this.sequence != null && !this.sequence.isEmpty();
1649        }
1650
1651        public boolean hasSequence() { 
1652          return this.sequence != null && !this.sequence.isEmpty();
1653        }
1654
1655        /**
1656         * @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
1657         */
1658        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
1659          this.sequence = value;
1660          return this;
1661        }
1662
1663        /**
1664         * @return A number to uniquely identify diagnosis entries.
1665         */
1666        public int getSequence() { 
1667          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1668        }
1669
1670        /**
1671         * @param value A number to uniquely identify diagnosis entries.
1672         */
1673        public DiagnosisComponent setSequence(int value) { 
1674            if (this.sequence == null)
1675              this.sequence = new PositiveIntType();
1676            this.sequence.setValue(value);
1677          return this;
1678        }
1679
1680        /**
1681         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1682         */
1683        public DataType getDiagnosis() { 
1684          return this.diagnosis;
1685        }
1686
1687        /**
1688         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1689         */
1690        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
1691          if (this.diagnosis == null)
1692            this.diagnosis = new CodeableConcept();
1693          if (!(this.diagnosis instanceof CodeableConcept))
1694            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1695          return (CodeableConcept) this.diagnosis;
1696        }
1697
1698        public boolean hasDiagnosisCodeableConcept() { 
1699          return this != null && this.diagnosis instanceof CodeableConcept;
1700        }
1701
1702        /**
1703         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1704         */
1705        public Reference getDiagnosisReference() throws FHIRException { 
1706          if (this.diagnosis == null)
1707            this.diagnosis = new Reference();
1708          if (!(this.diagnosis instanceof Reference))
1709            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1710          return (Reference) this.diagnosis;
1711        }
1712
1713        public boolean hasDiagnosisReference() { 
1714          return this != null && this.diagnosis instanceof Reference;
1715        }
1716
1717        public boolean hasDiagnosis() { 
1718          return this.diagnosis != null && !this.diagnosis.isEmpty();
1719        }
1720
1721        /**
1722         * @param value {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1723         */
1724        public DiagnosisComponent setDiagnosis(DataType value) { 
1725          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1726            throw new Error("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: "+value.fhirType());
1727          this.diagnosis = value;
1728          return this;
1729        }
1730
1731        /**
1732         * @return {@link #type} (When the condition was observed or the relative ranking.)
1733         */
1734        public List<CodeableConcept> getType() { 
1735          if (this.type == null)
1736            this.type = new ArrayList<CodeableConcept>();
1737          return this.type;
1738        }
1739
1740        /**
1741         * @return Returns a reference to <code>this</code> for easy method chaining
1742         */
1743        public DiagnosisComponent setType(List<CodeableConcept> theType) { 
1744          this.type = theType;
1745          return this;
1746        }
1747
1748        public boolean hasType() { 
1749          if (this.type == null)
1750            return false;
1751          for (CodeableConcept item : this.type)
1752            if (!item.isEmpty())
1753              return true;
1754          return false;
1755        }
1756
1757        public CodeableConcept addType() { //3
1758          CodeableConcept t = new CodeableConcept();
1759          if (this.type == null)
1760            this.type = new ArrayList<CodeableConcept>();
1761          this.type.add(t);
1762          return t;
1763        }
1764
1765        public DiagnosisComponent addType(CodeableConcept t) { //3
1766          if (t == null)
1767            return this;
1768          if (this.type == null)
1769            this.type = new ArrayList<CodeableConcept>();
1770          this.type.add(t);
1771          return this;
1772        }
1773
1774        /**
1775         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
1776         */
1777        public CodeableConcept getTypeFirstRep() { 
1778          if (getType().isEmpty()) {
1779            addType();
1780          }
1781          return getType().get(0);
1782        }
1783
1784        /**
1785         * @return {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
1786         */
1787        public CodeableConcept getOnAdmission() { 
1788          if (this.onAdmission == null)
1789            if (Configuration.errorOnAutoCreate())
1790              throw new Error("Attempt to auto-create DiagnosisComponent.onAdmission");
1791            else if (Configuration.doAutoCreate())
1792              this.onAdmission = new CodeableConcept(); // cc
1793          return this.onAdmission;
1794        }
1795
1796        public boolean hasOnAdmission() { 
1797          return this.onAdmission != null && !this.onAdmission.isEmpty();
1798        }
1799
1800        /**
1801         * @param value {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
1802         */
1803        public DiagnosisComponent setOnAdmission(CodeableConcept value) { 
1804          this.onAdmission = value;
1805          return this;
1806        }
1807
1808        /**
1809         * @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.)
1810         */
1811        public CodeableConcept getPackageCode() { 
1812          if (this.packageCode == null)
1813            if (Configuration.errorOnAutoCreate())
1814              throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
1815            else if (Configuration.doAutoCreate())
1816              this.packageCode = new CodeableConcept(); // cc
1817          return this.packageCode;
1818        }
1819
1820        public boolean hasPackageCode() { 
1821          return this.packageCode != null && !this.packageCode.isEmpty();
1822        }
1823
1824        /**
1825         * @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.)
1826         */
1827        public DiagnosisComponent setPackageCode(CodeableConcept value) { 
1828          this.packageCode = value;
1829          return this;
1830        }
1831
1832        protected void listChildren(List<Property> children) {
1833          super.listChildren(children);
1834          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence));
1835          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));
1836          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
1837          children.add(new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission));
1838          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));
1839        }
1840
1841        @Override
1842        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1843          switch (_hash) {
1844          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence);
1845          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);
1846          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);
1847          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);
1848          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);
1849          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
1850          case -3386134: /*onAdmission*/  return new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission);
1851          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);
1852          default: return super.getNamedProperty(_hash, _name, _checkValid);
1853          }
1854
1855        }
1856
1857      @Override
1858      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1859        switch (hash) {
1860        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1861        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // DataType
1862        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
1863        case -3386134: /*onAdmission*/ return this.onAdmission == null ? new Base[0] : new Base[] {this.onAdmission}; // CodeableConcept
1864        case 908444499: /*packageCode*/ return this.packageCode == null ? new Base[0] : new Base[] {this.packageCode}; // CodeableConcept
1865        default: return super.getProperty(hash, name, checkValid);
1866        }
1867
1868      }
1869
1870      @Override
1871      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1872        switch (hash) {
1873        case 1349547969: // sequence
1874          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1875          return value;
1876        case 1196993265: // diagnosis
1877          this.diagnosis = TypeConvertor.castToType(value); // DataType
1878          return value;
1879        case 3575610: // type
1880          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1881          return value;
1882        case -3386134: // onAdmission
1883          this.onAdmission = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1884          return value;
1885        case 908444499: // packageCode
1886          this.packageCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1887          return value;
1888        default: return super.setProperty(hash, name, value);
1889        }
1890
1891      }
1892
1893      @Override
1894      public Base setProperty(String name, Base value) throws FHIRException {
1895        if (name.equals("sequence")) {
1896          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1897        } else if (name.equals("diagnosis[x]")) {
1898          this.diagnosis = TypeConvertor.castToType(value); // DataType
1899        } else if (name.equals("type")) {
1900          this.getType().add(TypeConvertor.castToCodeableConcept(value));
1901        } else if (name.equals("onAdmission")) {
1902          this.onAdmission = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1903        } else if (name.equals("packageCode")) {
1904          this.packageCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1905        } else
1906          return super.setProperty(name, value);
1907        return value;
1908      }
1909
1910      @Override
1911      public Base makeProperty(int hash, String name) throws FHIRException {
1912        switch (hash) {
1913        case 1349547969:  return getSequenceElement();
1914        case -1487009809:  return getDiagnosis();
1915        case 1196993265:  return getDiagnosis();
1916        case 3575610:  return addType(); 
1917        case -3386134:  return getOnAdmission();
1918        case 908444499:  return getPackageCode();
1919        default: return super.makeProperty(hash, name);
1920        }
1921
1922      }
1923
1924      @Override
1925      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1926        switch (hash) {
1927        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1928        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
1929        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1930        case -3386134: /*onAdmission*/ return new String[] {"CodeableConcept"};
1931        case 908444499: /*packageCode*/ return new String[] {"CodeableConcept"};
1932        default: return super.getTypesForProperty(hash, name);
1933        }
1934
1935      }
1936
1937      @Override
1938      public Base addChild(String name) throws FHIRException {
1939        if (name.equals("sequence")) {
1940          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.diagnosis.sequence");
1941        }
1942        else if (name.equals("diagnosisCodeableConcept")) {
1943          this.diagnosis = new CodeableConcept();
1944          return this.diagnosis;
1945        }
1946        else if (name.equals("diagnosisReference")) {
1947          this.diagnosis = new Reference();
1948          return this.diagnosis;
1949        }
1950        else if (name.equals("type")) {
1951          return addType();
1952        }
1953        else if (name.equals("onAdmission")) {
1954          this.onAdmission = new CodeableConcept();
1955          return this.onAdmission;
1956        }
1957        else if (name.equals("packageCode")) {
1958          this.packageCode = new CodeableConcept();
1959          return this.packageCode;
1960        }
1961        else
1962          return super.addChild(name);
1963      }
1964
1965      public DiagnosisComponent copy() {
1966        DiagnosisComponent dst = new DiagnosisComponent();
1967        copyValues(dst);
1968        return dst;
1969      }
1970
1971      public void copyValues(DiagnosisComponent dst) {
1972        super.copyValues(dst);
1973        dst.sequence = sequence == null ? null : sequence.copy();
1974        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
1975        if (type != null) {
1976          dst.type = new ArrayList<CodeableConcept>();
1977          for (CodeableConcept i : type)
1978            dst.type.add(i.copy());
1979        };
1980        dst.onAdmission = onAdmission == null ? null : onAdmission.copy();
1981        dst.packageCode = packageCode == null ? null : packageCode.copy();
1982      }
1983
1984      @Override
1985      public boolean equalsDeep(Base other_) {
1986        if (!super.equalsDeep(other_))
1987          return false;
1988        if (!(other_ instanceof DiagnosisComponent))
1989          return false;
1990        DiagnosisComponent o = (DiagnosisComponent) other_;
1991        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(type, o.type, true)
1992           && compareDeep(onAdmission, o.onAdmission, true) && compareDeep(packageCode, o.packageCode, true)
1993          ;
1994      }
1995
1996      @Override
1997      public boolean equalsShallow(Base other_) {
1998        if (!super.equalsShallow(other_))
1999          return false;
2000        if (!(other_ instanceof DiagnosisComponent))
2001          return false;
2002        DiagnosisComponent o = (DiagnosisComponent) other_;
2003        return compareValues(sequence, o.sequence, true);
2004      }
2005
2006      public boolean isEmpty() {
2007        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type
2008          , onAdmission, packageCode);
2009      }
2010
2011  public String fhirType() {
2012    return "ExplanationOfBenefit.diagnosis";
2013
2014  }
2015
2016  }
2017
2018    @Block()
2019    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2020        /**
2021         * A number to uniquely identify procedure entries.
2022         */
2023        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2024        @Description(shortDefinition="Procedure instance identifier", formalDefinition="A number to uniquely identify procedure entries." )
2025        protected PositiveIntType sequence;
2026
2027        /**
2028         * When the condition was observed or the relative ranking.
2029         */
2030        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2031        @Description(shortDefinition="Category of Procedure", formalDefinition="When the condition was observed or the relative ranking." )
2032        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-procedure-type")
2033        protected List<CodeableConcept> type;
2034
2035        /**
2036         * Date and optionally time the procedure was performed.
2037         */
2038        @Child(name = "date", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2039        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed." )
2040        protected DateTimeType date;
2041
2042        /**
2043         * The code or reference to a Procedure resource which identifies the clinical intervention performed.
2044         */
2045        @Child(name = "procedure", type = {CodeableConcept.class, Procedure.class}, order=4, min=1, max=1, modifier=false, summary=false)
2046        @Description(shortDefinition="Specific clinical procedure", formalDefinition="The code or reference to a Procedure resource which identifies the clinical intervention performed." )
2047        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10-procedures")
2048        protected DataType procedure;
2049
2050        /**
2051         * Unique Device Identifiers associated with this line item.
2052         */
2053        @Child(name = "udi", type = {Device.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2054        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
2055        protected List<Reference> udi;
2056
2057        private static final long serialVersionUID = 1165684715L;
2058
2059    /**
2060     * Constructor
2061     */
2062      public ProcedureComponent() {
2063        super();
2064      }
2065
2066    /**
2067     * Constructor
2068     */
2069      public ProcedureComponent(int sequence, DataType procedure) {
2070        super();
2071        this.setSequence(sequence);
2072        this.setProcedure(procedure);
2073      }
2074
2075        /**
2076         * @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
2077         */
2078        public PositiveIntType getSequenceElement() { 
2079          if (this.sequence == null)
2080            if (Configuration.errorOnAutoCreate())
2081              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2082            else if (Configuration.doAutoCreate())
2083              this.sequence = new PositiveIntType(); // bb
2084          return this.sequence;
2085        }
2086
2087        public boolean hasSequenceElement() { 
2088          return this.sequence != null && !this.sequence.isEmpty();
2089        }
2090
2091        public boolean hasSequence() { 
2092          return this.sequence != null && !this.sequence.isEmpty();
2093        }
2094
2095        /**
2096         * @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
2097         */
2098        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
2099          this.sequence = value;
2100          return this;
2101        }
2102
2103        /**
2104         * @return A number to uniquely identify procedure entries.
2105         */
2106        public int getSequence() { 
2107          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2108        }
2109
2110        /**
2111         * @param value A number to uniquely identify procedure entries.
2112         */
2113        public ProcedureComponent setSequence(int value) { 
2114            if (this.sequence == null)
2115              this.sequence = new PositiveIntType();
2116            this.sequence.setValue(value);
2117          return this;
2118        }
2119
2120        /**
2121         * @return {@link #type} (When the condition was observed or the relative ranking.)
2122         */
2123        public List<CodeableConcept> getType() { 
2124          if (this.type == null)
2125            this.type = new ArrayList<CodeableConcept>();
2126          return this.type;
2127        }
2128
2129        /**
2130         * @return Returns a reference to <code>this</code> for easy method chaining
2131         */
2132        public ProcedureComponent setType(List<CodeableConcept> theType) { 
2133          this.type = theType;
2134          return this;
2135        }
2136
2137        public boolean hasType() { 
2138          if (this.type == null)
2139            return false;
2140          for (CodeableConcept item : this.type)
2141            if (!item.isEmpty())
2142              return true;
2143          return false;
2144        }
2145
2146        public CodeableConcept addType() { //3
2147          CodeableConcept t = new CodeableConcept();
2148          if (this.type == null)
2149            this.type = new ArrayList<CodeableConcept>();
2150          this.type.add(t);
2151          return t;
2152        }
2153
2154        public ProcedureComponent addType(CodeableConcept t) { //3
2155          if (t == null)
2156            return this;
2157          if (this.type == null)
2158            this.type = new ArrayList<CodeableConcept>();
2159          this.type.add(t);
2160          return this;
2161        }
2162
2163        /**
2164         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
2165         */
2166        public CodeableConcept getTypeFirstRep() { 
2167          if (getType().isEmpty()) {
2168            addType();
2169          }
2170          return getType().get(0);
2171        }
2172
2173        /**
2174         * @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
2175         */
2176        public DateTimeType getDateElement() { 
2177          if (this.date == null)
2178            if (Configuration.errorOnAutoCreate())
2179              throw new Error("Attempt to auto-create ProcedureComponent.date");
2180            else if (Configuration.doAutoCreate())
2181              this.date = new DateTimeType(); // bb
2182          return this.date;
2183        }
2184
2185        public boolean hasDateElement() { 
2186          return this.date != null && !this.date.isEmpty();
2187        }
2188
2189        public boolean hasDate() { 
2190          return this.date != null && !this.date.isEmpty();
2191        }
2192
2193        /**
2194         * @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
2195         */
2196        public ProcedureComponent setDateElement(DateTimeType value) { 
2197          this.date = value;
2198          return this;
2199        }
2200
2201        /**
2202         * @return Date and optionally time the procedure was performed.
2203         */
2204        public Date getDate() { 
2205          return this.date == null ? null : this.date.getValue();
2206        }
2207
2208        /**
2209         * @param value Date and optionally time the procedure was performed.
2210         */
2211        public ProcedureComponent setDate(Date value) { 
2212          if (value == null)
2213            this.date = null;
2214          else {
2215            if (this.date == null)
2216              this.date = new DateTimeType();
2217            this.date.setValue(value);
2218          }
2219          return this;
2220        }
2221
2222        /**
2223         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2224         */
2225        public DataType getProcedure() { 
2226          return this.procedure;
2227        }
2228
2229        /**
2230         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2231         */
2232        public CodeableConcept getProcedureCodeableConcept() throws FHIRException { 
2233          if (this.procedure == null)
2234            this.procedure = new CodeableConcept();
2235          if (!(this.procedure instanceof CodeableConcept))
2236            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.procedure.getClass().getName()+" was encountered");
2237          return (CodeableConcept) this.procedure;
2238        }
2239
2240        public boolean hasProcedureCodeableConcept() { 
2241          return this != null && this.procedure instanceof CodeableConcept;
2242        }
2243
2244        /**
2245         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2246         */
2247        public Reference getProcedureReference() throws FHIRException { 
2248          if (this.procedure == null)
2249            this.procedure = new Reference();
2250          if (!(this.procedure instanceof Reference))
2251            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
2252          return (Reference) this.procedure;
2253        }
2254
2255        public boolean hasProcedureReference() { 
2256          return this != null && this.procedure instanceof Reference;
2257        }
2258
2259        public boolean hasProcedure() { 
2260          return this.procedure != null && !this.procedure.isEmpty();
2261        }
2262
2263        /**
2264         * @param value {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2265         */
2266        public ProcedureComponent setProcedure(DataType value) { 
2267          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2268            throw new Error("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: "+value.fhirType());
2269          this.procedure = value;
2270          return this;
2271        }
2272
2273        /**
2274         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
2275         */
2276        public List<Reference> getUdi() { 
2277          if (this.udi == null)
2278            this.udi = new ArrayList<Reference>();
2279          return this.udi;
2280        }
2281
2282        /**
2283         * @return Returns a reference to <code>this</code> for easy method chaining
2284         */
2285        public ProcedureComponent setUdi(List<Reference> theUdi) { 
2286          this.udi = theUdi;
2287          return this;
2288        }
2289
2290        public boolean hasUdi() { 
2291          if (this.udi == null)
2292            return false;
2293          for (Reference item : this.udi)
2294            if (!item.isEmpty())
2295              return true;
2296          return false;
2297        }
2298
2299        public Reference addUdi() { //3
2300          Reference t = new Reference();
2301          if (this.udi == null)
2302            this.udi = new ArrayList<Reference>();
2303          this.udi.add(t);
2304          return t;
2305        }
2306
2307        public ProcedureComponent addUdi(Reference t) { //3
2308          if (t == null)
2309            return this;
2310          if (this.udi == null)
2311            this.udi = new ArrayList<Reference>();
2312          this.udi.add(t);
2313          return this;
2314        }
2315
2316        /**
2317         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
2318         */
2319        public Reference getUdiFirstRep() { 
2320          if (getUdi().isEmpty()) {
2321            addUdi();
2322          }
2323          return getUdi().get(0);
2324        }
2325
2326        protected void listChildren(List<Property> children) {
2327          super.listChildren(children);
2328          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence));
2329          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
2330          children.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date));
2331          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));
2332          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
2333        }
2334
2335        @Override
2336        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2337          switch (_hash) {
2338          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence);
2339          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2340          case 3076014: /*date*/  return new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date);
2341          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);
2342          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);
2343          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);
2344          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);
2345          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
2346          default: return super.getNamedProperty(_hash, _name, _checkValid);
2347          }
2348
2349        }
2350
2351      @Override
2352      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2353        switch (hash) {
2354        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2355        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2356        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2357        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // DataType
2358        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
2359        default: return super.getProperty(hash, name, checkValid);
2360        }
2361
2362      }
2363
2364      @Override
2365      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2366        switch (hash) {
2367        case 1349547969: // sequence
2368          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
2369          return value;
2370        case 3575610: // type
2371          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2372          return value;
2373        case 3076014: // date
2374          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
2375          return value;
2376        case -1095204141: // procedure
2377          this.procedure = TypeConvertor.castToType(value); // DataType
2378          return value;
2379        case 115642: // udi
2380          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
2381          return value;
2382        default: return super.setProperty(hash, name, value);
2383        }
2384
2385      }
2386
2387      @Override
2388      public Base setProperty(String name, Base value) throws FHIRException {
2389        if (name.equals("sequence")) {
2390          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
2391        } else if (name.equals("type")) {
2392          this.getType().add(TypeConvertor.castToCodeableConcept(value));
2393        } else if (name.equals("date")) {
2394          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
2395        } else if (name.equals("procedure[x]")) {
2396          this.procedure = TypeConvertor.castToType(value); // DataType
2397        } else if (name.equals("udi")) {
2398          this.getUdi().add(TypeConvertor.castToReference(value));
2399        } else
2400          return super.setProperty(name, value);
2401        return value;
2402      }
2403
2404      @Override
2405      public Base makeProperty(int hash, String name) throws FHIRException {
2406        switch (hash) {
2407        case 1349547969:  return getSequenceElement();
2408        case 3575610:  return addType(); 
2409        case 3076014:  return getDateElement();
2410        case 1640074445:  return getProcedure();
2411        case -1095204141:  return getProcedure();
2412        case 115642:  return addUdi(); 
2413        default: return super.makeProperty(hash, name);
2414        }
2415
2416      }
2417
2418      @Override
2419      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2420        switch (hash) {
2421        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2422        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2423        case 3076014: /*date*/ return new String[] {"dateTime"};
2424        case -1095204141: /*procedure*/ return new String[] {"CodeableConcept", "Reference"};
2425        case 115642: /*udi*/ return new String[] {"Reference"};
2426        default: return super.getTypesForProperty(hash, name);
2427        }
2428
2429      }
2430
2431      @Override
2432      public Base addChild(String name) throws FHIRException {
2433        if (name.equals("sequence")) {
2434          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedure.sequence");
2435        }
2436        else if (name.equals("type")) {
2437          return addType();
2438        }
2439        else if (name.equals("date")) {
2440          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedure.date");
2441        }
2442        else if (name.equals("procedureCodeableConcept")) {
2443          this.procedure = new CodeableConcept();
2444          return this.procedure;
2445        }
2446        else if (name.equals("procedureReference")) {
2447          this.procedure = new Reference();
2448          return this.procedure;
2449        }
2450        else if (name.equals("udi")) {
2451          return addUdi();
2452        }
2453        else
2454          return super.addChild(name);
2455      }
2456
2457      public ProcedureComponent copy() {
2458        ProcedureComponent dst = new ProcedureComponent();
2459        copyValues(dst);
2460        return dst;
2461      }
2462
2463      public void copyValues(ProcedureComponent dst) {
2464        super.copyValues(dst);
2465        dst.sequence = sequence == null ? null : sequence.copy();
2466        if (type != null) {
2467          dst.type = new ArrayList<CodeableConcept>();
2468          for (CodeableConcept i : type)
2469            dst.type.add(i.copy());
2470        };
2471        dst.date = date == null ? null : date.copy();
2472        dst.procedure = procedure == null ? null : procedure.copy();
2473        if (udi != null) {
2474          dst.udi = new ArrayList<Reference>();
2475          for (Reference i : udi)
2476            dst.udi.add(i.copy());
2477        };
2478      }
2479
2480      @Override
2481      public boolean equalsDeep(Base other_) {
2482        if (!super.equalsDeep(other_))
2483          return false;
2484        if (!(other_ instanceof ProcedureComponent))
2485          return false;
2486        ProcedureComponent o = (ProcedureComponent) other_;
2487        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(date, o.date, true)
2488           && compareDeep(procedure, o.procedure, true) && compareDeep(udi, o.udi, true);
2489      }
2490
2491      @Override
2492      public boolean equalsShallow(Base other_) {
2493        if (!super.equalsShallow(other_))
2494          return false;
2495        if (!(other_ instanceof ProcedureComponent))
2496          return false;
2497        ProcedureComponent o = (ProcedureComponent) other_;
2498        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
2499      }
2500
2501      public boolean isEmpty() {
2502        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, date, procedure
2503          , udi);
2504      }
2505
2506  public String fhirType() {
2507    return "ExplanationOfBenefit.procedure";
2508
2509  }
2510
2511  }
2512
2513    @Block()
2514    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
2515        /**
2516         * A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2517         */
2518        @Child(name = "focal", type = {BooleanType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2519        @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." )
2520        protected BooleanType focal;
2521
2522        /**
2523         * 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.
2524         */
2525        @Child(name = "coverage", type = {Coverage.class}, order=2, min=1, max=1, modifier=false, summary=true)
2526        @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." )
2527        protected Reference coverage;
2528
2529        /**
2530         * 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.
2531         */
2532        @Child(name = "preAuthRef", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2533        @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." )
2534        protected List<StringType> preAuthRef;
2535
2536        private static final long serialVersionUID = 1519900285L;
2537
2538    /**
2539     * Constructor
2540     */
2541      public InsuranceComponent() {
2542        super();
2543      }
2544
2545    /**
2546     * Constructor
2547     */
2548      public InsuranceComponent(boolean focal, Reference coverage) {
2549        super();
2550        this.setFocal(focal);
2551        this.setCoverage(coverage);
2552      }
2553
2554        /**
2555         * @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
2556         */
2557        public BooleanType getFocalElement() { 
2558          if (this.focal == null)
2559            if (Configuration.errorOnAutoCreate())
2560              throw new Error("Attempt to auto-create InsuranceComponent.focal");
2561            else if (Configuration.doAutoCreate())
2562              this.focal = new BooleanType(); // bb
2563          return this.focal;
2564        }
2565
2566        public boolean hasFocalElement() { 
2567          return this.focal != null && !this.focal.isEmpty();
2568        }
2569
2570        public boolean hasFocal() { 
2571          return this.focal != null && !this.focal.isEmpty();
2572        }
2573
2574        /**
2575         * @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
2576         */
2577        public InsuranceComponent setFocalElement(BooleanType value) { 
2578          this.focal = value;
2579          return this;
2580        }
2581
2582        /**
2583         * @return A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2584         */
2585        public boolean getFocal() { 
2586          return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
2587        }
2588
2589        /**
2590         * @param value A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2591         */
2592        public InsuranceComponent setFocal(boolean value) { 
2593            if (this.focal == null)
2594              this.focal = new BooleanType();
2595            this.focal.setValue(value);
2596          return this;
2597        }
2598
2599        /**
2600         * @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.)
2601         */
2602        public Reference getCoverage() { 
2603          if (this.coverage == null)
2604            if (Configuration.errorOnAutoCreate())
2605              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2606            else if (Configuration.doAutoCreate())
2607              this.coverage = new Reference(); // cc
2608          return this.coverage;
2609        }
2610
2611        public boolean hasCoverage() { 
2612          return this.coverage != null && !this.coverage.isEmpty();
2613        }
2614
2615        /**
2616         * @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.)
2617         */
2618        public InsuranceComponent setCoverage(Reference value) { 
2619          this.coverage = value;
2620          return this;
2621        }
2622
2623        /**
2624         * @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.)
2625         */
2626        public List<StringType> getPreAuthRef() { 
2627          if (this.preAuthRef == null)
2628            this.preAuthRef = new ArrayList<StringType>();
2629          return this.preAuthRef;
2630        }
2631
2632        /**
2633         * @return Returns a reference to <code>this</code> for easy method chaining
2634         */
2635        public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) { 
2636          this.preAuthRef = thePreAuthRef;
2637          return this;
2638        }
2639
2640        public boolean hasPreAuthRef() { 
2641          if (this.preAuthRef == null)
2642            return false;
2643          for (StringType item : this.preAuthRef)
2644            if (!item.isEmpty())
2645              return true;
2646          return false;
2647        }
2648
2649        /**
2650         * @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.)
2651         */
2652        public StringType addPreAuthRefElement() {//2 
2653          StringType t = new StringType();
2654          if (this.preAuthRef == null)
2655            this.preAuthRef = new ArrayList<StringType>();
2656          this.preAuthRef.add(t);
2657          return t;
2658        }
2659
2660        /**
2661         * @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.)
2662         */
2663        public InsuranceComponent addPreAuthRef(String value) { //1
2664          StringType t = new StringType();
2665          t.setValue(value);
2666          if (this.preAuthRef == null)
2667            this.preAuthRef = new ArrayList<StringType>();
2668          this.preAuthRef.add(t);
2669          return this;
2670        }
2671
2672        /**
2673         * @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.)
2674         */
2675        public boolean hasPreAuthRef(String value) { 
2676          if (this.preAuthRef == null)
2677            return false;
2678          for (StringType v : this.preAuthRef)
2679            if (v.getValue().equals(value)) // string
2680              return true;
2681          return false;
2682        }
2683
2684        protected void listChildren(List<Property> children) {
2685          super.listChildren(children);
2686          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));
2687          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));
2688          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));
2689        }
2690
2691        @Override
2692        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2693          switch (_hash) {
2694          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);
2695          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);
2696          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);
2697          default: return super.getNamedProperty(_hash, _name, _checkValid);
2698          }
2699
2700        }
2701
2702      @Override
2703      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2704        switch (hash) {
2705        case 97604197: /*focal*/ return this.focal == null ? new Base[0] : new Base[] {this.focal}; // BooleanType
2706        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
2707        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
2708        default: return super.getProperty(hash, name, checkValid);
2709        }
2710
2711      }
2712
2713      @Override
2714      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2715        switch (hash) {
2716        case 97604197: // focal
2717          this.focal = TypeConvertor.castToBoolean(value); // BooleanType
2718          return value;
2719        case -351767064: // coverage
2720          this.coverage = TypeConvertor.castToReference(value); // Reference
2721          return value;
2722        case 522246568: // preAuthRef
2723          this.getPreAuthRef().add(TypeConvertor.castToString(value)); // StringType
2724          return value;
2725        default: return super.setProperty(hash, name, value);
2726        }
2727
2728      }
2729
2730      @Override
2731      public Base setProperty(String name, Base value) throws FHIRException {
2732        if (name.equals("focal")) {
2733          this.focal = TypeConvertor.castToBoolean(value); // BooleanType
2734        } else if (name.equals("coverage")) {
2735          this.coverage = TypeConvertor.castToReference(value); // Reference
2736        } else if (name.equals("preAuthRef")) {
2737          this.getPreAuthRef().add(TypeConvertor.castToString(value));
2738        } else
2739          return super.setProperty(name, value);
2740        return value;
2741      }
2742
2743      @Override
2744      public Base makeProperty(int hash, String name) throws FHIRException {
2745        switch (hash) {
2746        case 97604197:  return getFocalElement();
2747        case -351767064:  return getCoverage();
2748        case 522246568:  return addPreAuthRefElement();
2749        default: return super.makeProperty(hash, name);
2750        }
2751
2752      }
2753
2754      @Override
2755      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2756        switch (hash) {
2757        case 97604197: /*focal*/ return new String[] {"boolean"};
2758        case -351767064: /*coverage*/ return new String[] {"Reference"};
2759        case 522246568: /*preAuthRef*/ return new String[] {"string"};
2760        default: return super.getTypesForProperty(hash, name);
2761        }
2762
2763      }
2764
2765      @Override
2766      public Base addChild(String name) throws FHIRException {
2767        if (name.equals("focal")) {
2768          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.insurance.focal");
2769        }
2770        else if (name.equals("coverage")) {
2771          this.coverage = new Reference();
2772          return this.coverage;
2773        }
2774        else if (name.equals("preAuthRef")) {
2775          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.insurance.preAuthRef");
2776        }
2777        else
2778          return super.addChild(name);
2779      }
2780
2781      public InsuranceComponent copy() {
2782        InsuranceComponent dst = new InsuranceComponent();
2783        copyValues(dst);
2784        return dst;
2785      }
2786
2787      public void copyValues(InsuranceComponent dst) {
2788        super.copyValues(dst);
2789        dst.focal = focal == null ? null : focal.copy();
2790        dst.coverage = coverage == null ? null : coverage.copy();
2791        if (preAuthRef != null) {
2792          dst.preAuthRef = new ArrayList<StringType>();
2793          for (StringType i : preAuthRef)
2794            dst.preAuthRef.add(i.copy());
2795        };
2796      }
2797
2798      @Override
2799      public boolean equalsDeep(Base other_) {
2800        if (!super.equalsDeep(other_))
2801          return false;
2802        if (!(other_ instanceof InsuranceComponent))
2803          return false;
2804        InsuranceComponent o = (InsuranceComponent) other_;
2805        return compareDeep(focal, o.focal, true) && compareDeep(coverage, o.coverage, true) && compareDeep(preAuthRef, o.preAuthRef, true)
2806          ;
2807      }
2808
2809      @Override
2810      public boolean equalsShallow(Base other_) {
2811        if (!super.equalsShallow(other_))
2812          return false;
2813        if (!(other_ instanceof InsuranceComponent))
2814          return false;
2815        InsuranceComponent o = (InsuranceComponent) other_;
2816        return compareValues(focal, o.focal, true) && compareValues(preAuthRef, o.preAuthRef, true);
2817      }
2818
2819      public boolean isEmpty() {
2820        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(focal, coverage, preAuthRef
2821          );
2822      }
2823
2824  public String fhirType() {
2825    return "ExplanationOfBenefit.insurance";
2826
2827  }
2828
2829  }
2830
2831    @Block()
2832    public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
2833        /**
2834         * Date of an accident event  related to the products and services contained in the claim.
2835         */
2836        @Child(name = "date", type = {DateType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2837        @Description(shortDefinition="When the incident occurred", formalDefinition="Date of an accident event  related to the products and services contained in the claim." )
2838        protected DateType date;
2839
2840        /**
2841         * The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.
2842         */
2843        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
2844        @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." )
2845        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActIncidentCode")
2846        protected CodeableConcept type;
2847
2848        /**
2849         * The physical location of the accident event.
2850         */
2851        @Child(name = "location", type = {Address.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=false)
2852        @Description(shortDefinition="Where the event occurred", formalDefinition="The physical location of the accident event." )
2853        protected DataType location;
2854
2855        private static final long serialVersionUID = 11882722L;
2856
2857    /**
2858     * Constructor
2859     */
2860      public AccidentComponent() {
2861        super();
2862      }
2863
2864        /**
2865         * @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
2866         */
2867        public DateType getDateElement() { 
2868          if (this.date == null)
2869            if (Configuration.errorOnAutoCreate())
2870              throw new Error("Attempt to auto-create AccidentComponent.date");
2871            else if (Configuration.doAutoCreate())
2872              this.date = new DateType(); // bb
2873          return this.date;
2874        }
2875
2876        public boolean hasDateElement() { 
2877          return this.date != null && !this.date.isEmpty();
2878        }
2879
2880        public boolean hasDate() { 
2881          return this.date != null && !this.date.isEmpty();
2882        }
2883
2884        /**
2885         * @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
2886         */
2887        public AccidentComponent setDateElement(DateType value) { 
2888          this.date = value;
2889          return this;
2890        }
2891
2892        /**
2893         * @return Date of an accident event  related to the products and services contained in the claim.
2894         */
2895        public Date getDate() { 
2896          return this.date == null ? null : this.date.getValue();
2897        }
2898
2899        /**
2900         * @param value Date of an accident event  related to the products and services contained in the claim.
2901         */
2902        public AccidentComponent setDate(Date value) { 
2903          if (value == null)
2904            this.date = null;
2905          else {
2906            if (this.date == null)
2907              this.date = new DateType();
2908            this.date.setValue(value);
2909          }
2910          return this;
2911        }
2912
2913        /**
2914         * @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.)
2915         */
2916        public CodeableConcept getType() { 
2917          if (this.type == null)
2918            if (Configuration.errorOnAutoCreate())
2919              throw new Error("Attempt to auto-create AccidentComponent.type");
2920            else if (Configuration.doAutoCreate())
2921              this.type = new CodeableConcept(); // cc
2922          return this.type;
2923        }
2924
2925        public boolean hasType() { 
2926          return this.type != null && !this.type.isEmpty();
2927        }
2928
2929        /**
2930         * @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.)
2931         */
2932        public AccidentComponent setType(CodeableConcept value) { 
2933          this.type = value;
2934          return this;
2935        }
2936
2937        /**
2938         * @return {@link #location} (The physical location of the accident event.)
2939         */
2940        public DataType getLocation() { 
2941          return this.location;
2942        }
2943
2944        /**
2945         * @return {@link #location} (The physical location of the accident event.)
2946         */
2947        public Address getLocationAddress() throws FHIRException { 
2948          if (this.location == null)
2949            this.location = new Address();
2950          if (!(this.location instanceof Address))
2951            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
2952          return (Address) this.location;
2953        }
2954
2955        public boolean hasLocationAddress() { 
2956          return this != null && this.location instanceof Address;
2957        }
2958
2959        /**
2960         * @return {@link #location} (The physical location of the accident event.)
2961         */
2962        public Reference getLocationReference() throws FHIRException { 
2963          if (this.location == null)
2964            this.location = new Reference();
2965          if (!(this.location instanceof Reference))
2966            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
2967          return (Reference) this.location;
2968        }
2969
2970        public boolean hasLocationReference() { 
2971          return this != null && this.location instanceof Reference;
2972        }
2973
2974        public boolean hasLocation() { 
2975          return this.location != null && !this.location.isEmpty();
2976        }
2977
2978        /**
2979         * @param value {@link #location} (The physical location of the accident event.)
2980         */
2981        public AccidentComponent setLocation(DataType value) { 
2982          if (value != null && !(value instanceof Address || value instanceof Reference))
2983            throw new Error("Not the right type for ExplanationOfBenefit.accident.location[x]: "+value.fhirType());
2984          this.location = value;
2985          return this;
2986        }
2987
2988        protected void listChildren(List<Property> children) {
2989          super.listChildren(children);
2990          children.add(new Property("date", "date", "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date));
2991          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));
2992          children.add(new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location));
2993        }
2994
2995        @Override
2996        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2997          switch (_hash) {
2998          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);
2999          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);
3000          case 552316075: /*location[x]*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3001          case 1901043637: /*location*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3002          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address", "The physical location of the accident event.", 0, 1, location);
3003          case 755866390: /*locationReference*/  return new Property("location[x]", "Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3004          default: return super.getNamedProperty(_hash, _name, _checkValid);
3005          }
3006
3007        }
3008
3009      @Override
3010      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3011        switch (hash) {
3012        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
3013        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3014        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // DataType
3015        default: return super.getProperty(hash, name, checkValid);
3016        }
3017
3018      }
3019
3020      @Override
3021      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3022        switch (hash) {
3023        case 3076014: // date
3024          this.date = TypeConvertor.castToDate(value); // DateType
3025          return value;
3026        case 3575610: // type
3027          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3028          return value;
3029        case 1901043637: // location
3030          this.location = TypeConvertor.castToType(value); // DataType
3031          return value;
3032        default: return super.setProperty(hash, name, value);
3033        }
3034
3035      }
3036
3037      @Override
3038      public Base setProperty(String name, Base value) throws FHIRException {
3039        if (name.equals("date")) {
3040          this.date = TypeConvertor.castToDate(value); // DateType
3041        } else if (name.equals("type")) {
3042          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3043        } else if (name.equals("location[x]")) {
3044          this.location = TypeConvertor.castToType(value); // DataType
3045        } else
3046          return super.setProperty(name, value);
3047        return value;
3048      }
3049
3050      @Override
3051      public Base makeProperty(int hash, String name) throws FHIRException {
3052        switch (hash) {
3053        case 3076014:  return getDateElement();
3054        case 3575610:  return getType();
3055        case 552316075:  return getLocation();
3056        case 1901043637:  return getLocation();
3057        default: return super.makeProperty(hash, name);
3058        }
3059
3060      }
3061
3062      @Override
3063      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3064        switch (hash) {
3065        case 3076014: /*date*/ return new String[] {"date"};
3066        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3067        case 1901043637: /*location*/ return new String[] {"Address", "Reference"};
3068        default: return super.getTypesForProperty(hash, name);
3069        }
3070
3071      }
3072
3073      @Override
3074      public Base addChild(String name) throws FHIRException {
3075        if (name.equals("date")) {
3076          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.accident.date");
3077        }
3078        else if (name.equals("type")) {
3079          this.type = new CodeableConcept();
3080          return this.type;
3081        }
3082        else if (name.equals("locationAddress")) {
3083          this.location = new Address();
3084          return this.location;
3085        }
3086        else if (name.equals("locationReference")) {
3087          this.location = new Reference();
3088          return this.location;
3089        }
3090        else
3091          return super.addChild(name);
3092      }
3093
3094      public AccidentComponent copy() {
3095        AccidentComponent dst = new AccidentComponent();
3096        copyValues(dst);
3097        return dst;
3098      }
3099
3100      public void copyValues(AccidentComponent dst) {
3101        super.copyValues(dst);
3102        dst.date = date == null ? null : date.copy();
3103        dst.type = type == null ? null : type.copy();
3104        dst.location = location == null ? null : location.copy();
3105      }
3106
3107      @Override
3108      public boolean equalsDeep(Base other_) {
3109        if (!super.equalsDeep(other_))
3110          return false;
3111        if (!(other_ instanceof AccidentComponent))
3112          return false;
3113        AccidentComponent o = (AccidentComponent) other_;
3114        return compareDeep(date, o.date, true) && compareDeep(type, o.type, true) && compareDeep(location, o.location, true)
3115          ;
3116      }
3117
3118      @Override
3119      public boolean equalsShallow(Base other_) {
3120        if (!super.equalsShallow(other_))
3121          return false;
3122        if (!(other_ instanceof AccidentComponent))
3123          return false;
3124        AccidentComponent o = (AccidentComponent) other_;
3125        return compareValues(date, o.date, true);
3126      }
3127
3128      public boolean isEmpty() {
3129        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
3130      }
3131
3132  public String fhirType() {
3133    return "ExplanationOfBenefit.accident";
3134
3135  }
3136
3137  }
3138
3139    @Block()
3140    public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
3141        /**
3142         * A number to uniquely identify item entries.
3143         */
3144        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
3145        @Description(shortDefinition="Item instance identifier", formalDefinition="A number to uniquely identify item entries." )
3146        protected PositiveIntType sequence;
3147
3148        /**
3149         * Care team members related to this service or product.
3150         */
3151        @Child(name = "careTeamSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3152        @Description(shortDefinition="Applicable care team members", formalDefinition="Care team members related to this service or product." )
3153        protected List<PositiveIntType> careTeamSequence;
3154
3155        /**
3156         * Diagnoses applicable for this service or product.
3157         */
3158        @Child(name = "diagnosisSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3159        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnoses applicable for this service or product." )
3160        protected List<PositiveIntType> diagnosisSequence;
3161
3162        /**
3163         * Procedures applicable for this service or product.
3164         */
3165        @Child(name = "procedureSequence", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3166        @Description(shortDefinition="Applicable procedures", formalDefinition="Procedures applicable for this service or product." )
3167        protected List<PositiveIntType> procedureSequence;
3168
3169        /**
3170         * Exceptions, special conditions and supporting information applicable for this service or product.
3171         */
3172        @Child(name = "informationSequence", type = {PositiveIntType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3173        @Description(shortDefinition="Applicable exception and supporting information", formalDefinition="Exceptions, special conditions and supporting information applicable for this service or product." )
3174        protected List<PositiveIntType> informationSequence;
3175
3176        /**
3177         * The type of revenue or cost center providing the product and/or service.
3178         */
3179        @Child(name = "revenue", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
3180        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
3181        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
3182        protected CodeableConcept revenue;
3183
3184        /**
3185         * Code to identify the general type of benefits under which products and services are provided.
3186         */
3187        @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
3188        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
3189        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
3190        protected CodeableConcept category;
3191
3192        /**
3193         * 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.
3194         */
3195        @Child(name = "productOrService", type = {CodeableConcept.class}, order=8, min=1, max=1, modifier=false, summary=false)
3196        @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." )
3197        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
3198        protected CodeableConcept productOrService;
3199
3200        /**
3201         * Item typification or modifiers codes to convey additional context for the product or service.
3202         */
3203        @Child(name = "modifier", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3204        @Description(shortDefinition="Product or service billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
3205        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
3206        protected List<CodeableConcept> modifier;
3207
3208        /**
3209         * Identifies the program under which this may be recovered.
3210         */
3211        @Child(name = "programCode", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3212        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
3213        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
3214        protected List<CodeableConcept> programCode;
3215
3216        /**
3217         * The date or dates when the service or product was supplied, performed or completed.
3218         */
3219        @Child(name = "serviced", type = {DateType.class, Period.class}, order=11, min=0, max=1, modifier=false, summary=false)
3220        @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." )
3221        protected DataType serviced;
3222
3223        /**
3224         * Where the product or service was provided.
3225         */
3226        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
3227        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
3228        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
3229        protected DataType location;
3230
3231        /**
3232         * The number of repetitions of a service or product.
3233         */
3234        @Child(name = "quantity", type = {Quantity.class}, order=13, min=0, max=1, modifier=false, summary=false)
3235        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
3236        protected Quantity quantity;
3237
3238        /**
3239         * 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.
3240         */
3241        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
3242        @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." )
3243        protected Money unitPrice;
3244
3245        /**
3246         * 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.
3247         */
3248        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=false)
3249        @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." )
3250        protected DecimalType factor;
3251
3252        /**
3253         * The quantity times the unit price for an additional service or product or charge.
3254         */
3255        @Child(name = "net", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
3256        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
3257        protected Money net;
3258
3259        /**
3260         * Unique Device Identifiers associated with this line item.
3261         */
3262        @Child(name = "udi", type = {Device.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3263        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
3264        protected List<Reference> udi;
3265
3266        /**
3267         * Physical service site on the patient (limb, tooth, etc.).
3268         */
3269        @Child(name = "bodySite", type = {CodeableConcept.class}, order=18, min=0, max=1, modifier=false, summary=false)
3270        @Description(shortDefinition="Anatomical location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
3271        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
3272        protected CodeableConcept bodySite;
3273
3274        /**
3275         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
3276         */
3277        @Child(name = "subSite", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3278        @Description(shortDefinition="Anatomical sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
3279        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
3280        protected List<CodeableConcept> subSite;
3281
3282        /**
3283         * A billed item may include goods or services provided in multiple encounters.
3284         */
3285        @Child(name = "encounter", type = {Encounter.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3286        @Description(shortDefinition="Encounters related to this billed item", formalDefinition="A billed item may include goods or services provided in multiple encounters." )
3287        protected List<Reference> encounter;
3288
3289        /**
3290         * The numbers associated with notes below which apply to the adjudication of this item.
3291         */
3292        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3293        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
3294        protected List<PositiveIntType> noteNumber;
3295
3296        /**
3297         * If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.
3298         */
3299        @Child(name = "adjudication", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3300        @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." )
3301        protected List<AdjudicationComponent> adjudication;
3302
3303        /**
3304         * Second-tier of goods and services.
3305         */
3306        @Child(name = "detail", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3307        @Description(shortDefinition="Additional items", formalDefinition="Second-tier of goods and services." )
3308        protected List<DetailComponent> detail;
3309
3310        private static final long serialVersionUID = -1350957145L;
3311
3312    /**
3313     * Constructor
3314     */
3315      public ItemComponent() {
3316        super();
3317      }
3318
3319    /**
3320     * Constructor
3321     */
3322      public ItemComponent(int sequence, CodeableConcept productOrService) {
3323        super();
3324        this.setSequence(sequence);
3325        this.setProductOrService(productOrService);
3326      }
3327
3328        /**
3329         * @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
3330         */
3331        public PositiveIntType getSequenceElement() { 
3332          if (this.sequence == null)
3333            if (Configuration.errorOnAutoCreate())
3334              throw new Error("Attempt to auto-create ItemComponent.sequence");
3335            else if (Configuration.doAutoCreate())
3336              this.sequence = new PositiveIntType(); // bb
3337          return this.sequence;
3338        }
3339
3340        public boolean hasSequenceElement() { 
3341          return this.sequence != null && !this.sequence.isEmpty();
3342        }
3343
3344        public boolean hasSequence() { 
3345          return this.sequence != null && !this.sequence.isEmpty();
3346        }
3347
3348        /**
3349         * @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
3350         */
3351        public ItemComponent setSequenceElement(PositiveIntType value) { 
3352          this.sequence = value;
3353          return this;
3354        }
3355
3356        /**
3357         * @return A number to uniquely identify item entries.
3358         */
3359        public int getSequence() { 
3360          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3361        }
3362
3363        /**
3364         * @param value A number to uniquely identify item entries.
3365         */
3366        public ItemComponent setSequence(int value) { 
3367            if (this.sequence == null)
3368              this.sequence = new PositiveIntType();
3369            this.sequence.setValue(value);
3370          return this;
3371        }
3372
3373        /**
3374         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3375         */
3376        public List<PositiveIntType> getCareTeamSequence() { 
3377          if (this.careTeamSequence == null)
3378            this.careTeamSequence = new ArrayList<PositiveIntType>();
3379          return this.careTeamSequence;
3380        }
3381
3382        /**
3383         * @return Returns a reference to <code>this</code> for easy method chaining
3384         */
3385        public ItemComponent setCareTeamSequence(List<PositiveIntType> theCareTeamSequence) { 
3386          this.careTeamSequence = theCareTeamSequence;
3387          return this;
3388        }
3389
3390        public boolean hasCareTeamSequence() { 
3391          if (this.careTeamSequence == null)
3392            return false;
3393          for (PositiveIntType item : this.careTeamSequence)
3394            if (!item.isEmpty())
3395              return true;
3396          return false;
3397        }
3398
3399        /**
3400         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3401         */
3402        public PositiveIntType addCareTeamSequenceElement() {//2 
3403          PositiveIntType t = new PositiveIntType();
3404          if (this.careTeamSequence == null)
3405            this.careTeamSequence = new ArrayList<PositiveIntType>();
3406          this.careTeamSequence.add(t);
3407          return t;
3408        }
3409
3410        /**
3411         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3412         */
3413        public ItemComponent addCareTeamSequence(int value) { //1
3414          PositiveIntType t = new PositiveIntType();
3415          t.setValue(value);
3416          if (this.careTeamSequence == null)
3417            this.careTeamSequence = new ArrayList<PositiveIntType>();
3418          this.careTeamSequence.add(t);
3419          return this;
3420        }
3421
3422        /**
3423         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3424         */
3425        public boolean hasCareTeamSequence(int value) { 
3426          if (this.careTeamSequence == null)
3427            return false;
3428          for (PositiveIntType v : this.careTeamSequence)
3429            if (v.getValue().equals(value)) // positiveInt
3430              return true;
3431          return false;
3432        }
3433
3434        /**
3435         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3436         */
3437        public List<PositiveIntType> getDiagnosisSequence() { 
3438          if (this.diagnosisSequence == null)
3439            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3440          return this.diagnosisSequence;
3441        }
3442
3443        /**
3444         * @return Returns a reference to <code>this</code> for easy method chaining
3445         */
3446        public ItemComponent setDiagnosisSequence(List<PositiveIntType> theDiagnosisSequence) { 
3447          this.diagnosisSequence = theDiagnosisSequence;
3448          return this;
3449        }
3450
3451        public boolean hasDiagnosisSequence() { 
3452          if (this.diagnosisSequence == null)
3453            return false;
3454          for (PositiveIntType item : this.diagnosisSequence)
3455            if (!item.isEmpty())
3456              return true;
3457          return false;
3458        }
3459
3460        /**
3461         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3462         */
3463        public PositiveIntType addDiagnosisSequenceElement() {//2 
3464          PositiveIntType t = new PositiveIntType();
3465          if (this.diagnosisSequence == null)
3466            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3467          this.diagnosisSequence.add(t);
3468          return t;
3469        }
3470
3471        /**
3472         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3473         */
3474        public ItemComponent addDiagnosisSequence(int value) { //1
3475          PositiveIntType t = new PositiveIntType();
3476          t.setValue(value);
3477          if (this.diagnosisSequence == null)
3478            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3479          this.diagnosisSequence.add(t);
3480          return this;
3481        }
3482
3483        /**
3484         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3485         */
3486        public boolean hasDiagnosisSequence(int value) { 
3487          if (this.diagnosisSequence == null)
3488            return false;
3489          for (PositiveIntType v : this.diagnosisSequence)
3490            if (v.getValue().equals(value)) // positiveInt
3491              return true;
3492          return false;
3493        }
3494
3495        /**
3496         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3497         */
3498        public List<PositiveIntType> getProcedureSequence() { 
3499          if (this.procedureSequence == null)
3500            this.procedureSequence = new ArrayList<PositiveIntType>();
3501          return this.procedureSequence;
3502        }
3503
3504        /**
3505         * @return Returns a reference to <code>this</code> for easy method chaining
3506         */
3507        public ItemComponent setProcedureSequence(List<PositiveIntType> theProcedureSequence) { 
3508          this.procedureSequence = theProcedureSequence;
3509          return this;
3510        }
3511
3512        public boolean hasProcedureSequence() { 
3513          if (this.procedureSequence == null)
3514            return false;
3515          for (PositiveIntType item : this.procedureSequence)
3516            if (!item.isEmpty())
3517              return true;
3518          return false;
3519        }
3520
3521        /**
3522         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3523         */
3524        public PositiveIntType addProcedureSequenceElement() {//2 
3525          PositiveIntType t = new PositiveIntType();
3526          if (this.procedureSequence == null)
3527            this.procedureSequence = new ArrayList<PositiveIntType>();
3528          this.procedureSequence.add(t);
3529          return t;
3530        }
3531
3532        /**
3533         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3534         */
3535        public ItemComponent addProcedureSequence(int value) { //1
3536          PositiveIntType t = new PositiveIntType();
3537          t.setValue(value);
3538          if (this.procedureSequence == null)
3539            this.procedureSequence = new ArrayList<PositiveIntType>();
3540          this.procedureSequence.add(t);
3541          return this;
3542        }
3543
3544        /**
3545         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3546         */
3547        public boolean hasProcedureSequence(int value) { 
3548          if (this.procedureSequence == null)
3549            return false;
3550          for (PositiveIntType v : this.procedureSequence)
3551            if (v.getValue().equals(value)) // positiveInt
3552              return true;
3553          return false;
3554        }
3555
3556        /**
3557         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3558         */
3559        public List<PositiveIntType> getInformationSequence() { 
3560          if (this.informationSequence == null)
3561            this.informationSequence = new ArrayList<PositiveIntType>();
3562          return this.informationSequence;
3563        }
3564
3565        /**
3566         * @return Returns a reference to <code>this</code> for easy method chaining
3567         */
3568        public ItemComponent setInformationSequence(List<PositiveIntType> theInformationSequence) { 
3569          this.informationSequence = theInformationSequence;
3570          return this;
3571        }
3572
3573        public boolean hasInformationSequence() { 
3574          if (this.informationSequence == null)
3575            return false;
3576          for (PositiveIntType item : this.informationSequence)
3577            if (!item.isEmpty())
3578              return true;
3579          return false;
3580        }
3581
3582        /**
3583         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3584         */
3585        public PositiveIntType addInformationSequenceElement() {//2 
3586          PositiveIntType t = new PositiveIntType();
3587          if (this.informationSequence == null)
3588            this.informationSequence = new ArrayList<PositiveIntType>();
3589          this.informationSequence.add(t);
3590          return t;
3591        }
3592
3593        /**
3594         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3595         */
3596        public ItemComponent addInformationSequence(int value) { //1
3597          PositiveIntType t = new PositiveIntType();
3598          t.setValue(value);
3599          if (this.informationSequence == null)
3600            this.informationSequence = new ArrayList<PositiveIntType>();
3601          this.informationSequence.add(t);
3602          return this;
3603        }
3604
3605        /**
3606         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3607         */
3608        public boolean hasInformationSequence(int value) { 
3609          if (this.informationSequence == null)
3610            return false;
3611          for (PositiveIntType v : this.informationSequence)
3612            if (v.getValue().equals(value)) // positiveInt
3613              return true;
3614          return false;
3615        }
3616
3617        /**
3618         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3619         */
3620        public CodeableConcept getRevenue() { 
3621          if (this.revenue == null)
3622            if (Configuration.errorOnAutoCreate())
3623              throw new Error("Attempt to auto-create ItemComponent.revenue");
3624            else if (Configuration.doAutoCreate())
3625              this.revenue = new CodeableConcept(); // cc
3626          return this.revenue;
3627        }
3628
3629        public boolean hasRevenue() { 
3630          return this.revenue != null && !this.revenue.isEmpty();
3631        }
3632
3633        /**
3634         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3635         */
3636        public ItemComponent setRevenue(CodeableConcept value) { 
3637          this.revenue = value;
3638          return this;
3639        }
3640
3641        /**
3642         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
3643         */
3644        public CodeableConcept getCategory() { 
3645          if (this.category == null)
3646            if (Configuration.errorOnAutoCreate())
3647              throw new Error("Attempt to auto-create ItemComponent.category");
3648            else if (Configuration.doAutoCreate())
3649              this.category = new CodeableConcept(); // cc
3650          return this.category;
3651        }
3652
3653        public boolean hasCategory() { 
3654          return this.category != null && !this.category.isEmpty();
3655        }
3656
3657        /**
3658         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
3659         */
3660        public ItemComponent setCategory(CodeableConcept value) { 
3661          this.category = value;
3662          return this;
3663        }
3664
3665        /**
3666         * @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.)
3667         */
3668        public CodeableConcept getProductOrService() { 
3669          if (this.productOrService == null)
3670            if (Configuration.errorOnAutoCreate())
3671              throw new Error("Attempt to auto-create ItemComponent.productOrService");
3672            else if (Configuration.doAutoCreate())
3673              this.productOrService = new CodeableConcept(); // cc
3674          return this.productOrService;
3675        }
3676
3677        public boolean hasProductOrService() { 
3678          return this.productOrService != null && !this.productOrService.isEmpty();
3679        }
3680
3681        /**
3682         * @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.)
3683         */
3684        public ItemComponent setProductOrService(CodeableConcept value) { 
3685          this.productOrService = value;
3686          return this;
3687        }
3688
3689        /**
3690         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
3691         */
3692        public List<CodeableConcept> getModifier() { 
3693          if (this.modifier == null)
3694            this.modifier = new ArrayList<CodeableConcept>();
3695          return this.modifier;
3696        }
3697
3698        /**
3699         * @return Returns a reference to <code>this</code> for easy method chaining
3700         */
3701        public ItemComponent setModifier(List<CodeableConcept> theModifier) { 
3702          this.modifier = theModifier;
3703          return this;
3704        }
3705
3706        public boolean hasModifier() { 
3707          if (this.modifier == null)
3708            return false;
3709          for (CodeableConcept item : this.modifier)
3710            if (!item.isEmpty())
3711              return true;
3712          return false;
3713        }
3714
3715        public CodeableConcept addModifier() { //3
3716          CodeableConcept t = new CodeableConcept();
3717          if (this.modifier == null)
3718            this.modifier = new ArrayList<CodeableConcept>();
3719          this.modifier.add(t);
3720          return t;
3721        }
3722
3723        public ItemComponent addModifier(CodeableConcept t) { //3
3724          if (t == null)
3725            return this;
3726          if (this.modifier == null)
3727            this.modifier = new ArrayList<CodeableConcept>();
3728          this.modifier.add(t);
3729          return this;
3730        }
3731
3732        /**
3733         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
3734         */
3735        public CodeableConcept getModifierFirstRep() { 
3736          if (getModifier().isEmpty()) {
3737            addModifier();
3738          }
3739          return getModifier().get(0);
3740        }
3741
3742        /**
3743         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
3744         */
3745        public List<CodeableConcept> getProgramCode() { 
3746          if (this.programCode == null)
3747            this.programCode = new ArrayList<CodeableConcept>();
3748          return this.programCode;
3749        }
3750
3751        /**
3752         * @return Returns a reference to <code>this</code> for easy method chaining
3753         */
3754        public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
3755          this.programCode = theProgramCode;
3756          return this;
3757        }
3758
3759        public boolean hasProgramCode() { 
3760          if (this.programCode == null)
3761            return false;
3762          for (CodeableConcept item : this.programCode)
3763            if (!item.isEmpty())
3764              return true;
3765          return false;
3766        }
3767
3768        public CodeableConcept addProgramCode() { //3
3769          CodeableConcept t = new CodeableConcept();
3770          if (this.programCode == null)
3771            this.programCode = new ArrayList<CodeableConcept>();
3772          this.programCode.add(t);
3773          return t;
3774        }
3775
3776        public ItemComponent addProgramCode(CodeableConcept t) { //3
3777          if (t == null)
3778            return this;
3779          if (this.programCode == null)
3780            this.programCode = new ArrayList<CodeableConcept>();
3781          this.programCode.add(t);
3782          return this;
3783        }
3784
3785        /**
3786         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
3787         */
3788        public CodeableConcept getProgramCodeFirstRep() { 
3789          if (getProgramCode().isEmpty()) {
3790            addProgramCode();
3791          }
3792          return getProgramCode().get(0);
3793        }
3794
3795        /**
3796         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3797         */
3798        public DataType getServiced() { 
3799          return this.serviced;
3800        }
3801
3802        /**
3803         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3804         */
3805        public DateType getServicedDateType() throws FHIRException { 
3806          if (this.serviced == null)
3807            this.serviced = new DateType();
3808          if (!(this.serviced instanceof DateType))
3809            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
3810          return (DateType) this.serviced;
3811        }
3812
3813        public boolean hasServicedDateType() { 
3814          return this != null && this.serviced instanceof DateType;
3815        }
3816
3817        /**
3818         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3819         */
3820        public Period getServicedPeriod() throws FHIRException { 
3821          if (this.serviced == null)
3822            this.serviced = new Period();
3823          if (!(this.serviced instanceof Period))
3824            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
3825          return (Period) this.serviced;
3826        }
3827
3828        public boolean hasServicedPeriod() { 
3829          return this != null && this.serviced instanceof Period;
3830        }
3831
3832        public boolean hasServiced() { 
3833          return this.serviced != null && !this.serviced.isEmpty();
3834        }
3835
3836        /**
3837         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3838         */
3839        public ItemComponent setServiced(DataType value) { 
3840          if (value != null && !(value instanceof DateType || value instanceof Period))
3841            throw new Error("Not the right type for ExplanationOfBenefit.item.serviced[x]: "+value.fhirType());
3842          this.serviced = value;
3843          return this;
3844        }
3845
3846        /**
3847         * @return {@link #location} (Where the product or service was provided.)
3848         */
3849        public DataType getLocation() { 
3850          return this.location;
3851        }
3852
3853        /**
3854         * @return {@link #location} (Where the product or service was provided.)
3855         */
3856        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
3857          if (this.location == null)
3858            this.location = new CodeableConcept();
3859          if (!(this.location instanceof CodeableConcept))
3860            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
3861          return (CodeableConcept) this.location;
3862        }
3863
3864        public boolean hasLocationCodeableConcept() { 
3865          return this != null && this.location instanceof CodeableConcept;
3866        }
3867
3868        /**
3869         * @return {@link #location} (Where the product or service was provided.)
3870         */
3871        public Address getLocationAddress() throws FHIRException { 
3872          if (this.location == null)
3873            this.location = new Address();
3874          if (!(this.location instanceof Address))
3875            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3876          return (Address) this.location;
3877        }
3878
3879        public boolean hasLocationAddress() { 
3880          return this != null && this.location instanceof Address;
3881        }
3882
3883        /**
3884         * @return {@link #location} (Where the product or service was provided.)
3885         */
3886        public Reference getLocationReference() throws FHIRException { 
3887          if (this.location == null)
3888            this.location = new Reference();
3889          if (!(this.location instanceof Reference))
3890            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3891          return (Reference) this.location;
3892        }
3893
3894        public boolean hasLocationReference() { 
3895          return this != null && this.location instanceof Reference;
3896        }
3897
3898        public boolean hasLocation() { 
3899          return this.location != null && !this.location.isEmpty();
3900        }
3901
3902        /**
3903         * @param value {@link #location} (Where the product or service was provided.)
3904         */
3905        public ItemComponent setLocation(DataType value) { 
3906          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
3907            throw new Error("Not the right type for ExplanationOfBenefit.item.location[x]: "+value.fhirType());
3908          this.location = value;
3909          return this;
3910        }
3911
3912        /**
3913         * @return {@link #quantity} (The number of repetitions of a service or product.)
3914         */
3915        public Quantity getQuantity() { 
3916          if (this.quantity == null)
3917            if (Configuration.errorOnAutoCreate())
3918              throw new Error("Attempt to auto-create ItemComponent.quantity");
3919            else if (Configuration.doAutoCreate())
3920              this.quantity = new Quantity(); // cc
3921          return this.quantity;
3922        }
3923
3924        public boolean hasQuantity() { 
3925          return this.quantity != null && !this.quantity.isEmpty();
3926        }
3927
3928        /**
3929         * @param value {@link #quantity} (The number of repetitions of a service or product.)
3930         */
3931        public ItemComponent setQuantity(Quantity value) { 
3932          this.quantity = value;
3933          return this;
3934        }
3935
3936        /**
3937         * @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.)
3938         */
3939        public Money getUnitPrice() { 
3940          if (this.unitPrice == null)
3941            if (Configuration.errorOnAutoCreate())
3942              throw new Error("Attempt to auto-create ItemComponent.unitPrice");
3943            else if (Configuration.doAutoCreate())
3944              this.unitPrice = new Money(); // cc
3945          return this.unitPrice;
3946        }
3947
3948        public boolean hasUnitPrice() { 
3949          return this.unitPrice != null && !this.unitPrice.isEmpty();
3950        }
3951
3952        /**
3953         * @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.)
3954         */
3955        public ItemComponent setUnitPrice(Money value) { 
3956          this.unitPrice = value;
3957          return this;
3958        }
3959
3960        /**
3961         * @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
3962         */
3963        public DecimalType getFactorElement() { 
3964          if (this.factor == null)
3965            if (Configuration.errorOnAutoCreate())
3966              throw new Error("Attempt to auto-create ItemComponent.factor");
3967            else if (Configuration.doAutoCreate())
3968              this.factor = new DecimalType(); // bb
3969          return this.factor;
3970        }
3971
3972        public boolean hasFactorElement() { 
3973          return this.factor != null && !this.factor.isEmpty();
3974        }
3975
3976        public boolean hasFactor() { 
3977          return this.factor != null && !this.factor.isEmpty();
3978        }
3979
3980        /**
3981         * @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
3982         */
3983        public ItemComponent setFactorElement(DecimalType value) { 
3984          this.factor = value;
3985          return this;
3986        }
3987
3988        /**
3989         * @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.
3990         */
3991        public BigDecimal getFactor() { 
3992          return this.factor == null ? null : this.factor.getValue();
3993        }
3994
3995        /**
3996         * @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.
3997         */
3998        public ItemComponent setFactor(BigDecimal value) { 
3999          if (value == null)
4000            this.factor = null;
4001          else {
4002            if (this.factor == null)
4003              this.factor = new DecimalType();
4004            this.factor.setValue(value);
4005          }
4006          return this;
4007        }
4008
4009        /**
4010         * @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.
4011         */
4012        public ItemComponent setFactor(long value) { 
4013              this.factor = new DecimalType();
4014            this.factor.setValue(value);
4015          return this;
4016        }
4017
4018        /**
4019         * @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.
4020         */
4021        public ItemComponent setFactor(double value) { 
4022              this.factor = new DecimalType();
4023            this.factor.setValue(value);
4024          return this;
4025        }
4026
4027        /**
4028         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4029         */
4030        public Money getNet() { 
4031          if (this.net == null)
4032            if (Configuration.errorOnAutoCreate())
4033              throw new Error("Attempt to auto-create ItemComponent.net");
4034            else if (Configuration.doAutoCreate())
4035              this.net = new Money(); // cc
4036          return this.net;
4037        }
4038
4039        public boolean hasNet() { 
4040          return this.net != null && !this.net.isEmpty();
4041        }
4042
4043        /**
4044         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4045         */
4046        public ItemComponent setNet(Money value) { 
4047          this.net = value;
4048          return this;
4049        }
4050
4051        /**
4052         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
4053         */
4054        public List<Reference> getUdi() { 
4055          if (this.udi == null)
4056            this.udi = new ArrayList<Reference>();
4057          return this.udi;
4058        }
4059
4060        /**
4061         * @return Returns a reference to <code>this</code> for easy method chaining
4062         */
4063        public ItemComponent setUdi(List<Reference> theUdi) { 
4064          this.udi = theUdi;
4065          return this;
4066        }
4067
4068        public boolean hasUdi() { 
4069          if (this.udi == null)
4070            return false;
4071          for (Reference item : this.udi)
4072            if (!item.isEmpty())
4073              return true;
4074          return false;
4075        }
4076
4077        public Reference addUdi() { //3
4078          Reference t = new Reference();
4079          if (this.udi == null)
4080            this.udi = new ArrayList<Reference>();
4081          this.udi.add(t);
4082          return t;
4083        }
4084
4085        public ItemComponent addUdi(Reference t) { //3
4086          if (t == null)
4087            return this;
4088          if (this.udi == null)
4089            this.udi = new ArrayList<Reference>();
4090          this.udi.add(t);
4091          return this;
4092        }
4093
4094        /**
4095         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
4096         */
4097        public Reference getUdiFirstRep() { 
4098          if (getUdi().isEmpty()) {
4099            addUdi();
4100          }
4101          return getUdi().get(0);
4102        }
4103
4104        /**
4105         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4106         */
4107        public CodeableConcept getBodySite() { 
4108          if (this.bodySite == null)
4109            if (Configuration.errorOnAutoCreate())
4110              throw new Error("Attempt to auto-create ItemComponent.bodySite");
4111            else if (Configuration.doAutoCreate())
4112              this.bodySite = new CodeableConcept(); // cc
4113          return this.bodySite;
4114        }
4115
4116        public boolean hasBodySite() { 
4117          return this.bodySite != null && !this.bodySite.isEmpty();
4118        }
4119
4120        /**
4121         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4122         */
4123        public ItemComponent setBodySite(CodeableConcept value) { 
4124          this.bodySite = value;
4125          return this;
4126        }
4127
4128        /**
4129         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
4130         */
4131        public List<CodeableConcept> getSubSite() { 
4132          if (this.subSite == null)
4133            this.subSite = new ArrayList<CodeableConcept>();
4134          return this.subSite;
4135        }
4136
4137        /**
4138         * @return Returns a reference to <code>this</code> for easy method chaining
4139         */
4140        public ItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
4141          this.subSite = theSubSite;
4142          return this;
4143        }
4144
4145        public boolean hasSubSite() { 
4146          if (this.subSite == null)
4147            return false;
4148          for (CodeableConcept item : this.subSite)
4149            if (!item.isEmpty())
4150              return true;
4151          return false;
4152        }
4153
4154        public CodeableConcept addSubSite() { //3
4155          CodeableConcept t = new CodeableConcept();
4156          if (this.subSite == null)
4157            this.subSite = new ArrayList<CodeableConcept>();
4158          this.subSite.add(t);
4159          return t;
4160        }
4161
4162        public ItemComponent addSubSite(CodeableConcept t) { //3
4163          if (t == null)
4164            return this;
4165          if (this.subSite == null)
4166            this.subSite = new ArrayList<CodeableConcept>();
4167          this.subSite.add(t);
4168          return this;
4169        }
4170
4171        /**
4172         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist {3}
4173         */
4174        public CodeableConcept getSubSiteFirstRep() { 
4175          if (getSubSite().isEmpty()) {
4176            addSubSite();
4177          }
4178          return getSubSite().get(0);
4179        }
4180
4181        /**
4182         * @return {@link #encounter} (A billed item may include goods or services provided in multiple encounters.)
4183         */
4184        public List<Reference> getEncounter() { 
4185          if (this.encounter == null)
4186            this.encounter = new ArrayList<Reference>();
4187          return this.encounter;
4188        }
4189
4190        /**
4191         * @return Returns a reference to <code>this</code> for easy method chaining
4192         */
4193        public ItemComponent setEncounter(List<Reference> theEncounter) { 
4194          this.encounter = theEncounter;
4195          return this;
4196        }
4197
4198        public boolean hasEncounter() { 
4199          if (this.encounter == null)
4200            return false;
4201          for (Reference item : this.encounter)
4202            if (!item.isEmpty())
4203              return true;
4204          return false;
4205        }
4206
4207        public Reference addEncounter() { //3
4208          Reference t = new Reference();
4209          if (this.encounter == null)
4210            this.encounter = new ArrayList<Reference>();
4211          this.encounter.add(t);
4212          return t;
4213        }
4214
4215        public ItemComponent addEncounter(Reference t) { //3
4216          if (t == null)
4217            return this;
4218          if (this.encounter == null)
4219            this.encounter = new ArrayList<Reference>();
4220          this.encounter.add(t);
4221          return this;
4222        }
4223
4224        /**
4225         * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist {3}
4226         */
4227        public Reference getEncounterFirstRep() { 
4228          if (getEncounter().isEmpty()) {
4229            addEncounter();
4230          }
4231          return getEncounter().get(0);
4232        }
4233
4234        /**
4235         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4236         */
4237        public List<PositiveIntType> getNoteNumber() { 
4238          if (this.noteNumber == null)
4239            this.noteNumber = new ArrayList<PositiveIntType>();
4240          return this.noteNumber;
4241        }
4242
4243        /**
4244         * @return Returns a reference to <code>this</code> for easy method chaining
4245         */
4246        public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
4247          this.noteNumber = theNoteNumber;
4248          return this;
4249        }
4250
4251        public boolean hasNoteNumber() { 
4252          if (this.noteNumber == null)
4253            return false;
4254          for (PositiveIntType item : this.noteNumber)
4255            if (!item.isEmpty())
4256              return true;
4257          return false;
4258        }
4259
4260        /**
4261         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4262         */
4263        public PositiveIntType addNoteNumberElement() {//2 
4264          PositiveIntType t = new PositiveIntType();
4265          if (this.noteNumber == null)
4266            this.noteNumber = new ArrayList<PositiveIntType>();
4267          this.noteNumber.add(t);
4268          return t;
4269        }
4270
4271        /**
4272         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4273         */
4274        public ItemComponent addNoteNumber(int value) { //1
4275          PositiveIntType t = new PositiveIntType();
4276          t.setValue(value);
4277          if (this.noteNumber == null)
4278            this.noteNumber = new ArrayList<PositiveIntType>();
4279          this.noteNumber.add(t);
4280          return this;
4281        }
4282
4283        /**
4284         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4285         */
4286        public boolean hasNoteNumber(int value) { 
4287          if (this.noteNumber == null)
4288            return false;
4289          for (PositiveIntType v : this.noteNumber)
4290            if (v.getValue().equals(value)) // positiveInt
4291              return true;
4292          return false;
4293        }
4294
4295        /**
4296         * @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.)
4297         */
4298        public List<AdjudicationComponent> getAdjudication() { 
4299          if (this.adjudication == null)
4300            this.adjudication = new ArrayList<AdjudicationComponent>();
4301          return this.adjudication;
4302        }
4303
4304        /**
4305         * @return Returns a reference to <code>this</code> for easy method chaining
4306         */
4307        public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
4308          this.adjudication = theAdjudication;
4309          return this;
4310        }
4311
4312        public boolean hasAdjudication() { 
4313          if (this.adjudication == null)
4314            return false;
4315          for (AdjudicationComponent item : this.adjudication)
4316            if (!item.isEmpty())
4317              return true;
4318          return false;
4319        }
4320
4321        public AdjudicationComponent addAdjudication() { //3
4322          AdjudicationComponent t = new AdjudicationComponent();
4323          if (this.adjudication == null)
4324            this.adjudication = new ArrayList<AdjudicationComponent>();
4325          this.adjudication.add(t);
4326          return t;
4327        }
4328
4329        public ItemComponent addAdjudication(AdjudicationComponent t) { //3
4330          if (t == null)
4331            return this;
4332          if (this.adjudication == null)
4333            this.adjudication = new ArrayList<AdjudicationComponent>();
4334          this.adjudication.add(t);
4335          return this;
4336        }
4337
4338        /**
4339         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
4340         */
4341        public AdjudicationComponent getAdjudicationFirstRep() { 
4342          if (getAdjudication().isEmpty()) {
4343            addAdjudication();
4344          }
4345          return getAdjudication().get(0);
4346        }
4347
4348        /**
4349         * @return {@link #detail} (Second-tier of goods and services.)
4350         */
4351        public List<DetailComponent> getDetail() { 
4352          if (this.detail == null)
4353            this.detail = new ArrayList<DetailComponent>();
4354          return this.detail;
4355        }
4356
4357        /**
4358         * @return Returns a reference to <code>this</code> for easy method chaining
4359         */
4360        public ItemComponent setDetail(List<DetailComponent> theDetail) { 
4361          this.detail = theDetail;
4362          return this;
4363        }
4364
4365        public boolean hasDetail() { 
4366          if (this.detail == null)
4367            return false;
4368          for (DetailComponent item : this.detail)
4369            if (!item.isEmpty())
4370              return true;
4371          return false;
4372        }
4373
4374        public DetailComponent addDetail() { //3
4375          DetailComponent t = new DetailComponent();
4376          if (this.detail == null)
4377            this.detail = new ArrayList<DetailComponent>();
4378          this.detail.add(t);
4379          return t;
4380        }
4381
4382        public ItemComponent addDetail(DetailComponent t) { //3
4383          if (t == null)
4384            return this;
4385          if (this.detail == null)
4386            this.detail = new ArrayList<DetailComponent>();
4387          this.detail.add(t);
4388          return this;
4389        }
4390
4391        /**
4392         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist {3}
4393         */
4394        public DetailComponent getDetailFirstRep() { 
4395          if (getDetail().isEmpty()) {
4396            addDetail();
4397          }
4398          return getDetail().get(0);
4399        }
4400
4401        protected void listChildren(List<Property> children) {
4402          super.listChildren(children);
4403          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
4404          children.add(new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence));
4405          children.add(new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence));
4406          children.add(new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence));
4407          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));
4408          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
4409          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
4410          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));
4411          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));
4412          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
4413          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));
4414          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
4415          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
4416          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));
4417          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));
4418          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
4419          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
4420          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
4421          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));
4422          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));
4423          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));
4424          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));
4425          children.add(new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
4426        }
4427
4428        @Override
4429        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4430          switch (_hash) {
4431          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence);
4432          case 1070083823: /*careTeamSequence*/  return new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence);
4433          case -909769262: /*diagnosisSequence*/  return new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence);
4434          case -808920140: /*procedureSequence*/  return new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence);
4435          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);
4436          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
4437          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);
4438          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);
4439          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);
4440          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
4441          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);
4442          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);
4443          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);
4444          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);
4445          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4446          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4447          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept", "Where the product or service was provided.", 0, 1, location);
4448          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address", "Where the product or service was provided.", 0, 1, location);
4449          case 755866390: /*locationReference*/  return new Property("location[x]", "Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4450          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
4451          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);
4452          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);
4453          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);
4454          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
4455          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
4456          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);
4457          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);
4458          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);
4459          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);
4460          case -1335224239: /*detail*/  return new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail);
4461          default: return super.getNamedProperty(_hash, _name, _checkValid);
4462          }
4463
4464        }
4465
4466      @Override
4467      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4468        switch (hash) {
4469        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
4470        case 1070083823: /*careTeamSequence*/ return this.careTeamSequence == null ? new Base[0] : this.careTeamSequence.toArray(new Base[this.careTeamSequence.size()]); // PositiveIntType
4471        case -909769262: /*diagnosisSequence*/ return this.diagnosisSequence == null ? new Base[0] : this.diagnosisSequence.toArray(new Base[this.diagnosisSequence.size()]); // PositiveIntType
4472        case -808920140: /*procedureSequence*/ return this.procedureSequence == null ? new Base[0] : this.procedureSequence.toArray(new Base[this.procedureSequence.size()]); // PositiveIntType
4473        case -702585587: /*informationSequence*/ return this.informationSequence == null ? new Base[0] : this.informationSequence.toArray(new Base[this.informationSequence.size()]); // PositiveIntType
4474        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
4475        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4476        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
4477        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
4478        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
4479        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // DataType
4480        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // DataType
4481        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
4482        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
4483        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
4484        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
4485        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
4486        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
4487        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
4488        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
4489        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
4490        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
4491        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
4492        default: return super.getProperty(hash, name, checkValid);
4493        }
4494
4495      }
4496
4497      @Override
4498      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4499        switch (hash) {
4500        case 1349547969: // sequence
4501          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
4502          return value;
4503        case 1070083823: // careTeamSequence
4504          this.getCareTeamSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4505          return value;
4506        case -909769262: // diagnosisSequence
4507          this.getDiagnosisSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4508          return value;
4509        case -808920140: // procedureSequence
4510          this.getProcedureSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4511          return value;
4512        case -702585587: // informationSequence
4513          this.getInformationSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4514          return value;
4515        case 1099842588: // revenue
4516          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4517          return value;
4518        case 50511102: // category
4519          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4520          return value;
4521        case 1957227299: // productOrService
4522          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4523          return value;
4524        case -615513385: // modifier
4525          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4526          return value;
4527        case 1010065041: // programCode
4528          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4529          return value;
4530        case 1379209295: // serviced
4531          this.serviced = TypeConvertor.castToType(value); // DataType
4532          return value;
4533        case 1901043637: // location
4534          this.location = TypeConvertor.castToType(value); // DataType
4535          return value;
4536        case -1285004149: // quantity
4537          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
4538          return value;
4539        case -486196699: // unitPrice
4540          this.unitPrice = TypeConvertor.castToMoney(value); // Money
4541          return value;
4542        case -1282148017: // factor
4543          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
4544          return value;
4545        case 108957: // net
4546          this.net = TypeConvertor.castToMoney(value); // Money
4547          return value;
4548        case 115642: // udi
4549          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
4550          return value;
4551        case 1702620169: // bodySite
4552          this.bodySite = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4553          return value;
4554        case -1868566105: // subSite
4555          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4556          return value;
4557        case 1524132147: // encounter
4558          this.getEncounter().add(TypeConvertor.castToReference(value)); // Reference
4559          return value;
4560        case -1110033957: // noteNumber
4561          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4562          return value;
4563        case -231349275: // adjudication
4564          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
4565          return value;
4566        case -1335224239: // detail
4567          this.getDetail().add((DetailComponent) value); // DetailComponent
4568          return value;
4569        default: return super.setProperty(hash, name, value);
4570        }
4571
4572      }
4573
4574      @Override
4575      public Base setProperty(String name, Base value) throws FHIRException {
4576        if (name.equals("sequence")) {
4577          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
4578        } else if (name.equals("careTeamSequence")) {
4579          this.getCareTeamSequence().add(TypeConvertor.castToPositiveInt(value));
4580        } else if (name.equals("diagnosisSequence")) {
4581          this.getDiagnosisSequence().add(TypeConvertor.castToPositiveInt(value));
4582        } else if (name.equals("procedureSequence")) {
4583          this.getProcedureSequence().add(TypeConvertor.castToPositiveInt(value));
4584        } else if (name.equals("informationSequence")) {
4585          this.getInformationSequence().add(TypeConvertor.castToPositiveInt(value));
4586        } else if (name.equals("revenue")) {
4587          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4588        } else if (name.equals("category")) {
4589          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4590        } else if (name.equals("productOrService")) {
4591          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4592        } else if (name.equals("modifier")) {
4593          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
4594        } else if (name.equals("programCode")) {
4595          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
4596        } else if (name.equals("serviced[x]")) {
4597          this.serviced = TypeConvertor.castToType(value); // DataType
4598        } else if (name.equals("location[x]")) {
4599          this.location = TypeConvertor.castToType(value); // DataType
4600        } else if (name.equals("quantity")) {
4601          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
4602        } else if (name.equals("unitPrice")) {
4603          this.unitPrice = TypeConvertor.castToMoney(value); // Money
4604        } else if (name.equals("factor")) {
4605          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
4606        } else if (name.equals("net")) {
4607          this.net = TypeConvertor.castToMoney(value); // Money
4608        } else if (name.equals("udi")) {
4609          this.getUdi().add(TypeConvertor.castToReference(value));
4610        } else if (name.equals("bodySite")) {
4611          this.bodySite = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4612        } else if (name.equals("subSite")) {
4613          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value));
4614        } else if (name.equals("encounter")) {
4615          this.getEncounter().add(TypeConvertor.castToReference(value));
4616        } else if (name.equals("noteNumber")) {
4617          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
4618        } else if (name.equals("adjudication")) {
4619          this.getAdjudication().add((AdjudicationComponent) value);
4620        } else if (name.equals("detail")) {
4621          this.getDetail().add((DetailComponent) value);
4622        } else
4623          return super.setProperty(name, value);
4624        return value;
4625      }
4626
4627      @Override
4628      public Base makeProperty(int hash, String name) throws FHIRException {
4629        switch (hash) {
4630        case 1349547969:  return getSequenceElement();
4631        case 1070083823:  return addCareTeamSequenceElement();
4632        case -909769262:  return addDiagnosisSequenceElement();
4633        case -808920140:  return addProcedureSequenceElement();
4634        case -702585587:  return addInformationSequenceElement();
4635        case 1099842588:  return getRevenue();
4636        case 50511102:  return getCategory();
4637        case 1957227299:  return getProductOrService();
4638        case -615513385:  return addModifier(); 
4639        case 1010065041:  return addProgramCode(); 
4640        case -1927922223:  return getServiced();
4641        case 1379209295:  return getServiced();
4642        case 552316075:  return getLocation();
4643        case 1901043637:  return getLocation();
4644        case -1285004149:  return getQuantity();
4645        case -486196699:  return getUnitPrice();
4646        case -1282148017:  return getFactorElement();
4647        case 108957:  return getNet();
4648        case 115642:  return addUdi(); 
4649        case 1702620169:  return getBodySite();
4650        case -1868566105:  return addSubSite(); 
4651        case 1524132147:  return addEncounter(); 
4652        case -1110033957:  return addNoteNumberElement();
4653        case -231349275:  return addAdjudication(); 
4654        case -1335224239:  return addDetail(); 
4655        default: return super.makeProperty(hash, name);
4656        }
4657
4658      }
4659
4660      @Override
4661      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4662        switch (hash) {
4663        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
4664        case 1070083823: /*careTeamSequence*/ return new String[] {"positiveInt"};
4665        case -909769262: /*diagnosisSequence*/ return new String[] {"positiveInt"};
4666        case -808920140: /*procedureSequence*/ return new String[] {"positiveInt"};
4667        case -702585587: /*informationSequence*/ return new String[] {"positiveInt"};
4668        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
4669        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4670        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
4671        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
4672        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
4673        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
4674        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
4675        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
4676        case -486196699: /*unitPrice*/ return new String[] {"Money"};
4677        case -1282148017: /*factor*/ return new String[] {"decimal"};
4678        case 108957: /*net*/ return new String[] {"Money"};
4679        case 115642: /*udi*/ return new String[] {"Reference"};
4680        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
4681        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
4682        case 1524132147: /*encounter*/ return new String[] {"Reference"};
4683        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
4684        case -231349275: /*adjudication*/ return new String[] {};
4685        case -1335224239: /*detail*/ return new String[] {};
4686        default: return super.getTypesForProperty(hash, name);
4687        }
4688
4689      }
4690
4691      @Override
4692      public Base addChild(String name) throws FHIRException {
4693        if (name.equals("sequence")) {
4694          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.sequence");
4695        }
4696        else if (name.equals("careTeamSequence")) {
4697          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.careTeamSequence");
4698        }
4699        else if (name.equals("diagnosisSequence")) {
4700          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.diagnosisSequence");
4701        }
4702        else if (name.equals("procedureSequence")) {
4703          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.procedureSequence");
4704        }
4705        else if (name.equals("informationSequence")) {
4706          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.informationSequence");
4707        }
4708        else if (name.equals("revenue")) {
4709          this.revenue = new CodeableConcept();
4710          return this.revenue;
4711        }
4712        else if (name.equals("category")) {
4713          this.category = new CodeableConcept();
4714          return this.category;
4715        }
4716        else if (name.equals("productOrService")) {
4717          this.productOrService = new CodeableConcept();
4718          return this.productOrService;
4719        }
4720        else if (name.equals("modifier")) {
4721          return addModifier();
4722        }
4723        else if (name.equals("programCode")) {
4724          return addProgramCode();
4725        }
4726        else if (name.equals("servicedDate")) {
4727          this.serviced = new DateType();
4728          return this.serviced;
4729        }
4730        else if (name.equals("servicedPeriod")) {
4731          this.serviced = new Period();
4732          return this.serviced;
4733        }
4734        else if (name.equals("locationCodeableConcept")) {
4735          this.location = new CodeableConcept();
4736          return this.location;
4737        }
4738        else if (name.equals("locationAddress")) {
4739          this.location = new Address();
4740          return this.location;
4741        }
4742        else if (name.equals("locationReference")) {
4743          this.location = new Reference();
4744          return this.location;
4745        }
4746        else if (name.equals("quantity")) {
4747          this.quantity = new Quantity();
4748          return this.quantity;
4749        }
4750        else if (name.equals("unitPrice")) {
4751          this.unitPrice = new Money();
4752          return this.unitPrice;
4753        }
4754        else if (name.equals("factor")) {
4755          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.factor");
4756        }
4757        else if (name.equals("net")) {
4758          this.net = new Money();
4759          return this.net;
4760        }
4761        else if (name.equals("udi")) {
4762          return addUdi();
4763        }
4764        else if (name.equals("bodySite")) {
4765          this.bodySite = new CodeableConcept();
4766          return this.bodySite;
4767        }
4768        else if (name.equals("subSite")) {
4769          return addSubSite();
4770        }
4771        else if (name.equals("encounter")) {
4772          return addEncounter();
4773        }
4774        else if (name.equals("noteNumber")) {
4775          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.noteNumber");
4776        }
4777        else if (name.equals("adjudication")) {
4778          return addAdjudication();
4779        }
4780        else if (name.equals("detail")) {
4781          return addDetail();
4782        }
4783        else
4784          return super.addChild(name);
4785      }
4786
4787      public ItemComponent copy() {
4788        ItemComponent dst = new ItemComponent();
4789        copyValues(dst);
4790        return dst;
4791      }
4792
4793      public void copyValues(ItemComponent dst) {
4794        super.copyValues(dst);
4795        dst.sequence = sequence == null ? null : sequence.copy();
4796        if (careTeamSequence != null) {
4797          dst.careTeamSequence = new ArrayList<PositiveIntType>();
4798          for (PositiveIntType i : careTeamSequence)
4799            dst.careTeamSequence.add(i.copy());
4800        };
4801        if (diagnosisSequence != null) {
4802          dst.diagnosisSequence = new ArrayList<PositiveIntType>();
4803          for (PositiveIntType i : diagnosisSequence)
4804            dst.diagnosisSequence.add(i.copy());
4805        };
4806        if (procedureSequence != null) {
4807          dst.procedureSequence = new ArrayList<PositiveIntType>();
4808          for (PositiveIntType i : procedureSequence)
4809            dst.procedureSequence.add(i.copy());
4810        };
4811        if (informationSequence != null) {
4812          dst.informationSequence = new ArrayList<PositiveIntType>();
4813          for (PositiveIntType i : informationSequence)
4814            dst.informationSequence.add(i.copy());
4815        };
4816        dst.revenue = revenue == null ? null : revenue.copy();
4817        dst.category = category == null ? null : category.copy();
4818        dst.productOrService = productOrService == null ? null : productOrService.copy();
4819        if (modifier != null) {
4820          dst.modifier = new ArrayList<CodeableConcept>();
4821          for (CodeableConcept i : modifier)
4822            dst.modifier.add(i.copy());
4823        };
4824        if (programCode != null) {
4825          dst.programCode = new ArrayList<CodeableConcept>();
4826          for (CodeableConcept i : programCode)
4827            dst.programCode.add(i.copy());
4828        };
4829        dst.serviced = serviced == null ? null : serviced.copy();
4830        dst.location = location == null ? null : location.copy();
4831        dst.quantity = quantity == null ? null : quantity.copy();
4832        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
4833        dst.factor = factor == null ? null : factor.copy();
4834        dst.net = net == null ? null : net.copy();
4835        if (udi != null) {
4836          dst.udi = new ArrayList<Reference>();
4837          for (Reference i : udi)
4838            dst.udi.add(i.copy());
4839        };
4840        dst.bodySite = bodySite == null ? null : bodySite.copy();
4841        if (subSite != null) {
4842          dst.subSite = new ArrayList<CodeableConcept>();
4843          for (CodeableConcept i : subSite)
4844            dst.subSite.add(i.copy());
4845        };
4846        if (encounter != null) {
4847          dst.encounter = new ArrayList<Reference>();
4848          for (Reference i : encounter)
4849            dst.encounter.add(i.copy());
4850        };
4851        if (noteNumber != null) {
4852          dst.noteNumber = new ArrayList<PositiveIntType>();
4853          for (PositiveIntType i : noteNumber)
4854            dst.noteNumber.add(i.copy());
4855        };
4856        if (adjudication != null) {
4857          dst.adjudication = new ArrayList<AdjudicationComponent>();
4858          for (AdjudicationComponent i : adjudication)
4859            dst.adjudication.add(i.copy());
4860        };
4861        if (detail != null) {
4862          dst.detail = new ArrayList<DetailComponent>();
4863          for (DetailComponent i : detail)
4864            dst.detail.add(i.copy());
4865        };
4866      }
4867
4868      @Override
4869      public boolean equalsDeep(Base other_) {
4870        if (!super.equalsDeep(other_))
4871          return false;
4872        if (!(other_ instanceof ItemComponent))
4873          return false;
4874        ItemComponent o = (ItemComponent) other_;
4875        return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamSequence, o.careTeamSequence, true)
4876           && compareDeep(diagnosisSequence, o.diagnosisSequence, true) && compareDeep(procedureSequence, o.procedureSequence, true)
4877           && compareDeep(informationSequence, o.informationSequence, true) && compareDeep(revenue, o.revenue, true)
4878           && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
4879           && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true)
4880           && compareDeep(location, o.location, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
4881           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
4882           && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true) && compareDeep(encounter, o.encounter, true)
4883           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
4884           && compareDeep(detail, o.detail, true);
4885      }
4886
4887      @Override
4888      public boolean equalsShallow(Base other_) {
4889        if (!super.equalsShallow(other_))
4890          return false;
4891        if (!(other_ instanceof ItemComponent))
4892          return false;
4893        ItemComponent o = (ItemComponent) other_;
4894        return compareValues(sequence, o.sequence, true) && compareValues(careTeamSequence, o.careTeamSequence, true)
4895           && compareValues(diagnosisSequence, o.diagnosisSequence, true) && compareValues(procedureSequence, o.procedureSequence, true)
4896           && compareValues(informationSequence, o.informationSequence, true) && compareValues(factor, o.factor, true)
4897           && compareValues(noteNumber, o.noteNumber, true);
4898      }
4899
4900      public boolean isEmpty() {
4901        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamSequence
4902          , diagnosisSequence, procedureSequence, informationSequence, revenue, category, productOrService
4903          , modifier, programCode, serviced, location, quantity, unitPrice, factor, net
4904          , udi, bodySite, subSite, encounter, noteNumber, adjudication, detail);
4905      }
4906
4907  public String fhirType() {
4908    return "ExplanationOfBenefit.item";
4909
4910  }
4911
4912  }
4913
4914    @Block()
4915    public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
4916        /**
4917         * 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.
4918         */
4919        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
4920        @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." )
4921        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
4922        protected CodeableConcept category;
4923
4924        /**
4925         * A code supporting the understanding of the adjudication result and explaining variance from expected amount.
4926         */
4927        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
4928        @Description(shortDefinition="Explanation of adjudication outcome", formalDefinition="A code supporting the understanding of the adjudication result and explaining variance from expected amount." )
4929        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-reason")
4930        protected CodeableConcept reason;
4931
4932        /**
4933         * Monetary amount associated with the category.
4934         */
4935        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
4936        @Description(shortDefinition="Monetary amount", formalDefinition="Monetary amount associated with the category." )
4937        protected Money amount;
4938
4939        /**
4940         * A non-monetary value associated with the category. Mutually exclusive to the amount element above.
4941         */
4942        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
4943        @Description(shortDefinition="Non-monitary value", formalDefinition="A non-monetary value associated with the category. Mutually exclusive to the amount element above." )
4944        protected DecimalType value;
4945
4946        private static final long serialVersionUID = 1559898786L;
4947
4948    /**
4949     * Constructor
4950     */
4951      public AdjudicationComponent() {
4952        super();
4953      }
4954
4955    /**
4956     * Constructor
4957     */
4958      public AdjudicationComponent(CodeableConcept category) {
4959        super();
4960        this.setCategory(category);
4961      }
4962
4963        /**
4964         * @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.)
4965         */
4966        public CodeableConcept getCategory() { 
4967          if (this.category == null)
4968            if (Configuration.errorOnAutoCreate())
4969              throw new Error("Attempt to auto-create AdjudicationComponent.category");
4970            else if (Configuration.doAutoCreate())
4971              this.category = new CodeableConcept(); // cc
4972          return this.category;
4973        }
4974
4975        public boolean hasCategory() { 
4976          return this.category != null && !this.category.isEmpty();
4977        }
4978
4979        /**
4980         * @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.)
4981         */
4982        public AdjudicationComponent setCategory(CodeableConcept value) { 
4983          this.category = value;
4984          return this;
4985        }
4986
4987        /**
4988         * @return {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
4989         */
4990        public CodeableConcept getReason() { 
4991          if (this.reason == null)
4992            if (Configuration.errorOnAutoCreate())
4993              throw new Error("Attempt to auto-create AdjudicationComponent.reason");
4994            else if (Configuration.doAutoCreate())
4995              this.reason = new CodeableConcept(); // cc
4996          return this.reason;
4997        }
4998
4999        public boolean hasReason() { 
5000          return this.reason != null && !this.reason.isEmpty();
5001        }
5002
5003        /**
5004         * @param value {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5005         */
5006        public AdjudicationComponent setReason(CodeableConcept value) { 
5007          this.reason = value;
5008          return this;
5009        }
5010
5011        /**
5012         * @return {@link #amount} (Monetary amount associated with the category.)
5013         */
5014        public Money getAmount() { 
5015          if (this.amount == null)
5016            if (Configuration.errorOnAutoCreate())
5017              throw new Error("Attempt to auto-create AdjudicationComponent.amount");
5018            else if (Configuration.doAutoCreate())
5019              this.amount = new Money(); // cc
5020          return this.amount;
5021        }
5022
5023        public boolean hasAmount() { 
5024          return this.amount != null && !this.amount.isEmpty();
5025        }
5026
5027        /**
5028         * @param value {@link #amount} (Monetary amount associated with the category.)
5029         */
5030        public AdjudicationComponent setAmount(Money value) { 
5031          this.amount = value;
5032          return this;
5033        }
5034
5035        /**
5036         * @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
5037         */
5038        public DecimalType getValueElement() { 
5039          if (this.value == null)
5040            if (Configuration.errorOnAutoCreate())
5041              throw new Error("Attempt to auto-create AdjudicationComponent.value");
5042            else if (Configuration.doAutoCreate())
5043              this.value = new DecimalType(); // bb
5044          return this.value;
5045        }
5046
5047        public boolean hasValueElement() { 
5048          return this.value != null && !this.value.isEmpty();
5049        }
5050
5051        public boolean hasValue() { 
5052          return this.value != null && !this.value.isEmpty();
5053        }
5054
5055        /**
5056         * @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
5057         */
5058        public AdjudicationComponent setValueElement(DecimalType value) { 
5059          this.value = value;
5060          return this;
5061        }
5062
5063        /**
5064         * @return A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5065         */
5066        public BigDecimal getValue() { 
5067          return this.value == null ? null : this.value.getValue();
5068        }
5069
5070        /**
5071         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5072         */
5073        public AdjudicationComponent setValue(BigDecimal value) { 
5074          if (value == null)
5075            this.value = null;
5076          else {
5077            if (this.value == null)
5078              this.value = new DecimalType();
5079            this.value.setValue(value);
5080          }
5081          return this;
5082        }
5083
5084        /**
5085         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5086         */
5087        public AdjudicationComponent setValue(long value) { 
5088              this.value = new DecimalType();
5089            this.value.setValue(value);
5090          return this;
5091        }
5092
5093        /**
5094         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5095         */
5096        public AdjudicationComponent setValue(double value) { 
5097              this.value = new DecimalType();
5098            this.value.setValue(value);
5099          return this;
5100        }
5101
5102        protected void listChildren(List<Property> children) {
5103          super.listChildren(children);
5104          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));
5105          children.add(new Property("reason", "CodeableConcept", "A code supporting the understanding of the adjudication result and explaining variance from expected amount.", 0, 1, reason));
5106          children.add(new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount));
5107          children.add(new Property("value", "decimal", "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1, value));
5108        }
5109
5110        @Override
5111        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5112          switch (_hash) {
5113          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);
5114          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);
5115          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount);
5116          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);
5117          default: return super.getNamedProperty(_hash, _name, _checkValid);
5118          }
5119
5120        }
5121
5122      @Override
5123      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5124        switch (hash) {
5125        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
5126        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
5127        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
5128        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
5129        default: return super.getProperty(hash, name, checkValid);
5130        }
5131
5132      }
5133
5134      @Override
5135      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5136        switch (hash) {
5137        case 50511102: // category
5138          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5139          return value;
5140        case -934964668: // reason
5141          this.reason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5142          return value;
5143        case -1413853096: // amount
5144          this.amount = TypeConvertor.castToMoney(value); // Money
5145          return value;
5146        case 111972721: // value
5147          this.value = TypeConvertor.castToDecimal(value); // DecimalType
5148          return value;
5149        default: return super.setProperty(hash, name, value);
5150        }
5151
5152      }
5153
5154      @Override
5155      public Base setProperty(String name, Base value) throws FHIRException {
5156        if (name.equals("category")) {
5157          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5158        } else if (name.equals("reason")) {
5159          this.reason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5160        } else if (name.equals("amount")) {
5161          this.amount = TypeConvertor.castToMoney(value); // Money
5162        } else if (name.equals("value")) {
5163          this.value = TypeConvertor.castToDecimal(value); // DecimalType
5164        } else
5165          return super.setProperty(name, value);
5166        return value;
5167      }
5168
5169      @Override
5170      public Base makeProperty(int hash, String name) throws FHIRException {
5171        switch (hash) {
5172        case 50511102:  return getCategory();
5173        case -934964668:  return getReason();
5174        case -1413853096:  return getAmount();
5175        case 111972721:  return getValueElement();
5176        default: return super.makeProperty(hash, name);
5177        }
5178
5179      }
5180
5181      @Override
5182      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5183        switch (hash) {
5184        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5185        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
5186        case -1413853096: /*amount*/ return new String[] {"Money"};
5187        case 111972721: /*value*/ return new String[] {"decimal"};
5188        default: return super.getTypesForProperty(hash, name);
5189        }
5190
5191      }
5192
5193      @Override
5194      public Base addChild(String name) throws FHIRException {
5195        if (name.equals("category")) {
5196          this.category = new CodeableConcept();
5197          return this.category;
5198        }
5199        else if (name.equals("reason")) {
5200          this.reason = new CodeableConcept();
5201          return this.reason;
5202        }
5203        else if (name.equals("amount")) {
5204          this.amount = new Money();
5205          return this.amount;
5206        }
5207        else if (name.equals("value")) {
5208          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.adjudication.value");
5209        }
5210        else
5211          return super.addChild(name);
5212      }
5213
5214      public AdjudicationComponent copy() {
5215        AdjudicationComponent dst = new AdjudicationComponent();
5216        copyValues(dst);
5217        return dst;
5218      }
5219
5220      public void copyValues(AdjudicationComponent dst) {
5221        super.copyValues(dst);
5222        dst.category = category == null ? null : category.copy();
5223        dst.reason = reason == null ? null : reason.copy();
5224        dst.amount = amount == null ? null : amount.copy();
5225        dst.value = value == null ? null : value.copy();
5226      }
5227
5228      @Override
5229      public boolean equalsDeep(Base other_) {
5230        if (!super.equalsDeep(other_))
5231          return false;
5232        if (!(other_ instanceof AdjudicationComponent))
5233          return false;
5234        AdjudicationComponent o = (AdjudicationComponent) other_;
5235        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
5236           && compareDeep(value, o.value, true);
5237      }
5238
5239      @Override
5240      public boolean equalsShallow(Base other_) {
5241        if (!super.equalsShallow(other_))
5242          return false;
5243        if (!(other_ instanceof AdjudicationComponent))
5244          return false;
5245        AdjudicationComponent o = (AdjudicationComponent) other_;
5246        return compareValues(value, o.value, true);
5247      }
5248
5249      public boolean isEmpty() {
5250        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount
5251          , value);
5252      }
5253
5254  public String fhirType() {
5255    return "ExplanationOfBenefit.item.adjudication";
5256
5257  }
5258
5259  }
5260
5261    @Block()
5262    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
5263        /**
5264         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5265         */
5266        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
5267        @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." )
5268        protected PositiveIntType sequence;
5269
5270        /**
5271         * The type of revenue or cost center providing the product and/or service.
5272         */
5273        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5274        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
5275        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
5276        protected CodeableConcept revenue;
5277
5278        /**
5279         * Code to identify the general type of benefits under which products and services are provided.
5280         */
5281        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
5282        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
5283        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
5284        protected CodeableConcept category;
5285
5286        /**
5287         * 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.
5288         */
5289        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
5290        @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." )
5291        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
5292        protected CodeableConcept productOrService;
5293
5294        /**
5295         * Item typification or modifiers codes to convey additional context for the product or service.
5296         */
5297        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5298        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
5299        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
5300        protected List<CodeableConcept> modifier;
5301
5302        /**
5303         * Identifies the program under which this may be recovered.
5304         */
5305        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5306        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
5307        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
5308        protected List<CodeableConcept> programCode;
5309
5310        /**
5311         * The number of repetitions of a service or product.
5312         */
5313        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
5314        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
5315        protected Quantity quantity;
5316
5317        /**
5318         * 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.
5319         */
5320        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
5321        @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." )
5322        protected Money unitPrice;
5323
5324        /**
5325         * 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.
5326         */
5327        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
5328        @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." )
5329        protected DecimalType factor;
5330
5331        /**
5332         * The quantity times the unit price for an additional service or product or charge.
5333         */
5334        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
5335        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
5336        protected Money net;
5337
5338        /**
5339         * Unique Device Identifiers associated with this line item.
5340         */
5341        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5342        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
5343        protected List<Reference> udi;
5344
5345        /**
5346         * The numbers associated with notes below which apply to the adjudication of this item.
5347         */
5348        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5349        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
5350        protected List<PositiveIntType> noteNumber;
5351
5352        /**
5353         * The adjudication results.
5354         */
5355        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5356        @Description(shortDefinition="Detail level adjudication details", formalDefinition="The adjudication results." )
5357        protected List<AdjudicationComponent> adjudication;
5358
5359        /**
5360         * Third-tier of goods and services.
5361         */
5362        @Child(name = "subDetail", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5363        @Description(shortDefinition="Additional items", formalDefinition="Third-tier of goods and services." )
5364        protected List<SubDetailComponent> subDetail;
5365
5366        private static final long serialVersionUID = -318460001L;
5367
5368    /**
5369     * Constructor
5370     */
5371      public DetailComponent() {
5372        super();
5373      }
5374
5375    /**
5376     * Constructor
5377     */
5378      public DetailComponent(int sequence, CodeableConcept productOrService) {
5379        super();
5380        this.setSequence(sequence);
5381        this.setProductOrService(productOrService);
5382      }
5383
5384        /**
5385         * @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
5386         */
5387        public PositiveIntType getSequenceElement() { 
5388          if (this.sequence == null)
5389            if (Configuration.errorOnAutoCreate())
5390              throw new Error("Attempt to auto-create DetailComponent.sequence");
5391            else if (Configuration.doAutoCreate())
5392              this.sequence = new PositiveIntType(); // bb
5393          return this.sequence;
5394        }
5395
5396        public boolean hasSequenceElement() { 
5397          return this.sequence != null && !this.sequence.isEmpty();
5398        }
5399
5400        public boolean hasSequence() { 
5401          return this.sequence != null && !this.sequence.isEmpty();
5402        }
5403
5404        /**
5405         * @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
5406         */
5407        public DetailComponent setSequenceElement(PositiveIntType value) { 
5408          this.sequence = value;
5409          return this;
5410        }
5411
5412        /**
5413         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5414         */
5415        public int getSequence() { 
5416          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
5417        }
5418
5419        /**
5420         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5421         */
5422        public DetailComponent setSequence(int value) { 
5423            if (this.sequence == null)
5424              this.sequence = new PositiveIntType();
5425            this.sequence.setValue(value);
5426          return this;
5427        }
5428
5429        /**
5430         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5431         */
5432        public CodeableConcept getRevenue() { 
5433          if (this.revenue == null)
5434            if (Configuration.errorOnAutoCreate())
5435              throw new Error("Attempt to auto-create DetailComponent.revenue");
5436            else if (Configuration.doAutoCreate())
5437              this.revenue = new CodeableConcept(); // cc
5438          return this.revenue;
5439        }
5440
5441        public boolean hasRevenue() { 
5442          return this.revenue != null && !this.revenue.isEmpty();
5443        }
5444
5445        /**
5446         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5447         */
5448        public DetailComponent setRevenue(CodeableConcept value) { 
5449          this.revenue = value;
5450          return this;
5451        }
5452
5453        /**
5454         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5455         */
5456        public CodeableConcept getCategory() { 
5457          if (this.category == null)
5458            if (Configuration.errorOnAutoCreate())
5459              throw new Error("Attempt to auto-create DetailComponent.category");
5460            else if (Configuration.doAutoCreate())
5461              this.category = new CodeableConcept(); // cc
5462          return this.category;
5463        }
5464
5465        public boolean hasCategory() { 
5466          return this.category != null && !this.category.isEmpty();
5467        }
5468
5469        /**
5470         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5471         */
5472        public DetailComponent setCategory(CodeableConcept value) { 
5473          this.category = value;
5474          return this;
5475        }
5476
5477        /**
5478         * @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.)
5479         */
5480        public CodeableConcept getProductOrService() { 
5481          if (this.productOrService == null)
5482            if (Configuration.errorOnAutoCreate())
5483              throw new Error("Attempt to auto-create DetailComponent.productOrService");
5484            else if (Configuration.doAutoCreate())
5485              this.productOrService = new CodeableConcept(); // cc
5486          return this.productOrService;
5487        }
5488
5489        public boolean hasProductOrService() { 
5490          return this.productOrService != null && !this.productOrService.isEmpty();
5491        }
5492
5493        /**
5494         * @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.)
5495         */
5496        public DetailComponent setProductOrService(CodeableConcept value) { 
5497          this.productOrService = value;
5498          return this;
5499        }
5500
5501        /**
5502         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
5503         */
5504        public List<CodeableConcept> getModifier() { 
5505          if (this.modifier == null)
5506            this.modifier = new ArrayList<CodeableConcept>();
5507          return this.modifier;
5508        }
5509
5510        /**
5511         * @return Returns a reference to <code>this</code> for easy method chaining
5512         */
5513        public DetailComponent setModifier(List<CodeableConcept> theModifier) { 
5514          this.modifier = theModifier;
5515          return this;
5516        }
5517
5518        public boolean hasModifier() { 
5519          if (this.modifier == null)
5520            return false;
5521          for (CodeableConcept item : this.modifier)
5522            if (!item.isEmpty())
5523              return true;
5524          return false;
5525        }
5526
5527        public CodeableConcept addModifier() { //3
5528          CodeableConcept t = new CodeableConcept();
5529          if (this.modifier == null)
5530            this.modifier = new ArrayList<CodeableConcept>();
5531          this.modifier.add(t);
5532          return t;
5533        }
5534
5535        public DetailComponent addModifier(CodeableConcept t) { //3
5536          if (t == null)
5537            return this;
5538          if (this.modifier == null)
5539            this.modifier = new ArrayList<CodeableConcept>();
5540          this.modifier.add(t);
5541          return this;
5542        }
5543
5544        /**
5545         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
5546         */
5547        public CodeableConcept getModifierFirstRep() { 
5548          if (getModifier().isEmpty()) {
5549            addModifier();
5550          }
5551          return getModifier().get(0);
5552        }
5553
5554        /**
5555         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
5556         */
5557        public List<CodeableConcept> getProgramCode() { 
5558          if (this.programCode == null)
5559            this.programCode = new ArrayList<CodeableConcept>();
5560          return this.programCode;
5561        }
5562
5563        /**
5564         * @return Returns a reference to <code>this</code> for easy method chaining
5565         */
5566        public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
5567          this.programCode = theProgramCode;
5568          return this;
5569        }
5570
5571        public boolean hasProgramCode() { 
5572          if (this.programCode == null)
5573            return false;
5574          for (CodeableConcept item : this.programCode)
5575            if (!item.isEmpty())
5576              return true;
5577          return false;
5578        }
5579
5580        public CodeableConcept addProgramCode() { //3
5581          CodeableConcept t = new CodeableConcept();
5582          if (this.programCode == null)
5583            this.programCode = new ArrayList<CodeableConcept>();
5584          this.programCode.add(t);
5585          return t;
5586        }
5587
5588        public DetailComponent addProgramCode(CodeableConcept t) { //3
5589          if (t == null)
5590            return this;
5591          if (this.programCode == null)
5592            this.programCode = new ArrayList<CodeableConcept>();
5593          this.programCode.add(t);
5594          return this;
5595        }
5596
5597        /**
5598         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
5599         */
5600        public CodeableConcept getProgramCodeFirstRep() { 
5601          if (getProgramCode().isEmpty()) {
5602            addProgramCode();
5603          }
5604          return getProgramCode().get(0);
5605        }
5606
5607        /**
5608         * @return {@link #quantity} (The number of repetitions of a service or product.)
5609         */
5610        public Quantity getQuantity() { 
5611          if (this.quantity == null)
5612            if (Configuration.errorOnAutoCreate())
5613              throw new Error("Attempt to auto-create DetailComponent.quantity");
5614            else if (Configuration.doAutoCreate())
5615              this.quantity = new Quantity(); // cc
5616          return this.quantity;
5617        }
5618
5619        public boolean hasQuantity() { 
5620          return this.quantity != null && !this.quantity.isEmpty();
5621        }
5622
5623        /**
5624         * @param value {@link #quantity} (The number of repetitions of a service or product.)
5625         */
5626        public DetailComponent setQuantity(Quantity value) { 
5627          this.quantity = value;
5628          return this;
5629        }
5630
5631        /**
5632         * @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.)
5633         */
5634        public Money getUnitPrice() { 
5635          if (this.unitPrice == null)
5636            if (Configuration.errorOnAutoCreate())
5637              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
5638            else if (Configuration.doAutoCreate())
5639              this.unitPrice = new Money(); // cc
5640          return this.unitPrice;
5641        }
5642
5643        public boolean hasUnitPrice() { 
5644          return this.unitPrice != null && !this.unitPrice.isEmpty();
5645        }
5646
5647        /**
5648         * @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.)
5649         */
5650        public DetailComponent setUnitPrice(Money value) { 
5651          this.unitPrice = value;
5652          return this;
5653        }
5654
5655        /**
5656         * @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
5657         */
5658        public DecimalType getFactorElement() { 
5659          if (this.factor == null)
5660            if (Configuration.errorOnAutoCreate())
5661              throw new Error("Attempt to auto-create DetailComponent.factor");
5662            else if (Configuration.doAutoCreate())
5663              this.factor = new DecimalType(); // bb
5664          return this.factor;
5665        }
5666
5667        public boolean hasFactorElement() { 
5668          return this.factor != null && !this.factor.isEmpty();
5669        }
5670
5671        public boolean hasFactor() { 
5672          return this.factor != null && !this.factor.isEmpty();
5673        }
5674
5675        /**
5676         * @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
5677         */
5678        public DetailComponent setFactorElement(DecimalType value) { 
5679          this.factor = value;
5680          return this;
5681        }
5682
5683        /**
5684         * @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.
5685         */
5686        public BigDecimal getFactor() { 
5687          return this.factor == null ? null : this.factor.getValue();
5688        }
5689
5690        /**
5691         * @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.
5692         */
5693        public DetailComponent setFactor(BigDecimal value) { 
5694          if (value == null)
5695            this.factor = null;
5696          else {
5697            if (this.factor == null)
5698              this.factor = new DecimalType();
5699            this.factor.setValue(value);
5700          }
5701          return this;
5702        }
5703
5704        /**
5705         * @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.
5706         */
5707        public DetailComponent setFactor(long value) { 
5708              this.factor = new DecimalType();
5709            this.factor.setValue(value);
5710          return this;
5711        }
5712
5713        /**
5714         * @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.
5715         */
5716        public DetailComponent setFactor(double value) { 
5717              this.factor = new DecimalType();
5718            this.factor.setValue(value);
5719          return this;
5720        }
5721
5722        /**
5723         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
5724         */
5725        public Money getNet() { 
5726          if (this.net == null)
5727            if (Configuration.errorOnAutoCreate())
5728              throw new Error("Attempt to auto-create DetailComponent.net");
5729            else if (Configuration.doAutoCreate())
5730              this.net = new Money(); // cc
5731          return this.net;
5732        }
5733
5734        public boolean hasNet() { 
5735          return this.net != null && !this.net.isEmpty();
5736        }
5737
5738        /**
5739         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
5740         */
5741        public DetailComponent setNet(Money value) { 
5742          this.net = value;
5743          return this;
5744        }
5745
5746        /**
5747         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
5748         */
5749        public List<Reference> getUdi() { 
5750          if (this.udi == null)
5751            this.udi = new ArrayList<Reference>();
5752          return this.udi;
5753        }
5754
5755        /**
5756         * @return Returns a reference to <code>this</code> for easy method chaining
5757         */
5758        public DetailComponent setUdi(List<Reference> theUdi) { 
5759          this.udi = theUdi;
5760          return this;
5761        }
5762
5763        public boolean hasUdi() { 
5764          if (this.udi == null)
5765            return false;
5766          for (Reference item : this.udi)
5767            if (!item.isEmpty())
5768              return true;
5769          return false;
5770        }
5771
5772        public Reference addUdi() { //3
5773          Reference t = new Reference();
5774          if (this.udi == null)
5775            this.udi = new ArrayList<Reference>();
5776          this.udi.add(t);
5777          return t;
5778        }
5779
5780        public DetailComponent addUdi(Reference t) { //3
5781          if (t == null)
5782            return this;
5783          if (this.udi == null)
5784            this.udi = new ArrayList<Reference>();
5785          this.udi.add(t);
5786          return this;
5787        }
5788
5789        /**
5790         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
5791         */
5792        public Reference getUdiFirstRep() { 
5793          if (getUdi().isEmpty()) {
5794            addUdi();
5795          }
5796          return getUdi().get(0);
5797        }
5798
5799        /**
5800         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
5801         */
5802        public List<PositiveIntType> getNoteNumber() { 
5803          if (this.noteNumber == null)
5804            this.noteNumber = new ArrayList<PositiveIntType>();
5805          return this.noteNumber;
5806        }
5807
5808        /**
5809         * @return Returns a reference to <code>this</code> for easy method chaining
5810         */
5811        public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
5812          this.noteNumber = theNoteNumber;
5813          return this;
5814        }
5815
5816        public boolean hasNoteNumber() { 
5817          if (this.noteNumber == null)
5818            return false;
5819          for (PositiveIntType item : this.noteNumber)
5820            if (!item.isEmpty())
5821              return true;
5822          return false;
5823        }
5824
5825        /**
5826         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
5827         */
5828        public PositiveIntType addNoteNumberElement() {//2 
5829          PositiveIntType t = new PositiveIntType();
5830          if (this.noteNumber == null)
5831            this.noteNumber = new ArrayList<PositiveIntType>();
5832          this.noteNumber.add(t);
5833          return t;
5834        }
5835
5836        /**
5837         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
5838         */
5839        public DetailComponent addNoteNumber(int value) { //1
5840          PositiveIntType t = new PositiveIntType();
5841          t.setValue(value);
5842          if (this.noteNumber == null)
5843            this.noteNumber = new ArrayList<PositiveIntType>();
5844          this.noteNumber.add(t);
5845          return this;
5846        }
5847
5848        /**
5849         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
5850         */
5851        public boolean hasNoteNumber(int value) { 
5852          if (this.noteNumber == null)
5853            return false;
5854          for (PositiveIntType v : this.noteNumber)
5855            if (v.getValue().equals(value)) // positiveInt
5856              return true;
5857          return false;
5858        }
5859
5860        /**
5861         * @return {@link #adjudication} (The adjudication results.)
5862         */
5863        public List<AdjudicationComponent> getAdjudication() { 
5864          if (this.adjudication == null)
5865            this.adjudication = new ArrayList<AdjudicationComponent>();
5866          return this.adjudication;
5867        }
5868
5869        /**
5870         * @return Returns a reference to <code>this</code> for easy method chaining
5871         */
5872        public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
5873          this.adjudication = theAdjudication;
5874          return this;
5875        }
5876
5877        public boolean hasAdjudication() { 
5878          if (this.adjudication == null)
5879            return false;
5880          for (AdjudicationComponent item : this.adjudication)
5881            if (!item.isEmpty())
5882              return true;
5883          return false;
5884        }
5885
5886        public AdjudicationComponent addAdjudication() { //3
5887          AdjudicationComponent t = new AdjudicationComponent();
5888          if (this.adjudication == null)
5889            this.adjudication = new ArrayList<AdjudicationComponent>();
5890          this.adjudication.add(t);
5891          return t;
5892        }
5893
5894        public DetailComponent addAdjudication(AdjudicationComponent t) { //3
5895          if (t == null)
5896            return this;
5897          if (this.adjudication == null)
5898            this.adjudication = new ArrayList<AdjudicationComponent>();
5899          this.adjudication.add(t);
5900          return this;
5901        }
5902
5903        /**
5904         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
5905         */
5906        public AdjudicationComponent getAdjudicationFirstRep() { 
5907          if (getAdjudication().isEmpty()) {
5908            addAdjudication();
5909          }
5910          return getAdjudication().get(0);
5911        }
5912
5913        /**
5914         * @return {@link #subDetail} (Third-tier of goods and services.)
5915         */
5916        public List<SubDetailComponent> getSubDetail() { 
5917          if (this.subDetail == null)
5918            this.subDetail = new ArrayList<SubDetailComponent>();
5919          return this.subDetail;
5920        }
5921
5922        /**
5923         * @return Returns a reference to <code>this</code> for easy method chaining
5924         */
5925        public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) { 
5926          this.subDetail = theSubDetail;
5927          return this;
5928        }
5929
5930        public boolean hasSubDetail() { 
5931          if (this.subDetail == null)
5932            return false;
5933          for (SubDetailComponent item : this.subDetail)
5934            if (!item.isEmpty())
5935              return true;
5936          return false;
5937        }
5938
5939        public SubDetailComponent addSubDetail() { //3
5940          SubDetailComponent t = new SubDetailComponent();
5941          if (this.subDetail == null)
5942            this.subDetail = new ArrayList<SubDetailComponent>();
5943          this.subDetail.add(t);
5944          return t;
5945        }
5946
5947        public DetailComponent addSubDetail(SubDetailComponent t) { //3
5948          if (t == null)
5949            return this;
5950          if (this.subDetail == null)
5951            this.subDetail = new ArrayList<SubDetailComponent>();
5952          this.subDetail.add(t);
5953          return this;
5954        }
5955
5956        /**
5957         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist {3}
5958         */
5959        public SubDetailComponent getSubDetailFirstRep() { 
5960          if (getSubDetail().isEmpty()) {
5961            addSubDetail();
5962          }
5963          return getSubDetail().get(0);
5964        }
5965
5966        protected void listChildren(List<Property> children) {
5967          super.listChildren(children);
5968          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));
5969          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
5970          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
5971          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));
5972          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));
5973          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
5974          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
5975          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));
5976          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));
5977          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
5978          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
5979          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));
5980          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
5981          children.add(new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
5982        }
5983
5984        @Override
5985        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5986          switch (_hash) {
5987          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);
5988          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
5989          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);
5990          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);
5991          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);
5992          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
5993          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
5994          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);
5995          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);
5996          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);
5997          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
5998          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);
5999          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6000          case -828829007: /*subDetail*/  return new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
6001          default: return super.getNamedProperty(_hash, _name, _checkValid);
6002          }
6003
6004        }
6005
6006      @Override
6007      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6008        switch (hash) {
6009        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6010        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6011        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6012        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
6013        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6014        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6015        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
6016        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6017        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6018        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6019        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6020        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
6021        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
6022        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
6023        default: return super.getProperty(hash, name, checkValid);
6024        }
6025
6026      }
6027
6028      @Override
6029      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6030        switch (hash) {
6031        case 1349547969: // sequence
6032          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
6033          return value;
6034        case 1099842588: // revenue
6035          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6036          return value;
6037        case 50511102: // category
6038          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6039          return value;
6040        case 1957227299: // productOrService
6041          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6042          return value;
6043        case -615513385: // modifier
6044          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
6045          return value;
6046        case 1010065041: // programCode
6047          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
6048          return value;
6049        case -1285004149: // quantity
6050          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
6051          return value;
6052        case -486196699: // unitPrice
6053          this.unitPrice = TypeConvertor.castToMoney(value); // Money
6054          return value;
6055        case -1282148017: // factor
6056          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
6057          return value;
6058        case 108957: // net
6059          this.net = TypeConvertor.castToMoney(value); // Money
6060          return value;
6061        case 115642: // udi
6062          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
6063          return value;
6064        case -1110033957: // noteNumber
6065          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
6066          return value;
6067        case -231349275: // adjudication
6068          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
6069          return value;
6070        case -828829007: // subDetail
6071          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
6072          return value;
6073        default: return super.setProperty(hash, name, value);
6074        }
6075
6076      }
6077
6078      @Override
6079      public Base setProperty(String name, Base value) throws FHIRException {
6080        if (name.equals("sequence")) {
6081          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
6082        } else if (name.equals("revenue")) {
6083          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6084        } else if (name.equals("category")) {
6085          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6086        } else if (name.equals("productOrService")) {
6087          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6088        } else if (name.equals("modifier")) {
6089          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
6090        } else if (name.equals("programCode")) {
6091          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
6092        } else if (name.equals("quantity")) {
6093          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
6094        } else if (name.equals("unitPrice")) {
6095          this.unitPrice = TypeConvertor.castToMoney(value); // Money
6096        } else if (name.equals("factor")) {
6097          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
6098        } else if (name.equals("net")) {
6099          this.net = TypeConvertor.castToMoney(value); // Money
6100        } else if (name.equals("udi")) {
6101          this.getUdi().add(TypeConvertor.castToReference(value));
6102        } else if (name.equals("noteNumber")) {
6103          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
6104        } else if (name.equals("adjudication")) {
6105          this.getAdjudication().add((AdjudicationComponent) value);
6106        } else if (name.equals("subDetail")) {
6107          this.getSubDetail().add((SubDetailComponent) value);
6108        } else
6109          return super.setProperty(name, value);
6110        return value;
6111      }
6112
6113      @Override
6114      public Base makeProperty(int hash, String name) throws FHIRException {
6115        switch (hash) {
6116        case 1349547969:  return getSequenceElement();
6117        case 1099842588:  return getRevenue();
6118        case 50511102:  return getCategory();
6119        case 1957227299:  return getProductOrService();
6120        case -615513385:  return addModifier(); 
6121        case 1010065041:  return addProgramCode(); 
6122        case -1285004149:  return getQuantity();
6123        case -486196699:  return getUnitPrice();
6124        case -1282148017:  return getFactorElement();
6125        case 108957:  return getNet();
6126        case 115642:  return addUdi(); 
6127        case -1110033957:  return addNoteNumberElement();
6128        case -231349275:  return addAdjudication(); 
6129        case -828829007:  return addSubDetail(); 
6130        default: return super.makeProperty(hash, name);
6131        }
6132
6133      }
6134
6135      @Override
6136      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6137        switch (hash) {
6138        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
6139        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
6140        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
6141        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
6142        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
6143        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
6144        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
6145        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6146        case -1282148017: /*factor*/ return new String[] {"decimal"};
6147        case 108957: /*net*/ return new String[] {"Money"};
6148        case 115642: /*udi*/ return new String[] {"Reference"};
6149        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
6150        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
6151        case -828829007: /*subDetail*/ return new String[] {};
6152        default: return super.getTypesForProperty(hash, name);
6153        }
6154
6155      }
6156
6157      @Override
6158      public Base addChild(String name) throws FHIRException {
6159        if (name.equals("sequence")) {
6160          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.sequence");
6161        }
6162        else if (name.equals("revenue")) {
6163          this.revenue = new CodeableConcept();
6164          return this.revenue;
6165        }
6166        else if (name.equals("category")) {
6167          this.category = new CodeableConcept();
6168          return this.category;
6169        }
6170        else if (name.equals("productOrService")) {
6171          this.productOrService = new CodeableConcept();
6172          return this.productOrService;
6173        }
6174        else if (name.equals("modifier")) {
6175          return addModifier();
6176        }
6177        else if (name.equals("programCode")) {
6178          return addProgramCode();
6179        }
6180        else if (name.equals("quantity")) {
6181          this.quantity = new Quantity();
6182          return this.quantity;
6183        }
6184        else if (name.equals("unitPrice")) {
6185          this.unitPrice = new Money();
6186          return this.unitPrice;
6187        }
6188        else if (name.equals("factor")) {
6189          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.factor");
6190        }
6191        else if (name.equals("net")) {
6192          this.net = new Money();
6193          return this.net;
6194        }
6195        else if (name.equals("udi")) {
6196          return addUdi();
6197        }
6198        else if (name.equals("noteNumber")) {
6199          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.noteNumber");
6200        }
6201        else if (name.equals("adjudication")) {
6202          return addAdjudication();
6203        }
6204        else if (name.equals("subDetail")) {
6205          return addSubDetail();
6206        }
6207        else
6208          return super.addChild(name);
6209      }
6210
6211      public DetailComponent copy() {
6212        DetailComponent dst = new DetailComponent();
6213        copyValues(dst);
6214        return dst;
6215      }
6216
6217      public void copyValues(DetailComponent dst) {
6218        super.copyValues(dst);
6219        dst.sequence = sequence == null ? null : sequence.copy();
6220        dst.revenue = revenue == null ? null : revenue.copy();
6221        dst.category = category == null ? null : category.copy();
6222        dst.productOrService = productOrService == null ? null : productOrService.copy();
6223        if (modifier != null) {
6224          dst.modifier = new ArrayList<CodeableConcept>();
6225          for (CodeableConcept i : modifier)
6226            dst.modifier.add(i.copy());
6227        };
6228        if (programCode != null) {
6229          dst.programCode = new ArrayList<CodeableConcept>();
6230          for (CodeableConcept i : programCode)
6231            dst.programCode.add(i.copy());
6232        };
6233        dst.quantity = quantity == null ? null : quantity.copy();
6234        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6235        dst.factor = factor == null ? null : factor.copy();
6236        dst.net = net == null ? null : net.copy();
6237        if (udi != null) {
6238          dst.udi = new ArrayList<Reference>();
6239          for (Reference i : udi)
6240            dst.udi.add(i.copy());
6241        };
6242        if (noteNumber != null) {
6243          dst.noteNumber = new ArrayList<PositiveIntType>();
6244          for (PositiveIntType i : noteNumber)
6245            dst.noteNumber.add(i.copy());
6246        };
6247        if (adjudication != null) {
6248          dst.adjudication = new ArrayList<AdjudicationComponent>();
6249          for (AdjudicationComponent i : adjudication)
6250            dst.adjudication.add(i.copy());
6251        };
6252        if (subDetail != null) {
6253          dst.subDetail = new ArrayList<SubDetailComponent>();
6254          for (SubDetailComponent i : subDetail)
6255            dst.subDetail.add(i.copy());
6256        };
6257      }
6258
6259      @Override
6260      public boolean equalsDeep(Base other_) {
6261        if (!super.equalsDeep(other_))
6262          return false;
6263        if (!(other_ instanceof DetailComponent))
6264          return false;
6265        DetailComponent o = (DetailComponent) other_;
6266        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
6267           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
6268           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
6269           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6270           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
6271           && compareDeep(subDetail, o.subDetail, true);
6272      }
6273
6274      @Override
6275      public boolean equalsShallow(Base other_) {
6276        if (!super.equalsShallow(other_))
6277          return false;
6278        if (!(other_ instanceof DetailComponent))
6279          return false;
6280        DetailComponent o = (DetailComponent) other_;
6281        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
6282          ;
6283      }
6284
6285      public boolean isEmpty() {
6286        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
6287          , productOrService, modifier, programCode, quantity, unitPrice, factor, net, udi
6288          , noteNumber, adjudication, subDetail);
6289      }
6290
6291  public String fhirType() {
6292    return "ExplanationOfBenefit.item.detail";
6293
6294  }
6295
6296  }
6297
6298    @Block()
6299    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
6300        /**
6301         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6302         */
6303        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
6304        @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." )
6305        protected PositiveIntType sequence;
6306
6307        /**
6308         * The type of revenue or cost center providing the product and/or service.
6309         */
6310        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
6311        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
6312        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
6313        protected CodeableConcept revenue;
6314
6315        /**
6316         * Code to identify the general type of benefits under which products and services are provided.
6317         */
6318        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
6319        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
6320        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
6321        protected CodeableConcept category;
6322
6323        /**
6324         * 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.
6325         */
6326        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
6327        @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." )
6328        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6329        protected CodeableConcept productOrService;
6330
6331        /**
6332         * Item typification or modifiers codes to convey additional context for the product or service.
6333         */
6334        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6335        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
6336        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
6337        protected List<CodeableConcept> modifier;
6338
6339        /**
6340         * Identifies the program under which this may be recovered.
6341         */
6342        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6343        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
6344        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
6345        protected List<CodeableConcept> programCode;
6346
6347        /**
6348         * The number of repetitions of a service or product.
6349         */
6350        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
6351        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
6352        protected Quantity quantity;
6353
6354        /**
6355         * 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.
6356         */
6357        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
6358        @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." )
6359        protected Money unitPrice;
6360
6361        /**
6362         * 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.
6363         */
6364        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
6365        @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." )
6366        protected DecimalType factor;
6367
6368        /**
6369         * The quantity times the unit price for an additional service or product or charge.
6370         */
6371        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
6372        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
6373        protected Money net;
6374
6375        /**
6376         * Unique Device Identifiers associated with this line item.
6377         */
6378        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6379        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
6380        protected List<Reference> udi;
6381
6382        /**
6383         * The numbers associated with notes below which apply to the adjudication of this item.
6384         */
6385        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6386        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
6387        protected List<PositiveIntType> noteNumber;
6388
6389        /**
6390         * The adjudication results.
6391         */
6392        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6393        @Description(shortDefinition="Subdetail level adjudication details", formalDefinition="The adjudication results." )
6394        protected List<AdjudicationComponent> adjudication;
6395
6396        private static final long serialVersionUID = -579551678L;
6397
6398    /**
6399     * Constructor
6400     */
6401      public SubDetailComponent() {
6402        super();
6403      }
6404
6405    /**
6406     * Constructor
6407     */
6408      public SubDetailComponent(int sequence, CodeableConcept productOrService) {
6409        super();
6410        this.setSequence(sequence);
6411        this.setProductOrService(productOrService);
6412      }
6413
6414        /**
6415         * @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
6416         */
6417        public PositiveIntType getSequenceElement() { 
6418          if (this.sequence == null)
6419            if (Configuration.errorOnAutoCreate())
6420              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
6421            else if (Configuration.doAutoCreate())
6422              this.sequence = new PositiveIntType(); // bb
6423          return this.sequence;
6424        }
6425
6426        public boolean hasSequenceElement() { 
6427          return this.sequence != null && !this.sequence.isEmpty();
6428        }
6429
6430        public boolean hasSequence() { 
6431          return this.sequence != null && !this.sequence.isEmpty();
6432        }
6433
6434        /**
6435         * @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
6436         */
6437        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
6438          this.sequence = value;
6439          return this;
6440        }
6441
6442        /**
6443         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6444         */
6445        public int getSequence() { 
6446          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6447        }
6448
6449        /**
6450         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6451         */
6452        public SubDetailComponent setSequence(int value) { 
6453            if (this.sequence == null)
6454              this.sequence = new PositiveIntType();
6455            this.sequence.setValue(value);
6456          return this;
6457        }
6458
6459        /**
6460         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6461         */
6462        public CodeableConcept getRevenue() { 
6463          if (this.revenue == null)
6464            if (Configuration.errorOnAutoCreate())
6465              throw new Error("Attempt to auto-create SubDetailComponent.revenue");
6466            else if (Configuration.doAutoCreate())
6467              this.revenue = new CodeableConcept(); // cc
6468          return this.revenue;
6469        }
6470
6471        public boolean hasRevenue() { 
6472          return this.revenue != null && !this.revenue.isEmpty();
6473        }
6474
6475        /**
6476         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6477         */
6478        public SubDetailComponent setRevenue(CodeableConcept value) { 
6479          this.revenue = value;
6480          return this;
6481        }
6482
6483        /**
6484         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
6485         */
6486        public CodeableConcept getCategory() { 
6487          if (this.category == null)
6488            if (Configuration.errorOnAutoCreate())
6489              throw new Error("Attempt to auto-create SubDetailComponent.category");
6490            else if (Configuration.doAutoCreate())
6491              this.category = new CodeableConcept(); // cc
6492          return this.category;
6493        }
6494
6495        public boolean hasCategory() { 
6496          return this.category != null && !this.category.isEmpty();
6497        }
6498
6499        /**
6500         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
6501         */
6502        public SubDetailComponent setCategory(CodeableConcept value) { 
6503          this.category = value;
6504          return this;
6505        }
6506
6507        /**
6508         * @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.)
6509         */
6510        public CodeableConcept getProductOrService() { 
6511          if (this.productOrService == null)
6512            if (Configuration.errorOnAutoCreate())
6513              throw new Error("Attempt to auto-create SubDetailComponent.productOrService");
6514            else if (Configuration.doAutoCreate())
6515              this.productOrService = new CodeableConcept(); // cc
6516          return this.productOrService;
6517        }
6518
6519        public boolean hasProductOrService() { 
6520          return this.productOrService != null && !this.productOrService.isEmpty();
6521        }
6522
6523        /**
6524         * @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.)
6525         */
6526        public SubDetailComponent setProductOrService(CodeableConcept value) { 
6527          this.productOrService = value;
6528          return this;
6529        }
6530
6531        /**
6532         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
6533         */
6534        public List<CodeableConcept> getModifier() { 
6535          if (this.modifier == null)
6536            this.modifier = new ArrayList<CodeableConcept>();
6537          return this.modifier;
6538        }
6539
6540        /**
6541         * @return Returns a reference to <code>this</code> for easy method chaining
6542         */
6543        public SubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
6544          this.modifier = theModifier;
6545          return this;
6546        }
6547
6548        public boolean hasModifier() { 
6549          if (this.modifier == null)
6550            return false;
6551          for (CodeableConcept item : this.modifier)
6552            if (!item.isEmpty())
6553              return true;
6554          return false;
6555        }
6556
6557        public CodeableConcept addModifier() { //3
6558          CodeableConcept t = new CodeableConcept();
6559          if (this.modifier == null)
6560            this.modifier = new ArrayList<CodeableConcept>();
6561          this.modifier.add(t);
6562          return t;
6563        }
6564
6565        public SubDetailComponent addModifier(CodeableConcept t) { //3
6566          if (t == null)
6567            return this;
6568          if (this.modifier == null)
6569            this.modifier = new ArrayList<CodeableConcept>();
6570          this.modifier.add(t);
6571          return this;
6572        }
6573
6574        /**
6575         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
6576         */
6577        public CodeableConcept getModifierFirstRep() { 
6578          if (getModifier().isEmpty()) {
6579            addModifier();
6580          }
6581          return getModifier().get(0);
6582        }
6583
6584        /**
6585         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
6586         */
6587        public List<CodeableConcept> getProgramCode() { 
6588          if (this.programCode == null)
6589            this.programCode = new ArrayList<CodeableConcept>();
6590          return this.programCode;
6591        }
6592
6593        /**
6594         * @return Returns a reference to <code>this</code> for easy method chaining
6595         */
6596        public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
6597          this.programCode = theProgramCode;
6598          return this;
6599        }
6600
6601        public boolean hasProgramCode() { 
6602          if (this.programCode == null)
6603            return false;
6604          for (CodeableConcept item : this.programCode)
6605            if (!item.isEmpty())
6606              return true;
6607          return false;
6608        }
6609
6610        public CodeableConcept addProgramCode() { //3
6611          CodeableConcept t = new CodeableConcept();
6612          if (this.programCode == null)
6613            this.programCode = new ArrayList<CodeableConcept>();
6614          this.programCode.add(t);
6615          return t;
6616        }
6617
6618        public SubDetailComponent addProgramCode(CodeableConcept t) { //3
6619          if (t == null)
6620            return this;
6621          if (this.programCode == null)
6622            this.programCode = new ArrayList<CodeableConcept>();
6623          this.programCode.add(t);
6624          return this;
6625        }
6626
6627        /**
6628         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
6629         */
6630        public CodeableConcept getProgramCodeFirstRep() { 
6631          if (getProgramCode().isEmpty()) {
6632            addProgramCode();
6633          }
6634          return getProgramCode().get(0);
6635        }
6636
6637        /**
6638         * @return {@link #quantity} (The number of repetitions of a service or product.)
6639         */
6640        public Quantity getQuantity() { 
6641          if (this.quantity == null)
6642            if (Configuration.errorOnAutoCreate())
6643              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
6644            else if (Configuration.doAutoCreate())
6645              this.quantity = new Quantity(); // cc
6646          return this.quantity;
6647        }
6648
6649        public boolean hasQuantity() { 
6650          return this.quantity != null && !this.quantity.isEmpty();
6651        }
6652
6653        /**
6654         * @param value {@link #quantity} (The number of repetitions of a service or product.)
6655         */
6656        public SubDetailComponent setQuantity(Quantity value) { 
6657          this.quantity = value;
6658          return this;
6659        }
6660
6661        /**
6662         * @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.)
6663         */
6664        public Money getUnitPrice() { 
6665          if (this.unitPrice == null)
6666            if (Configuration.errorOnAutoCreate())
6667              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
6668            else if (Configuration.doAutoCreate())
6669              this.unitPrice = new Money(); // cc
6670          return this.unitPrice;
6671        }
6672
6673        public boolean hasUnitPrice() { 
6674          return this.unitPrice != null && !this.unitPrice.isEmpty();
6675        }
6676
6677        /**
6678         * @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.)
6679         */
6680        public SubDetailComponent setUnitPrice(Money value) { 
6681          this.unitPrice = value;
6682          return this;
6683        }
6684
6685        /**
6686         * @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
6687         */
6688        public DecimalType getFactorElement() { 
6689          if (this.factor == null)
6690            if (Configuration.errorOnAutoCreate())
6691              throw new Error("Attempt to auto-create SubDetailComponent.factor");
6692            else if (Configuration.doAutoCreate())
6693              this.factor = new DecimalType(); // bb
6694          return this.factor;
6695        }
6696
6697        public boolean hasFactorElement() { 
6698          return this.factor != null && !this.factor.isEmpty();
6699        }
6700
6701        public boolean hasFactor() { 
6702          return this.factor != null && !this.factor.isEmpty();
6703        }
6704
6705        /**
6706         * @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
6707         */
6708        public SubDetailComponent setFactorElement(DecimalType value) { 
6709          this.factor = value;
6710          return this;
6711        }
6712
6713        /**
6714         * @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.
6715         */
6716        public BigDecimal getFactor() { 
6717          return this.factor == null ? null : this.factor.getValue();
6718        }
6719
6720        /**
6721         * @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.
6722         */
6723        public SubDetailComponent setFactor(BigDecimal value) { 
6724          if (value == null)
6725            this.factor = null;
6726          else {
6727            if (this.factor == null)
6728              this.factor = new DecimalType();
6729            this.factor.setValue(value);
6730          }
6731          return this;
6732        }
6733
6734        /**
6735         * @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.
6736         */
6737        public SubDetailComponent setFactor(long value) { 
6738              this.factor = new DecimalType();
6739            this.factor.setValue(value);
6740          return this;
6741        }
6742
6743        /**
6744         * @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.
6745         */
6746        public SubDetailComponent setFactor(double value) { 
6747              this.factor = new DecimalType();
6748            this.factor.setValue(value);
6749          return this;
6750        }
6751
6752        /**
6753         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6754         */
6755        public Money getNet() { 
6756          if (this.net == null)
6757            if (Configuration.errorOnAutoCreate())
6758              throw new Error("Attempt to auto-create SubDetailComponent.net");
6759            else if (Configuration.doAutoCreate())
6760              this.net = new Money(); // cc
6761          return this.net;
6762        }
6763
6764        public boolean hasNet() { 
6765          return this.net != null && !this.net.isEmpty();
6766        }
6767
6768        /**
6769         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6770         */
6771        public SubDetailComponent setNet(Money value) { 
6772          this.net = value;
6773          return this;
6774        }
6775
6776        /**
6777         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
6778         */
6779        public List<Reference> getUdi() { 
6780          if (this.udi == null)
6781            this.udi = new ArrayList<Reference>();
6782          return this.udi;
6783        }
6784
6785        /**
6786         * @return Returns a reference to <code>this</code> for easy method chaining
6787         */
6788        public SubDetailComponent setUdi(List<Reference> theUdi) { 
6789          this.udi = theUdi;
6790          return this;
6791        }
6792
6793        public boolean hasUdi() { 
6794          if (this.udi == null)
6795            return false;
6796          for (Reference item : this.udi)
6797            if (!item.isEmpty())
6798              return true;
6799          return false;
6800        }
6801
6802        public Reference addUdi() { //3
6803          Reference t = new Reference();
6804          if (this.udi == null)
6805            this.udi = new ArrayList<Reference>();
6806          this.udi.add(t);
6807          return t;
6808        }
6809
6810        public SubDetailComponent addUdi(Reference t) { //3
6811          if (t == null)
6812            return this;
6813          if (this.udi == null)
6814            this.udi = new ArrayList<Reference>();
6815          this.udi.add(t);
6816          return this;
6817        }
6818
6819        /**
6820         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
6821         */
6822        public Reference getUdiFirstRep() { 
6823          if (getUdi().isEmpty()) {
6824            addUdi();
6825          }
6826          return getUdi().get(0);
6827        }
6828
6829        /**
6830         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6831         */
6832        public List<PositiveIntType> getNoteNumber() { 
6833          if (this.noteNumber == null)
6834            this.noteNumber = new ArrayList<PositiveIntType>();
6835          return this.noteNumber;
6836        }
6837
6838        /**
6839         * @return Returns a reference to <code>this</code> for easy method chaining
6840         */
6841        public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
6842          this.noteNumber = theNoteNumber;
6843          return this;
6844        }
6845
6846        public boolean hasNoteNumber() { 
6847          if (this.noteNumber == null)
6848            return false;
6849          for (PositiveIntType item : this.noteNumber)
6850            if (!item.isEmpty())
6851              return true;
6852          return false;
6853        }
6854
6855        /**
6856         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6857         */
6858        public PositiveIntType addNoteNumberElement() {//2 
6859          PositiveIntType t = new PositiveIntType();
6860          if (this.noteNumber == null)
6861            this.noteNumber = new ArrayList<PositiveIntType>();
6862          this.noteNumber.add(t);
6863          return t;
6864        }
6865
6866        /**
6867         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6868         */
6869        public SubDetailComponent addNoteNumber(int value) { //1
6870          PositiveIntType t = new PositiveIntType();
6871          t.setValue(value);
6872          if (this.noteNumber == null)
6873            this.noteNumber = new ArrayList<PositiveIntType>();
6874          this.noteNumber.add(t);
6875          return this;
6876        }
6877
6878        /**
6879         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6880         */
6881        public boolean hasNoteNumber(int value) { 
6882          if (this.noteNumber == null)
6883            return false;
6884          for (PositiveIntType v : this.noteNumber)
6885            if (v.getValue().equals(value)) // positiveInt
6886              return true;
6887          return false;
6888        }
6889
6890        /**
6891         * @return {@link #adjudication} (The adjudication results.)
6892         */
6893        public List<AdjudicationComponent> getAdjudication() { 
6894          if (this.adjudication == null)
6895            this.adjudication = new ArrayList<AdjudicationComponent>();
6896          return this.adjudication;
6897        }
6898
6899        /**
6900         * @return Returns a reference to <code>this</code> for easy method chaining
6901         */
6902        public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
6903          this.adjudication = theAdjudication;
6904          return this;
6905        }
6906
6907        public boolean hasAdjudication() { 
6908          if (this.adjudication == null)
6909            return false;
6910          for (AdjudicationComponent item : this.adjudication)
6911            if (!item.isEmpty())
6912              return true;
6913          return false;
6914        }
6915
6916        public AdjudicationComponent addAdjudication() { //3
6917          AdjudicationComponent t = new AdjudicationComponent();
6918          if (this.adjudication == null)
6919            this.adjudication = new ArrayList<AdjudicationComponent>();
6920          this.adjudication.add(t);
6921          return t;
6922        }
6923
6924        public SubDetailComponent addAdjudication(AdjudicationComponent t) { //3
6925          if (t == null)
6926            return this;
6927          if (this.adjudication == null)
6928            this.adjudication = new ArrayList<AdjudicationComponent>();
6929          this.adjudication.add(t);
6930          return this;
6931        }
6932
6933        /**
6934         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
6935         */
6936        public AdjudicationComponent getAdjudicationFirstRep() { 
6937          if (getAdjudication().isEmpty()) {
6938            addAdjudication();
6939          }
6940          return getAdjudication().get(0);
6941        }
6942
6943        protected void listChildren(List<Property> children) {
6944          super.listChildren(children);
6945          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));
6946          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
6947          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
6948          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));
6949          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));
6950          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
6951          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
6952          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));
6953          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));
6954          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
6955          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
6956          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));
6957          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6958        }
6959
6960        @Override
6961        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6962          switch (_hash) {
6963          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);
6964          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
6965          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);
6966          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);
6967          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);
6968          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
6969          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
6970          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);
6971          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);
6972          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);
6973          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
6974          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);
6975          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6976          default: return super.getNamedProperty(_hash, _name, _checkValid);
6977          }
6978
6979        }
6980
6981      @Override
6982      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6983        switch (hash) {
6984        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6985        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6986        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6987        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
6988        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6989        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6990        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
6991        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6992        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6993        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6994        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6995        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
6996        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
6997        default: return super.getProperty(hash, name, checkValid);
6998        }
6999
7000      }
7001
7002      @Override
7003      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7004        switch (hash) {
7005        case 1349547969: // sequence
7006          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
7007          return value;
7008        case 1099842588: // revenue
7009          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7010          return value;
7011        case 50511102: // category
7012          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7013          return value;
7014        case 1957227299: // productOrService
7015          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7016          return value;
7017        case -615513385: // modifier
7018          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
7019          return value;
7020        case 1010065041: // programCode
7021          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
7022          return value;
7023        case -1285004149: // quantity
7024          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
7025          return value;
7026        case -486196699: // unitPrice
7027          this.unitPrice = TypeConvertor.castToMoney(value); // Money
7028          return value;
7029        case -1282148017: // factor
7030          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
7031          return value;
7032        case 108957: // net
7033          this.net = TypeConvertor.castToMoney(value); // Money
7034          return value;
7035        case 115642: // udi
7036          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
7037          return value;
7038        case -1110033957: // noteNumber
7039          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
7040          return value;
7041        case -231349275: // adjudication
7042          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7043          return value;
7044        default: return super.setProperty(hash, name, value);
7045        }
7046
7047      }
7048
7049      @Override
7050      public Base setProperty(String name, Base value) throws FHIRException {
7051        if (name.equals("sequence")) {
7052          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
7053        } else if (name.equals("revenue")) {
7054          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7055        } else if (name.equals("category")) {
7056          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7057        } else if (name.equals("productOrService")) {
7058          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7059        } else if (name.equals("modifier")) {
7060          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
7061        } else if (name.equals("programCode")) {
7062          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
7063        } else if (name.equals("quantity")) {
7064          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
7065        } else if (name.equals("unitPrice")) {
7066          this.unitPrice = TypeConvertor.castToMoney(value); // Money
7067        } else if (name.equals("factor")) {
7068          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
7069        } else if (name.equals("net")) {
7070          this.net = TypeConvertor.castToMoney(value); // Money
7071        } else if (name.equals("udi")) {
7072          this.getUdi().add(TypeConvertor.castToReference(value));
7073        } else if (name.equals("noteNumber")) {
7074          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
7075        } else if (name.equals("adjudication")) {
7076          this.getAdjudication().add((AdjudicationComponent) value);
7077        } else
7078          return super.setProperty(name, value);
7079        return value;
7080      }
7081
7082      @Override
7083      public Base makeProperty(int hash, String name) throws FHIRException {
7084        switch (hash) {
7085        case 1349547969:  return getSequenceElement();
7086        case 1099842588:  return getRevenue();
7087        case 50511102:  return getCategory();
7088        case 1957227299:  return getProductOrService();
7089        case -615513385:  return addModifier(); 
7090        case 1010065041:  return addProgramCode(); 
7091        case -1285004149:  return getQuantity();
7092        case -486196699:  return getUnitPrice();
7093        case -1282148017:  return getFactorElement();
7094        case 108957:  return getNet();
7095        case 115642:  return addUdi(); 
7096        case -1110033957:  return addNoteNumberElement();
7097        case -231349275:  return addAdjudication(); 
7098        default: return super.makeProperty(hash, name);
7099        }
7100
7101      }
7102
7103      @Override
7104      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7105        switch (hash) {
7106        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
7107        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7108        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7109        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
7110        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7111        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
7112        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
7113        case -486196699: /*unitPrice*/ return new String[] {"Money"};
7114        case -1282148017: /*factor*/ return new String[] {"decimal"};
7115        case 108957: /*net*/ return new String[] {"Money"};
7116        case 115642: /*udi*/ return new String[] {"Reference"};
7117        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7118        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7119        default: return super.getTypesForProperty(hash, name);
7120        }
7121
7122      }
7123
7124      @Override
7125      public Base addChild(String name) throws FHIRException {
7126        if (name.equals("sequence")) {
7127          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.subDetail.sequence");
7128        }
7129        else if (name.equals("revenue")) {
7130          this.revenue = new CodeableConcept();
7131          return this.revenue;
7132        }
7133        else if (name.equals("category")) {
7134          this.category = new CodeableConcept();
7135          return this.category;
7136        }
7137        else if (name.equals("productOrService")) {
7138          this.productOrService = new CodeableConcept();
7139          return this.productOrService;
7140        }
7141        else if (name.equals("modifier")) {
7142          return addModifier();
7143        }
7144        else if (name.equals("programCode")) {
7145          return addProgramCode();
7146        }
7147        else if (name.equals("quantity")) {
7148          this.quantity = new Quantity();
7149          return this.quantity;
7150        }
7151        else if (name.equals("unitPrice")) {
7152          this.unitPrice = new Money();
7153          return this.unitPrice;
7154        }
7155        else if (name.equals("factor")) {
7156          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.subDetail.factor");
7157        }
7158        else if (name.equals("net")) {
7159          this.net = new Money();
7160          return this.net;
7161        }
7162        else if (name.equals("udi")) {
7163          return addUdi();
7164        }
7165        else if (name.equals("noteNumber")) {
7166          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.subDetail.noteNumber");
7167        }
7168        else if (name.equals("adjudication")) {
7169          return addAdjudication();
7170        }
7171        else
7172          return super.addChild(name);
7173      }
7174
7175      public SubDetailComponent copy() {
7176        SubDetailComponent dst = new SubDetailComponent();
7177        copyValues(dst);
7178        return dst;
7179      }
7180
7181      public void copyValues(SubDetailComponent dst) {
7182        super.copyValues(dst);
7183        dst.sequence = sequence == null ? null : sequence.copy();
7184        dst.revenue = revenue == null ? null : revenue.copy();
7185        dst.category = category == null ? null : category.copy();
7186        dst.productOrService = productOrService == null ? null : productOrService.copy();
7187        if (modifier != null) {
7188          dst.modifier = new ArrayList<CodeableConcept>();
7189          for (CodeableConcept i : modifier)
7190            dst.modifier.add(i.copy());
7191        };
7192        if (programCode != null) {
7193          dst.programCode = new ArrayList<CodeableConcept>();
7194          for (CodeableConcept i : programCode)
7195            dst.programCode.add(i.copy());
7196        };
7197        dst.quantity = quantity == null ? null : quantity.copy();
7198        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7199        dst.factor = factor == null ? null : factor.copy();
7200        dst.net = net == null ? null : net.copy();
7201        if (udi != null) {
7202          dst.udi = new ArrayList<Reference>();
7203          for (Reference i : udi)
7204            dst.udi.add(i.copy());
7205        };
7206        if (noteNumber != null) {
7207          dst.noteNumber = new ArrayList<PositiveIntType>();
7208          for (PositiveIntType i : noteNumber)
7209            dst.noteNumber.add(i.copy());
7210        };
7211        if (adjudication != null) {
7212          dst.adjudication = new ArrayList<AdjudicationComponent>();
7213          for (AdjudicationComponent i : adjudication)
7214            dst.adjudication.add(i.copy());
7215        };
7216      }
7217
7218      @Override
7219      public boolean equalsDeep(Base other_) {
7220        if (!super.equalsDeep(other_))
7221          return false;
7222        if (!(other_ instanceof SubDetailComponent))
7223          return false;
7224        SubDetailComponent o = (SubDetailComponent) other_;
7225        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
7226           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
7227           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
7228           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
7229           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
7230          ;
7231      }
7232
7233      @Override
7234      public boolean equalsShallow(Base other_) {
7235        if (!super.equalsShallow(other_))
7236          return false;
7237        if (!(other_ instanceof SubDetailComponent))
7238          return false;
7239        SubDetailComponent o = (SubDetailComponent) other_;
7240        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
7241          ;
7242      }
7243
7244      public boolean isEmpty() {
7245        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
7246          , productOrService, modifier, programCode, quantity, unitPrice, factor, net, udi
7247          , noteNumber, adjudication);
7248      }
7249
7250  public String fhirType() {
7251    return "ExplanationOfBenefit.item.detail.subDetail";
7252
7253  }
7254
7255  }
7256
7257    @Block()
7258    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
7259        /**
7260         * Claim items which this service line is intended to replace.
7261         */
7262        @Child(name = "itemSequence", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7263        @Description(shortDefinition="Item sequence number", formalDefinition="Claim items which this service line is intended to replace." )
7264        protected List<PositiveIntType> itemSequence;
7265
7266        /**
7267         * The sequence number of the details within the claim item which this line is intended to replace.
7268         */
7269        @Child(name = "detailSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7270        @Description(shortDefinition="Detail sequence number", formalDefinition="The sequence number of the details within the claim item which this line is intended to replace." )
7271        protected List<PositiveIntType> detailSequence;
7272
7273        /**
7274         * The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.
7275         */
7276        @Child(name = "subDetailSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7277        @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." )
7278        protected List<PositiveIntType> subDetailSequence;
7279
7280        /**
7281         * The providers who are authorized for the services rendered to the patient.
7282         */
7283        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7284        @Description(shortDefinition="Authorized providers", formalDefinition="The providers who are authorized for the services rendered to the patient." )
7285        protected List<Reference> provider;
7286
7287        /**
7288         * 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.
7289         */
7290        @Child(name = "productOrService", type = {CodeableConcept.class}, order=5, min=1, max=1, modifier=false, summary=false)
7291        @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." )
7292        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7293        protected CodeableConcept productOrService;
7294
7295        /**
7296         * Item typification or modifiers codes to convey additional context for the product or service.
7297         */
7298        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7299        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
7300        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
7301        protected List<CodeableConcept> modifier;
7302
7303        /**
7304         * Identifies the program under which this may be recovered.
7305         */
7306        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7307        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
7308        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
7309        protected List<CodeableConcept> programCode;
7310
7311        /**
7312         * The date or dates when the service or product was supplied, performed or completed.
7313         */
7314        @Child(name = "serviced", type = {DateType.class, Period.class}, order=8, min=0, max=1, modifier=false, summary=false)
7315        @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." )
7316        protected DataType serviced;
7317
7318        /**
7319         * Where the product or service was provided.
7320         */
7321        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=9, min=0, max=1, modifier=false, summary=false)
7322        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
7323        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
7324        protected DataType location;
7325
7326        /**
7327         * The number of repetitions of a service or product.
7328         */
7329        @Child(name = "quantity", type = {Quantity.class}, order=10, min=0, max=1, modifier=false, summary=false)
7330        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
7331        protected Quantity quantity;
7332
7333        /**
7334         * 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.
7335         */
7336        @Child(name = "unitPrice", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=false)
7337        @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." )
7338        protected Money unitPrice;
7339
7340        /**
7341         * 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.
7342         */
7343        @Child(name = "factor", type = {DecimalType.class}, order=12, min=0, max=1, modifier=false, summary=false)
7344        @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." )
7345        protected DecimalType factor;
7346
7347        /**
7348         * The quantity times the unit price for an additional service or product or charge.
7349         */
7350        @Child(name = "net", type = {Money.class}, order=13, min=0, max=1, modifier=false, summary=false)
7351        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
7352        protected Money net;
7353
7354        /**
7355         * Physical service site on the patient (limb, tooth, etc.).
7356         */
7357        @Child(name = "bodySite", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false)
7358        @Description(shortDefinition="Anatomical location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
7359        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
7360        protected CodeableConcept bodySite;
7361
7362        /**
7363         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
7364         */
7365        @Child(name = "subSite", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7366        @Description(shortDefinition="Anatomical sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
7367        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
7368        protected List<CodeableConcept> subSite;
7369
7370        /**
7371         * The numbers associated with notes below which apply to the adjudication of this item.
7372         */
7373        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7374        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
7375        protected List<PositiveIntType> noteNumber;
7376
7377        /**
7378         * The adjudication results.
7379         */
7380        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7381        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
7382        protected List<AdjudicationComponent> adjudication;
7383
7384        /**
7385         * The second-tier service adjudications for payor added services.
7386         */
7387        @Child(name = "detail", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7388        @Description(shortDefinition="Insurer added line items", formalDefinition="The second-tier service adjudications for payor added services." )
7389        protected List<AddedItemDetailComponent> detail;
7390
7391        private static final long serialVersionUID = 2055842184L;
7392
7393    /**
7394     * Constructor
7395     */
7396      public AddedItemComponent() {
7397        super();
7398      }
7399
7400    /**
7401     * Constructor
7402     */
7403      public AddedItemComponent(CodeableConcept productOrService) {
7404        super();
7405        this.setProductOrService(productOrService);
7406      }
7407
7408        /**
7409         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
7410         */
7411        public List<PositiveIntType> getItemSequence() { 
7412          if (this.itemSequence == null)
7413            this.itemSequence = new ArrayList<PositiveIntType>();
7414          return this.itemSequence;
7415        }
7416
7417        /**
7418         * @return Returns a reference to <code>this</code> for easy method chaining
7419         */
7420        public AddedItemComponent setItemSequence(List<PositiveIntType> theItemSequence) { 
7421          this.itemSequence = theItemSequence;
7422          return this;
7423        }
7424
7425        public boolean hasItemSequence() { 
7426          if (this.itemSequence == null)
7427            return false;
7428          for (PositiveIntType item : this.itemSequence)
7429            if (!item.isEmpty())
7430              return true;
7431          return false;
7432        }
7433
7434        /**
7435         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
7436         */
7437        public PositiveIntType addItemSequenceElement() {//2 
7438          PositiveIntType t = new PositiveIntType();
7439          if (this.itemSequence == null)
7440            this.itemSequence = new ArrayList<PositiveIntType>();
7441          this.itemSequence.add(t);
7442          return t;
7443        }
7444
7445        /**
7446         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
7447         */
7448        public AddedItemComponent addItemSequence(int value) { //1
7449          PositiveIntType t = new PositiveIntType();
7450          t.setValue(value);
7451          if (this.itemSequence == null)
7452            this.itemSequence = new ArrayList<PositiveIntType>();
7453          this.itemSequence.add(t);
7454          return this;
7455        }
7456
7457        /**
7458         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
7459         */
7460        public boolean hasItemSequence(int value) { 
7461          if (this.itemSequence == null)
7462            return false;
7463          for (PositiveIntType v : this.itemSequence)
7464            if (v.getValue().equals(value)) // positiveInt
7465              return true;
7466          return false;
7467        }
7468
7469        /**
7470         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7471         */
7472        public List<PositiveIntType> getDetailSequence() { 
7473          if (this.detailSequence == null)
7474            this.detailSequence = new ArrayList<PositiveIntType>();
7475          return this.detailSequence;
7476        }
7477
7478        /**
7479         * @return Returns a reference to <code>this</code> for easy method chaining
7480         */
7481        public AddedItemComponent setDetailSequence(List<PositiveIntType> theDetailSequence) { 
7482          this.detailSequence = theDetailSequence;
7483          return this;
7484        }
7485
7486        public boolean hasDetailSequence() { 
7487          if (this.detailSequence == null)
7488            return false;
7489          for (PositiveIntType item : this.detailSequence)
7490            if (!item.isEmpty())
7491              return true;
7492          return false;
7493        }
7494
7495        /**
7496         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7497         */
7498        public PositiveIntType addDetailSequenceElement() {//2 
7499          PositiveIntType t = new PositiveIntType();
7500          if (this.detailSequence == null)
7501            this.detailSequence = new ArrayList<PositiveIntType>();
7502          this.detailSequence.add(t);
7503          return t;
7504        }
7505
7506        /**
7507         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7508         */
7509        public AddedItemComponent addDetailSequence(int value) { //1
7510          PositiveIntType t = new PositiveIntType();
7511          t.setValue(value);
7512          if (this.detailSequence == null)
7513            this.detailSequence = new ArrayList<PositiveIntType>();
7514          this.detailSequence.add(t);
7515          return this;
7516        }
7517
7518        /**
7519         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7520         */
7521        public boolean hasDetailSequence(int value) { 
7522          if (this.detailSequence == null)
7523            return false;
7524          for (PositiveIntType v : this.detailSequence)
7525            if (v.getValue().equals(value)) // positiveInt
7526              return true;
7527          return false;
7528        }
7529
7530        /**
7531         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
7532         */
7533        public List<PositiveIntType> getSubDetailSequence() { 
7534          if (this.subDetailSequence == null)
7535            this.subDetailSequence = new ArrayList<PositiveIntType>();
7536          return this.subDetailSequence;
7537        }
7538
7539        /**
7540         * @return Returns a reference to <code>this</code> for easy method chaining
7541         */
7542        public AddedItemComponent setSubDetailSequence(List<PositiveIntType> theSubDetailSequence) { 
7543          this.subDetailSequence = theSubDetailSequence;
7544          return this;
7545        }
7546
7547        public boolean hasSubDetailSequence() { 
7548          if (this.subDetailSequence == null)
7549            return false;
7550          for (PositiveIntType item : this.subDetailSequence)
7551            if (!item.isEmpty())
7552              return true;
7553          return false;
7554        }
7555
7556        /**
7557         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
7558         */
7559        public PositiveIntType addSubDetailSequenceElement() {//2 
7560          PositiveIntType t = new PositiveIntType();
7561          if (this.subDetailSequence == null)
7562            this.subDetailSequence = new ArrayList<PositiveIntType>();
7563          this.subDetailSequence.add(t);
7564          return t;
7565        }
7566
7567        /**
7568         * @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.)
7569         */
7570        public AddedItemComponent addSubDetailSequence(int value) { //1
7571          PositiveIntType t = new PositiveIntType();
7572          t.setValue(value);
7573          if (this.subDetailSequence == null)
7574            this.subDetailSequence = new ArrayList<PositiveIntType>();
7575          this.subDetailSequence.add(t);
7576          return this;
7577        }
7578
7579        /**
7580         * @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.)
7581         */
7582        public boolean hasSubDetailSequence(int value) { 
7583          if (this.subDetailSequence == null)
7584            return false;
7585          for (PositiveIntType v : this.subDetailSequence)
7586            if (v.getValue().equals(value)) // positiveInt
7587              return true;
7588          return false;
7589        }
7590
7591        /**
7592         * @return {@link #provider} (The providers who are authorized for the services rendered to the patient.)
7593         */
7594        public List<Reference> getProvider() { 
7595          if (this.provider == null)
7596            this.provider = new ArrayList<Reference>();
7597          return this.provider;
7598        }
7599
7600        /**
7601         * @return Returns a reference to <code>this</code> for easy method chaining
7602         */
7603        public AddedItemComponent setProvider(List<Reference> theProvider) { 
7604          this.provider = theProvider;
7605          return this;
7606        }
7607
7608        public boolean hasProvider() { 
7609          if (this.provider == null)
7610            return false;
7611          for (Reference item : this.provider)
7612            if (!item.isEmpty())
7613              return true;
7614          return false;
7615        }
7616
7617        public Reference addProvider() { //3
7618          Reference t = new Reference();
7619          if (this.provider == null)
7620            this.provider = new ArrayList<Reference>();
7621          this.provider.add(t);
7622          return t;
7623        }
7624
7625        public AddedItemComponent addProvider(Reference t) { //3
7626          if (t == null)
7627            return this;
7628          if (this.provider == null)
7629            this.provider = new ArrayList<Reference>();
7630          this.provider.add(t);
7631          return this;
7632        }
7633
7634        /**
7635         * @return The first repetition of repeating field {@link #provider}, creating it if it does not already exist {3}
7636         */
7637        public Reference getProviderFirstRep() { 
7638          if (getProvider().isEmpty()) {
7639            addProvider();
7640          }
7641          return getProvider().get(0);
7642        }
7643
7644        /**
7645         * @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.)
7646         */
7647        public CodeableConcept getProductOrService() { 
7648          if (this.productOrService == null)
7649            if (Configuration.errorOnAutoCreate())
7650              throw new Error("Attempt to auto-create AddedItemComponent.productOrService");
7651            else if (Configuration.doAutoCreate())
7652              this.productOrService = new CodeableConcept(); // cc
7653          return this.productOrService;
7654        }
7655
7656        public boolean hasProductOrService() { 
7657          return this.productOrService != null && !this.productOrService.isEmpty();
7658        }
7659
7660        /**
7661         * @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.)
7662         */
7663        public AddedItemComponent setProductOrService(CodeableConcept value) { 
7664          this.productOrService = value;
7665          return this;
7666        }
7667
7668        /**
7669         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
7670         */
7671        public List<CodeableConcept> getModifier() { 
7672          if (this.modifier == null)
7673            this.modifier = new ArrayList<CodeableConcept>();
7674          return this.modifier;
7675        }
7676
7677        /**
7678         * @return Returns a reference to <code>this</code> for easy method chaining
7679         */
7680        public AddedItemComponent setModifier(List<CodeableConcept> theModifier) { 
7681          this.modifier = theModifier;
7682          return this;
7683        }
7684
7685        public boolean hasModifier() { 
7686          if (this.modifier == null)
7687            return false;
7688          for (CodeableConcept item : this.modifier)
7689            if (!item.isEmpty())
7690              return true;
7691          return false;
7692        }
7693
7694        public CodeableConcept addModifier() { //3
7695          CodeableConcept t = new CodeableConcept();
7696          if (this.modifier == null)
7697            this.modifier = new ArrayList<CodeableConcept>();
7698          this.modifier.add(t);
7699          return t;
7700        }
7701
7702        public AddedItemComponent addModifier(CodeableConcept t) { //3
7703          if (t == null)
7704            return this;
7705          if (this.modifier == null)
7706            this.modifier = new ArrayList<CodeableConcept>();
7707          this.modifier.add(t);
7708          return this;
7709        }
7710
7711        /**
7712         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
7713         */
7714        public CodeableConcept getModifierFirstRep() { 
7715          if (getModifier().isEmpty()) {
7716            addModifier();
7717          }
7718          return getModifier().get(0);
7719        }
7720
7721        /**
7722         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
7723         */
7724        public List<CodeableConcept> getProgramCode() { 
7725          if (this.programCode == null)
7726            this.programCode = new ArrayList<CodeableConcept>();
7727          return this.programCode;
7728        }
7729
7730        /**
7731         * @return Returns a reference to <code>this</code> for easy method chaining
7732         */
7733        public AddedItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
7734          this.programCode = theProgramCode;
7735          return this;
7736        }
7737
7738        public boolean hasProgramCode() { 
7739          if (this.programCode == null)
7740            return false;
7741          for (CodeableConcept item : this.programCode)
7742            if (!item.isEmpty())
7743              return true;
7744          return false;
7745        }
7746
7747        public CodeableConcept addProgramCode() { //3
7748          CodeableConcept t = new CodeableConcept();
7749          if (this.programCode == null)
7750            this.programCode = new ArrayList<CodeableConcept>();
7751          this.programCode.add(t);
7752          return t;
7753        }
7754
7755        public AddedItemComponent addProgramCode(CodeableConcept t) { //3
7756          if (t == null)
7757            return this;
7758          if (this.programCode == null)
7759            this.programCode = new ArrayList<CodeableConcept>();
7760          this.programCode.add(t);
7761          return this;
7762        }
7763
7764        /**
7765         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
7766         */
7767        public CodeableConcept getProgramCodeFirstRep() { 
7768          if (getProgramCode().isEmpty()) {
7769            addProgramCode();
7770          }
7771          return getProgramCode().get(0);
7772        }
7773
7774        /**
7775         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
7776         */
7777        public DataType getServiced() { 
7778          return this.serviced;
7779        }
7780
7781        /**
7782         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
7783         */
7784        public DateType getServicedDateType() throws FHIRException { 
7785          if (this.serviced == null)
7786            this.serviced = new DateType();
7787          if (!(this.serviced instanceof DateType))
7788            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
7789          return (DateType) this.serviced;
7790        }
7791
7792        public boolean hasServicedDateType() { 
7793          return this != null && this.serviced instanceof DateType;
7794        }
7795
7796        /**
7797         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
7798         */
7799        public Period getServicedPeriod() throws FHIRException { 
7800          if (this.serviced == null)
7801            this.serviced = new Period();
7802          if (!(this.serviced instanceof Period))
7803            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
7804          return (Period) this.serviced;
7805        }
7806
7807        public boolean hasServicedPeriod() { 
7808          return this != null && this.serviced instanceof Period;
7809        }
7810
7811        public boolean hasServiced() { 
7812          return this.serviced != null && !this.serviced.isEmpty();
7813        }
7814
7815        /**
7816         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
7817         */
7818        public AddedItemComponent setServiced(DataType value) { 
7819          if (value != null && !(value instanceof DateType || value instanceof Period))
7820            throw new Error("Not the right type for ExplanationOfBenefit.addItem.serviced[x]: "+value.fhirType());
7821          this.serviced = value;
7822          return this;
7823        }
7824
7825        /**
7826         * @return {@link #location} (Where the product or service was provided.)
7827         */
7828        public DataType getLocation() { 
7829          return this.location;
7830        }
7831
7832        /**
7833         * @return {@link #location} (Where the product or service was provided.)
7834         */
7835        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
7836          if (this.location == null)
7837            this.location = new CodeableConcept();
7838          if (!(this.location instanceof CodeableConcept))
7839            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
7840          return (CodeableConcept) this.location;
7841        }
7842
7843        public boolean hasLocationCodeableConcept() { 
7844          return this != null && this.location instanceof CodeableConcept;
7845        }
7846
7847        /**
7848         * @return {@link #location} (Where the product or service was provided.)
7849         */
7850        public Address getLocationAddress() throws FHIRException { 
7851          if (this.location == null)
7852            this.location = new Address();
7853          if (!(this.location instanceof Address))
7854            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
7855          return (Address) this.location;
7856        }
7857
7858        public boolean hasLocationAddress() { 
7859          return this != null && this.location instanceof Address;
7860        }
7861
7862        /**
7863         * @return {@link #location} (Where the product or service was provided.)
7864         */
7865        public Reference getLocationReference() throws FHIRException { 
7866          if (this.location == null)
7867            this.location = new Reference();
7868          if (!(this.location instanceof Reference))
7869            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
7870          return (Reference) this.location;
7871        }
7872
7873        public boolean hasLocationReference() { 
7874          return this != null && this.location instanceof Reference;
7875        }
7876
7877        public boolean hasLocation() { 
7878          return this.location != null && !this.location.isEmpty();
7879        }
7880
7881        /**
7882         * @param value {@link #location} (Where the product or service was provided.)
7883         */
7884        public AddedItemComponent setLocation(DataType value) { 
7885          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
7886            throw new Error("Not the right type for ExplanationOfBenefit.addItem.location[x]: "+value.fhirType());
7887          this.location = value;
7888          return this;
7889        }
7890
7891        /**
7892         * @return {@link #quantity} (The number of repetitions of a service or product.)
7893         */
7894        public Quantity getQuantity() { 
7895          if (this.quantity == null)
7896            if (Configuration.errorOnAutoCreate())
7897              throw new Error("Attempt to auto-create AddedItemComponent.quantity");
7898            else if (Configuration.doAutoCreate())
7899              this.quantity = new Quantity(); // cc
7900          return this.quantity;
7901        }
7902
7903        public boolean hasQuantity() { 
7904          return this.quantity != null && !this.quantity.isEmpty();
7905        }
7906
7907        /**
7908         * @param value {@link #quantity} (The number of repetitions of a service or product.)
7909         */
7910        public AddedItemComponent setQuantity(Quantity value) { 
7911          this.quantity = value;
7912          return this;
7913        }
7914
7915        /**
7916         * @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.)
7917         */
7918        public Money getUnitPrice() { 
7919          if (this.unitPrice == null)
7920            if (Configuration.errorOnAutoCreate())
7921              throw new Error("Attempt to auto-create AddedItemComponent.unitPrice");
7922            else if (Configuration.doAutoCreate())
7923              this.unitPrice = new Money(); // cc
7924          return this.unitPrice;
7925        }
7926
7927        public boolean hasUnitPrice() { 
7928          return this.unitPrice != null && !this.unitPrice.isEmpty();
7929        }
7930
7931        /**
7932         * @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.)
7933         */
7934        public AddedItemComponent setUnitPrice(Money value) { 
7935          this.unitPrice = value;
7936          return this;
7937        }
7938
7939        /**
7940         * @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
7941         */
7942        public DecimalType getFactorElement() { 
7943          if (this.factor == null)
7944            if (Configuration.errorOnAutoCreate())
7945              throw new Error("Attempt to auto-create AddedItemComponent.factor");
7946            else if (Configuration.doAutoCreate())
7947              this.factor = new DecimalType(); // bb
7948          return this.factor;
7949        }
7950
7951        public boolean hasFactorElement() { 
7952          return this.factor != null && !this.factor.isEmpty();
7953        }
7954
7955        public boolean hasFactor() { 
7956          return this.factor != null && !this.factor.isEmpty();
7957        }
7958
7959        /**
7960         * @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
7961         */
7962        public AddedItemComponent setFactorElement(DecimalType value) { 
7963          this.factor = value;
7964          return this;
7965        }
7966
7967        /**
7968         * @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.
7969         */
7970        public BigDecimal getFactor() { 
7971          return this.factor == null ? null : this.factor.getValue();
7972        }
7973
7974        /**
7975         * @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.
7976         */
7977        public AddedItemComponent setFactor(BigDecimal value) { 
7978          if (value == null)
7979            this.factor = null;
7980          else {
7981            if (this.factor == null)
7982              this.factor = new DecimalType();
7983            this.factor.setValue(value);
7984          }
7985          return this;
7986        }
7987
7988        /**
7989         * @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.
7990         */
7991        public AddedItemComponent setFactor(long value) { 
7992              this.factor = new DecimalType();
7993            this.factor.setValue(value);
7994          return this;
7995        }
7996
7997        /**
7998         * @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.
7999         */
8000        public AddedItemComponent setFactor(double value) { 
8001              this.factor = new DecimalType();
8002            this.factor.setValue(value);
8003          return this;
8004        }
8005
8006        /**
8007         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8008         */
8009        public Money getNet() { 
8010          if (this.net == null)
8011            if (Configuration.errorOnAutoCreate())
8012              throw new Error("Attempt to auto-create AddedItemComponent.net");
8013            else if (Configuration.doAutoCreate())
8014              this.net = new Money(); // cc
8015          return this.net;
8016        }
8017
8018        public boolean hasNet() { 
8019          return this.net != null && !this.net.isEmpty();
8020        }
8021
8022        /**
8023         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8024         */
8025        public AddedItemComponent setNet(Money value) { 
8026          this.net = value;
8027          return this;
8028        }
8029
8030        /**
8031         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8032         */
8033        public CodeableConcept getBodySite() { 
8034          if (this.bodySite == null)
8035            if (Configuration.errorOnAutoCreate())
8036              throw new Error("Attempt to auto-create AddedItemComponent.bodySite");
8037            else if (Configuration.doAutoCreate())
8038              this.bodySite = new CodeableConcept(); // cc
8039          return this.bodySite;
8040        }
8041
8042        public boolean hasBodySite() { 
8043          return this.bodySite != null && !this.bodySite.isEmpty();
8044        }
8045
8046        /**
8047         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8048         */
8049        public AddedItemComponent setBodySite(CodeableConcept value) { 
8050          this.bodySite = value;
8051          return this;
8052        }
8053
8054        /**
8055         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
8056         */
8057        public List<CodeableConcept> getSubSite() { 
8058          if (this.subSite == null)
8059            this.subSite = new ArrayList<CodeableConcept>();
8060          return this.subSite;
8061        }
8062
8063        /**
8064         * @return Returns a reference to <code>this</code> for easy method chaining
8065         */
8066        public AddedItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
8067          this.subSite = theSubSite;
8068          return this;
8069        }
8070
8071        public boolean hasSubSite() { 
8072          if (this.subSite == null)
8073            return false;
8074          for (CodeableConcept item : this.subSite)
8075            if (!item.isEmpty())
8076              return true;
8077          return false;
8078        }
8079
8080        public CodeableConcept addSubSite() { //3
8081          CodeableConcept t = new CodeableConcept();
8082          if (this.subSite == null)
8083            this.subSite = new ArrayList<CodeableConcept>();
8084          this.subSite.add(t);
8085          return t;
8086        }
8087
8088        public AddedItemComponent addSubSite(CodeableConcept t) { //3
8089          if (t == null)
8090            return this;
8091          if (this.subSite == null)
8092            this.subSite = new ArrayList<CodeableConcept>();
8093          this.subSite.add(t);
8094          return this;
8095        }
8096
8097        /**
8098         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist {3}
8099         */
8100        public CodeableConcept getSubSiteFirstRep() { 
8101          if (getSubSite().isEmpty()) {
8102            addSubSite();
8103          }
8104          return getSubSite().get(0);
8105        }
8106
8107        /**
8108         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8109         */
8110        public List<PositiveIntType> getNoteNumber() { 
8111          if (this.noteNumber == null)
8112            this.noteNumber = new ArrayList<PositiveIntType>();
8113          return this.noteNumber;
8114        }
8115
8116        /**
8117         * @return Returns a reference to <code>this</code> for easy method chaining
8118         */
8119        public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
8120          this.noteNumber = theNoteNumber;
8121          return this;
8122        }
8123
8124        public boolean hasNoteNumber() { 
8125          if (this.noteNumber == null)
8126            return false;
8127          for (PositiveIntType item : this.noteNumber)
8128            if (!item.isEmpty())
8129              return true;
8130          return false;
8131        }
8132
8133        /**
8134         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8135         */
8136        public PositiveIntType addNoteNumberElement() {//2 
8137          PositiveIntType t = new PositiveIntType();
8138          if (this.noteNumber == null)
8139            this.noteNumber = new ArrayList<PositiveIntType>();
8140          this.noteNumber.add(t);
8141          return t;
8142        }
8143
8144        /**
8145         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8146         */
8147        public AddedItemComponent addNoteNumber(int value) { //1
8148          PositiveIntType t = new PositiveIntType();
8149          t.setValue(value);
8150          if (this.noteNumber == null)
8151            this.noteNumber = new ArrayList<PositiveIntType>();
8152          this.noteNumber.add(t);
8153          return this;
8154        }
8155
8156        /**
8157         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8158         */
8159        public boolean hasNoteNumber(int value) { 
8160          if (this.noteNumber == null)
8161            return false;
8162          for (PositiveIntType v : this.noteNumber)
8163            if (v.getValue().equals(value)) // positiveInt
8164              return true;
8165          return false;
8166        }
8167
8168        /**
8169         * @return {@link #adjudication} (The adjudication results.)
8170         */
8171        public List<AdjudicationComponent> getAdjudication() { 
8172          if (this.adjudication == null)
8173            this.adjudication = new ArrayList<AdjudicationComponent>();
8174          return this.adjudication;
8175        }
8176
8177        /**
8178         * @return Returns a reference to <code>this</code> for easy method chaining
8179         */
8180        public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
8181          this.adjudication = theAdjudication;
8182          return this;
8183        }
8184
8185        public boolean hasAdjudication() { 
8186          if (this.adjudication == null)
8187            return false;
8188          for (AdjudicationComponent item : this.adjudication)
8189            if (!item.isEmpty())
8190              return true;
8191          return false;
8192        }
8193
8194        public AdjudicationComponent addAdjudication() { //3
8195          AdjudicationComponent t = new AdjudicationComponent();
8196          if (this.adjudication == null)
8197            this.adjudication = new ArrayList<AdjudicationComponent>();
8198          this.adjudication.add(t);
8199          return t;
8200        }
8201
8202        public AddedItemComponent addAdjudication(AdjudicationComponent t) { //3
8203          if (t == null)
8204            return this;
8205          if (this.adjudication == null)
8206            this.adjudication = new ArrayList<AdjudicationComponent>();
8207          this.adjudication.add(t);
8208          return this;
8209        }
8210
8211        /**
8212         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
8213         */
8214        public AdjudicationComponent getAdjudicationFirstRep() { 
8215          if (getAdjudication().isEmpty()) {
8216            addAdjudication();
8217          }
8218          return getAdjudication().get(0);
8219        }
8220
8221        /**
8222         * @return {@link #detail} (The second-tier service adjudications for payor added services.)
8223         */
8224        public List<AddedItemDetailComponent> getDetail() { 
8225          if (this.detail == null)
8226            this.detail = new ArrayList<AddedItemDetailComponent>();
8227          return this.detail;
8228        }
8229
8230        /**
8231         * @return Returns a reference to <code>this</code> for easy method chaining
8232         */
8233        public AddedItemComponent setDetail(List<AddedItemDetailComponent> theDetail) { 
8234          this.detail = theDetail;
8235          return this;
8236        }
8237
8238        public boolean hasDetail() { 
8239          if (this.detail == null)
8240            return false;
8241          for (AddedItemDetailComponent item : this.detail)
8242            if (!item.isEmpty())
8243              return true;
8244          return false;
8245        }
8246
8247        public AddedItemDetailComponent addDetail() { //3
8248          AddedItemDetailComponent t = new AddedItemDetailComponent();
8249          if (this.detail == null)
8250            this.detail = new ArrayList<AddedItemDetailComponent>();
8251          this.detail.add(t);
8252          return t;
8253        }
8254
8255        public AddedItemComponent addDetail(AddedItemDetailComponent t) { //3
8256          if (t == null)
8257            return this;
8258          if (this.detail == null)
8259            this.detail = new ArrayList<AddedItemDetailComponent>();
8260          this.detail.add(t);
8261          return this;
8262        }
8263
8264        /**
8265         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist {3}
8266         */
8267        public AddedItemDetailComponent getDetailFirstRep() { 
8268          if (getDetail().isEmpty()) {
8269            addDetail();
8270          }
8271          return getDetail().get(0);
8272        }
8273
8274        protected void listChildren(List<Property> children) {
8275          super.listChildren(children);
8276          children.add(new Property("itemSequence", "positiveInt", "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, itemSequence));
8277          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));
8278          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));
8279          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));
8280          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));
8281          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));
8282          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
8283          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));
8284          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
8285          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
8286          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));
8287          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));
8288          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
8289          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
8290          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));
8291          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));
8292          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
8293          children.add(new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
8294        }
8295
8296        @Override
8297        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8298          switch (_hash) {
8299          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);
8300          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);
8301          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);
8302          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);
8303          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);
8304          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);
8305          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
8306          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);
8307          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);
8308          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);
8309          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);
8310          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8311          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8312          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept", "Where the product or service was provided.", 0, 1, location);
8313          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address", "Where the product or service was provided.", 0, 1, location);
8314          case 755866390: /*locationReference*/  return new Property("location[x]", "Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8315          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
8316          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);
8317          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);
8318          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);
8319          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
8320          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);
8321          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);
8322          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
8323          case -1335224239: /*detail*/  return new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail);
8324          default: return super.getNamedProperty(_hash, _name, _checkValid);
8325          }
8326
8327        }
8328
8329      @Override
8330      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8331        switch (hash) {
8332        case 1977979892: /*itemSequence*/ return this.itemSequence == null ? new Base[0] : this.itemSequence.toArray(new Base[this.itemSequence.size()]); // PositiveIntType
8333        case 1321472818: /*detailSequence*/ return this.detailSequence == null ? new Base[0] : this.detailSequence.toArray(new Base[this.detailSequence.size()]); // PositiveIntType
8334        case -855462510: /*subDetailSequence*/ return this.subDetailSequence == null ? new Base[0] : this.subDetailSequence.toArray(new Base[this.subDetailSequence.size()]); // PositiveIntType
8335        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : this.provider.toArray(new Base[this.provider.size()]); // Reference
8336        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
8337        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
8338        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
8339        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // DataType
8340        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // DataType
8341        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
8342        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
8343        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
8344        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
8345        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
8346        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
8347        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
8348        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
8349        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemDetailComponent
8350        default: return super.getProperty(hash, name, checkValid);
8351        }
8352
8353      }
8354
8355      @Override
8356      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8357        switch (hash) {
8358        case 1977979892: // itemSequence
8359          this.getItemSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
8360          return value;
8361        case 1321472818: // detailSequence
8362          this.getDetailSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
8363          return value;
8364        case -855462510: // subDetailSequence
8365          this.getSubDetailSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
8366          return value;
8367        case -987494927: // provider
8368          this.getProvider().add(TypeConvertor.castToReference(value)); // Reference
8369          return value;
8370        case 1957227299: // productOrService
8371          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8372          return value;
8373        case -615513385: // modifier
8374          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
8375          return value;
8376        case 1010065041: // programCode
8377          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
8378          return value;
8379        case 1379209295: // serviced
8380          this.serviced = TypeConvertor.castToType(value); // DataType
8381          return value;
8382        case 1901043637: // location
8383          this.location = TypeConvertor.castToType(value); // DataType
8384          return value;
8385        case -1285004149: // quantity
8386          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
8387          return value;
8388        case -486196699: // unitPrice
8389          this.unitPrice = TypeConvertor.castToMoney(value); // Money
8390          return value;
8391        case -1282148017: // factor
8392          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
8393          return value;
8394        case 108957: // net
8395          this.net = TypeConvertor.castToMoney(value); // Money
8396          return value;
8397        case 1702620169: // bodySite
8398          this.bodySite = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8399          return value;
8400        case -1868566105: // subSite
8401          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
8402          return value;
8403        case -1110033957: // noteNumber
8404          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
8405          return value;
8406        case -231349275: // adjudication
8407          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
8408          return value;
8409        case -1335224239: // detail
8410          this.getDetail().add((AddedItemDetailComponent) value); // AddedItemDetailComponent
8411          return value;
8412        default: return super.setProperty(hash, name, value);
8413        }
8414
8415      }
8416
8417      @Override
8418      public Base setProperty(String name, Base value) throws FHIRException {
8419        if (name.equals("itemSequence")) {
8420          this.getItemSequence().add(TypeConvertor.castToPositiveInt(value));
8421        } else if (name.equals("detailSequence")) {
8422          this.getDetailSequence().add(TypeConvertor.castToPositiveInt(value));
8423        } else if (name.equals("subDetailSequence")) {
8424          this.getSubDetailSequence().add(TypeConvertor.castToPositiveInt(value));
8425        } else if (name.equals("provider")) {
8426          this.getProvider().add(TypeConvertor.castToReference(value));
8427        } else if (name.equals("productOrService")) {
8428          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8429        } else if (name.equals("modifier")) {
8430          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
8431        } else if (name.equals("programCode")) {
8432          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
8433        } else if (name.equals("serviced[x]")) {
8434          this.serviced = TypeConvertor.castToType(value); // DataType
8435        } else if (name.equals("location[x]")) {
8436          this.location = TypeConvertor.castToType(value); // DataType
8437        } else if (name.equals("quantity")) {
8438          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
8439        } else if (name.equals("unitPrice")) {
8440          this.unitPrice = TypeConvertor.castToMoney(value); // Money
8441        } else if (name.equals("factor")) {
8442          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
8443        } else if (name.equals("net")) {
8444          this.net = TypeConvertor.castToMoney(value); // Money
8445        } else if (name.equals("bodySite")) {
8446          this.bodySite = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8447        } else if (name.equals("subSite")) {
8448          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value));
8449        } else if (name.equals("noteNumber")) {
8450          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
8451        } else if (name.equals("adjudication")) {
8452          this.getAdjudication().add((AdjudicationComponent) value);
8453        } else if (name.equals("detail")) {
8454          this.getDetail().add((AddedItemDetailComponent) value);
8455        } else
8456          return super.setProperty(name, value);
8457        return value;
8458      }
8459
8460      @Override
8461      public Base makeProperty(int hash, String name) throws FHIRException {
8462        switch (hash) {
8463        case 1977979892:  return addItemSequenceElement();
8464        case 1321472818:  return addDetailSequenceElement();
8465        case -855462510:  return addSubDetailSequenceElement();
8466        case -987494927:  return addProvider(); 
8467        case 1957227299:  return getProductOrService();
8468        case -615513385:  return addModifier(); 
8469        case 1010065041:  return addProgramCode(); 
8470        case -1927922223:  return getServiced();
8471        case 1379209295:  return getServiced();
8472        case 552316075:  return getLocation();
8473        case 1901043637:  return getLocation();
8474        case -1285004149:  return getQuantity();
8475        case -486196699:  return getUnitPrice();
8476        case -1282148017:  return getFactorElement();
8477        case 108957:  return getNet();
8478        case 1702620169:  return getBodySite();
8479        case -1868566105:  return addSubSite(); 
8480        case -1110033957:  return addNoteNumberElement();
8481        case -231349275:  return addAdjudication(); 
8482        case -1335224239:  return addDetail(); 
8483        default: return super.makeProperty(hash, name);
8484        }
8485
8486      }
8487
8488      @Override
8489      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8490        switch (hash) {
8491        case 1977979892: /*itemSequence*/ return new String[] {"positiveInt"};
8492        case 1321472818: /*detailSequence*/ return new String[] {"positiveInt"};
8493        case -855462510: /*subDetailSequence*/ return new String[] {"positiveInt"};
8494        case -987494927: /*provider*/ return new String[] {"Reference"};
8495        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
8496        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
8497        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
8498        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
8499        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
8500        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
8501        case -486196699: /*unitPrice*/ return new String[] {"Money"};
8502        case -1282148017: /*factor*/ return new String[] {"decimal"};
8503        case 108957: /*net*/ return new String[] {"Money"};
8504        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
8505        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
8506        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
8507        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
8508        case -1335224239: /*detail*/ return new String[] {};
8509        default: return super.getTypesForProperty(hash, name);
8510        }
8511
8512      }
8513
8514      @Override
8515      public Base addChild(String name) throws FHIRException {
8516        if (name.equals("itemSequence")) {
8517          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.itemSequence");
8518        }
8519        else if (name.equals("detailSequence")) {
8520          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detailSequence");
8521        }
8522        else if (name.equals("subDetailSequence")) {
8523          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.subDetailSequence");
8524        }
8525        else if (name.equals("provider")) {
8526          return addProvider();
8527        }
8528        else if (name.equals("productOrService")) {
8529          this.productOrService = new CodeableConcept();
8530          return this.productOrService;
8531        }
8532        else if (name.equals("modifier")) {
8533          return addModifier();
8534        }
8535        else if (name.equals("programCode")) {
8536          return addProgramCode();
8537        }
8538        else if (name.equals("servicedDate")) {
8539          this.serviced = new DateType();
8540          return this.serviced;
8541        }
8542        else if (name.equals("servicedPeriod")) {
8543          this.serviced = new Period();
8544          return this.serviced;
8545        }
8546        else if (name.equals("locationCodeableConcept")) {
8547          this.location = new CodeableConcept();
8548          return this.location;
8549        }
8550        else if (name.equals("locationAddress")) {
8551          this.location = new Address();
8552          return this.location;
8553        }
8554        else if (name.equals("locationReference")) {
8555          this.location = new Reference();
8556          return this.location;
8557        }
8558        else if (name.equals("quantity")) {
8559          this.quantity = new Quantity();
8560          return this.quantity;
8561        }
8562        else if (name.equals("unitPrice")) {
8563          this.unitPrice = new Money();
8564          return this.unitPrice;
8565        }
8566        else if (name.equals("factor")) {
8567          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.factor");
8568        }
8569        else if (name.equals("net")) {
8570          this.net = new Money();
8571          return this.net;
8572        }
8573        else if (name.equals("bodySite")) {
8574          this.bodySite = new CodeableConcept();
8575          return this.bodySite;
8576        }
8577        else if (name.equals("subSite")) {
8578          return addSubSite();
8579        }
8580        else if (name.equals("noteNumber")) {
8581          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.noteNumber");
8582        }
8583        else if (name.equals("adjudication")) {
8584          return addAdjudication();
8585        }
8586        else if (name.equals("detail")) {
8587          return addDetail();
8588        }
8589        else
8590          return super.addChild(name);
8591      }
8592
8593      public AddedItemComponent copy() {
8594        AddedItemComponent dst = new AddedItemComponent();
8595        copyValues(dst);
8596        return dst;
8597      }
8598
8599      public void copyValues(AddedItemComponent dst) {
8600        super.copyValues(dst);
8601        if (itemSequence != null) {
8602          dst.itemSequence = new ArrayList<PositiveIntType>();
8603          for (PositiveIntType i : itemSequence)
8604            dst.itemSequence.add(i.copy());
8605        };
8606        if (detailSequence != null) {
8607          dst.detailSequence = new ArrayList<PositiveIntType>();
8608          for (PositiveIntType i : detailSequence)
8609            dst.detailSequence.add(i.copy());
8610        };
8611        if (subDetailSequence != null) {
8612          dst.subDetailSequence = new ArrayList<PositiveIntType>();
8613          for (PositiveIntType i : subDetailSequence)
8614            dst.subDetailSequence.add(i.copy());
8615        };
8616        if (provider != null) {
8617          dst.provider = new ArrayList<Reference>();
8618          for (Reference i : provider)
8619            dst.provider.add(i.copy());
8620        };
8621        dst.productOrService = productOrService == null ? null : productOrService.copy();
8622        if (modifier != null) {
8623          dst.modifier = new ArrayList<CodeableConcept>();
8624          for (CodeableConcept i : modifier)
8625            dst.modifier.add(i.copy());
8626        };
8627        if (programCode != null) {
8628          dst.programCode = new ArrayList<CodeableConcept>();
8629          for (CodeableConcept i : programCode)
8630            dst.programCode.add(i.copy());
8631        };
8632        dst.serviced = serviced == null ? null : serviced.copy();
8633        dst.location = location == null ? null : location.copy();
8634        dst.quantity = quantity == null ? null : quantity.copy();
8635        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
8636        dst.factor = factor == null ? null : factor.copy();
8637        dst.net = net == null ? null : net.copy();
8638        dst.bodySite = bodySite == null ? null : bodySite.copy();
8639        if (subSite != null) {
8640          dst.subSite = new ArrayList<CodeableConcept>();
8641          for (CodeableConcept i : subSite)
8642            dst.subSite.add(i.copy());
8643        };
8644        if (noteNumber != null) {
8645          dst.noteNumber = new ArrayList<PositiveIntType>();
8646          for (PositiveIntType i : noteNumber)
8647            dst.noteNumber.add(i.copy());
8648        };
8649        if (adjudication != null) {
8650          dst.adjudication = new ArrayList<AdjudicationComponent>();
8651          for (AdjudicationComponent i : adjudication)
8652            dst.adjudication.add(i.copy());
8653        };
8654        if (detail != null) {
8655          dst.detail = new ArrayList<AddedItemDetailComponent>();
8656          for (AddedItemDetailComponent i : detail)
8657            dst.detail.add(i.copy());
8658        };
8659      }
8660
8661      @Override
8662      public boolean equalsDeep(Base other_) {
8663        if (!super.equalsDeep(other_))
8664          return false;
8665        if (!(other_ instanceof AddedItemComponent))
8666          return false;
8667        AddedItemComponent o = (AddedItemComponent) other_;
8668        return compareDeep(itemSequence, o.itemSequence, true) && compareDeep(detailSequence, o.detailSequence, true)
8669           && compareDeep(subDetailSequence, o.subDetailSequence, true) && compareDeep(provider, o.provider, true)
8670           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
8671           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
8672           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
8673           && compareDeep(net, o.net, true) && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true)
8674           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
8675           && compareDeep(detail, o.detail, true);
8676      }
8677
8678      @Override
8679      public boolean equalsShallow(Base other_) {
8680        if (!super.equalsShallow(other_))
8681          return false;
8682        if (!(other_ instanceof AddedItemComponent))
8683          return false;
8684        AddedItemComponent o = (AddedItemComponent) other_;
8685        return compareValues(itemSequence, o.itemSequence, true) && compareValues(detailSequence, o.detailSequence, true)
8686           && compareValues(subDetailSequence, o.subDetailSequence, true) && compareValues(factor, o.factor, true)
8687           && compareValues(noteNumber, o.noteNumber, true);
8688      }
8689
8690      public boolean isEmpty() {
8691        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemSequence, detailSequence
8692          , subDetailSequence, provider, productOrService, modifier, programCode, serviced
8693          , location, quantity, unitPrice, factor, net, bodySite, subSite, noteNumber
8694          , adjudication, detail);
8695      }
8696
8697  public String fhirType() {
8698    return "ExplanationOfBenefit.addItem";
8699
8700  }
8701
8702  }
8703
8704    @Block()
8705    public static class AddedItemDetailComponent extends BackboneElement implements IBaseBackboneElement {
8706        /**
8707         * 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.
8708         */
8709        @Child(name = "productOrService", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
8710        @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." )
8711        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
8712        protected CodeableConcept productOrService;
8713
8714        /**
8715         * Item typification or modifiers codes to convey additional context for the product or service.
8716         */
8717        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8718        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
8719        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
8720        protected List<CodeableConcept> modifier;
8721
8722        /**
8723         * The number of repetitions of a service or product.
8724         */
8725        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
8726        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
8727        protected Quantity quantity;
8728
8729        /**
8730         * 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.
8731         */
8732        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
8733        @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." )
8734        protected Money unitPrice;
8735
8736        /**
8737         * 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.
8738         */
8739        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
8740        @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." )
8741        protected DecimalType factor;
8742
8743        /**
8744         * The quantity times the unit price for an additional service or product or charge.
8745         */
8746        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
8747        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
8748        protected Money net;
8749
8750        /**
8751         * The numbers associated with notes below which apply to the adjudication of this item.
8752         */
8753        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8754        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
8755        protected List<PositiveIntType> noteNumber;
8756
8757        /**
8758         * The adjudication results.
8759         */
8760        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8761        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
8762        protected List<AdjudicationComponent> adjudication;
8763
8764        /**
8765         * The third-tier service adjudications for payor added services.
8766         */
8767        @Child(name = "subDetail", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8768        @Description(shortDefinition="Insurer added line items", formalDefinition="The third-tier service adjudications for payor added services." )
8769        protected List<AddedItemDetailSubDetailComponent> subDetail;
8770
8771        private static final long serialVersionUID = 295910869L;
8772
8773    /**
8774     * Constructor
8775     */
8776      public AddedItemDetailComponent() {
8777        super();
8778      }
8779
8780    /**
8781     * Constructor
8782     */
8783      public AddedItemDetailComponent(CodeableConcept productOrService) {
8784        super();
8785        this.setProductOrService(productOrService);
8786      }
8787
8788        /**
8789         * @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.)
8790         */
8791        public CodeableConcept getProductOrService() { 
8792          if (this.productOrService == null)
8793            if (Configuration.errorOnAutoCreate())
8794              throw new Error("Attempt to auto-create AddedItemDetailComponent.productOrService");
8795            else if (Configuration.doAutoCreate())
8796              this.productOrService = new CodeableConcept(); // cc
8797          return this.productOrService;
8798        }
8799
8800        public boolean hasProductOrService() { 
8801          return this.productOrService != null && !this.productOrService.isEmpty();
8802        }
8803
8804        /**
8805         * @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.)
8806         */
8807        public AddedItemDetailComponent setProductOrService(CodeableConcept value) { 
8808          this.productOrService = value;
8809          return this;
8810        }
8811
8812        /**
8813         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
8814         */
8815        public List<CodeableConcept> getModifier() { 
8816          if (this.modifier == null)
8817            this.modifier = new ArrayList<CodeableConcept>();
8818          return this.modifier;
8819        }
8820
8821        /**
8822         * @return Returns a reference to <code>this</code> for easy method chaining
8823         */
8824        public AddedItemDetailComponent setModifier(List<CodeableConcept> theModifier) { 
8825          this.modifier = theModifier;
8826          return this;
8827        }
8828
8829        public boolean hasModifier() { 
8830          if (this.modifier == null)
8831            return false;
8832          for (CodeableConcept item : this.modifier)
8833            if (!item.isEmpty())
8834              return true;
8835          return false;
8836        }
8837
8838        public CodeableConcept addModifier() { //3
8839          CodeableConcept t = new CodeableConcept();
8840          if (this.modifier == null)
8841            this.modifier = new ArrayList<CodeableConcept>();
8842          this.modifier.add(t);
8843          return t;
8844        }
8845
8846        public AddedItemDetailComponent addModifier(CodeableConcept t) { //3
8847          if (t == null)
8848            return this;
8849          if (this.modifier == null)
8850            this.modifier = new ArrayList<CodeableConcept>();
8851          this.modifier.add(t);
8852          return this;
8853        }
8854
8855        /**
8856         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
8857         */
8858        public CodeableConcept getModifierFirstRep() { 
8859          if (getModifier().isEmpty()) {
8860            addModifier();
8861          }
8862          return getModifier().get(0);
8863        }
8864
8865        /**
8866         * @return {@link #quantity} (The number of repetitions of a service or product.)
8867         */
8868        public Quantity getQuantity() { 
8869          if (this.quantity == null)
8870            if (Configuration.errorOnAutoCreate())
8871              throw new Error("Attempt to auto-create AddedItemDetailComponent.quantity");
8872            else if (Configuration.doAutoCreate())
8873              this.quantity = new Quantity(); // cc
8874          return this.quantity;
8875        }
8876
8877        public boolean hasQuantity() { 
8878          return this.quantity != null && !this.quantity.isEmpty();
8879        }
8880
8881        /**
8882         * @param value {@link #quantity} (The number of repetitions of a service or product.)
8883         */
8884        public AddedItemDetailComponent setQuantity(Quantity value) { 
8885          this.quantity = value;
8886          return this;
8887        }
8888
8889        /**
8890         * @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.)
8891         */
8892        public Money getUnitPrice() { 
8893          if (this.unitPrice == null)
8894            if (Configuration.errorOnAutoCreate())
8895              throw new Error("Attempt to auto-create AddedItemDetailComponent.unitPrice");
8896            else if (Configuration.doAutoCreate())
8897              this.unitPrice = new Money(); // cc
8898          return this.unitPrice;
8899        }
8900
8901        public boolean hasUnitPrice() { 
8902          return this.unitPrice != null && !this.unitPrice.isEmpty();
8903        }
8904
8905        /**
8906         * @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.)
8907         */
8908        public AddedItemDetailComponent setUnitPrice(Money value) { 
8909          this.unitPrice = value;
8910          return this;
8911        }
8912
8913        /**
8914         * @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
8915         */
8916        public DecimalType getFactorElement() { 
8917          if (this.factor == null)
8918            if (Configuration.errorOnAutoCreate())
8919              throw new Error("Attempt to auto-create AddedItemDetailComponent.factor");
8920            else if (Configuration.doAutoCreate())
8921              this.factor = new DecimalType(); // bb
8922          return this.factor;
8923        }
8924
8925        public boolean hasFactorElement() { 
8926          return this.factor != null && !this.factor.isEmpty();
8927        }
8928
8929        public boolean hasFactor() { 
8930          return this.factor != null && !this.factor.isEmpty();
8931        }
8932
8933        /**
8934         * @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
8935         */
8936        public AddedItemDetailComponent setFactorElement(DecimalType value) { 
8937          this.factor = value;
8938          return this;
8939        }
8940
8941        /**
8942         * @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.
8943         */
8944        public BigDecimal getFactor() { 
8945          return this.factor == null ? null : this.factor.getValue();
8946        }
8947
8948        /**
8949         * @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.
8950         */
8951        public AddedItemDetailComponent setFactor(BigDecimal value) { 
8952          if (value == null)
8953            this.factor = null;
8954          else {
8955            if (this.factor == null)
8956              this.factor = new DecimalType();
8957            this.factor.setValue(value);
8958          }
8959          return this;
8960        }
8961
8962        /**
8963         * @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.
8964         */
8965        public AddedItemDetailComponent setFactor(long value) { 
8966              this.factor = new DecimalType();
8967            this.factor.setValue(value);
8968          return this;
8969        }
8970
8971        /**
8972         * @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.
8973         */
8974        public AddedItemDetailComponent setFactor(double value) { 
8975              this.factor = new DecimalType();
8976            this.factor.setValue(value);
8977          return this;
8978        }
8979
8980        /**
8981         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8982         */
8983        public Money getNet() { 
8984          if (this.net == null)
8985            if (Configuration.errorOnAutoCreate())
8986              throw new Error("Attempt to auto-create AddedItemDetailComponent.net");
8987            else if (Configuration.doAutoCreate())
8988              this.net = new Money(); // cc
8989          return this.net;
8990        }
8991
8992        public boolean hasNet() { 
8993          return this.net != null && !this.net.isEmpty();
8994        }
8995
8996        /**
8997         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8998         */
8999        public AddedItemDetailComponent setNet(Money value) { 
9000          this.net = value;
9001          return this;
9002        }
9003
9004        /**
9005         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9006         */
9007        public List<PositiveIntType> getNoteNumber() { 
9008          if (this.noteNumber == null)
9009            this.noteNumber = new ArrayList<PositiveIntType>();
9010          return this.noteNumber;
9011        }
9012
9013        /**
9014         * @return Returns a reference to <code>this</code> for easy method chaining
9015         */
9016        public AddedItemDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
9017          this.noteNumber = theNoteNumber;
9018          return this;
9019        }
9020
9021        public boolean hasNoteNumber() { 
9022          if (this.noteNumber == null)
9023            return false;
9024          for (PositiveIntType item : this.noteNumber)
9025            if (!item.isEmpty())
9026              return true;
9027          return false;
9028        }
9029
9030        /**
9031         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9032         */
9033        public PositiveIntType addNoteNumberElement() {//2 
9034          PositiveIntType t = new PositiveIntType();
9035          if (this.noteNumber == null)
9036            this.noteNumber = new ArrayList<PositiveIntType>();
9037          this.noteNumber.add(t);
9038          return t;
9039        }
9040
9041        /**
9042         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9043         */
9044        public AddedItemDetailComponent addNoteNumber(int value) { //1
9045          PositiveIntType t = new PositiveIntType();
9046          t.setValue(value);
9047          if (this.noteNumber == null)
9048            this.noteNumber = new ArrayList<PositiveIntType>();
9049          this.noteNumber.add(t);
9050          return this;
9051        }
9052
9053        /**
9054         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9055         */
9056        public boolean hasNoteNumber(int value) { 
9057          if (this.noteNumber == null)
9058            return false;
9059          for (PositiveIntType v : this.noteNumber)
9060            if (v.getValue().equals(value)) // positiveInt
9061              return true;
9062          return false;
9063        }
9064
9065        /**
9066         * @return {@link #adjudication} (The adjudication results.)
9067         */
9068        public List<AdjudicationComponent> getAdjudication() { 
9069          if (this.adjudication == null)
9070            this.adjudication = new ArrayList<AdjudicationComponent>();
9071          return this.adjudication;
9072        }
9073
9074        /**
9075         * @return Returns a reference to <code>this</code> for easy method chaining
9076         */
9077        public AddedItemDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
9078          this.adjudication = theAdjudication;
9079          return this;
9080        }
9081
9082        public boolean hasAdjudication() { 
9083          if (this.adjudication == null)
9084            return false;
9085          for (AdjudicationComponent item : this.adjudication)
9086            if (!item.isEmpty())
9087              return true;
9088          return false;
9089        }
9090
9091        public AdjudicationComponent addAdjudication() { //3
9092          AdjudicationComponent t = new AdjudicationComponent();
9093          if (this.adjudication == null)
9094            this.adjudication = new ArrayList<AdjudicationComponent>();
9095          this.adjudication.add(t);
9096          return t;
9097        }
9098
9099        public AddedItemDetailComponent addAdjudication(AdjudicationComponent t) { //3
9100          if (t == null)
9101            return this;
9102          if (this.adjudication == null)
9103            this.adjudication = new ArrayList<AdjudicationComponent>();
9104          this.adjudication.add(t);
9105          return this;
9106        }
9107
9108        /**
9109         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
9110         */
9111        public AdjudicationComponent getAdjudicationFirstRep() { 
9112          if (getAdjudication().isEmpty()) {
9113            addAdjudication();
9114          }
9115          return getAdjudication().get(0);
9116        }
9117
9118        /**
9119         * @return {@link #subDetail} (The third-tier service adjudications for payor added services.)
9120         */
9121        public List<AddedItemDetailSubDetailComponent> getSubDetail() { 
9122          if (this.subDetail == null)
9123            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9124          return this.subDetail;
9125        }
9126
9127        /**
9128         * @return Returns a reference to <code>this</code> for easy method chaining
9129         */
9130        public AddedItemDetailComponent setSubDetail(List<AddedItemDetailSubDetailComponent> theSubDetail) { 
9131          this.subDetail = theSubDetail;
9132          return this;
9133        }
9134
9135        public boolean hasSubDetail() { 
9136          if (this.subDetail == null)
9137            return false;
9138          for (AddedItemDetailSubDetailComponent item : this.subDetail)
9139            if (!item.isEmpty())
9140              return true;
9141          return false;
9142        }
9143
9144        public AddedItemDetailSubDetailComponent addSubDetail() { //3
9145          AddedItemDetailSubDetailComponent t = new AddedItemDetailSubDetailComponent();
9146          if (this.subDetail == null)
9147            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9148          this.subDetail.add(t);
9149          return t;
9150        }
9151
9152        public AddedItemDetailComponent addSubDetail(AddedItemDetailSubDetailComponent t) { //3
9153          if (t == null)
9154            return this;
9155          if (this.subDetail == null)
9156            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9157          this.subDetail.add(t);
9158          return this;
9159        }
9160
9161        /**
9162         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist {3}
9163         */
9164        public AddedItemDetailSubDetailComponent getSubDetailFirstRep() { 
9165          if (getSubDetail().isEmpty()) {
9166            addSubDetail();
9167          }
9168          return getSubDetail().get(0);
9169        }
9170
9171        protected void listChildren(List<Property> children) {
9172          super.listChildren(children);
9173          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));
9174          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));
9175          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
9176          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));
9177          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));
9178          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
9179          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));
9180          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
9181          children.add(new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
9182        }
9183
9184        @Override
9185        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9186          switch (_hash) {
9187          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);
9188          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);
9189          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
9190          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);
9191          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);
9192          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);
9193          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);
9194          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
9195          case -828829007: /*subDetail*/  return new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
9196          default: return super.getNamedProperty(_hash, _name, _checkValid);
9197          }
9198
9199        }
9200
9201      @Override
9202      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9203        switch (hash) {
9204        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
9205        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
9206        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
9207        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
9208        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
9209        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
9210        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
9211        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
9212        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // AddedItemDetailSubDetailComponent
9213        default: return super.getProperty(hash, name, checkValid);
9214        }
9215
9216      }
9217
9218      @Override
9219      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9220        switch (hash) {
9221        case 1957227299: // productOrService
9222          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9223          return value;
9224        case -615513385: // modifier
9225          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
9226          return value;
9227        case -1285004149: // quantity
9228          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
9229          return value;
9230        case -486196699: // unitPrice
9231          this.unitPrice = TypeConvertor.castToMoney(value); // Money
9232          return value;
9233        case -1282148017: // factor
9234          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
9235          return value;
9236        case 108957: // net
9237          this.net = TypeConvertor.castToMoney(value); // Money
9238          return value;
9239        case -1110033957: // noteNumber
9240          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
9241          return value;
9242        case -231349275: // adjudication
9243          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
9244          return value;
9245        case -828829007: // subDetail
9246          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value); // AddedItemDetailSubDetailComponent
9247          return value;
9248        default: return super.setProperty(hash, name, value);
9249        }
9250
9251      }
9252
9253      @Override
9254      public Base setProperty(String name, Base value) throws FHIRException {
9255        if (name.equals("productOrService")) {
9256          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9257        } else if (name.equals("modifier")) {
9258          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
9259        } else if (name.equals("quantity")) {
9260          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
9261        } else if (name.equals("unitPrice")) {
9262          this.unitPrice = TypeConvertor.castToMoney(value); // Money
9263        } else if (name.equals("factor")) {
9264          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
9265        } else if (name.equals("net")) {
9266          this.net = TypeConvertor.castToMoney(value); // Money
9267        } else if (name.equals("noteNumber")) {
9268          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
9269        } else if (name.equals("adjudication")) {
9270          this.getAdjudication().add((AdjudicationComponent) value);
9271        } else if (name.equals("subDetail")) {
9272          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value);
9273        } else
9274          return super.setProperty(name, value);
9275        return value;
9276      }
9277
9278      @Override
9279      public Base makeProperty(int hash, String name) throws FHIRException {
9280        switch (hash) {
9281        case 1957227299:  return getProductOrService();
9282        case -615513385:  return addModifier(); 
9283        case -1285004149:  return getQuantity();
9284        case -486196699:  return getUnitPrice();
9285        case -1282148017:  return getFactorElement();
9286        case 108957:  return getNet();
9287        case -1110033957:  return addNoteNumberElement();
9288        case -231349275:  return addAdjudication(); 
9289        case -828829007:  return addSubDetail(); 
9290        default: return super.makeProperty(hash, name);
9291        }
9292
9293      }
9294
9295      @Override
9296      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9297        switch (hash) {
9298        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
9299        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
9300        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
9301        case -486196699: /*unitPrice*/ return new String[] {"Money"};
9302        case -1282148017: /*factor*/ return new String[] {"decimal"};
9303        case 108957: /*net*/ return new String[] {"Money"};
9304        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
9305        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
9306        case -828829007: /*subDetail*/ return new String[] {};
9307        default: return super.getTypesForProperty(hash, name);
9308        }
9309
9310      }
9311
9312      @Override
9313      public Base addChild(String name) throws FHIRException {
9314        if (name.equals("productOrService")) {
9315          this.productOrService = new CodeableConcept();
9316          return this.productOrService;
9317        }
9318        else if (name.equals("modifier")) {
9319          return addModifier();
9320        }
9321        else if (name.equals("quantity")) {
9322          this.quantity = new Quantity();
9323          return this.quantity;
9324        }
9325        else if (name.equals("unitPrice")) {
9326          this.unitPrice = new Money();
9327          return this.unitPrice;
9328        }
9329        else if (name.equals("factor")) {
9330          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detail.factor");
9331        }
9332        else if (name.equals("net")) {
9333          this.net = new Money();
9334          return this.net;
9335        }
9336        else if (name.equals("noteNumber")) {
9337          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detail.noteNumber");
9338        }
9339        else if (name.equals("adjudication")) {
9340          return addAdjudication();
9341        }
9342        else if (name.equals("subDetail")) {
9343          return addSubDetail();
9344        }
9345        else
9346          return super.addChild(name);
9347      }
9348
9349      public AddedItemDetailComponent copy() {
9350        AddedItemDetailComponent dst = new AddedItemDetailComponent();
9351        copyValues(dst);
9352        return dst;
9353      }
9354
9355      public void copyValues(AddedItemDetailComponent dst) {
9356        super.copyValues(dst);
9357        dst.productOrService = productOrService == null ? null : productOrService.copy();
9358        if (modifier != null) {
9359          dst.modifier = new ArrayList<CodeableConcept>();
9360          for (CodeableConcept i : modifier)
9361            dst.modifier.add(i.copy());
9362        };
9363        dst.quantity = quantity == null ? null : quantity.copy();
9364        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
9365        dst.factor = factor == null ? null : factor.copy();
9366        dst.net = net == null ? null : net.copy();
9367        if (noteNumber != null) {
9368          dst.noteNumber = new ArrayList<PositiveIntType>();
9369          for (PositiveIntType i : noteNumber)
9370            dst.noteNumber.add(i.copy());
9371        };
9372        if (adjudication != null) {
9373          dst.adjudication = new ArrayList<AdjudicationComponent>();
9374          for (AdjudicationComponent i : adjudication)
9375            dst.adjudication.add(i.copy());
9376        };
9377        if (subDetail != null) {
9378          dst.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9379          for (AddedItemDetailSubDetailComponent i : subDetail)
9380            dst.subDetail.add(i.copy());
9381        };
9382      }
9383
9384      @Override
9385      public boolean equalsDeep(Base other_) {
9386        if (!super.equalsDeep(other_))
9387          return false;
9388        if (!(other_ instanceof AddedItemDetailComponent))
9389          return false;
9390        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9391        return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
9392           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
9393           && compareDeep(net, o.net, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
9394           && compareDeep(subDetail, o.subDetail, true);
9395      }
9396
9397      @Override
9398      public boolean equalsShallow(Base other_) {
9399        if (!super.equalsShallow(other_))
9400          return false;
9401        if (!(other_ instanceof AddedItemDetailComponent))
9402          return false;
9403        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9404        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
9405      }
9406
9407      public boolean isEmpty() {
9408        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier
9409          , quantity, unitPrice, factor, net, noteNumber, adjudication, subDetail);
9410      }
9411
9412  public String fhirType() {
9413    return "ExplanationOfBenefit.addItem.detail";
9414
9415  }
9416
9417  }
9418
9419    @Block()
9420    public static class AddedItemDetailSubDetailComponent extends BackboneElement implements IBaseBackboneElement {
9421        /**
9422         * 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.
9423         */
9424        @Child(name = "productOrService", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9425        @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." )
9426        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
9427        protected CodeableConcept productOrService;
9428
9429        /**
9430         * Item typification or modifiers codes to convey additional context for the product or service.
9431         */
9432        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9433        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
9434        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
9435        protected List<CodeableConcept> modifier;
9436
9437        /**
9438         * The number of repetitions of a service or product.
9439         */
9440        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
9441        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
9442        protected Quantity quantity;
9443
9444        /**
9445         * 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.
9446         */
9447        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
9448        @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." )
9449        protected Money unitPrice;
9450
9451        /**
9452         * 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.
9453         */
9454        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
9455        @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." )
9456        protected DecimalType factor;
9457
9458        /**
9459         * The quantity times the unit price for an additional service or product or charge.
9460         */
9461        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
9462        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
9463        protected Money net;
9464
9465        /**
9466         * The numbers associated with notes below which apply to the adjudication of this item.
9467         */
9468        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9469        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
9470        protected List<PositiveIntType> noteNumber;
9471
9472        /**
9473         * The adjudication results.
9474         */
9475        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9476        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
9477        protected List<AdjudicationComponent> adjudication;
9478
9479        private static final long serialVersionUID = 1301363592L;
9480
9481    /**
9482     * Constructor
9483     */
9484      public AddedItemDetailSubDetailComponent() {
9485        super();
9486      }
9487
9488    /**
9489     * Constructor
9490     */
9491      public AddedItemDetailSubDetailComponent(CodeableConcept productOrService) {
9492        super();
9493        this.setProductOrService(productOrService);
9494      }
9495
9496        /**
9497         * @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.)
9498         */
9499        public CodeableConcept getProductOrService() { 
9500          if (this.productOrService == null)
9501            if (Configuration.errorOnAutoCreate())
9502              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.productOrService");
9503            else if (Configuration.doAutoCreate())
9504              this.productOrService = new CodeableConcept(); // cc
9505          return this.productOrService;
9506        }
9507
9508        public boolean hasProductOrService() { 
9509          return this.productOrService != null && !this.productOrService.isEmpty();
9510        }
9511
9512        /**
9513         * @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.)
9514         */
9515        public AddedItemDetailSubDetailComponent setProductOrService(CodeableConcept value) { 
9516          this.productOrService = value;
9517          return this;
9518        }
9519
9520        /**
9521         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
9522         */
9523        public List<CodeableConcept> getModifier() { 
9524          if (this.modifier == null)
9525            this.modifier = new ArrayList<CodeableConcept>();
9526          return this.modifier;
9527        }
9528
9529        /**
9530         * @return Returns a reference to <code>this</code> for easy method chaining
9531         */
9532        public AddedItemDetailSubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
9533          this.modifier = theModifier;
9534          return this;
9535        }
9536
9537        public boolean hasModifier() { 
9538          if (this.modifier == null)
9539            return false;
9540          for (CodeableConcept item : this.modifier)
9541            if (!item.isEmpty())
9542              return true;
9543          return false;
9544        }
9545
9546        public CodeableConcept addModifier() { //3
9547          CodeableConcept t = new CodeableConcept();
9548          if (this.modifier == null)
9549            this.modifier = new ArrayList<CodeableConcept>();
9550          this.modifier.add(t);
9551          return t;
9552        }
9553
9554        public AddedItemDetailSubDetailComponent addModifier(CodeableConcept t) { //3
9555          if (t == null)
9556            return this;
9557          if (this.modifier == null)
9558            this.modifier = new ArrayList<CodeableConcept>();
9559          this.modifier.add(t);
9560          return this;
9561        }
9562
9563        /**
9564         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
9565         */
9566        public CodeableConcept getModifierFirstRep() { 
9567          if (getModifier().isEmpty()) {
9568            addModifier();
9569          }
9570          return getModifier().get(0);
9571        }
9572
9573        /**
9574         * @return {@link #quantity} (The number of repetitions of a service or product.)
9575         */
9576        public Quantity getQuantity() { 
9577          if (this.quantity == null)
9578            if (Configuration.errorOnAutoCreate())
9579              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.quantity");
9580            else if (Configuration.doAutoCreate())
9581              this.quantity = new Quantity(); // cc
9582          return this.quantity;
9583        }
9584
9585        public boolean hasQuantity() { 
9586          return this.quantity != null && !this.quantity.isEmpty();
9587        }
9588
9589        /**
9590         * @param value {@link #quantity} (The number of repetitions of a service or product.)
9591         */
9592        public AddedItemDetailSubDetailComponent setQuantity(Quantity value) { 
9593          this.quantity = value;
9594          return this;
9595        }
9596
9597        /**
9598         * @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.)
9599         */
9600        public Money getUnitPrice() { 
9601          if (this.unitPrice == null)
9602            if (Configuration.errorOnAutoCreate())
9603              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.unitPrice");
9604            else if (Configuration.doAutoCreate())
9605              this.unitPrice = new Money(); // cc
9606          return this.unitPrice;
9607        }
9608
9609        public boolean hasUnitPrice() { 
9610          return this.unitPrice != null && !this.unitPrice.isEmpty();
9611        }
9612
9613        /**
9614         * @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.)
9615         */
9616        public AddedItemDetailSubDetailComponent setUnitPrice(Money value) { 
9617          this.unitPrice = value;
9618          return this;
9619        }
9620
9621        /**
9622         * @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
9623         */
9624        public DecimalType getFactorElement() { 
9625          if (this.factor == null)
9626            if (Configuration.errorOnAutoCreate())
9627              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.factor");
9628            else if (Configuration.doAutoCreate())
9629              this.factor = new DecimalType(); // bb
9630          return this.factor;
9631        }
9632
9633        public boolean hasFactorElement() { 
9634          return this.factor != null && !this.factor.isEmpty();
9635        }
9636
9637        public boolean hasFactor() { 
9638          return this.factor != null && !this.factor.isEmpty();
9639        }
9640
9641        /**
9642         * @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
9643         */
9644        public AddedItemDetailSubDetailComponent setFactorElement(DecimalType value) { 
9645          this.factor = value;
9646          return this;
9647        }
9648
9649        /**
9650         * @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.
9651         */
9652        public BigDecimal getFactor() { 
9653          return this.factor == null ? null : this.factor.getValue();
9654        }
9655
9656        /**
9657         * @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.
9658         */
9659        public AddedItemDetailSubDetailComponent setFactor(BigDecimal value) { 
9660          if (value == null)
9661            this.factor = null;
9662          else {
9663            if (this.factor == null)
9664              this.factor = new DecimalType();
9665            this.factor.setValue(value);
9666          }
9667          return this;
9668        }
9669
9670        /**
9671         * @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.
9672         */
9673        public AddedItemDetailSubDetailComponent setFactor(long value) { 
9674              this.factor = new DecimalType();
9675            this.factor.setValue(value);
9676          return this;
9677        }
9678
9679        /**
9680         * @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.
9681         */
9682        public AddedItemDetailSubDetailComponent setFactor(double value) { 
9683              this.factor = new DecimalType();
9684            this.factor.setValue(value);
9685          return this;
9686        }
9687
9688        /**
9689         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9690         */
9691        public Money getNet() { 
9692          if (this.net == null)
9693            if (Configuration.errorOnAutoCreate())
9694              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.net");
9695            else if (Configuration.doAutoCreate())
9696              this.net = new Money(); // cc
9697          return this.net;
9698        }
9699
9700        public boolean hasNet() { 
9701          return this.net != null && !this.net.isEmpty();
9702        }
9703
9704        /**
9705         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9706         */
9707        public AddedItemDetailSubDetailComponent setNet(Money value) { 
9708          this.net = value;
9709          return this;
9710        }
9711
9712        /**
9713         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9714         */
9715        public List<PositiveIntType> getNoteNumber() { 
9716          if (this.noteNumber == null)
9717            this.noteNumber = new ArrayList<PositiveIntType>();
9718          return this.noteNumber;
9719        }
9720
9721        /**
9722         * @return Returns a reference to <code>this</code> for easy method chaining
9723         */
9724        public AddedItemDetailSubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
9725          this.noteNumber = theNoteNumber;
9726          return this;
9727        }
9728
9729        public boolean hasNoteNumber() { 
9730          if (this.noteNumber == null)
9731            return false;
9732          for (PositiveIntType item : this.noteNumber)
9733            if (!item.isEmpty())
9734              return true;
9735          return false;
9736        }
9737
9738        /**
9739         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9740         */
9741        public PositiveIntType addNoteNumberElement() {//2 
9742          PositiveIntType t = new PositiveIntType();
9743          if (this.noteNumber == null)
9744            this.noteNumber = new ArrayList<PositiveIntType>();
9745          this.noteNumber.add(t);
9746          return t;
9747        }
9748
9749        /**
9750         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9751         */
9752        public AddedItemDetailSubDetailComponent addNoteNumber(int value) { //1
9753          PositiveIntType t = new PositiveIntType();
9754          t.setValue(value);
9755          if (this.noteNumber == null)
9756            this.noteNumber = new ArrayList<PositiveIntType>();
9757          this.noteNumber.add(t);
9758          return this;
9759        }
9760
9761        /**
9762         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9763         */
9764        public boolean hasNoteNumber(int value) { 
9765          if (this.noteNumber == null)
9766            return false;
9767          for (PositiveIntType v : this.noteNumber)
9768            if (v.getValue().equals(value)) // positiveInt
9769              return true;
9770          return false;
9771        }
9772
9773        /**
9774         * @return {@link #adjudication} (The adjudication results.)
9775         */
9776        public List<AdjudicationComponent> getAdjudication() { 
9777          if (this.adjudication == null)
9778            this.adjudication = new ArrayList<AdjudicationComponent>();
9779          return this.adjudication;
9780        }
9781
9782        /**
9783         * @return Returns a reference to <code>this</code> for easy method chaining
9784         */
9785        public AddedItemDetailSubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
9786          this.adjudication = theAdjudication;
9787          return this;
9788        }
9789
9790        public boolean hasAdjudication() { 
9791          if (this.adjudication == null)
9792            return false;
9793          for (AdjudicationComponent item : this.adjudication)
9794            if (!item.isEmpty())
9795              return true;
9796          return false;
9797        }
9798
9799        public AdjudicationComponent addAdjudication() { //3
9800          AdjudicationComponent t = new AdjudicationComponent();
9801          if (this.adjudication == null)
9802            this.adjudication = new ArrayList<AdjudicationComponent>();
9803          this.adjudication.add(t);
9804          return t;
9805        }
9806
9807        public AddedItemDetailSubDetailComponent addAdjudication(AdjudicationComponent t) { //3
9808          if (t == null)
9809            return this;
9810          if (this.adjudication == null)
9811            this.adjudication = new ArrayList<AdjudicationComponent>();
9812          this.adjudication.add(t);
9813          return this;
9814        }
9815
9816        /**
9817         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
9818         */
9819        public AdjudicationComponent getAdjudicationFirstRep() { 
9820          if (getAdjudication().isEmpty()) {
9821            addAdjudication();
9822          }
9823          return getAdjudication().get(0);
9824        }
9825
9826        protected void listChildren(List<Property> children) {
9827          super.listChildren(children);
9828          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));
9829          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));
9830          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
9831          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));
9832          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));
9833          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
9834          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));
9835          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
9836        }
9837
9838        @Override
9839        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9840          switch (_hash) {
9841          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);
9842          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);
9843          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
9844          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);
9845          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);
9846          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);
9847          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);
9848          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
9849          default: return super.getNamedProperty(_hash, _name, _checkValid);
9850          }
9851
9852        }
9853
9854      @Override
9855      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9856        switch (hash) {
9857        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
9858        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
9859        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
9860        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
9861        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
9862        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
9863        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
9864        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
9865        default: return super.getProperty(hash, name, checkValid);
9866        }
9867
9868      }
9869
9870      @Override
9871      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9872        switch (hash) {
9873        case 1957227299: // productOrService
9874          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9875          return value;
9876        case -615513385: // modifier
9877          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
9878          return value;
9879        case -1285004149: // quantity
9880          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
9881          return value;
9882        case -486196699: // unitPrice
9883          this.unitPrice = TypeConvertor.castToMoney(value); // Money
9884          return value;
9885        case -1282148017: // factor
9886          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
9887          return value;
9888        case 108957: // net
9889          this.net = TypeConvertor.castToMoney(value); // Money
9890          return value;
9891        case -1110033957: // noteNumber
9892          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
9893          return value;
9894        case -231349275: // adjudication
9895          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
9896          return value;
9897        default: return super.setProperty(hash, name, value);
9898        }
9899
9900      }
9901
9902      @Override
9903      public Base setProperty(String name, Base value) throws FHIRException {
9904        if (name.equals("productOrService")) {
9905          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9906        } else if (name.equals("modifier")) {
9907          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
9908        } else if (name.equals("quantity")) {
9909          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
9910        } else if (name.equals("unitPrice")) {
9911          this.unitPrice = TypeConvertor.castToMoney(value); // Money
9912        } else if (name.equals("factor")) {
9913          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
9914        } else if (name.equals("net")) {
9915          this.net = TypeConvertor.castToMoney(value); // Money
9916        } else if (name.equals("noteNumber")) {
9917          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
9918        } else if (name.equals("adjudication")) {
9919          this.getAdjudication().add((AdjudicationComponent) value);
9920        } else
9921          return super.setProperty(name, value);
9922        return value;
9923      }
9924
9925      @Override
9926      public Base makeProperty(int hash, String name) throws FHIRException {
9927        switch (hash) {
9928        case 1957227299:  return getProductOrService();
9929        case -615513385:  return addModifier(); 
9930        case -1285004149:  return getQuantity();
9931        case -486196699:  return getUnitPrice();
9932        case -1282148017:  return getFactorElement();
9933        case 108957:  return getNet();
9934        case -1110033957:  return addNoteNumberElement();
9935        case -231349275:  return addAdjudication(); 
9936        default: return super.makeProperty(hash, name);
9937        }
9938
9939      }
9940
9941      @Override
9942      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9943        switch (hash) {
9944        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
9945        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
9946        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
9947        case -486196699: /*unitPrice*/ return new String[] {"Money"};
9948        case -1282148017: /*factor*/ return new String[] {"decimal"};
9949        case 108957: /*net*/ return new String[] {"Money"};
9950        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
9951        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
9952        default: return super.getTypesForProperty(hash, name);
9953        }
9954
9955      }
9956
9957      @Override
9958      public Base addChild(String name) throws FHIRException {
9959        if (name.equals("productOrService")) {
9960          this.productOrService = new CodeableConcept();
9961          return this.productOrService;
9962        }
9963        else if (name.equals("modifier")) {
9964          return addModifier();
9965        }
9966        else if (name.equals("quantity")) {
9967          this.quantity = new Quantity();
9968          return this.quantity;
9969        }
9970        else if (name.equals("unitPrice")) {
9971          this.unitPrice = new Money();
9972          return this.unitPrice;
9973        }
9974        else if (name.equals("factor")) {
9975          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detail.subDetail.factor");
9976        }
9977        else if (name.equals("net")) {
9978          this.net = new Money();
9979          return this.net;
9980        }
9981        else if (name.equals("noteNumber")) {
9982          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detail.subDetail.noteNumber");
9983        }
9984        else if (name.equals("adjudication")) {
9985          return addAdjudication();
9986        }
9987        else
9988          return super.addChild(name);
9989      }
9990
9991      public AddedItemDetailSubDetailComponent copy() {
9992        AddedItemDetailSubDetailComponent dst = new AddedItemDetailSubDetailComponent();
9993        copyValues(dst);
9994        return dst;
9995      }
9996
9997      public void copyValues(AddedItemDetailSubDetailComponent dst) {
9998        super.copyValues(dst);
9999        dst.productOrService = productOrService == null ? null : productOrService.copy();
10000        if (modifier != null) {
10001          dst.modifier = new ArrayList<CodeableConcept>();
10002          for (CodeableConcept i : modifier)
10003            dst.modifier.add(i.copy());
10004        };
10005        dst.quantity = quantity == null ? null : quantity.copy();
10006        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
10007        dst.factor = factor == null ? null : factor.copy();
10008        dst.net = net == null ? null : net.copy();
10009        if (noteNumber != null) {
10010          dst.noteNumber = new ArrayList<PositiveIntType>();
10011          for (PositiveIntType i : noteNumber)
10012            dst.noteNumber.add(i.copy());
10013        };
10014        if (adjudication != null) {
10015          dst.adjudication = new ArrayList<AdjudicationComponent>();
10016          for (AdjudicationComponent i : adjudication)
10017            dst.adjudication.add(i.copy());
10018        };
10019      }
10020
10021      @Override
10022      public boolean equalsDeep(Base other_) {
10023        if (!super.equalsDeep(other_))
10024          return false;
10025        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10026          return false;
10027        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10028        return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
10029           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
10030           && compareDeep(net, o.net, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
10031          ;
10032      }
10033
10034      @Override
10035      public boolean equalsShallow(Base other_) {
10036        if (!super.equalsShallow(other_))
10037          return false;
10038        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10039          return false;
10040        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10041        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
10042      }
10043
10044      public boolean isEmpty() {
10045        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier
10046          , quantity, unitPrice, factor, net, noteNumber, adjudication);
10047      }
10048
10049  public String fhirType() {
10050    return "ExplanationOfBenefit.addItem.detail.subDetail";
10051
10052  }
10053
10054  }
10055
10056    @Block()
10057    public static class TotalComponent extends BackboneElement implements IBaseBackboneElement {
10058        /**
10059         * 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.
10060         */
10061        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
10062        @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." )
10063        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
10064        protected CodeableConcept category;
10065
10066        /**
10067         * Monetary total amount associated with the category.
10068         */
10069        @Child(name = "amount", type = {Money.class}, order=2, min=1, max=1, modifier=false, summary=true)
10070        @Description(shortDefinition="Financial total for the category", formalDefinition="Monetary total amount associated with the category." )
10071        protected Money amount;
10072
10073        private static final long serialVersionUID = 2012310309L;
10074
10075    /**
10076     * Constructor
10077     */
10078      public TotalComponent() {
10079        super();
10080      }
10081
10082    /**
10083     * Constructor
10084     */
10085      public TotalComponent(CodeableConcept category, Money amount) {
10086        super();
10087        this.setCategory(category);
10088        this.setAmount(amount);
10089      }
10090
10091        /**
10092         * @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.)
10093         */
10094        public CodeableConcept getCategory() { 
10095          if (this.category == null)
10096            if (Configuration.errorOnAutoCreate())
10097              throw new Error("Attempt to auto-create TotalComponent.category");
10098            else if (Configuration.doAutoCreate())
10099              this.category = new CodeableConcept(); // cc
10100          return this.category;
10101        }
10102
10103        public boolean hasCategory() { 
10104          return this.category != null && !this.category.isEmpty();
10105        }
10106
10107        /**
10108         * @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.)
10109         */
10110        public TotalComponent setCategory(CodeableConcept value) { 
10111          this.category = value;
10112          return this;
10113        }
10114
10115        /**
10116         * @return {@link #amount} (Monetary total amount associated with the category.)
10117         */
10118        public Money getAmount() { 
10119          if (this.amount == null)
10120            if (Configuration.errorOnAutoCreate())
10121              throw new Error("Attempt to auto-create TotalComponent.amount");
10122            else if (Configuration.doAutoCreate())
10123              this.amount = new Money(); // cc
10124          return this.amount;
10125        }
10126
10127        public boolean hasAmount() { 
10128          return this.amount != null && !this.amount.isEmpty();
10129        }
10130
10131        /**
10132         * @param value {@link #amount} (Monetary total amount associated with the category.)
10133         */
10134        public TotalComponent setAmount(Money value) { 
10135          this.amount = value;
10136          return this;
10137        }
10138
10139        protected void listChildren(List<Property> children) {
10140          super.listChildren(children);
10141          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));
10142          children.add(new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount));
10143        }
10144
10145        @Override
10146        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10147          switch (_hash) {
10148          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);
10149          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount);
10150          default: return super.getNamedProperty(_hash, _name, _checkValid);
10151          }
10152
10153        }
10154
10155      @Override
10156      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10157        switch (hash) {
10158        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
10159        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
10160        default: return super.getProperty(hash, name, checkValid);
10161        }
10162
10163      }
10164
10165      @Override
10166      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10167        switch (hash) {
10168        case 50511102: // category
10169          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10170          return value;
10171        case -1413853096: // amount
10172          this.amount = TypeConvertor.castToMoney(value); // Money
10173          return value;
10174        default: return super.setProperty(hash, name, value);
10175        }
10176
10177      }
10178
10179      @Override
10180      public Base setProperty(String name, Base value) throws FHIRException {
10181        if (name.equals("category")) {
10182          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10183        } else if (name.equals("amount")) {
10184          this.amount = TypeConvertor.castToMoney(value); // Money
10185        } else
10186          return super.setProperty(name, value);
10187        return value;
10188      }
10189
10190      @Override
10191      public Base makeProperty(int hash, String name) throws FHIRException {
10192        switch (hash) {
10193        case 50511102:  return getCategory();
10194        case -1413853096:  return getAmount();
10195        default: return super.makeProperty(hash, name);
10196        }
10197
10198      }
10199
10200      @Override
10201      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10202        switch (hash) {
10203        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
10204        case -1413853096: /*amount*/ return new String[] {"Money"};
10205        default: return super.getTypesForProperty(hash, name);
10206        }
10207
10208      }
10209
10210      @Override
10211      public Base addChild(String name) throws FHIRException {
10212        if (name.equals("category")) {
10213          this.category = new CodeableConcept();
10214          return this.category;
10215        }
10216        else if (name.equals("amount")) {
10217          this.amount = new Money();
10218          return this.amount;
10219        }
10220        else
10221          return super.addChild(name);
10222      }
10223
10224      public TotalComponent copy() {
10225        TotalComponent dst = new TotalComponent();
10226        copyValues(dst);
10227        return dst;
10228      }
10229
10230      public void copyValues(TotalComponent dst) {
10231        super.copyValues(dst);
10232        dst.category = category == null ? null : category.copy();
10233        dst.amount = amount == null ? null : amount.copy();
10234      }
10235
10236      @Override
10237      public boolean equalsDeep(Base other_) {
10238        if (!super.equalsDeep(other_))
10239          return false;
10240        if (!(other_ instanceof TotalComponent))
10241          return false;
10242        TotalComponent o = (TotalComponent) other_;
10243        return compareDeep(category, o.category, true) && compareDeep(amount, o.amount, true);
10244      }
10245
10246      @Override
10247      public boolean equalsShallow(Base other_) {
10248        if (!super.equalsShallow(other_))
10249          return false;
10250        if (!(other_ instanceof TotalComponent))
10251          return false;
10252        TotalComponent o = (TotalComponent) other_;
10253        return true;
10254      }
10255
10256      public boolean isEmpty() {
10257        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, amount);
10258      }
10259
10260  public String fhirType() {
10261    return "ExplanationOfBenefit.total";
10262
10263  }
10264
10265  }
10266
10267    @Block()
10268    public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
10269        /**
10270         * Whether this represents partial or complete payment of the benefits payable.
10271         */
10272        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
10273        @Description(shortDefinition="Partial or complete payment", formalDefinition="Whether this represents partial or complete payment of the benefits payable." )
10274        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-paymenttype")
10275        protected CodeableConcept type;
10276
10277        /**
10278         * Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.
10279         */
10280        @Child(name = "adjustment", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
10281        @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." )
10282        protected Money adjustment;
10283
10284        /**
10285         * Reason for the payment adjustment.
10286         */
10287        @Child(name = "adjustmentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
10288        @Description(shortDefinition="Explanation for the variance", formalDefinition="Reason for the payment adjustment." )
10289        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
10290        protected CodeableConcept adjustmentReason;
10291
10292        /**
10293         * Estimated date the payment will be issued or the actual issue date of payment.
10294         */
10295        @Child(name = "date", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=false)
10296        @Description(shortDefinition="Expected date of payment", formalDefinition="Estimated date the payment will be issued or the actual issue date of payment." )
10297        protected DateType date;
10298
10299        /**
10300         * Benefits payable less any payment adjustment.
10301         */
10302        @Child(name = "amount", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
10303        @Description(shortDefinition="Payable amount after adjustment", formalDefinition="Benefits payable less any payment adjustment." )
10304        protected Money amount;
10305
10306        /**
10307         * Issuer's unique identifier for the payment instrument.
10308         */
10309        @Child(name = "identifier", type = {Identifier.class}, order=6, min=0, max=1, modifier=false, summary=false)
10310        @Description(shortDefinition="Business identifier for the payment", formalDefinition="Issuer's unique identifier for the payment instrument." )
10311        protected Identifier identifier;
10312
10313        private static final long serialVersionUID = 1539906026L;
10314
10315    /**
10316     * Constructor
10317     */
10318      public PaymentComponent() {
10319        super();
10320      }
10321
10322        /**
10323         * @return {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
10324         */
10325        public CodeableConcept getType() { 
10326          if (this.type == null)
10327            if (Configuration.errorOnAutoCreate())
10328              throw new Error("Attempt to auto-create PaymentComponent.type");
10329            else if (Configuration.doAutoCreate())
10330              this.type = new CodeableConcept(); // cc
10331          return this.type;
10332        }
10333
10334        public boolean hasType() { 
10335          return this.type != null && !this.type.isEmpty();
10336        }
10337
10338        /**
10339         * @param value {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
10340         */
10341        public PaymentComponent setType(CodeableConcept value) { 
10342          this.type = value;
10343          return this;
10344        }
10345
10346        /**
10347         * @return {@link #adjustment} (Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.)
10348         */
10349        public Money getAdjustment() { 
10350          if (this.adjustment == null)
10351            if (Configuration.errorOnAutoCreate())
10352              throw new Error("Attempt to auto-create PaymentComponent.adjustment");
10353            else if (Configuration.doAutoCreate())
10354              this.adjustment = new Money(); // cc
10355          return this.adjustment;
10356        }
10357
10358        public boolean hasAdjustment() { 
10359          return this.adjustment != null && !this.adjustment.isEmpty();
10360        }
10361
10362        /**
10363         * @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.)
10364         */
10365        public PaymentComponent setAdjustment(Money value) { 
10366          this.adjustment = value;
10367          return this;
10368        }
10369
10370        /**
10371         * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
10372         */
10373        public CodeableConcept getAdjustmentReason() { 
10374          if (this.adjustmentReason == null)
10375            if (Configuration.errorOnAutoCreate())
10376              throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
10377            else if (Configuration.doAutoCreate())
10378              this.adjustmentReason = new CodeableConcept(); // cc
10379          return this.adjustmentReason;
10380        }
10381
10382        public boolean hasAdjustmentReason() { 
10383          return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
10384        }
10385
10386        /**
10387         * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
10388         */
10389        public PaymentComponent setAdjustmentReason(CodeableConcept value) { 
10390          this.adjustmentReason = value;
10391          return this;
10392        }
10393
10394        /**
10395         * @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
10396         */
10397        public DateType getDateElement() { 
10398          if (this.date == null)
10399            if (Configuration.errorOnAutoCreate())
10400              throw new Error("Attempt to auto-create PaymentComponent.date");
10401            else if (Configuration.doAutoCreate())
10402              this.date = new DateType(); // bb
10403          return this.date;
10404        }
10405
10406        public boolean hasDateElement() { 
10407          return this.date != null && !this.date.isEmpty();
10408        }
10409
10410        public boolean hasDate() { 
10411          return this.date != null && !this.date.isEmpty();
10412        }
10413
10414        /**
10415         * @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
10416         */
10417        public PaymentComponent setDateElement(DateType value) { 
10418          this.date = value;
10419          return this;
10420        }
10421
10422        /**
10423         * @return Estimated date the payment will be issued or the actual issue date of payment.
10424         */
10425        public Date getDate() { 
10426          return this.date == null ? null : this.date.getValue();
10427        }
10428
10429        /**
10430         * @param value Estimated date the payment will be issued or the actual issue date of payment.
10431         */
10432        public PaymentComponent setDate(Date value) { 
10433          if (value == null)
10434            this.date = null;
10435          else {
10436            if (this.date == null)
10437              this.date = new DateType();
10438            this.date.setValue(value);
10439          }
10440          return this;
10441        }
10442
10443        /**
10444         * @return {@link #amount} (Benefits payable less any payment adjustment.)
10445         */
10446        public Money getAmount() { 
10447          if (this.amount == null)
10448            if (Configuration.errorOnAutoCreate())
10449              throw new Error("Attempt to auto-create PaymentComponent.amount");
10450            else if (Configuration.doAutoCreate())
10451              this.amount = new Money(); // cc
10452          return this.amount;
10453        }
10454
10455        public boolean hasAmount() { 
10456          return this.amount != null && !this.amount.isEmpty();
10457        }
10458
10459        /**
10460         * @param value {@link #amount} (Benefits payable less any payment adjustment.)
10461         */
10462        public PaymentComponent setAmount(Money value) { 
10463          this.amount = value;
10464          return this;
10465        }
10466
10467        /**
10468         * @return {@link #identifier} (Issuer's unique identifier for the payment instrument.)
10469         */
10470        public Identifier getIdentifier() { 
10471          if (this.identifier == null)
10472            if (Configuration.errorOnAutoCreate())
10473              throw new Error("Attempt to auto-create PaymentComponent.identifier");
10474            else if (Configuration.doAutoCreate())
10475              this.identifier = new Identifier(); // cc
10476          return this.identifier;
10477        }
10478
10479        public boolean hasIdentifier() { 
10480          return this.identifier != null && !this.identifier.isEmpty();
10481        }
10482
10483        /**
10484         * @param value {@link #identifier} (Issuer's unique identifier for the payment instrument.)
10485         */
10486        public PaymentComponent setIdentifier(Identifier value) { 
10487          this.identifier = value;
10488          return this;
10489        }
10490
10491        protected void listChildren(List<Property> children) {
10492          super.listChildren(children);
10493          children.add(new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type));
10494          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));
10495          children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason));
10496          children.add(new Property("date", "date", "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date));
10497          children.add(new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount));
10498          children.add(new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier));
10499        }
10500
10501        @Override
10502        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10503          switch (_hash) {
10504          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type);
10505          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);
10506          case -1255938543: /*adjustmentReason*/  return new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason);
10507          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);
10508          case -1413853096: /*amount*/  return new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount);
10509          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier);
10510          default: return super.getNamedProperty(_hash, _name, _checkValid);
10511          }
10512
10513        }
10514
10515      @Override
10516      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10517        switch (hash) {
10518        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
10519        case 1977085293: /*adjustment*/ return this.adjustment == null ? new Base[0] : new Base[] {this.adjustment}; // Money
10520        case -1255938543: /*adjustmentReason*/ return this.adjustmentReason == null ? new Base[0] : new Base[] {this.adjustmentReason}; // CodeableConcept
10521        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
10522        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
10523        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
10524        default: return super.getProperty(hash, name, checkValid);
10525        }
10526
10527      }
10528
10529      @Override
10530      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10531        switch (hash) {
10532        case 3575610: // type
10533          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10534          return value;
10535        case 1977085293: // adjustment
10536          this.adjustment = TypeConvertor.castToMoney(value); // Money
10537          return value;
10538        case -1255938543: // adjustmentReason
10539          this.adjustmentReason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10540          return value;
10541        case 3076014: // date
10542          this.date = TypeConvertor.castToDate(value); // DateType
10543          return value;
10544        case -1413853096: // amount
10545          this.amount = TypeConvertor.castToMoney(value); // Money
10546          return value;
10547        case -1618432855: // identifier
10548          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
10549          return value;
10550        default: return super.setProperty(hash, name, value);
10551        }
10552
10553      }
10554
10555      @Override
10556      public Base setProperty(String name, Base value) throws FHIRException {
10557        if (name.equals("type")) {
10558          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10559        } else if (name.equals("adjustment")) {
10560          this.adjustment = TypeConvertor.castToMoney(value); // Money
10561        } else if (name.equals("adjustmentReason")) {
10562          this.adjustmentReason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10563        } else if (name.equals("date")) {
10564          this.date = TypeConvertor.castToDate(value); // DateType
10565        } else if (name.equals("amount")) {
10566          this.amount = TypeConvertor.castToMoney(value); // Money
10567        } else if (name.equals("identifier")) {
10568          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
10569        } else
10570          return super.setProperty(name, value);
10571        return value;
10572      }
10573
10574      @Override
10575      public Base makeProperty(int hash, String name) throws FHIRException {
10576        switch (hash) {
10577        case 3575610:  return getType();
10578        case 1977085293:  return getAdjustment();
10579        case -1255938543:  return getAdjustmentReason();
10580        case 3076014:  return getDateElement();
10581        case -1413853096:  return getAmount();
10582        case -1618432855:  return getIdentifier();
10583        default: return super.makeProperty(hash, name);
10584        }
10585
10586      }
10587
10588      @Override
10589      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10590        switch (hash) {
10591        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
10592        case 1977085293: /*adjustment*/ return new String[] {"Money"};
10593        case -1255938543: /*adjustmentReason*/ return new String[] {"CodeableConcept"};
10594        case 3076014: /*date*/ return new String[] {"date"};
10595        case -1413853096: /*amount*/ return new String[] {"Money"};
10596        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
10597        default: return super.getTypesForProperty(hash, name);
10598        }
10599
10600      }
10601
10602      @Override
10603      public Base addChild(String name) throws FHIRException {
10604        if (name.equals("type")) {
10605          this.type = new CodeableConcept();
10606          return this.type;
10607        }
10608        else if (name.equals("adjustment")) {
10609          this.adjustment = new Money();
10610          return this.adjustment;
10611        }
10612        else if (name.equals("adjustmentReason")) {
10613          this.adjustmentReason = new CodeableConcept();
10614          return this.adjustmentReason;
10615        }
10616        else if (name.equals("date")) {
10617          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.payment.date");
10618        }
10619        else if (name.equals("amount")) {
10620          this.amount = new Money();
10621          return this.amount;
10622        }
10623        else if (name.equals("identifier")) {
10624          this.identifier = new Identifier();
10625          return this.identifier;
10626        }
10627        else
10628          return super.addChild(name);
10629      }
10630
10631      public PaymentComponent copy() {
10632        PaymentComponent dst = new PaymentComponent();
10633        copyValues(dst);
10634        return dst;
10635      }
10636
10637      public void copyValues(PaymentComponent dst) {
10638        super.copyValues(dst);
10639        dst.type = type == null ? null : type.copy();
10640        dst.adjustment = adjustment == null ? null : adjustment.copy();
10641        dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
10642        dst.date = date == null ? null : date.copy();
10643        dst.amount = amount == null ? null : amount.copy();
10644        dst.identifier = identifier == null ? null : identifier.copy();
10645      }
10646
10647      @Override
10648      public boolean equalsDeep(Base other_) {
10649        if (!super.equalsDeep(other_))
10650          return false;
10651        if (!(other_ instanceof PaymentComponent))
10652          return false;
10653        PaymentComponent o = (PaymentComponent) other_;
10654        return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true) && compareDeep(adjustmentReason, o.adjustmentReason, true)
10655           && compareDeep(date, o.date, true) && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true)
10656          ;
10657      }
10658
10659      @Override
10660      public boolean equalsShallow(Base other_) {
10661        if (!super.equalsShallow(other_))
10662          return false;
10663        if (!(other_ instanceof PaymentComponent))
10664          return false;
10665        PaymentComponent o = (PaymentComponent) other_;
10666        return compareValues(date, o.date, true);
10667      }
10668
10669      public boolean isEmpty() {
10670        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason
10671          , date, amount, identifier);
10672      }
10673
10674  public String fhirType() {
10675    return "ExplanationOfBenefit.payment";
10676
10677  }
10678
10679  }
10680
10681    @Block()
10682    public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
10683        /**
10684         * A number to uniquely identify a note entry.
10685         */
10686        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
10687        @Description(shortDefinition="Note instance identifier", formalDefinition="A number to uniquely identify a note entry." )
10688        protected PositiveIntType number;
10689
10690        /**
10691         * The business purpose of the note text.
10692         */
10693        @Child(name = "type", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
10694        @Description(shortDefinition="display | print | printoper", formalDefinition="The business purpose of the note text." )
10695        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
10696        protected Enumeration<NoteType> type;
10697
10698        /**
10699         * The explanation or description associated with the processing.
10700         */
10701        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
10702        @Description(shortDefinition="Note explanatory text", formalDefinition="The explanation or description associated with the processing." )
10703        protected StringType text;
10704
10705        /**
10706         * A code to define the language used in the text of the note.
10707         */
10708        @Child(name = "language", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
10709        @Description(shortDefinition="Language of the text", formalDefinition="A code to define the language used in the text of the note." )
10710        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
10711        protected CodeableConcept language;
10712
10713        private static final long serialVersionUID = -385184277L;
10714
10715    /**
10716     * Constructor
10717     */
10718      public NoteComponent() {
10719        super();
10720      }
10721
10722        /**
10723         * @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
10724         */
10725        public PositiveIntType getNumberElement() { 
10726          if (this.number == null)
10727            if (Configuration.errorOnAutoCreate())
10728              throw new Error("Attempt to auto-create NoteComponent.number");
10729            else if (Configuration.doAutoCreate())
10730              this.number = new PositiveIntType(); // bb
10731          return this.number;
10732        }
10733
10734        public boolean hasNumberElement() { 
10735          return this.number != null && !this.number.isEmpty();
10736        }
10737
10738        public boolean hasNumber() { 
10739          return this.number != null && !this.number.isEmpty();
10740        }
10741
10742        /**
10743         * @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
10744         */
10745        public NoteComponent setNumberElement(PositiveIntType value) { 
10746          this.number = value;
10747          return this;
10748        }
10749
10750        /**
10751         * @return A number to uniquely identify a note entry.
10752         */
10753        public int getNumber() { 
10754          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
10755        }
10756
10757        /**
10758         * @param value A number to uniquely identify a note entry.
10759         */
10760        public NoteComponent setNumber(int value) { 
10761            if (this.number == null)
10762              this.number = new PositiveIntType();
10763            this.number.setValue(value);
10764          return this;
10765        }
10766
10767        /**
10768         * @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
10769         */
10770        public Enumeration<NoteType> getTypeElement() { 
10771          if (this.type == null)
10772            if (Configuration.errorOnAutoCreate())
10773              throw new Error("Attempt to auto-create NoteComponent.type");
10774            else if (Configuration.doAutoCreate())
10775              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory()); // bb
10776          return this.type;
10777        }
10778
10779        public boolean hasTypeElement() { 
10780          return this.type != null && !this.type.isEmpty();
10781        }
10782
10783        public boolean hasType() { 
10784          return this.type != null && !this.type.isEmpty();
10785        }
10786
10787        /**
10788         * @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
10789         */
10790        public NoteComponent setTypeElement(Enumeration<NoteType> value) { 
10791          this.type = value;
10792          return this;
10793        }
10794
10795        /**
10796         * @return The business purpose of the note text.
10797         */
10798        public NoteType getType() { 
10799          return this.type == null ? null : this.type.getValue();
10800        }
10801
10802        /**
10803         * @param value The business purpose of the note text.
10804         */
10805        public NoteComponent setType(NoteType value) { 
10806          if (value == null)
10807            this.type = null;
10808          else {
10809            if (this.type == null)
10810              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory());
10811            this.type.setValue(value);
10812          }
10813          return this;
10814        }
10815
10816        /**
10817         * @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
10818         */
10819        public StringType getTextElement() { 
10820          if (this.text == null)
10821            if (Configuration.errorOnAutoCreate())
10822              throw new Error("Attempt to auto-create NoteComponent.text");
10823            else if (Configuration.doAutoCreate())
10824              this.text = new StringType(); // bb
10825          return this.text;
10826        }
10827
10828        public boolean hasTextElement() { 
10829          return this.text != null && !this.text.isEmpty();
10830        }
10831
10832        public boolean hasText() { 
10833          return this.text != null && !this.text.isEmpty();
10834        }
10835
10836        /**
10837         * @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
10838         */
10839        public NoteComponent setTextElement(StringType value) { 
10840          this.text = value;
10841          return this;
10842        }
10843
10844        /**
10845         * @return The explanation or description associated with the processing.
10846         */
10847        public String getText() { 
10848          return this.text == null ? null : this.text.getValue();
10849        }
10850
10851        /**
10852         * @param value The explanation or description associated with the processing.
10853         */
10854        public NoteComponent setText(String value) { 
10855          if (Utilities.noString(value))
10856            this.text = null;
10857          else {
10858            if (this.text == null)
10859              this.text = new StringType();
10860            this.text.setValue(value);
10861          }
10862          return this;
10863        }
10864
10865        /**
10866         * @return {@link #language} (A code to define the language used in the text of the note.)
10867         */
10868        public CodeableConcept getLanguage() { 
10869          if (this.language == null)
10870            if (Configuration.errorOnAutoCreate())
10871              throw new Error("Attempt to auto-create NoteComponent.language");
10872            else if (Configuration.doAutoCreate())
10873              this.language = new CodeableConcept(); // cc
10874          return this.language;
10875        }
10876
10877        public boolean hasLanguage() { 
10878          return this.language != null && !this.language.isEmpty();
10879        }
10880
10881        /**
10882         * @param value {@link #language} (A code to define the language used in the text of the note.)
10883         */
10884        public NoteComponent setLanguage(CodeableConcept value) { 
10885          this.language = value;
10886          return this;
10887        }
10888
10889        protected void listChildren(List<Property> children) {
10890          super.listChildren(children);
10891          children.add(new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number));
10892          children.add(new Property("type", "code", "The business purpose of the note text.", 0, 1, type));
10893          children.add(new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text));
10894          children.add(new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language));
10895        }
10896
10897        @Override
10898        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10899          switch (_hash) {
10900          case -1034364087: /*number*/  return new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number);
10901          case 3575610: /*type*/  return new Property("type", "code", "The business purpose of the note text.", 0, 1, type);
10902          case 3556653: /*text*/  return new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text);
10903          case -1613589672: /*language*/  return new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language);
10904          default: return super.getNamedProperty(_hash, _name, _checkValid);
10905          }
10906
10907        }
10908
10909      @Override
10910      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10911        switch (hash) {
10912        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
10913        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<NoteType>
10914        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
10915        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
10916        default: return super.getProperty(hash, name, checkValid);
10917        }
10918
10919      }
10920
10921      @Override
10922      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10923        switch (hash) {
10924        case -1034364087: // number
10925          this.number = TypeConvertor.castToPositiveInt(value); // PositiveIntType
10926          return value;
10927        case 3575610: // type
10928          value = new NoteTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
10929          this.type = (Enumeration) value; // Enumeration<NoteType>
10930          return value;
10931        case 3556653: // text
10932          this.text = TypeConvertor.castToString(value); // StringType
10933          return value;
10934        case -1613589672: // language
10935          this.language = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10936          return value;
10937        default: return super.setProperty(hash, name, value);
10938        }
10939
10940      }
10941
10942      @Override
10943      public Base setProperty(String name, Base value) throws FHIRException {
10944        if (name.equals("number")) {
10945          this.number = TypeConvertor.castToPositiveInt(value); // PositiveIntType
10946        } else if (name.equals("type")) {
10947          value = new NoteTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
10948          this.type = (Enumeration) value; // Enumeration<NoteType>
10949        } else if (name.equals("text")) {
10950          this.text = TypeConvertor.castToString(value); // StringType
10951        } else if (name.equals("language")) {
10952          this.language = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10953        } else
10954          return super.setProperty(name, value);
10955        return value;
10956      }
10957
10958      @Override
10959      public Base makeProperty(int hash, String name) throws FHIRException {
10960        switch (hash) {
10961        case -1034364087:  return getNumberElement();
10962        case 3575610:  return getTypeElement();
10963        case 3556653:  return getTextElement();
10964        case -1613589672:  return getLanguage();
10965        default: return super.makeProperty(hash, name);
10966        }
10967
10968      }
10969
10970      @Override
10971      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10972        switch (hash) {
10973        case -1034364087: /*number*/ return new String[] {"positiveInt"};
10974        case 3575610: /*type*/ return new String[] {"code"};
10975        case 3556653: /*text*/ return new String[] {"string"};
10976        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
10977        default: return super.getTypesForProperty(hash, name);
10978        }
10979
10980      }
10981
10982      @Override
10983      public Base addChild(String name) throws FHIRException {
10984        if (name.equals("number")) {
10985          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.processNote.number");
10986        }
10987        else if (name.equals("type")) {
10988          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.processNote.type");
10989        }
10990        else if (name.equals("text")) {
10991          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.processNote.text");
10992        }
10993        else if (name.equals("language")) {
10994          this.language = new CodeableConcept();
10995          return this.language;
10996        }
10997        else
10998          return super.addChild(name);
10999      }
11000
11001      public NoteComponent copy() {
11002        NoteComponent dst = new NoteComponent();
11003        copyValues(dst);
11004        return dst;
11005      }
11006
11007      public void copyValues(NoteComponent dst) {
11008        super.copyValues(dst);
11009        dst.number = number == null ? null : number.copy();
11010        dst.type = type == null ? null : type.copy();
11011        dst.text = text == null ? null : text.copy();
11012        dst.language = language == null ? null : language.copy();
11013      }
11014
11015      @Override
11016      public boolean equalsDeep(Base other_) {
11017        if (!super.equalsDeep(other_))
11018          return false;
11019        if (!(other_ instanceof NoteComponent))
11020          return false;
11021        NoteComponent o = (NoteComponent) other_;
11022        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
11023           && compareDeep(language, o.language, true);
11024      }
11025
11026      @Override
11027      public boolean equalsShallow(Base other_) {
11028        if (!super.equalsShallow(other_))
11029          return false;
11030        if (!(other_ instanceof NoteComponent))
11031          return false;
11032        NoteComponent o = (NoteComponent) other_;
11033        return compareValues(number, o.number, true) && compareValues(type, o.type, true) && compareValues(text, o.text, true)
11034          ;
11035      }
11036
11037      public boolean isEmpty() {
11038        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language
11039          );
11040      }
11041
11042  public String fhirType() {
11043    return "ExplanationOfBenefit.processNote";
11044
11045  }
11046
11047  }
11048
11049    @Block()
11050    public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
11051        /**
11052         * Code to identify the general type of benefits under which products and services are provided.
11053         */
11054        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
11055        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
11056        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
11057        protected CodeableConcept category;
11058
11059        /**
11060         * 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.
11061         */
11062        @Child(name = "excluded", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
11063        @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." )
11064        protected BooleanType excluded;
11065
11066        /**
11067         * A short name or tag for the benefit.
11068         */
11069        @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
11070        @Description(shortDefinition="Short name for the benefit", formalDefinition="A short name or tag for the benefit." )
11071        protected StringType name;
11072
11073        /**
11074         * A richer description of the benefit or services covered.
11075         */
11076        @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
11077        @Description(shortDefinition="Description of the benefit or services covered", formalDefinition="A richer description of the benefit or services covered." )
11078        protected StringType description;
11079
11080        /**
11081         * Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.
11082         */
11083        @Child(name = "network", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
11084        @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." )
11085        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-network")
11086        protected CodeableConcept network;
11087
11088        /**
11089         * Indicates if the benefits apply to an individual or to the family.
11090         */
11091        @Child(name = "unit", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
11092        @Description(shortDefinition="Individual or family", formalDefinition="Indicates if the benefits apply to an individual or to the family." )
11093        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-unit")
11094        protected CodeableConcept unit;
11095
11096        /**
11097         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.
11098         */
11099        @Child(name = "term", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
11100        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'." )
11101        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-term")
11102        protected CodeableConcept term;
11103
11104        /**
11105         * Benefits Used to date.
11106         */
11107        @Child(name = "financial", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
11108        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
11109        protected List<BenefitComponent> financial;
11110
11111        private static final long serialVersionUID = -1889655824L;
11112
11113    /**
11114     * Constructor
11115     */
11116      public BenefitBalanceComponent() {
11117        super();
11118      }
11119
11120    /**
11121     * Constructor
11122     */
11123      public BenefitBalanceComponent(CodeableConcept category) {
11124        super();
11125        this.setCategory(category);
11126      }
11127
11128        /**
11129         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
11130         */
11131        public CodeableConcept getCategory() { 
11132          if (this.category == null)
11133            if (Configuration.errorOnAutoCreate())
11134              throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
11135            else if (Configuration.doAutoCreate())
11136              this.category = new CodeableConcept(); // cc
11137          return this.category;
11138        }
11139
11140        public boolean hasCategory() { 
11141          return this.category != null && !this.category.isEmpty();
11142        }
11143
11144        /**
11145         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
11146         */
11147        public BenefitBalanceComponent setCategory(CodeableConcept value) { 
11148          this.category = value;
11149          return this;
11150        }
11151
11152        /**
11153         * @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
11154         */
11155        public BooleanType getExcludedElement() { 
11156          if (this.excluded == null)
11157            if (Configuration.errorOnAutoCreate())
11158              throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
11159            else if (Configuration.doAutoCreate())
11160              this.excluded = new BooleanType(); // bb
11161          return this.excluded;
11162        }
11163
11164        public boolean hasExcludedElement() { 
11165          return this.excluded != null && !this.excluded.isEmpty();
11166        }
11167
11168        public boolean hasExcluded() { 
11169          return this.excluded != null && !this.excluded.isEmpty();
11170        }
11171
11172        /**
11173         * @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
11174         */
11175        public BenefitBalanceComponent setExcludedElement(BooleanType value) { 
11176          this.excluded = value;
11177          return this;
11178        }
11179
11180        /**
11181         * @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.
11182         */
11183        public boolean getExcluded() { 
11184          return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
11185        }
11186
11187        /**
11188         * @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.
11189         */
11190        public BenefitBalanceComponent setExcluded(boolean value) { 
11191            if (this.excluded == null)
11192              this.excluded = new BooleanType();
11193            this.excluded.setValue(value);
11194          return this;
11195        }
11196
11197        /**
11198         * @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
11199         */
11200        public StringType getNameElement() { 
11201          if (this.name == null)
11202            if (Configuration.errorOnAutoCreate())
11203              throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
11204            else if (Configuration.doAutoCreate())
11205              this.name = new StringType(); // bb
11206          return this.name;
11207        }
11208
11209        public boolean hasNameElement() { 
11210          return this.name != null && !this.name.isEmpty();
11211        }
11212
11213        public boolean hasName() { 
11214          return this.name != null && !this.name.isEmpty();
11215        }
11216
11217        /**
11218         * @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
11219         */
11220        public BenefitBalanceComponent setNameElement(StringType value) { 
11221          this.name = value;
11222          return this;
11223        }
11224
11225        /**
11226         * @return A short name or tag for the benefit.
11227         */
11228        public String getName() { 
11229          return this.name == null ? null : this.name.getValue();
11230        }
11231
11232        /**
11233         * @param value A short name or tag for the benefit.
11234         */
11235        public BenefitBalanceComponent setName(String value) { 
11236          if (Utilities.noString(value))
11237            this.name = null;
11238          else {
11239            if (this.name == null)
11240              this.name = new StringType();
11241            this.name.setValue(value);
11242          }
11243          return this;
11244        }
11245
11246        /**
11247         * @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
11248         */
11249        public StringType getDescriptionElement() { 
11250          if (this.description == null)
11251            if (Configuration.errorOnAutoCreate())
11252              throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
11253            else if (Configuration.doAutoCreate())
11254              this.description = new StringType(); // bb
11255          return this.description;
11256        }
11257
11258        public boolean hasDescriptionElement() { 
11259          return this.description != null && !this.description.isEmpty();
11260        }
11261
11262        public boolean hasDescription() { 
11263          return this.description != null && !this.description.isEmpty();
11264        }
11265
11266        /**
11267         * @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
11268         */
11269        public BenefitBalanceComponent setDescriptionElement(StringType value) { 
11270          this.description = value;
11271          return this;
11272        }
11273
11274        /**
11275         * @return A richer description of the benefit or services covered.
11276         */
11277        public String getDescription() { 
11278          return this.description == null ? null : this.description.getValue();
11279        }
11280
11281        /**
11282         * @param value A richer description of the benefit or services covered.
11283         */
11284        public BenefitBalanceComponent setDescription(String value) { 
11285          if (Utilities.noString(value))
11286            this.description = null;
11287          else {
11288            if (this.description == null)
11289              this.description = new StringType();
11290            this.description.setValue(value);
11291          }
11292          return this;
11293        }
11294
11295        /**
11296         * @return {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
11297         */
11298        public CodeableConcept getNetwork() { 
11299          if (this.network == null)
11300            if (Configuration.errorOnAutoCreate())
11301              throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
11302            else if (Configuration.doAutoCreate())
11303              this.network = new CodeableConcept(); // cc
11304          return this.network;
11305        }
11306
11307        public boolean hasNetwork() { 
11308          return this.network != null && !this.network.isEmpty();
11309        }
11310
11311        /**
11312         * @param value {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
11313         */
11314        public BenefitBalanceComponent setNetwork(CodeableConcept value) { 
11315          this.network = value;
11316          return this;
11317        }
11318
11319        /**
11320         * @return {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
11321         */
11322        public CodeableConcept getUnit() { 
11323          if (this.unit == null)
11324            if (Configuration.errorOnAutoCreate())
11325              throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
11326            else if (Configuration.doAutoCreate())
11327              this.unit = new CodeableConcept(); // cc
11328          return this.unit;
11329        }
11330
11331        public boolean hasUnit() { 
11332          return this.unit != null && !this.unit.isEmpty();
11333        }
11334
11335        /**
11336         * @param value {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
11337         */
11338        public BenefitBalanceComponent setUnit(CodeableConcept value) { 
11339          this.unit = value;
11340          return this;
11341        }
11342
11343        /**
11344         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
11345         */
11346        public CodeableConcept getTerm() { 
11347          if (this.term == null)
11348            if (Configuration.errorOnAutoCreate())
11349              throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
11350            else if (Configuration.doAutoCreate())
11351              this.term = new CodeableConcept(); // cc
11352          return this.term;
11353        }
11354
11355        public boolean hasTerm() { 
11356          return this.term != null && !this.term.isEmpty();
11357        }
11358
11359        /**
11360         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
11361         */
11362        public BenefitBalanceComponent setTerm(CodeableConcept value) { 
11363          this.term = value;
11364          return this;
11365        }
11366
11367        /**
11368         * @return {@link #financial} (Benefits Used to date.)
11369         */
11370        public List<BenefitComponent> getFinancial() { 
11371          if (this.financial == null)
11372            this.financial = new ArrayList<BenefitComponent>();
11373          return this.financial;
11374        }
11375
11376        /**
11377         * @return Returns a reference to <code>this</code> for easy method chaining
11378         */
11379        public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) { 
11380          this.financial = theFinancial;
11381          return this;
11382        }
11383
11384        public boolean hasFinancial() { 
11385          if (this.financial == null)
11386            return false;
11387          for (BenefitComponent item : this.financial)
11388            if (!item.isEmpty())
11389              return true;
11390          return false;
11391        }
11392
11393        public BenefitComponent addFinancial() { //3
11394          BenefitComponent t = new BenefitComponent();
11395          if (this.financial == null)
11396            this.financial = new ArrayList<BenefitComponent>();
11397          this.financial.add(t);
11398          return t;
11399        }
11400
11401        public BenefitBalanceComponent addFinancial(BenefitComponent t) { //3
11402          if (t == null)
11403            return this;
11404          if (this.financial == null)
11405            this.financial = new ArrayList<BenefitComponent>();
11406          this.financial.add(t);
11407          return this;
11408        }
11409
11410        /**
11411         * @return The first repetition of repeating field {@link #financial}, creating it if it does not already exist {3}
11412         */
11413        public BenefitComponent getFinancialFirstRep() { 
11414          if (getFinancial().isEmpty()) {
11415            addFinancial();
11416          }
11417          return getFinancial().get(0);
11418        }
11419
11420        protected void listChildren(List<Property> children) {
11421          super.listChildren(children);
11422          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
11423          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));
11424          children.add(new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name));
11425          children.add(new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description));
11426          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));
11427          children.add(new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit));
11428          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));
11429          children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
11430        }
11431
11432        @Override
11433        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11434          switch (_hash) {
11435          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);
11436          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);
11437          case 3373707: /*name*/  return new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name);
11438          case -1724546052: /*description*/  return new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description);
11439          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);
11440          case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit);
11441          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);
11442          case 357555337: /*financial*/  return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial);
11443          default: return super.getNamedProperty(_hash, _name, _checkValid);
11444          }
11445
11446        }
11447
11448      @Override
11449      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11450        switch (hash) {
11451        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
11452        case 1994055114: /*excluded*/ return this.excluded == null ? new Base[0] : new Base[] {this.excluded}; // BooleanType
11453        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
11454        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
11455        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // CodeableConcept
11456        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
11457        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // CodeableConcept
11458        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
11459        default: return super.getProperty(hash, name, checkValid);
11460        }
11461
11462      }
11463
11464      @Override
11465      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11466        switch (hash) {
11467        case 50511102: // category
11468          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11469          return value;
11470        case 1994055114: // excluded
11471          this.excluded = TypeConvertor.castToBoolean(value); // BooleanType
11472          return value;
11473        case 3373707: // name
11474          this.name = TypeConvertor.castToString(value); // StringType
11475          return value;
11476        case -1724546052: // description
11477          this.description = TypeConvertor.castToString(value); // StringType
11478          return value;
11479        case 1843485230: // network
11480          this.network = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11481          return value;
11482        case 3594628: // unit
11483          this.unit = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11484          return value;
11485        case 3556460: // term
11486          this.term = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11487          return value;
11488        case 357555337: // financial
11489          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
11490          return value;
11491        default: return super.setProperty(hash, name, value);
11492        }
11493
11494      }
11495
11496      @Override
11497      public Base setProperty(String name, Base value) throws FHIRException {
11498        if (name.equals("category")) {
11499          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11500        } else if (name.equals("excluded")) {
11501          this.excluded = TypeConvertor.castToBoolean(value); // BooleanType
11502        } else if (name.equals("name")) {
11503          this.name = TypeConvertor.castToString(value); // StringType
11504        } else if (name.equals("description")) {
11505          this.description = TypeConvertor.castToString(value); // StringType
11506        } else if (name.equals("network")) {
11507          this.network = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11508        } else if (name.equals("unit")) {
11509          this.unit = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11510        } else if (name.equals("term")) {
11511          this.term = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11512        } else if (name.equals("financial")) {
11513          this.getFinancial().add((BenefitComponent) value);
11514        } else
11515          return super.setProperty(name, value);
11516        return value;
11517      }
11518
11519      @Override
11520      public Base makeProperty(int hash, String name) throws FHIRException {
11521        switch (hash) {
11522        case 50511102:  return getCategory();
11523        case 1994055114:  return getExcludedElement();
11524        case 3373707:  return getNameElement();
11525        case -1724546052:  return getDescriptionElement();
11526        case 1843485230:  return getNetwork();
11527        case 3594628:  return getUnit();
11528        case 3556460:  return getTerm();
11529        case 357555337:  return addFinancial(); 
11530        default: return super.makeProperty(hash, name);
11531        }
11532
11533      }
11534
11535      @Override
11536      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11537        switch (hash) {
11538        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
11539        case 1994055114: /*excluded*/ return new String[] {"boolean"};
11540        case 3373707: /*name*/ return new String[] {"string"};
11541        case -1724546052: /*description*/ return new String[] {"string"};
11542        case 1843485230: /*network*/ return new String[] {"CodeableConcept"};
11543        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
11544        case 3556460: /*term*/ return new String[] {"CodeableConcept"};
11545        case 357555337: /*financial*/ return new String[] {};
11546        default: return super.getTypesForProperty(hash, name);
11547        }
11548
11549      }
11550
11551      @Override
11552      public Base addChild(String name) throws FHIRException {
11553        if (name.equals("category")) {
11554          this.category = new CodeableConcept();
11555          return this.category;
11556        }
11557        else if (name.equals("excluded")) {
11558          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.benefitBalance.excluded");
11559        }
11560        else if (name.equals("name")) {
11561          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.benefitBalance.name");
11562        }
11563        else if (name.equals("description")) {
11564          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.benefitBalance.description");
11565        }
11566        else if (name.equals("network")) {
11567          this.network = new CodeableConcept();
11568          return this.network;
11569        }
11570        else if (name.equals("unit")) {
11571          this.unit = new CodeableConcept();
11572          return this.unit;
11573        }
11574        else if (name.equals("term")) {
11575          this.term = new CodeableConcept();
11576          return this.term;
11577        }
11578        else if (name.equals("financial")) {
11579          return addFinancial();
11580        }
11581        else
11582          return super.addChild(name);
11583      }
11584
11585      public BenefitBalanceComponent copy() {
11586        BenefitBalanceComponent dst = new BenefitBalanceComponent();
11587        copyValues(dst);
11588        return dst;
11589      }
11590
11591      public void copyValues(BenefitBalanceComponent dst) {
11592        super.copyValues(dst);
11593        dst.category = category == null ? null : category.copy();
11594        dst.excluded = excluded == null ? null : excluded.copy();
11595        dst.name = name == null ? null : name.copy();
11596        dst.description = description == null ? null : description.copy();
11597        dst.network = network == null ? null : network.copy();
11598        dst.unit = unit == null ? null : unit.copy();
11599        dst.term = term == null ? null : term.copy();
11600        if (financial != null) {
11601          dst.financial = new ArrayList<BenefitComponent>();
11602          for (BenefitComponent i : financial)
11603            dst.financial.add(i.copy());
11604        };
11605      }
11606
11607      @Override
11608      public boolean equalsDeep(Base other_) {
11609        if (!super.equalsDeep(other_))
11610          return false;
11611        if (!(other_ instanceof BenefitBalanceComponent))
11612          return false;
11613        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
11614        return compareDeep(category, o.category, true) && compareDeep(excluded, o.excluded, true) && compareDeep(name, o.name, true)
11615           && compareDeep(description, o.description, true) && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true)
11616           && compareDeep(term, o.term, true) && compareDeep(financial, o.financial, true);
11617      }
11618
11619      @Override
11620      public boolean equalsShallow(Base other_) {
11621        if (!super.equalsShallow(other_))
11622          return false;
11623        if (!(other_ instanceof BenefitBalanceComponent))
11624          return false;
11625        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
11626        return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
11627          ;
11628      }
11629
11630      public boolean isEmpty() {
11631        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, excluded, name
11632          , description, network, unit, term, financial);
11633      }
11634
11635  public String fhirType() {
11636    return "ExplanationOfBenefit.benefitBalance";
11637
11638  }
11639
11640  }
11641
11642    @Block()
11643    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
11644        /**
11645         * Classification of benefit being provided.
11646         */
11647        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
11648        @Description(shortDefinition="Benefit classification", formalDefinition="Classification of benefit being provided." )
11649        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-type")
11650        protected CodeableConcept type;
11651
11652        /**
11653         * The quantity of the benefit which is permitted under the coverage.
11654         */
11655        @Child(name = "allowed", type = {UnsignedIntType.class, StringType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
11656        @Description(shortDefinition="Benefits allowed", formalDefinition="The quantity of the benefit which is permitted under the coverage." )
11657        protected DataType allowed;
11658
11659        /**
11660         * The quantity of the benefit which have been consumed to date.
11661         */
11662        @Child(name = "used", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
11663        @Description(shortDefinition="Benefits used", formalDefinition="The quantity of the benefit which have been consumed to date." )
11664        protected DataType used;
11665
11666        private static final long serialVersionUID = 1900247614L;
11667
11668    /**
11669     * Constructor
11670     */
11671      public BenefitComponent() {
11672        super();
11673      }
11674
11675    /**
11676     * Constructor
11677     */
11678      public BenefitComponent(CodeableConcept type) {
11679        super();
11680        this.setType(type);
11681      }
11682
11683        /**
11684         * @return {@link #type} (Classification of benefit being provided.)
11685         */
11686        public CodeableConcept getType() { 
11687          if (this.type == null)
11688            if (Configuration.errorOnAutoCreate())
11689              throw new Error("Attempt to auto-create BenefitComponent.type");
11690            else if (Configuration.doAutoCreate())
11691              this.type = new CodeableConcept(); // cc
11692          return this.type;
11693        }
11694
11695        public boolean hasType() { 
11696          return this.type != null && !this.type.isEmpty();
11697        }
11698
11699        /**
11700         * @param value {@link #type} (Classification of benefit being provided.)
11701         */
11702        public BenefitComponent setType(CodeableConcept value) { 
11703          this.type = value;
11704          return this;
11705        }
11706
11707        /**
11708         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11709         */
11710        public DataType getAllowed() { 
11711          return this.allowed;
11712        }
11713
11714        /**
11715         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11716         */
11717        public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException { 
11718          if (this.allowed == null)
11719            this.allowed = new UnsignedIntType();
11720          if (!(this.allowed instanceof UnsignedIntType))
11721            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.allowed.getClass().getName()+" was encountered");
11722          return (UnsignedIntType) this.allowed;
11723        }
11724
11725        public boolean hasAllowedUnsignedIntType() { 
11726          return this != null && this.allowed instanceof UnsignedIntType;
11727        }
11728
11729        /**
11730         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11731         */
11732        public StringType getAllowedStringType() throws FHIRException { 
11733          if (this.allowed == null)
11734            this.allowed = new StringType();
11735          if (!(this.allowed instanceof StringType))
11736            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.allowed.getClass().getName()+" was encountered");
11737          return (StringType) this.allowed;
11738        }
11739
11740        public boolean hasAllowedStringType() { 
11741          return this != null && this.allowed instanceof StringType;
11742        }
11743
11744        /**
11745         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11746         */
11747        public Money getAllowedMoney() throws FHIRException { 
11748          if (this.allowed == null)
11749            this.allowed = new Money();
11750          if (!(this.allowed instanceof Money))
11751            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.allowed.getClass().getName()+" was encountered");
11752          return (Money) this.allowed;
11753        }
11754
11755        public boolean hasAllowedMoney() { 
11756          return this != null && this.allowed instanceof Money;
11757        }
11758
11759        public boolean hasAllowed() { 
11760          return this.allowed != null && !this.allowed.isEmpty();
11761        }
11762
11763        /**
11764         * @param value {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11765         */
11766        public BenefitComponent setAllowed(DataType value) { 
11767          if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
11768            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.allowed[x]: "+value.fhirType());
11769          this.allowed = value;
11770          return this;
11771        }
11772
11773        /**
11774         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
11775         */
11776        public DataType getUsed() { 
11777          return this.used;
11778        }
11779
11780        /**
11781         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
11782         */
11783        public UnsignedIntType getUsedUnsignedIntType() throws FHIRException { 
11784          if (this.used == null)
11785            this.used = new UnsignedIntType();
11786          if (!(this.used instanceof UnsignedIntType))
11787            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.used.getClass().getName()+" was encountered");
11788          return (UnsignedIntType) this.used;
11789        }
11790
11791        public boolean hasUsedUnsignedIntType() { 
11792          return this != null && this.used instanceof UnsignedIntType;
11793        }
11794
11795        /**
11796         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
11797         */
11798        public Money getUsedMoney() throws FHIRException { 
11799          if (this.used == null)
11800            this.used = new Money();
11801          if (!(this.used instanceof Money))
11802            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.used.getClass().getName()+" was encountered");
11803          return (Money) this.used;
11804        }
11805
11806        public boolean hasUsedMoney() { 
11807          return this != null && this.used instanceof Money;
11808        }
11809
11810        public boolean hasUsed() { 
11811          return this.used != null && !this.used.isEmpty();
11812        }
11813
11814        /**
11815         * @param value {@link #used} (The quantity of the benefit which have been consumed to date.)
11816         */
11817        public BenefitComponent setUsed(DataType value) { 
11818          if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
11819            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.used[x]: "+value.fhirType());
11820          this.used = value;
11821          return this;
11822        }
11823
11824        protected void listChildren(List<Property> children) {
11825          super.listChildren(children);
11826          children.add(new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type));
11827          children.add(new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed));
11828          children.add(new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used));
11829        }
11830
11831        @Override
11832        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11833          switch (_hash) {
11834          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type);
11835          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);
11836          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);
11837          case 1668802034: /*allowedUnsignedInt*/  return new Property("allowed[x]", "unsignedInt", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
11838          case -2135265319: /*allowedString*/  return new Property("allowed[x]", "string", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
11839          case -351668232: /*allowedMoney*/  return new Property("allowed[x]", "Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
11840          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);
11841          case 3599293: /*used*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
11842          case 1252740285: /*usedUnsignedInt*/  return new Property("used[x]", "unsignedInt", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
11843          case -78048509: /*usedMoney*/  return new Property("used[x]", "Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
11844          default: return super.getNamedProperty(_hash, _name, _checkValid);
11845          }
11846
11847        }
11848
11849      @Override
11850      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11851        switch (hash) {
11852        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
11853        case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // DataType
11854        case 3599293: /*used*/ return this.used == null ? new Base[0] : new Base[] {this.used}; // DataType
11855        default: return super.getProperty(hash, name, checkValid);
11856        }
11857
11858      }
11859
11860      @Override
11861      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11862        switch (hash) {
11863        case 3575610: // type
11864          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11865          return value;
11866        case -911343192: // allowed
11867          this.allowed = TypeConvertor.castToType(value); // DataType
11868          return value;
11869        case 3599293: // used
11870          this.used = TypeConvertor.castToType(value); // DataType
11871          return value;
11872        default: return super.setProperty(hash, name, value);
11873        }
11874
11875      }
11876
11877      @Override
11878      public Base setProperty(String name, Base value) throws FHIRException {
11879        if (name.equals("type")) {
11880          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11881        } else if (name.equals("allowed[x]")) {
11882          this.allowed = TypeConvertor.castToType(value); // DataType
11883        } else if (name.equals("used[x]")) {
11884          this.used = TypeConvertor.castToType(value); // DataType
11885        } else
11886          return super.setProperty(name, value);
11887        return value;
11888      }
11889
11890      @Override
11891      public Base makeProperty(int hash, String name) throws FHIRException {
11892        switch (hash) {
11893        case 3575610:  return getType();
11894        case -1336663592:  return getAllowed();
11895        case -911343192:  return getAllowed();
11896        case -147553373:  return getUsed();
11897        case 3599293:  return getUsed();
11898        default: return super.makeProperty(hash, name);
11899        }
11900
11901      }
11902
11903      @Override
11904      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11905        switch (hash) {
11906        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
11907        case -911343192: /*allowed*/ return new String[] {"unsignedInt", "string", "Money"};
11908        case 3599293: /*used*/ return new String[] {"unsignedInt", "Money"};
11909        default: return super.getTypesForProperty(hash, name);
11910        }
11911
11912      }
11913
11914      @Override
11915      public Base addChild(String name) throws FHIRException {
11916        if (name.equals("type")) {
11917          this.type = new CodeableConcept();
11918          return this.type;
11919        }
11920        else if (name.equals("allowedUnsignedInt")) {
11921          this.allowed = new UnsignedIntType();
11922          return this.allowed;
11923        }
11924        else if (name.equals("allowedString")) {
11925          this.allowed = new StringType();
11926          return this.allowed;
11927        }
11928        else if (name.equals("allowedMoney")) {
11929          this.allowed = new Money();
11930          return this.allowed;
11931        }
11932        else if (name.equals("usedUnsignedInt")) {
11933          this.used = new UnsignedIntType();
11934          return this.used;
11935        }
11936        else if (name.equals("usedMoney")) {
11937          this.used = new Money();
11938          return this.used;
11939        }
11940        else
11941          return super.addChild(name);
11942      }
11943
11944      public BenefitComponent copy() {
11945        BenefitComponent dst = new BenefitComponent();
11946        copyValues(dst);
11947        return dst;
11948      }
11949
11950      public void copyValues(BenefitComponent dst) {
11951        super.copyValues(dst);
11952        dst.type = type == null ? null : type.copy();
11953        dst.allowed = allowed == null ? null : allowed.copy();
11954        dst.used = used == null ? null : used.copy();
11955      }
11956
11957      @Override
11958      public boolean equalsDeep(Base other_) {
11959        if (!super.equalsDeep(other_))
11960          return false;
11961        if (!(other_ instanceof BenefitComponent))
11962          return false;
11963        BenefitComponent o = (BenefitComponent) other_;
11964        return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true) && compareDeep(used, o.used, true)
11965          ;
11966      }
11967
11968      @Override
11969      public boolean equalsShallow(Base other_) {
11970        if (!super.equalsShallow(other_))
11971          return false;
11972        if (!(other_ instanceof BenefitComponent))
11973          return false;
11974        BenefitComponent o = (BenefitComponent) other_;
11975        return true;
11976      }
11977
11978      public boolean isEmpty() {
11979        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
11980      }
11981
11982  public String fhirType() {
11983    return "ExplanationOfBenefit.benefitBalance.financial";
11984
11985  }
11986
11987  }
11988
11989    /**
11990     * A unique identifier assigned to this explanation of benefit.
11991     */
11992    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
11993    @Description(shortDefinition="Business Identifier for the resource", formalDefinition="A unique identifier assigned to this explanation of benefit." )
11994    protected List<Identifier> identifier;
11995
11996    /**
11997     * The status of the resource instance.
11998     */
11999    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
12000    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
12001    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
12002    protected Enumeration<ExplanationOfBenefitStatus> status;
12003
12004    /**
12005     * The category of claim, e.g. oral, pharmacy, vision, institutional, professional.
12006     */
12007    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
12008    @Description(shortDefinition="Category or discipline", formalDefinition="The category of claim, e.g. oral, pharmacy, vision, institutional, professional." )
12009    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-type")
12010    protected CodeableConcept type;
12011
12012    /**
12013     * A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.
12014     */
12015    @Child(name = "subType", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
12016    @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." )
12017    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-subtype")
12018    protected CodeableConcept subType;
12019
12020    /**
12021     * 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.
12022     */
12023    @Child(name = "use", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
12024    @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." )
12025    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-use")
12026    protected Enumeration<Use> use;
12027
12028    /**
12029     * 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.
12030     */
12031    @Child(name = "patient", type = {Patient.class}, order=5, min=1, max=1, modifier=false, summary=true)
12032    @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." )
12033    protected Reference patient;
12034
12035    /**
12036     * The period for which charges are being submitted.
12037     */
12038    @Child(name = "billablePeriod", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=true)
12039    @Description(shortDefinition="Relevant time frame for the claim", formalDefinition="The period for which charges are being submitted." )
12040    protected Period billablePeriod;
12041
12042    /**
12043     * The date this resource was created.
12044     */
12045    @Child(name = "created", type = {DateTimeType.class}, order=7, min=1, max=1, modifier=false, summary=true)
12046    @Description(shortDefinition="Response creation date", formalDefinition="The date this resource was created." )
12047    protected DateTimeType created;
12048
12049    /**
12050     * Individual who created the claim, predetermination or preauthorization.
12051     */
12052    @Child(name = "enterer", type = {Practitioner.class, PractitionerRole.class}, order=8, min=0, max=1, modifier=false, summary=false)
12053    @Description(shortDefinition="Author of the claim", formalDefinition="Individual who created the claim, predetermination or preauthorization." )
12054    protected Reference enterer;
12055
12056    /**
12057     * The party responsible for authorization, adjudication and reimbursement.
12058     */
12059    @Child(name = "insurer", type = {Organization.class}, order=9, min=1, max=1, modifier=false, summary=true)
12060    @Description(shortDefinition="Party responsible for reimbursement", formalDefinition="The party responsible for authorization, adjudication and reimbursement." )
12061    protected Reference insurer;
12062
12063    /**
12064     * The provider which is responsible for the claim, predetermination or preauthorization.
12065     */
12066    @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=10, min=1, max=1, modifier=false, summary=true)
12067    @Description(shortDefinition="Party responsible for the claim", formalDefinition="The provider which is responsible for the claim, predetermination or preauthorization." )
12068    protected Reference provider;
12069
12070    /**
12071     * The provider-required urgency of processing the request. Typical values include: stat, routine deferred.
12072     */
12073    @Child(name = "priority", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=false)
12074    @Description(shortDefinition="Desired processing urgency", formalDefinition="The provider-required urgency of processing the request. Typical values include: stat, routine deferred." )
12075    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/CodeSystem/processpriority")
12076    protected CodeableConcept priority;
12077
12078    /**
12079     * A code to indicate whether and for whom funds are to be reserved for future claims.
12080     */
12081    @Child(name = "fundsReserveRequested", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
12082    @Description(shortDefinition="For whom to reserve funds", formalDefinition="A code to indicate whether and for whom funds are to be reserved for future claims." )
12083    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
12084    protected CodeableConcept fundsReserveRequested;
12085
12086    /**
12087     * A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.
12088     */
12089    @Child(name = "fundsReserve", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
12090    @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." )
12091    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
12092    protected CodeableConcept fundsReserve;
12093
12094    /**
12095     * Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.
12096     */
12097    @Child(name = "related", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12098    @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." )
12099    protected List<RelatedClaimComponent> related;
12100
12101    /**
12102     * Prescription to support the dispensing of pharmacy, device or vision products.
12103     */
12104    @Child(name = "prescription", type = {MedicationRequest.class, VisionPrescription.class}, order=15, min=0, max=1, modifier=false, summary=false)
12105    @Description(shortDefinition="Prescription authorizing services or products", formalDefinition="Prescription to support the dispensing of pharmacy, device or vision products." )
12106    protected Reference prescription;
12107
12108    /**
12109     * Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.
12110     */
12111    @Child(name = "originalPrescription", type = {MedicationRequest.class}, order=16, min=0, max=1, modifier=false, summary=false)
12112    @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." )
12113    protected Reference originalPrescription;
12114
12115    /**
12116     * The party to be reimbursed for cost of the products and services according to the terms of the policy.
12117     */
12118    @Child(name = "payee", type = {}, order=17, min=0, max=1, modifier=false, summary=false)
12119    @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." )
12120    protected PayeeComponent payee;
12121
12122    /**
12123     * A reference to a referral resource.
12124     */
12125    @Child(name = "referral", type = {ServiceRequest.class}, order=18, min=0, max=1, modifier=false, summary=false)
12126    @Description(shortDefinition="Treatment Referral", formalDefinition="A reference to a referral resource." )
12127    protected Reference referral;
12128
12129    /**
12130     * Facility where the services were provided.
12131     */
12132    @Child(name = "facility", type = {Location.class}, order=19, min=0, max=1, modifier=false, summary=false)
12133    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
12134    protected Reference facility;
12135
12136    /**
12137     * The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.
12138     */
12139    @Child(name = "claim", type = {Claim.class}, order=20, min=0, max=1, modifier=false, summary=false)
12140    @Description(shortDefinition="Claim reference", formalDefinition="The business identifier for the instance of the adjudication request: claim predetermination or preauthorization." )
12141    protected Reference claim;
12142
12143    /**
12144     * The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.
12145     */
12146    @Child(name = "claimResponse", type = {ClaimResponse.class}, order=21, min=0, max=1, modifier=false, summary=false)
12147    @Description(shortDefinition="Claim response reference", formalDefinition="The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response." )
12148    protected Reference claimResponse;
12149
12150    /**
12151     * The outcome of the claim, predetermination, or preauthorization processing.
12152     */
12153    @Child(name = "outcome", type = {CodeType.class}, order=22, min=1, max=1, modifier=false, summary=true)
12154    @Description(shortDefinition="queued | complete | error | partial", formalDefinition="The outcome of the claim, predetermination, or preauthorization processing." )
12155    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-outcome")
12156    protected Enumeration<ClaimProcessingCodes> outcome;
12157
12158    /**
12159     * A human readable description of the status of the adjudication.
12160     */
12161    @Child(name = "disposition", type = {StringType.class}, order=23, min=0, max=1, modifier=false, summary=false)
12162    @Description(shortDefinition="Disposition Message", formalDefinition="A human readable description of the status of the adjudication." )
12163    protected StringType disposition;
12164
12165    /**
12166     * Reference from the Insurer which is used in later communications which refers to this adjudication.
12167     */
12168    @Child(name = "preAuthRef", type = {StringType.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12169    @Description(shortDefinition="Preauthorization reference", formalDefinition="Reference from the Insurer which is used in later communications which refers to this adjudication." )
12170    protected List<StringType> preAuthRef;
12171
12172    /**
12173     * The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.
12174     */
12175    @Child(name = "preAuthRefPeriod", type = {Period.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12176    @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." )
12177    protected List<Period> preAuthRefPeriod;
12178
12179    /**
12180     * The members of the team who provided the products and services.
12181     */
12182    @Child(name = "careTeam", type = {}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12183    @Description(shortDefinition="Care Team members", formalDefinition="The members of the team who provided the products and services." )
12184    protected List<CareTeamComponent> careTeam;
12185
12186    /**
12187     * Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.
12188     */
12189    @Child(name = "supportingInfo", type = {}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12190    @Description(shortDefinition="Supporting information", formalDefinition="Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues." )
12191    protected List<SupportingInformationComponent> supportingInfo;
12192
12193    /**
12194     * Information about diagnoses relevant to the claim items.
12195     */
12196    @Child(name = "diagnosis", type = {}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12197    @Description(shortDefinition="Pertinent diagnosis information", formalDefinition="Information about diagnoses relevant to the claim items." )
12198    protected List<DiagnosisComponent> diagnosis;
12199
12200    /**
12201     * Procedures performed on the patient relevant to the billing items with the claim.
12202     */
12203    @Child(name = "procedure", type = {}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12204    @Description(shortDefinition="Clinical procedures performed", formalDefinition="Procedures performed on the patient relevant to the billing items with the claim." )
12205    protected List<ProcedureComponent> procedure;
12206
12207    /**
12208     * This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
12209     */
12210    @Child(name = "precedence", type = {PositiveIntType.class}, order=30, min=0, max=1, modifier=false, summary=false)
12211    @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." )
12212    protected PositiveIntType precedence;
12213
12214    /**
12215     * Financial instruments for reimbursement for the health care products and services specified on the claim.
12216     */
12217    @Child(name = "insurance", type = {}, order=31, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
12218    @Description(shortDefinition="Patient insurance information", formalDefinition="Financial instruments for reimbursement for the health care products and services specified on the claim." )
12219    protected List<InsuranceComponent> insurance;
12220
12221    /**
12222     * Details of a accident which resulted in injuries which required the products and services listed in the claim.
12223     */
12224    @Child(name = "accident", type = {}, order=32, min=0, max=1, modifier=false, summary=false)
12225    @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." )
12226    protected AccidentComponent accident;
12227
12228    /**
12229     * 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.
12230     */
12231    @Child(name = "item", type = {}, order=33, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12232    @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." )
12233    protected List<ItemComponent> item;
12234
12235    /**
12236     * The first-tier service adjudications for payor added product or service lines.
12237     */
12238    @Child(name = "addItem", type = {}, order=34, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12239    @Description(shortDefinition="Insurer added line items", formalDefinition="The first-tier service adjudications for payor added product or service lines." )
12240    protected List<AddedItemComponent> addItem;
12241
12242    /**
12243     * The adjudication results which are presented at the header level rather than at the line-item or add-item levels.
12244     */
12245    @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=35, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12246    @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." )
12247    protected List<AdjudicationComponent> adjudication;
12248
12249    /**
12250     * Categorized monetary totals for the adjudication.
12251     */
12252    @Child(name = "total", type = {}, order=36, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
12253    @Description(shortDefinition="Adjudication totals", formalDefinition="Categorized monetary totals for the adjudication." )
12254    protected List<TotalComponent> total;
12255
12256    /**
12257     * Payment details for the adjudication of the claim.
12258     */
12259    @Child(name = "payment", type = {}, order=37, min=0, max=1, modifier=false, summary=false)
12260    @Description(shortDefinition="Payment Details", formalDefinition="Payment details for the adjudication of the claim." )
12261    protected PaymentComponent payment;
12262
12263    /**
12264     * A code for the form to be used for printing the content.
12265     */
12266    @Child(name = "formCode", type = {CodeableConcept.class}, order=38, min=0, max=1, modifier=false, summary=false)
12267    @Description(shortDefinition="Printed form identifier", formalDefinition="A code for the form to be used for printing the content." )
12268    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
12269    protected CodeableConcept formCode;
12270
12271    /**
12272     * The actual form, by reference or inclusion, for printing the content or an EOB.
12273     */
12274    @Child(name = "form", type = {Attachment.class}, order=39, min=0, max=1, modifier=false, summary=false)
12275    @Description(shortDefinition="Printed reference or actual form", formalDefinition="The actual form, by reference or inclusion, for printing the content or an EOB." )
12276    protected Attachment form;
12277
12278    /**
12279     * A note that describes or explains adjudication results in a human readable form.
12280     */
12281    @Child(name = "processNote", type = {}, order=40, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12282    @Description(shortDefinition="Note concerning adjudication", formalDefinition="A note that describes or explains adjudication results in a human readable form." )
12283    protected List<NoteComponent> processNote;
12284
12285    /**
12286     * The term of the benefits documented in this response.
12287     */
12288    @Child(name = "benefitPeriod", type = {Period.class}, order=41, min=0, max=1, modifier=false, summary=false)
12289    @Description(shortDefinition="When the benefits are applicable", formalDefinition="The term of the benefits documented in this response." )
12290    protected Period benefitPeriod;
12291
12292    /**
12293     * Balance by Benefit Category.
12294     */
12295    @Child(name = "benefitBalance", type = {}, order=42, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12296    @Description(shortDefinition="Balance by Benefit Category", formalDefinition="Balance by Benefit Category." )
12297    protected List<BenefitBalanceComponent> benefitBalance;
12298
12299    private static final long serialVersionUID = -1934679453L;
12300
12301  /**
12302   * Constructor
12303   */
12304    public ExplanationOfBenefit() {
12305      super();
12306    }
12307
12308  /**
12309   * Constructor
12310   */
12311    public ExplanationOfBenefit(ExplanationOfBenefitStatus status, CodeableConcept type, Use use, Reference patient, Date created, Reference insurer, Reference provider, ClaimProcessingCodes outcome, InsuranceComponent insurance) {
12312      super();
12313      this.setStatus(status);
12314      this.setType(type);
12315      this.setUse(use);
12316      this.setPatient(patient);
12317      this.setCreated(created);
12318      this.setInsurer(insurer);
12319      this.setProvider(provider);
12320      this.setOutcome(outcome);
12321      this.addInsurance(insurance);
12322    }
12323
12324    /**
12325     * @return {@link #identifier} (A unique identifier assigned to this explanation of benefit.)
12326     */
12327    public List<Identifier> getIdentifier() { 
12328      if (this.identifier == null)
12329        this.identifier = new ArrayList<Identifier>();
12330      return this.identifier;
12331    }
12332
12333    /**
12334     * @return Returns a reference to <code>this</code> for easy method chaining
12335     */
12336    public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) { 
12337      this.identifier = theIdentifier;
12338      return this;
12339    }
12340
12341    public boolean hasIdentifier() { 
12342      if (this.identifier == null)
12343        return false;
12344      for (Identifier item : this.identifier)
12345        if (!item.isEmpty())
12346          return true;
12347      return false;
12348    }
12349
12350    public Identifier addIdentifier() { //3
12351      Identifier t = new Identifier();
12352      if (this.identifier == null)
12353        this.identifier = new ArrayList<Identifier>();
12354      this.identifier.add(t);
12355      return t;
12356    }
12357
12358    public ExplanationOfBenefit addIdentifier(Identifier t) { //3
12359      if (t == null)
12360        return this;
12361      if (this.identifier == null)
12362        this.identifier = new ArrayList<Identifier>();
12363      this.identifier.add(t);
12364      return this;
12365    }
12366
12367    /**
12368     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
12369     */
12370    public Identifier getIdentifierFirstRep() { 
12371      if (getIdentifier().isEmpty()) {
12372        addIdentifier();
12373      }
12374      return getIdentifier().get(0);
12375    }
12376
12377    /**
12378     * @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
12379     */
12380    public Enumeration<ExplanationOfBenefitStatus> getStatusElement() { 
12381      if (this.status == null)
12382        if (Configuration.errorOnAutoCreate())
12383          throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
12384        else if (Configuration.doAutoCreate())
12385          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
12386      return this.status;
12387    }
12388
12389    public boolean hasStatusElement() { 
12390      return this.status != null && !this.status.isEmpty();
12391    }
12392
12393    public boolean hasStatus() { 
12394      return this.status != null && !this.status.isEmpty();
12395    }
12396
12397    /**
12398     * @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
12399     */
12400    public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) { 
12401      this.status = value;
12402      return this;
12403    }
12404
12405    /**
12406     * @return The status of the resource instance.
12407     */
12408    public ExplanationOfBenefitStatus getStatus() { 
12409      return this.status == null ? null : this.status.getValue();
12410    }
12411
12412    /**
12413     * @param value The status of the resource instance.
12414     */
12415    public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) { 
12416        if (this.status == null)
12417          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
12418        this.status.setValue(value);
12419      return this;
12420    }
12421
12422    /**
12423     * @return {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
12424     */
12425    public CodeableConcept getType() { 
12426      if (this.type == null)
12427        if (Configuration.errorOnAutoCreate())
12428          throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
12429        else if (Configuration.doAutoCreate())
12430          this.type = new CodeableConcept(); // cc
12431      return this.type;
12432    }
12433
12434    public boolean hasType() { 
12435      return this.type != null && !this.type.isEmpty();
12436    }
12437
12438    /**
12439     * @param value {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
12440     */
12441    public ExplanationOfBenefit setType(CodeableConcept value) { 
12442      this.type = value;
12443      return this;
12444    }
12445
12446    /**
12447     * @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.)
12448     */
12449    public CodeableConcept getSubType() { 
12450      if (this.subType == null)
12451        if (Configuration.errorOnAutoCreate())
12452          throw new Error("Attempt to auto-create ExplanationOfBenefit.subType");
12453        else if (Configuration.doAutoCreate())
12454          this.subType = new CodeableConcept(); // cc
12455      return this.subType;
12456    }
12457
12458    public boolean hasSubType() { 
12459      return this.subType != null && !this.subType.isEmpty();
12460    }
12461
12462    /**
12463     * @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.)
12464     */
12465    public ExplanationOfBenefit setSubType(CodeableConcept value) { 
12466      this.subType = value;
12467      return this;
12468    }
12469
12470    /**
12471     * @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
12472     */
12473    public Enumeration<Use> getUseElement() { 
12474      if (this.use == null)
12475        if (Configuration.errorOnAutoCreate())
12476          throw new Error("Attempt to auto-create ExplanationOfBenefit.use");
12477        else if (Configuration.doAutoCreate())
12478          this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
12479      return this.use;
12480    }
12481
12482    public boolean hasUseElement() { 
12483      return this.use != null && !this.use.isEmpty();
12484    }
12485
12486    public boolean hasUse() { 
12487      return this.use != null && !this.use.isEmpty();
12488    }
12489
12490    /**
12491     * @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
12492     */
12493    public ExplanationOfBenefit setUseElement(Enumeration<Use> value) { 
12494      this.use = value;
12495      return this;
12496    }
12497
12498    /**
12499     * @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.
12500     */
12501    public Use getUse() { 
12502      return this.use == null ? null : this.use.getValue();
12503    }
12504
12505    /**
12506     * @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.
12507     */
12508    public ExplanationOfBenefit setUse(Use value) { 
12509        if (this.use == null)
12510          this.use = new Enumeration<Use>(new UseEnumFactory());
12511        this.use.setValue(value);
12512      return this;
12513    }
12514
12515    /**
12516     * @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.)
12517     */
12518    public Reference getPatient() { 
12519      if (this.patient == null)
12520        if (Configuration.errorOnAutoCreate())
12521          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
12522        else if (Configuration.doAutoCreate())
12523          this.patient = new Reference(); // cc
12524      return this.patient;
12525    }
12526
12527    public boolean hasPatient() { 
12528      return this.patient != null && !this.patient.isEmpty();
12529    }
12530
12531    /**
12532     * @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.)
12533     */
12534    public ExplanationOfBenefit setPatient(Reference value) { 
12535      this.patient = value;
12536      return this;
12537    }
12538
12539    /**
12540     * @return {@link #billablePeriod} (The period for which charges are being submitted.)
12541     */
12542    public Period getBillablePeriod() { 
12543      if (this.billablePeriod == null)
12544        if (Configuration.errorOnAutoCreate())
12545          throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
12546        else if (Configuration.doAutoCreate())
12547          this.billablePeriod = new Period(); // cc
12548      return this.billablePeriod;
12549    }
12550
12551    public boolean hasBillablePeriod() { 
12552      return this.billablePeriod != null && !this.billablePeriod.isEmpty();
12553    }
12554
12555    /**
12556     * @param value {@link #billablePeriod} (The period for which charges are being submitted.)
12557     */
12558    public ExplanationOfBenefit setBillablePeriod(Period value) { 
12559      this.billablePeriod = value;
12560      return this;
12561    }
12562
12563    /**
12564     * @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
12565     */
12566    public DateTimeType getCreatedElement() { 
12567      if (this.created == null)
12568        if (Configuration.errorOnAutoCreate())
12569          throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
12570        else if (Configuration.doAutoCreate())
12571          this.created = new DateTimeType(); // bb
12572      return this.created;
12573    }
12574
12575    public boolean hasCreatedElement() { 
12576      return this.created != null && !this.created.isEmpty();
12577    }
12578
12579    public boolean hasCreated() { 
12580      return this.created != null && !this.created.isEmpty();
12581    }
12582
12583    /**
12584     * @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
12585     */
12586    public ExplanationOfBenefit setCreatedElement(DateTimeType value) { 
12587      this.created = value;
12588      return this;
12589    }
12590
12591    /**
12592     * @return The date this resource was created.
12593     */
12594    public Date getCreated() { 
12595      return this.created == null ? null : this.created.getValue();
12596    }
12597
12598    /**
12599     * @param value The date this resource was created.
12600     */
12601    public ExplanationOfBenefit setCreated(Date value) { 
12602        if (this.created == null)
12603          this.created = new DateTimeType();
12604        this.created.setValue(value);
12605      return this;
12606    }
12607
12608    /**
12609     * @return {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
12610     */
12611    public Reference getEnterer() { 
12612      if (this.enterer == null)
12613        if (Configuration.errorOnAutoCreate())
12614          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
12615        else if (Configuration.doAutoCreate())
12616          this.enterer = new Reference(); // cc
12617      return this.enterer;
12618    }
12619
12620    public boolean hasEnterer() { 
12621      return this.enterer != null && !this.enterer.isEmpty();
12622    }
12623
12624    /**
12625     * @param value {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
12626     */
12627    public ExplanationOfBenefit setEnterer(Reference value) { 
12628      this.enterer = value;
12629      return this;
12630    }
12631
12632    /**
12633     * @return {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
12634     */
12635    public Reference getInsurer() { 
12636      if (this.insurer == null)
12637        if (Configuration.errorOnAutoCreate())
12638          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
12639        else if (Configuration.doAutoCreate())
12640          this.insurer = new Reference(); // cc
12641      return this.insurer;
12642    }
12643
12644    public boolean hasInsurer() { 
12645      return this.insurer != null && !this.insurer.isEmpty();
12646    }
12647
12648    /**
12649     * @param value {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
12650     */
12651    public ExplanationOfBenefit setInsurer(Reference value) { 
12652      this.insurer = value;
12653      return this;
12654    }
12655
12656    /**
12657     * @return {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
12658     */
12659    public Reference getProvider() { 
12660      if (this.provider == null)
12661        if (Configuration.errorOnAutoCreate())
12662          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
12663        else if (Configuration.doAutoCreate())
12664          this.provider = new Reference(); // cc
12665      return this.provider;
12666    }
12667
12668    public boolean hasProvider() { 
12669      return this.provider != null && !this.provider.isEmpty();
12670    }
12671
12672    /**
12673     * @param value {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
12674     */
12675    public ExplanationOfBenefit setProvider(Reference value) { 
12676      this.provider = value;
12677      return this;
12678    }
12679
12680    /**
12681     * @return {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, routine deferred.)
12682     */
12683    public CodeableConcept getPriority() { 
12684      if (this.priority == null)
12685        if (Configuration.errorOnAutoCreate())
12686          throw new Error("Attempt to auto-create ExplanationOfBenefit.priority");
12687        else if (Configuration.doAutoCreate())
12688          this.priority = new CodeableConcept(); // cc
12689      return this.priority;
12690    }
12691
12692    public boolean hasPriority() { 
12693      return this.priority != null && !this.priority.isEmpty();
12694    }
12695
12696    /**
12697     * @param value {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, routine deferred.)
12698     */
12699    public ExplanationOfBenefit setPriority(CodeableConcept value) { 
12700      this.priority = value;
12701      return this;
12702    }
12703
12704    /**
12705     * @return {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
12706     */
12707    public CodeableConcept getFundsReserveRequested() { 
12708      if (this.fundsReserveRequested == null)
12709        if (Configuration.errorOnAutoCreate())
12710          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserveRequested");
12711        else if (Configuration.doAutoCreate())
12712          this.fundsReserveRequested = new CodeableConcept(); // cc
12713      return this.fundsReserveRequested;
12714    }
12715
12716    public boolean hasFundsReserveRequested() { 
12717      return this.fundsReserveRequested != null && !this.fundsReserveRequested.isEmpty();
12718    }
12719
12720    /**
12721     * @param value {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
12722     */
12723    public ExplanationOfBenefit setFundsReserveRequested(CodeableConcept value) { 
12724      this.fundsReserveRequested = value;
12725      return this;
12726    }
12727
12728    /**
12729     * @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.)
12730     */
12731    public CodeableConcept getFundsReserve() { 
12732      if (this.fundsReserve == null)
12733        if (Configuration.errorOnAutoCreate())
12734          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserve");
12735        else if (Configuration.doAutoCreate())
12736          this.fundsReserve = new CodeableConcept(); // cc
12737      return this.fundsReserve;
12738    }
12739
12740    public boolean hasFundsReserve() { 
12741      return this.fundsReserve != null && !this.fundsReserve.isEmpty();
12742    }
12743
12744    /**
12745     * @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.)
12746     */
12747    public ExplanationOfBenefit setFundsReserve(CodeableConcept value) { 
12748      this.fundsReserve = value;
12749      return this;
12750    }
12751
12752    /**
12753     * @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.)
12754     */
12755    public List<RelatedClaimComponent> getRelated() { 
12756      if (this.related == null)
12757        this.related = new ArrayList<RelatedClaimComponent>();
12758      return this.related;
12759    }
12760
12761    /**
12762     * @return Returns a reference to <code>this</code> for easy method chaining
12763     */
12764    public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) { 
12765      this.related = theRelated;
12766      return this;
12767    }
12768
12769    public boolean hasRelated() { 
12770      if (this.related == null)
12771        return false;
12772      for (RelatedClaimComponent item : this.related)
12773        if (!item.isEmpty())
12774          return true;
12775      return false;
12776    }
12777
12778    public RelatedClaimComponent addRelated() { //3
12779      RelatedClaimComponent t = new RelatedClaimComponent();
12780      if (this.related == null)
12781        this.related = new ArrayList<RelatedClaimComponent>();
12782      this.related.add(t);
12783      return t;
12784    }
12785
12786    public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { //3
12787      if (t == null)
12788        return this;
12789      if (this.related == null)
12790        this.related = new ArrayList<RelatedClaimComponent>();
12791      this.related.add(t);
12792      return this;
12793    }
12794
12795    /**
12796     * @return The first repetition of repeating field {@link #related}, creating it if it does not already exist {3}
12797     */
12798    public RelatedClaimComponent getRelatedFirstRep() { 
12799      if (getRelated().isEmpty()) {
12800        addRelated();
12801      }
12802      return getRelated().get(0);
12803    }
12804
12805    /**
12806     * @return {@link #prescription} (Prescription to support the dispensing of pharmacy, device or vision products.)
12807     */
12808    public Reference getPrescription() { 
12809      if (this.prescription == null)
12810        if (Configuration.errorOnAutoCreate())
12811          throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
12812        else if (Configuration.doAutoCreate())
12813          this.prescription = new Reference(); // cc
12814      return this.prescription;
12815    }
12816
12817    public boolean hasPrescription() { 
12818      return this.prescription != null && !this.prescription.isEmpty();
12819    }
12820
12821    /**
12822     * @param value {@link #prescription} (Prescription to support the dispensing of pharmacy, device or vision products.)
12823     */
12824    public ExplanationOfBenefit setPrescription(Reference value) { 
12825      this.prescription = value;
12826      return this;
12827    }
12828
12829    /**
12830     * @return {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
12831     */
12832    public Reference getOriginalPrescription() { 
12833      if (this.originalPrescription == null)
12834        if (Configuration.errorOnAutoCreate())
12835          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
12836        else if (Configuration.doAutoCreate())
12837          this.originalPrescription = new Reference(); // cc
12838      return this.originalPrescription;
12839    }
12840
12841    public boolean hasOriginalPrescription() { 
12842      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
12843    }
12844
12845    /**
12846     * @param value {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
12847     */
12848    public ExplanationOfBenefit setOriginalPrescription(Reference value) { 
12849      this.originalPrescription = value;
12850      return this;
12851    }
12852
12853    /**
12854     * @return {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
12855     */
12856    public PayeeComponent getPayee() { 
12857      if (this.payee == null)
12858        if (Configuration.errorOnAutoCreate())
12859          throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
12860        else if (Configuration.doAutoCreate())
12861          this.payee = new PayeeComponent(); // cc
12862      return this.payee;
12863    }
12864
12865    public boolean hasPayee() { 
12866      return this.payee != null && !this.payee.isEmpty();
12867    }
12868
12869    /**
12870     * @param value {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
12871     */
12872    public ExplanationOfBenefit setPayee(PayeeComponent value) { 
12873      this.payee = value;
12874      return this;
12875    }
12876
12877    /**
12878     * @return {@link #referral} (A reference to a referral resource.)
12879     */
12880    public Reference getReferral() { 
12881      if (this.referral == null)
12882        if (Configuration.errorOnAutoCreate())
12883          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
12884        else if (Configuration.doAutoCreate())
12885          this.referral = new Reference(); // cc
12886      return this.referral;
12887    }
12888
12889    public boolean hasReferral() { 
12890      return this.referral != null && !this.referral.isEmpty();
12891    }
12892
12893    /**
12894     * @param value {@link #referral} (A reference to a referral resource.)
12895     */
12896    public ExplanationOfBenefit setReferral(Reference value) { 
12897      this.referral = value;
12898      return this;
12899    }
12900
12901    /**
12902     * @return {@link #facility} (Facility where the services were provided.)
12903     */
12904    public Reference getFacility() { 
12905      if (this.facility == null)
12906        if (Configuration.errorOnAutoCreate())
12907          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
12908        else if (Configuration.doAutoCreate())
12909          this.facility = new Reference(); // cc
12910      return this.facility;
12911    }
12912
12913    public boolean hasFacility() { 
12914      return this.facility != null && !this.facility.isEmpty();
12915    }
12916
12917    /**
12918     * @param value {@link #facility} (Facility where the services were provided.)
12919     */
12920    public ExplanationOfBenefit setFacility(Reference value) { 
12921      this.facility = value;
12922      return this;
12923    }
12924
12925    /**
12926     * @return {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
12927     */
12928    public Reference getClaim() { 
12929      if (this.claim == null)
12930        if (Configuration.errorOnAutoCreate())
12931          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
12932        else if (Configuration.doAutoCreate())
12933          this.claim = new Reference(); // cc
12934      return this.claim;
12935    }
12936
12937    public boolean hasClaim() { 
12938      return this.claim != null && !this.claim.isEmpty();
12939    }
12940
12941    /**
12942     * @param value {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
12943     */
12944    public ExplanationOfBenefit setClaim(Reference value) { 
12945      this.claim = value;
12946      return this;
12947    }
12948
12949    /**
12950     * @return {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
12951     */
12952    public Reference getClaimResponse() { 
12953      if (this.claimResponse == null)
12954        if (Configuration.errorOnAutoCreate())
12955          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
12956        else if (Configuration.doAutoCreate())
12957          this.claimResponse = new Reference(); // cc
12958      return this.claimResponse;
12959    }
12960
12961    public boolean hasClaimResponse() { 
12962      return this.claimResponse != null && !this.claimResponse.isEmpty();
12963    }
12964
12965    /**
12966     * @param value {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
12967     */
12968    public ExplanationOfBenefit setClaimResponse(Reference value) { 
12969      this.claimResponse = value;
12970      return this;
12971    }
12972
12973    /**
12974     * @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
12975     */
12976    public Enumeration<ClaimProcessingCodes> getOutcomeElement() { 
12977      if (this.outcome == null)
12978        if (Configuration.errorOnAutoCreate())
12979          throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
12980        else if (Configuration.doAutoCreate())
12981          this.outcome = new Enumeration<ClaimProcessingCodes>(new ClaimProcessingCodesEnumFactory()); // bb
12982      return this.outcome;
12983    }
12984
12985    public boolean hasOutcomeElement() { 
12986      return this.outcome != null && !this.outcome.isEmpty();
12987    }
12988
12989    public boolean hasOutcome() { 
12990      return this.outcome != null && !this.outcome.isEmpty();
12991    }
12992
12993    /**
12994     * @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
12995     */
12996    public ExplanationOfBenefit setOutcomeElement(Enumeration<ClaimProcessingCodes> value) { 
12997      this.outcome = value;
12998      return this;
12999    }
13000
13001    /**
13002     * @return The outcome of the claim, predetermination, or preauthorization processing.
13003     */
13004    public ClaimProcessingCodes getOutcome() { 
13005      return this.outcome == null ? null : this.outcome.getValue();
13006    }
13007
13008    /**
13009     * @param value The outcome of the claim, predetermination, or preauthorization processing.
13010     */
13011    public ExplanationOfBenefit setOutcome(ClaimProcessingCodes value) { 
13012        if (this.outcome == null)
13013          this.outcome = new Enumeration<ClaimProcessingCodes>(new ClaimProcessingCodesEnumFactory());
13014        this.outcome.setValue(value);
13015      return this;
13016    }
13017
13018    /**
13019     * @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
13020     */
13021    public StringType getDispositionElement() { 
13022      if (this.disposition == null)
13023        if (Configuration.errorOnAutoCreate())
13024          throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
13025        else if (Configuration.doAutoCreate())
13026          this.disposition = new StringType(); // bb
13027      return this.disposition;
13028    }
13029
13030    public boolean hasDispositionElement() { 
13031      return this.disposition != null && !this.disposition.isEmpty();
13032    }
13033
13034    public boolean hasDisposition() { 
13035      return this.disposition != null && !this.disposition.isEmpty();
13036    }
13037
13038    /**
13039     * @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
13040     */
13041    public ExplanationOfBenefit setDispositionElement(StringType value) { 
13042      this.disposition = value;
13043      return this;
13044    }
13045
13046    /**
13047     * @return A human readable description of the status of the adjudication.
13048     */
13049    public String getDisposition() { 
13050      return this.disposition == null ? null : this.disposition.getValue();
13051    }
13052
13053    /**
13054     * @param value A human readable description of the status of the adjudication.
13055     */
13056    public ExplanationOfBenefit setDisposition(String value) { 
13057      if (Utilities.noString(value))
13058        this.disposition = null;
13059      else {
13060        if (this.disposition == null)
13061          this.disposition = new StringType();
13062        this.disposition.setValue(value);
13063      }
13064      return this;
13065    }
13066
13067    /**
13068     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13069     */
13070    public List<StringType> getPreAuthRef() { 
13071      if (this.preAuthRef == null)
13072        this.preAuthRef = new ArrayList<StringType>();
13073      return this.preAuthRef;
13074    }
13075
13076    /**
13077     * @return Returns a reference to <code>this</code> for easy method chaining
13078     */
13079    public ExplanationOfBenefit setPreAuthRef(List<StringType> thePreAuthRef) { 
13080      this.preAuthRef = thePreAuthRef;
13081      return this;
13082    }
13083
13084    public boolean hasPreAuthRef() { 
13085      if (this.preAuthRef == null)
13086        return false;
13087      for (StringType item : this.preAuthRef)
13088        if (!item.isEmpty())
13089          return true;
13090      return false;
13091    }
13092
13093    /**
13094     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13095     */
13096    public StringType addPreAuthRefElement() {//2 
13097      StringType t = new StringType();
13098      if (this.preAuthRef == null)
13099        this.preAuthRef = new ArrayList<StringType>();
13100      this.preAuthRef.add(t);
13101      return t;
13102    }
13103
13104    /**
13105     * @param value {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13106     */
13107    public ExplanationOfBenefit addPreAuthRef(String value) { //1
13108      StringType t = new StringType();
13109      t.setValue(value);
13110      if (this.preAuthRef == null)
13111        this.preAuthRef = new ArrayList<StringType>();
13112      this.preAuthRef.add(t);
13113      return this;
13114    }
13115
13116    /**
13117     * @param value {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13118     */
13119    public boolean hasPreAuthRef(String value) { 
13120      if (this.preAuthRef == null)
13121        return false;
13122      for (StringType v : this.preAuthRef)
13123        if (v.getValue().equals(value)) // string
13124          return true;
13125      return false;
13126    }
13127
13128    /**
13129     * @return {@link #preAuthRefPeriod} (The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.)
13130     */
13131    public List<Period> getPreAuthRefPeriod() { 
13132      if (this.preAuthRefPeriod == null)
13133        this.preAuthRefPeriod = new ArrayList<Period>();
13134      return this.preAuthRefPeriod;
13135    }
13136
13137    /**
13138     * @return Returns a reference to <code>this</code> for easy method chaining
13139     */
13140    public ExplanationOfBenefit setPreAuthRefPeriod(List<Period> thePreAuthRefPeriod) { 
13141      this.preAuthRefPeriod = thePreAuthRefPeriod;
13142      return this;
13143    }
13144
13145    public boolean hasPreAuthRefPeriod() { 
13146      if (this.preAuthRefPeriod == null)
13147        return false;
13148      for (Period item : this.preAuthRefPeriod)
13149        if (!item.isEmpty())
13150          return true;
13151      return false;
13152    }
13153
13154    public Period addPreAuthRefPeriod() { //3
13155      Period t = new Period();
13156      if (this.preAuthRefPeriod == null)
13157        this.preAuthRefPeriod = new ArrayList<Period>();
13158      this.preAuthRefPeriod.add(t);
13159      return t;
13160    }
13161
13162    public ExplanationOfBenefit addPreAuthRefPeriod(Period t) { //3
13163      if (t == null)
13164        return this;
13165      if (this.preAuthRefPeriod == null)
13166        this.preAuthRefPeriod = new ArrayList<Period>();
13167      this.preAuthRefPeriod.add(t);
13168      return this;
13169    }
13170
13171    /**
13172     * @return The first repetition of repeating field {@link #preAuthRefPeriod}, creating it if it does not already exist {3}
13173     */
13174    public Period getPreAuthRefPeriodFirstRep() { 
13175      if (getPreAuthRefPeriod().isEmpty()) {
13176        addPreAuthRefPeriod();
13177      }
13178      return getPreAuthRefPeriod().get(0);
13179    }
13180
13181    /**
13182     * @return {@link #careTeam} (The members of the team who provided the products and services.)
13183     */
13184    public List<CareTeamComponent> getCareTeam() { 
13185      if (this.careTeam == null)
13186        this.careTeam = new ArrayList<CareTeamComponent>();
13187      return this.careTeam;
13188    }
13189
13190    /**
13191     * @return Returns a reference to <code>this</code> for easy method chaining
13192     */
13193    public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) { 
13194      this.careTeam = theCareTeam;
13195      return this;
13196    }
13197
13198    public boolean hasCareTeam() { 
13199      if (this.careTeam == null)
13200        return false;
13201      for (CareTeamComponent item : this.careTeam)
13202        if (!item.isEmpty())
13203          return true;
13204      return false;
13205    }
13206
13207    public CareTeamComponent addCareTeam() { //3
13208      CareTeamComponent t = new CareTeamComponent();
13209      if (this.careTeam == null)
13210        this.careTeam = new ArrayList<CareTeamComponent>();
13211      this.careTeam.add(t);
13212      return t;
13213    }
13214
13215    public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { //3
13216      if (t == null)
13217        return this;
13218      if (this.careTeam == null)
13219        this.careTeam = new ArrayList<CareTeamComponent>();
13220      this.careTeam.add(t);
13221      return this;
13222    }
13223
13224    /**
13225     * @return The first repetition of repeating field {@link #careTeam}, creating it if it does not already exist {3}
13226     */
13227    public CareTeamComponent getCareTeamFirstRep() { 
13228      if (getCareTeam().isEmpty()) {
13229        addCareTeam();
13230      }
13231      return getCareTeam().get(0);
13232    }
13233
13234    /**
13235     * @return {@link #supportingInfo} (Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.)
13236     */
13237    public List<SupportingInformationComponent> getSupportingInfo() { 
13238      if (this.supportingInfo == null)
13239        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13240      return this.supportingInfo;
13241    }
13242
13243    /**
13244     * @return Returns a reference to <code>this</code> for easy method chaining
13245     */
13246    public ExplanationOfBenefit setSupportingInfo(List<SupportingInformationComponent> theSupportingInfo) { 
13247      this.supportingInfo = theSupportingInfo;
13248      return this;
13249    }
13250
13251    public boolean hasSupportingInfo() { 
13252      if (this.supportingInfo == null)
13253        return false;
13254      for (SupportingInformationComponent item : this.supportingInfo)
13255        if (!item.isEmpty())
13256          return true;
13257      return false;
13258    }
13259
13260    public SupportingInformationComponent addSupportingInfo() { //3
13261      SupportingInformationComponent t = new SupportingInformationComponent();
13262      if (this.supportingInfo == null)
13263        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13264      this.supportingInfo.add(t);
13265      return t;
13266    }
13267
13268    public ExplanationOfBenefit addSupportingInfo(SupportingInformationComponent t) { //3
13269      if (t == null)
13270        return this;
13271      if (this.supportingInfo == null)
13272        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13273      this.supportingInfo.add(t);
13274      return this;
13275    }
13276
13277    /**
13278     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist {3}
13279     */
13280    public SupportingInformationComponent getSupportingInfoFirstRep() { 
13281      if (getSupportingInfo().isEmpty()) {
13282        addSupportingInfo();
13283      }
13284      return getSupportingInfo().get(0);
13285    }
13286
13287    /**
13288     * @return {@link #diagnosis} (Information about diagnoses relevant to the claim items.)
13289     */
13290    public List<DiagnosisComponent> getDiagnosis() { 
13291      if (this.diagnosis == null)
13292        this.diagnosis = new ArrayList<DiagnosisComponent>();
13293      return this.diagnosis;
13294    }
13295
13296    /**
13297     * @return Returns a reference to <code>this</code> for easy method chaining
13298     */
13299    public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
13300      this.diagnosis = theDiagnosis;
13301      return this;
13302    }
13303
13304    public boolean hasDiagnosis() { 
13305      if (this.diagnosis == null)
13306        return false;
13307      for (DiagnosisComponent item : this.diagnosis)
13308        if (!item.isEmpty())
13309          return true;
13310      return false;
13311    }
13312
13313    public DiagnosisComponent addDiagnosis() { //3
13314      DiagnosisComponent t = new DiagnosisComponent();
13315      if (this.diagnosis == null)
13316        this.diagnosis = new ArrayList<DiagnosisComponent>();
13317      this.diagnosis.add(t);
13318      return t;
13319    }
13320
13321    public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { //3
13322      if (t == null)
13323        return this;
13324      if (this.diagnosis == null)
13325        this.diagnosis = new ArrayList<DiagnosisComponent>();
13326      this.diagnosis.add(t);
13327      return this;
13328    }
13329
13330    /**
13331     * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist {3}
13332     */
13333    public DiagnosisComponent getDiagnosisFirstRep() { 
13334      if (getDiagnosis().isEmpty()) {
13335        addDiagnosis();
13336      }
13337      return getDiagnosis().get(0);
13338    }
13339
13340    /**
13341     * @return {@link #procedure} (Procedures performed on the patient relevant to the billing items with the claim.)
13342     */
13343    public List<ProcedureComponent> getProcedure() { 
13344      if (this.procedure == null)
13345        this.procedure = new ArrayList<ProcedureComponent>();
13346      return this.procedure;
13347    }
13348
13349    /**
13350     * @return Returns a reference to <code>this</code> for easy method chaining
13351     */
13352    public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) { 
13353      this.procedure = theProcedure;
13354      return this;
13355    }
13356
13357    public boolean hasProcedure() { 
13358      if (this.procedure == null)
13359        return false;
13360      for (ProcedureComponent item : this.procedure)
13361        if (!item.isEmpty())
13362          return true;
13363      return false;
13364    }
13365
13366    public ProcedureComponent addProcedure() { //3
13367      ProcedureComponent t = new ProcedureComponent();
13368      if (this.procedure == null)
13369        this.procedure = new ArrayList<ProcedureComponent>();
13370      this.procedure.add(t);
13371      return t;
13372    }
13373
13374    public ExplanationOfBenefit addProcedure(ProcedureComponent t) { //3
13375      if (t == null)
13376        return this;
13377      if (this.procedure == null)
13378        this.procedure = new ArrayList<ProcedureComponent>();
13379      this.procedure.add(t);
13380      return this;
13381    }
13382
13383    /**
13384     * @return The first repetition of repeating field {@link #procedure}, creating it if it does not already exist {3}
13385     */
13386    public ProcedureComponent getProcedureFirstRep() { 
13387      if (getProcedure().isEmpty()) {
13388        addProcedure();
13389      }
13390      return getProcedure().get(0);
13391    }
13392
13393    /**
13394     * @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
13395     */
13396    public PositiveIntType getPrecedenceElement() { 
13397      if (this.precedence == null)
13398        if (Configuration.errorOnAutoCreate())
13399          throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
13400        else if (Configuration.doAutoCreate())
13401          this.precedence = new PositiveIntType(); // bb
13402      return this.precedence;
13403    }
13404
13405    public boolean hasPrecedenceElement() { 
13406      return this.precedence != null && !this.precedence.isEmpty();
13407    }
13408
13409    public boolean hasPrecedence() { 
13410      return this.precedence != null && !this.precedence.isEmpty();
13411    }
13412
13413    /**
13414     * @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
13415     */
13416    public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) { 
13417      this.precedence = value;
13418      return this;
13419    }
13420
13421    /**
13422     * @return This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
13423     */
13424    public int getPrecedence() { 
13425      return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
13426    }
13427
13428    /**
13429     * @param value This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
13430     */
13431    public ExplanationOfBenefit setPrecedence(int value) { 
13432        if (this.precedence == null)
13433          this.precedence = new PositiveIntType();
13434        this.precedence.setValue(value);
13435      return this;
13436    }
13437
13438    /**
13439     * @return {@link #insurance} (Financial instruments for reimbursement for the health care products and services specified on the claim.)
13440     */
13441    public List<InsuranceComponent> getInsurance() { 
13442      if (this.insurance == null)
13443        this.insurance = new ArrayList<InsuranceComponent>();
13444      return this.insurance;
13445    }
13446
13447    /**
13448     * @return Returns a reference to <code>this</code> for easy method chaining
13449     */
13450    public ExplanationOfBenefit setInsurance(List<InsuranceComponent> theInsurance) { 
13451      this.insurance = theInsurance;
13452      return this;
13453    }
13454
13455    public boolean hasInsurance() { 
13456      if (this.insurance == null)
13457        return false;
13458      for (InsuranceComponent item : this.insurance)
13459        if (!item.isEmpty())
13460          return true;
13461      return false;
13462    }
13463
13464    public InsuranceComponent addInsurance() { //3
13465      InsuranceComponent t = new InsuranceComponent();
13466      if (this.insurance == null)
13467        this.insurance = new ArrayList<InsuranceComponent>();
13468      this.insurance.add(t);
13469      return t;
13470    }
13471
13472    public ExplanationOfBenefit addInsurance(InsuranceComponent t) { //3
13473      if (t == null)
13474        return this;
13475      if (this.insurance == null)
13476        this.insurance = new ArrayList<InsuranceComponent>();
13477      this.insurance.add(t);
13478      return this;
13479    }
13480
13481    /**
13482     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist {3}
13483     */
13484    public InsuranceComponent getInsuranceFirstRep() { 
13485      if (getInsurance().isEmpty()) {
13486        addInsurance();
13487      }
13488      return getInsurance().get(0);
13489    }
13490
13491    /**
13492     * @return {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
13493     */
13494    public AccidentComponent getAccident() { 
13495      if (this.accident == null)
13496        if (Configuration.errorOnAutoCreate())
13497          throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
13498        else if (Configuration.doAutoCreate())
13499          this.accident = new AccidentComponent(); // cc
13500      return this.accident;
13501    }
13502
13503    public boolean hasAccident() { 
13504      return this.accident != null && !this.accident.isEmpty();
13505    }
13506
13507    /**
13508     * @param value {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
13509     */
13510    public ExplanationOfBenefit setAccident(AccidentComponent value) { 
13511      this.accident = value;
13512      return this;
13513    }
13514
13515    /**
13516     * @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.)
13517     */
13518    public List<ItemComponent> getItem() { 
13519      if (this.item == null)
13520        this.item = new ArrayList<ItemComponent>();
13521      return this.item;
13522    }
13523
13524    /**
13525     * @return Returns a reference to <code>this</code> for easy method chaining
13526     */
13527    public ExplanationOfBenefit setItem(List<ItemComponent> theItem) { 
13528      this.item = theItem;
13529      return this;
13530    }
13531
13532    public boolean hasItem() { 
13533      if (this.item == null)
13534        return false;
13535      for (ItemComponent item : this.item)
13536        if (!item.isEmpty())
13537          return true;
13538      return false;
13539    }
13540
13541    public ItemComponent addItem() { //3
13542      ItemComponent t = new ItemComponent();
13543      if (this.item == null)
13544        this.item = new ArrayList<ItemComponent>();
13545      this.item.add(t);
13546      return t;
13547    }
13548
13549    public ExplanationOfBenefit addItem(ItemComponent t) { //3
13550      if (t == null)
13551        return this;
13552      if (this.item == null)
13553        this.item = new ArrayList<ItemComponent>();
13554      this.item.add(t);
13555      return this;
13556    }
13557
13558    /**
13559     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist {3}
13560     */
13561    public ItemComponent getItemFirstRep() { 
13562      if (getItem().isEmpty()) {
13563        addItem();
13564      }
13565      return getItem().get(0);
13566    }
13567
13568    /**
13569     * @return {@link #addItem} (The first-tier service adjudications for payor added product or service lines.)
13570     */
13571    public List<AddedItemComponent> getAddItem() { 
13572      if (this.addItem == null)
13573        this.addItem = new ArrayList<AddedItemComponent>();
13574      return this.addItem;
13575    }
13576
13577    /**
13578     * @return Returns a reference to <code>this</code> for easy method chaining
13579     */
13580    public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) { 
13581      this.addItem = theAddItem;
13582      return this;
13583    }
13584
13585    public boolean hasAddItem() { 
13586      if (this.addItem == null)
13587        return false;
13588      for (AddedItemComponent item : this.addItem)
13589        if (!item.isEmpty())
13590          return true;
13591      return false;
13592    }
13593
13594    public AddedItemComponent addAddItem() { //3
13595      AddedItemComponent t = new AddedItemComponent();
13596      if (this.addItem == null)
13597        this.addItem = new ArrayList<AddedItemComponent>();
13598      this.addItem.add(t);
13599      return t;
13600    }
13601
13602    public ExplanationOfBenefit addAddItem(AddedItemComponent t) { //3
13603      if (t == null)
13604        return this;
13605      if (this.addItem == null)
13606        this.addItem = new ArrayList<AddedItemComponent>();
13607      this.addItem.add(t);
13608      return this;
13609    }
13610
13611    /**
13612     * @return The first repetition of repeating field {@link #addItem}, creating it if it does not already exist {3}
13613     */
13614    public AddedItemComponent getAddItemFirstRep() { 
13615      if (getAddItem().isEmpty()) {
13616        addAddItem();
13617      }
13618      return getAddItem().get(0);
13619    }
13620
13621    /**
13622     * @return {@link #adjudication} (The adjudication results which are presented at the header level rather than at the line-item or add-item levels.)
13623     */
13624    public List<AdjudicationComponent> getAdjudication() { 
13625      if (this.adjudication == null)
13626        this.adjudication = new ArrayList<AdjudicationComponent>();
13627      return this.adjudication;
13628    }
13629
13630    /**
13631     * @return Returns a reference to <code>this</code> for easy method chaining
13632     */
13633    public ExplanationOfBenefit setAdjudication(List<AdjudicationComponent> theAdjudication) { 
13634      this.adjudication = theAdjudication;
13635      return this;
13636    }
13637
13638    public boolean hasAdjudication() { 
13639      if (this.adjudication == null)
13640        return false;
13641      for (AdjudicationComponent item : this.adjudication)
13642        if (!item.isEmpty())
13643          return true;
13644      return false;
13645    }
13646
13647    public AdjudicationComponent addAdjudication() { //3
13648      AdjudicationComponent t = new AdjudicationComponent();
13649      if (this.adjudication == null)
13650        this.adjudication = new ArrayList<AdjudicationComponent>();
13651      this.adjudication.add(t);
13652      return t;
13653    }
13654
13655    public ExplanationOfBenefit addAdjudication(AdjudicationComponent t) { //3
13656      if (t == null)
13657        return this;
13658      if (this.adjudication == null)
13659        this.adjudication = new ArrayList<AdjudicationComponent>();
13660      this.adjudication.add(t);
13661      return this;
13662    }
13663
13664    /**
13665     * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
13666     */
13667    public AdjudicationComponent getAdjudicationFirstRep() { 
13668      if (getAdjudication().isEmpty()) {
13669        addAdjudication();
13670      }
13671      return getAdjudication().get(0);
13672    }
13673
13674    /**
13675     * @return {@link #total} (Categorized monetary totals for the adjudication.)
13676     */
13677    public List<TotalComponent> getTotal() { 
13678      if (this.total == null)
13679        this.total = new ArrayList<TotalComponent>();
13680      return this.total;
13681    }
13682
13683    /**
13684     * @return Returns a reference to <code>this</code> for easy method chaining
13685     */
13686    public ExplanationOfBenefit setTotal(List<TotalComponent> theTotal) { 
13687      this.total = theTotal;
13688      return this;
13689    }
13690
13691    public boolean hasTotal() { 
13692      if (this.total == null)
13693        return false;
13694      for (TotalComponent item : this.total)
13695        if (!item.isEmpty())
13696          return true;
13697      return false;
13698    }
13699
13700    public TotalComponent addTotal() { //3
13701      TotalComponent t = new TotalComponent();
13702      if (this.total == null)
13703        this.total = new ArrayList<TotalComponent>();
13704      this.total.add(t);
13705      return t;
13706    }
13707
13708    public ExplanationOfBenefit addTotal(TotalComponent t) { //3
13709      if (t == null)
13710        return this;
13711      if (this.total == null)
13712        this.total = new ArrayList<TotalComponent>();
13713      this.total.add(t);
13714      return this;
13715    }
13716
13717    /**
13718     * @return The first repetition of repeating field {@link #total}, creating it if it does not already exist {3}
13719     */
13720    public TotalComponent getTotalFirstRep() { 
13721      if (getTotal().isEmpty()) {
13722        addTotal();
13723      }
13724      return getTotal().get(0);
13725    }
13726
13727    /**
13728     * @return {@link #payment} (Payment details for the adjudication of the claim.)
13729     */
13730    public PaymentComponent getPayment() { 
13731      if (this.payment == null)
13732        if (Configuration.errorOnAutoCreate())
13733          throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
13734        else if (Configuration.doAutoCreate())
13735          this.payment = new PaymentComponent(); // cc
13736      return this.payment;
13737    }
13738
13739    public boolean hasPayment() { 
13740      return this.payment != null && !this.payment.isEmpty();
13741    }
13742
13743    /**
13744     * @param value {@link #payment} (Payment details for the adjudication of the claim.)
13745     */
13746    public ExplanationOfBenefit setPayment(PaymentComponent value) { 
13747      this.payment = value;
13748      return this;
13749    }
13750
13751    /**
13752     * @return {@link #formCode} (A code for the form to be used for printing the content.)
13753     */
13754    public CodeableConcept getFormCode() { 
13755      if (this.formCode == null)
13756        if (Configuration.errorOnAutoCreate())
13757          throw new Error("Attempt to auto-create ExplanationOfBenefit.formCode");
13758        else if (Configuration.doAutoCreate())
13759          this.formCode = new CodeableConcept(); // cc
13760      return this.formCode;
13761    }
13762
13763    public boolean hasFormCode() { 
13764      return this.formCode != null && !this.formCode.isEmpty();
13765    }
13766
13767    /**
13768     * @param value {@link #formCode} (A code for the form to be used for printing the content.)
13769     */
13770    public ExplanationOfBenefit setFormCode(CodeableConcept value) { 
13771      this.formCode = value;
13772      return this;
13773    }
13774
13775    /**
13776     * @return {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
13777     */
13778    public Attachment getForm() { 
13779      if (this.form == null)
13780        if (Configuration.errorOnAutoCreate())
13781          throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
13782        else if (Configuration.doAutoCreate())
13783          this.form = new Attachment(); // cc
13784      return this.form;
13785    }
13786
13787    public boolean hasForm() { 
13788      return this.form != null && !this.form.isEmpty();
13789    }
13790
13791    /**
13792     * @param value {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
13793     */
13794    public ExplanationOfBenefit setForm(Attachment value) { 
13795      this.form = value;
13796      return this;
13797    }
13798
13799    /**
13800     * @return {@link #processNote} (A note that describes or explains adjudication results in a human readable form.)
13801     */
13802    public List<NoteComponent> getProcessNote() { 
13803      if (this.processNote == null)
13804        this.processNote = new ArrayList<NoteComponent>();
13805      return this.processNote;
13806    }
13807
13808    /**
13809     * @return Returns a reference to <code>this</code> for easy method chaining
13810     */
13811    public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) { 
13812      this.processNote = theProcessNote;
13813      return this;
13814    }
13815
13816    public boolean hasProcessNote() { 
13817      if (this.processNote == null)
13818        return false;
13819      for (NoteComponent item : this.processNote)
13820        if (!item.isEmpty())
13821          return true;
13822      return false;
13823    }
13824
13825    public NoteComponent addProcessNote() { //3
13826      NoteComponent t = new NoteComponent();
13827      if (this.processNote == null)
13828        this.processNote = new ArrayList<NoteComponent>();
13829      this.processNote.add(t);
13830      return t;
13831    }
13832
13833    public ExplanationOfBenefit addProcessNote(NoteComponent t) { //3
13834      if (t == null)
13835        return this;
13836      if (this.processNote == null)
13837        this.processNote = new ArrayList<NoteComponent>();
13838      this.processNote.add(t);
13839      return this;
13840    }
13841
13842    /**
13843     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist {3}
13844     */
13845    public NoteComponent getProcessNoteFirstRep() { 
13846      if (getProcessNote().isEmpty()) {
13847        addProcessNote();
13848      }
13849      return getProcessNote().get(0);
13850    }
13851
13852    /**
13853     * @return {@link #benefitPeriod} (The term of the benefits documented in this response.)
13854     */
13855    public Period getBenefitPeriod() { 
13856      if (this.benefitPeriod == null)
13857        if (Configuration.errorOnAutoCreate())
13858          throw new Error("Attempt to auto-create ExplanationOfBenefit.benefitPeriod");
13859        else if (Configuration.doAutoCreate())
13860          this.benefitPeriod = new Period(); // cc
13861      return this.benefitPeriod;
13862    }
13863
13864    public boolean hasBenefitPeriod() { 
13865      return this.benefitPeriod != null && !this.benefitPeriod.isEmpty();
13866    }
13867
13868    /**
13869     * @param value {@link #benefitPeriod} (The term of the benefits documented in this response.)
13870     */
13871    public ExplanationOfBenefit setBenefitPeriod(Period value) { 
13872      this.benefitPeriod = value;
13873      return this;
13874    }
13875
13876    /**
13877     * @return {@link #benefitBalance} (Balance by Benefit Category.)
13878     */
13879    public List<BenefitBalanceComponent> getBenefitBalance() { 
13880      if (this.benefitBalance == null)
13881        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
13882      return this.benefitBalance;
13883    }
13884
13885    /**
13886     * @return Returns a reference to <code>this</code> for easy method chaining
13887     */
13888    public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) { 
13889      this.benefitBalance = theBenefitBalance;
13890      return this;
13891    }
13892
13893    public boolean hasBenefitBalance() { 
13894      if (this.benefitBalance == null)
13895        return false;
13896      for (BenefitBalanceComponent item : this.benefitBalance)
13897        if (!item.isEmpty())
13898          return true;
13899      return false;
13900    }
13901
13902    public BenefitBalanceComponent addBenefitBalance() { //3
13903      BenefitBalanceComponent t = new BenefitBalanceComponent();
13904      if (this.benefitBalance == null)
13905        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
13906      this.benefitBalance.add(t);
13907      return t;
13908    }
13909
13910    public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { //3
13911      if (t == null)
13912        return this;
13913      if (this.benefitBalance == null)
13914        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
13915      this.benefitBalance.add(t);
13916      return this;
13917    }
13918
13919    /**
13920     * @return The first repetition of repeating field {@link #benefitBalance}, creating it if it does not already exist {3}
13921     */
13922    public BenefitBalanceComponent getBenefitBalanceFirstRep() { 
13923      if (getBenefitBalance().isEmpty()) {
13924        addBenefitBalance();
13925      }
13926      return getBenefitBalance().get(0);
13927    }
13928
13929      protected void listChildren(List<Property> children) {
13930        super.listChildren(children);
13931        children.add(new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier));
13932        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
13933        children.add(new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type));
13934        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));
13935        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));
13936        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));
13937        children.add(new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod));
13938        children.add(new Property("created", "dateTime", "The date this resource was created.", 0, 1, created));
13939        children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer));
13940        children.add(new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer));
13941        children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider));
13942        children.add(new Property("priority", "CodeableConcept", "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0, 1, priority));
13943        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));
13944        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));
13945        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));
13946        children.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription));
13947        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));
13948        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));
13949        children.add(new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral));
13950        children.add(new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
13951        children.add(new Property("claim", "Reference(Claim)", "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.", 0, 1, claim));
13952        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));
13953        children.add(new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome));
13954        children.add(new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition));
13955        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));
13956        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));
13957        children.add(new Property("careTeam", "", "The members of the team who provided the products and services.", 0, java.lang.Integer.MAX_VALUE, careTeam));
13958        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));
13959        children.add(new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
13960        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));
13961        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));
13962        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));
13963        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));
13964        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));
13965        children.add(new Property("addItem", "", "The first-tier service adjudications for payor added product or service lines.", 0, java.lang.Integer.MAX_VALUE, addItem));
13966        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));
13967        children.add(new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total));
13968        children.add(new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment));
13969        children.add(new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode));
13970        children.add(new Property("form", "Attachment", "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form));
13971        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));
13972        children.add(new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod));
13973        children.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
13974      }
13975
13976      @Override
13977      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
13978        switch (_hash) {
13979        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier);
13980        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
13981        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type);
13982        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);
13983        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);
13984        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);
13985        case -332066046: /*billablePeriod*/  return new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod);
13986        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date this resource was created.", 0, 1, created);
13987        case -1591951995: /*enterer*/  return new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer);
13988        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer);
13989        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);
13990        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);
13991        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);
13992        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);
13993        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);
13994        case 460301338: /*prescription*/  return new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription);
13995        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);
13996        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);
13997        case -722568291: /*referral*/  return new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral);
13998        case 501116579: /*facility*/  return new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility);
13999        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);
14000        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);
14001        case -1106507950: /*outcome*/  return new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome);
14002        case 583380919: /*disposition*/  return new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition);
14003        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);
14004        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);
14005        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);
14006        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);
14007        case 1196993265: /*diagnosis*/  return new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis);
14008        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);
14009        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);
14010        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);
14011        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);
14012        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);
14013        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);
14014        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);
14015        case 110549828: /*total*/  return new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total);
14016        case -786681338: /*payment*/  return new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment);
14017        case 473181393: /*formCode*/  return new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode);
14018        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);
14019        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);
14020        case -407369416: /*benefitPeriod*/  return new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod);
14021        case 596003397: /*benefitBalance*/  return new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance);
14022        default: return super.getNamedProperty(_hash, _name, _checkValid);
14023        }
14024
14025      }
14026
14027      @Override
14028      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
14029        switch (hash) {
14030        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
14031        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ExplanationOfBenefitStatus>
14032        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
14033        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
14034        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<Use>
14035        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
14036        case -332066046: /*billablePeriod*/ return this.billablePeriod == null ? new Base[0] : new Base[] {this.billablePeriod}; // Period
14037        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
14038        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
14039        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
14040        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
14041        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
14042        case -1688904576: /*fundsReserveRequested*/ return this.fundsReserveRequested == null ? new Base[0] : new Base[] {this.fundsReserveRequested}; // CodeableConcept
14043        case 1314609806: /*fundsReserve*/ return this.fundsReserve == null ? new Base[0] : new Base[] {this.fundsReserve}; // CodeableConcept
14044        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
14045        case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Reference
14046        case -1814015861: /*originalPrescription*/ return this.originalPrescription == null ? new Base[0] : new Base[] {this.originalPrescription}; // Reference
14047        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // PayeeComponent
14048        case -722568291: /*referral*/ return this.referral == null ? new Base[0] : new Base[] {this.referral}; // Reference
14049        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
14050        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
14051        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Reference
14052        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // Enumeration<ClaimProcessingCodes>
14053        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
14054        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
14055        case -1262920311: /*preAuthRefPeriod*/ return this.preAuthRefPeriod == null ? new Base[0] : this.preAuthRefPeriod.toArray(new Base[this.preAuthRefPeriod.size()]); // Period
14056        case -7323378: /*careTeam*/ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
14057        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // SupportingInformationComponent
14058        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
14059        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
14060        case 159695370: /*precedence*/ return this.precedence == null ? new Base[0] : new Base[] {this.precedence}; // PositiveIntType
14061        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
14062        case -2143202801: /*accident*/ return this.accident == null ? new Base[0] : new Base[] {this.accident}; // AccidentComponent
14063        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
14064        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
14065        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
14066        case 110549828: /*total*/ return this.total == null ? new Base[0] : this.total.toArray(new Base[this.total.size()]); // TotalComponent
14067        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // PaymentComponent
14068        case 473181393: /*formCode*/ return this.formCode == null ? new Base[0] : new Base[] {this.formCode}; // CodeableConcept
14069        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // Attachment
14070        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
14071        case -407369416: /*benefitPeriod*/ return this.benefitPeriod == null ? new Base[0] : new Base[] {this.benefitPeriod}; // Period
14072        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
14073        default: return super.getProperty(hash, name, checkValid);
14074        }
14075
14076      }
14077
14078      @Override
14079      public Base setProperty(int hash, String name, Base value) throws FHIRException {
14080        switch (hash) {
14081        case -1618432855: // identifier
14082          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
14083          return value;
14084        case -892481550: // status
14085          value = new ExplanationOfBenefitStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
14086          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14087          return value;
14088        case 3575610: // type
14089          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14090          return value;
14091        case -1868521062: // subType
14092          this.subType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14093          return value;
14094        case 116103: // use
14095          value = new UseEnumFactory().fromType(TypeConvertor.castToCode(value));
14096          this.use = (Enumeration) value; // Enumeration<Use>
14097          return value;
14098        case -791418107: // patient
14099          this.patient = TypeConvertor.castToReference(value); // Reference
14100          return value;
14101        case -332066046: // billablePeriod
14102          this.billablePeriod = TypeConvertor.castToPeriod(value); // Period
14103          return value;
14104        case 1028554472: // created
14105          this.created = TypeConvertor.castToDateTime(value); // DateTimeType
14106          return value;
14107        case -1591951995: // enterer
14108          this.enterer = TypeConvertor.castToReference(value); // Reference
14109          return value;
14110        case 1957615864: // insurer
14111          this.insurer = TypeConvertor.castToReference(value); // Reference
14112          return value;
14113        case -987494927: // provider
14114          this.provider = TypeConvertor.castToReference(value); // Reference
14115          return value;
14116        case -1165461084: // priority
14117          this.priority = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14118          return value;
14119        case -1688904576: // fundsReserveRequested
14120          this.fundsReserveRequested = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14121          return value;
14122        case 1314609806: // fundsReserve
14123          this.fundsReserve = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14124          return value;
14125        case 1090493483: // related
14126          this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
14127          return value;
14128        case 460301338: // prescription
14129          this.prescription = TypeConvertor.castToReference(value); // Reference
14130          return value;
14131        case -1814015861: // originalPrescription
14132          this.originalPrescription = TypeConvertor.castToReference(value); // Reference
14133          return value;
14134        case 106443592: // payee
14135          this.payee = (PayeeComponent) value; // PayeeComponent
14136          return value;
14137        case -722568291: // referral
14138          this.referral = TypeConvertor.castToReference(value); // Reference
14139          return value;
14140        case 501116579: // facility
14141          this.facility = TypeConvertor.castToReference(value); // Reference
14142          return value;
14143        case 94742588: // claim
14144          this.claim = TypeConvertor.castToReference(value); // Reference
14145          return value;
14146        case 689513629: // claimResponse
14147          this.claimResponse = TypeConvertor.castToReference(value); // Reference
14148          return value;
14149        case -1106507950: // outcome
14150          value = new ClaimProcessingCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
14151          this.outcome = (Enumeration) value; // Enumeration<ClaimProcessingCodes>
14152          return value;
14153        case 583380919: // disposition
14154          this.disposition = TypeConvertor.castToString(value); // StringType
14155          return value;
14156        case 522246568: // preAuthRef
14157          this.getPreAuthRef().add(TypeConvertor.castToString(value)); // StringType
14158          return value;
14159        case -1262920311: // preAuthRefPeriod
14160          this.getPreAuthRefPeriod().add(TypeConvertor.castToPeriod(value)); // Period
14161          return value;
14162        case -7323378: // careTeam
14163          this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
14164          return value;
14165        case 1922406657: // supportingInfo
14166          this.getSupportingInfo().add((SupportingInformationComponent) value); // SupportingInformationComponent
14167          return value;
14168        case 1196993265: // diagnosis
14169          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
14170          return value;
14171        case -1095204141: // procedure
14172          this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
14173          return value;
14174        case 159695370: // precedence
14175          this.precedence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
14176          return value;
14177        case 73049818: // insurance
14178          this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
14179          return value;
14180        case -2143202801: // accident
14181          this.accident = (AccidentComponent) value; // AccidentComponent
14182          return value;
14183        case 3242771: // item
14184          this.getItem().add((ItemComponent) value); // ItemComponent
14185          return value;
14186        case -1148899500: // addItem
14187          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
14188          return value;
14189        case -231349275: // adjudication
14190          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
14191          return value;
14192        case 110549828: // total
14193          this.getTotal().add((TotalComponent) value); // TotalComponent
14194          return value;
14195        case -786681338: // payment
14196          this.payment = (PaymentComponent) value; // PaymentComponent
14197          return value;
14198        case 473181393: // formCode
14199          this.formCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14200          return value;
14201        case 3148996: // form
14202          this.form = TypeConvertor.castToAttachment(value); // Attachment
14203          return value;
14204        case 202339073: // processNote
14205          this.getProcessNote().add((NoteComponent) value); // NoteComponent
14206          return value;
14207        case -407369416: // benefitPeriod
14208          this.benefitPeriod = TypeConvertor.castToPeriod(value); // Period
14209          return value;
14210        case 596003397: // benefitBalance
14211          this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
14212          return value;
14213        default: return super.setProperty(hash, name, value);
14214        }
14215
14216      }
14217
14218      @Override
14219      public Base setProperty(String name, Base value) throws FHIRException {
14220        if (name.equals("identifier")) {
14221          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
14222        } else if (name.equals("status")) {
14223          value = new ExplanationOfBenefitStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
14224          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14225        } else if (name.equals("type")) {
14226          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14227        } else if (name.equals("subType")) {
14228          this.subType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14229        } else if (name.equals("use")) {
14230          value = new UseEnumFactory().fromType(TypeConvertor.castToCode(value));
14231          this.use = (Enumeration) value; // Enumeration<Use>
14232        } else if (name.equals("patient")) {
14233          this.patient = TypeConvertor.castToReference(value); // Reference
14234        } else if (name.equals("billablePeriod")) {
14235          this.billablePeriod = TypeConvertor.castToPeriod(value); // Period
14236        } else if (name.equals("created")) {
14237          this.created = TypeConvertor.castToDateTime(value); // DateTimeType
14238        } else if (name.equals("enterer")) {
14239          this.enterer = TypeConvertor.castToReference(value); // Reference
14240        } else if (name.equals("insurer")) {
14241          this.insurer = TypeConvertor.castToReference(value); // Reference
14242        } else if (name.equals("provider")) {
14243          this.provider = TypeConvertor.castToReference(value); // Reference
14244        } else if (name.equals("priority")) {
14245          this.priority = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14246        } else if (name.equals("fundsReserveRequested")) {
14247          this.fundsReserveRequested = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14248        } else if (name.equals("fundsReserve")) {
14249          this.fundsReserve = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14250        } else if (name.equals("related")) {
14251          this.getRelated().add((RelatedClaimComponent) value);
14252        } else if (name.equals("prescription")) {
14253          this.prescription = TypeConvertor.castToReference(value); // Reference
14254        } else if (name.equals("originalPrescription")) {
14255          this.originalPrescription = TypeConvertor.castToReference(value); // Reference
14256        } else if (name.equals("payee")) {
14257          this.payee = (PayeeComponent) value; // PayeeComponent
14258        } else if (name.equals("referral")) {
14259          this.referral = TypeConvertor.castToReference(value); // Reference
14260        } else if (name.equals("facility")) {
14261          this.facility = TypeConvertor.castToReference(value); // Reference
14262        } else if (name.equals("claim")) {
14263          this.claim = TypeConvertor.castToReference(value); // Reference
14264        } else if (name.equals("claimResponse")) {
14265          this.claimResponse = TypeConvertor.castToReference(value); // Reference
14266        } else if (name.equals("outcome")) {
14267          value = new ClaimProcessingCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
14268          this.outcome = (Enumeration) value; // Enumeration<ClaimProcessingCodes>
14269        } else if (name.equals("disposition")) {
14270          this.disposition = TypeConvertor.castToString(value); // StringType
14271        } else if (name.equals("preAuthRef")) {
14272          this.getPreAuthRef().add(TypeConvertor.castToString(value));
14273        } else if (name.equals("preAuthRefPeriod")) {
14274          this.getPreAuthRefPeriod().add(TypeConvertor.castToPeriod(value));
14275        } else if (name.equals("careTeam")) {
14276          this.getCareTeam().add((CareTeamComponent) value);
14277        } else if (name.equals("supportingInfo")) {
14278          this.getSupportingInfo().add((SupportingInformationComponent) value);
14279        } else if (name.equals("diagnosis")) {
14280          this.getDiagnosis().add((DiagnosisComponent) value);
14281        } else if (name.equals("procedure")) {
14282          this.getProcedure().add((ProcedureComponent) value);
14283        } else if (name.equals("precedence")) {
14284          this.precedence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
14285        } else if (name.equals("insurance")) {
14286          this.getInsurance().add((InsuranceComponent) value);
14287        } else if (name.equals("accident")) {
14288          this.accident = (AccidentComponent) value; // AccidentComponent
14289        } else if (name.equals("item")) {
14290          this.getItem().add((ItemComponent) value);
14291        } else if (name.equals("addItem")) {
14292          this.getAddItem().add((AddedItemComponent) value);
14293        } else if (name.equals("adjudication")) {
14294          this.getAdjudication().add((AdjudicationComponent) value);
14295        } else if (name.equals("total")) {
14296          this.getTotal().add((TotalComponent) value);
14297        } else if (name.equals("payment")) {
14298          this.payment = (PaymentComponent) value; // PaymentComponent
14299        } else if (name.equals("formCode")) {
14300          this.formCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14301        } else if (name.equals("form")) {
14302          this.form = TypeConvertor.castToAttachment(value); // Attachment
14303        } else if (name.equals("processNote")) {
14304          this.getProcessNote().add((NoteComponent) value);
14305        } else if (name.equals("benefitPeriod")) {
14306          this.benefitPeriod = TypeConvertor.castToPeriod(value); // Period
14307        } else if (name.equals("benefitBalance")) {
14308          this.getBenefitBalance().add((BenefitBalanceComponent) value);
14309        } else
14310          return super.setProperty(name, value);
14311        return value;
14312      }
14313
14314      @Override
14315      public Base makeProperty(int hash, String name) throws FHIRException {
14316        switch (hash) {
14317        case -1618432855:  return addIdentifier(); 
14318        case -892481550:  return getStatusElement();
14319        case 3575610:  return getType();
14320        case -1868521062:  return getSubType();
14321        case 116103:  return getUseElement();
14322        case -791418107:  return getPatient();
14323        case -332066046:  return getBillablePeriod();
14324        case 1028554472:  return getCreatedElement();
14325        case -1591951995:  return getEnterer();
14326        case 1957615864:  return getInsurer();
14327        case -987494927:  return getProvider();
14328        case -1165461084:  return getPriority();
14329        case -1688904576:  return getFundsReserveRequested();
14330        case 1314609806:  return getFundsReserve();
14331        case 1090493483:  return addRelated(); 
14332        case 460301338:  return getPrescription();
14333        case -1814015861:  return getOriginalPrescription();
14334        case 106443592:  return getPayee();
14335        case -722568291:  return getReferral();
14336        case 501116579:  return getFacility();
14337        case 94742588:  return getClaim();
14338        case 689513629:  return getClaimResponse();
14339        case -1106507950:  return getOutcomeElement();
14340        case 583380919:  return getDispositionElement();
14341        case 522246568:  return addPreAuthRefElement();
14342        case -1262920311:  return addPreAuthRefPeriod(); 
14343        case -7323378:  return addCareTeam(); 
14344        case 1922406657:  return addSupportingInfo(); 
14345        case 1196993265:  return addDiagnosis(); 
14346        case -1095204141:  return addProcedure(); 
14347        case 159695370:  return getPrecedenceElement();
14348        case 73049818:  return addInsurance(); 
14349        case -2143202801:  return getAccident();
14350        case 3242771:  return addItem(); 
14351        case -1148899500:  return addAddItem(); 
14352        case -231349275:  return addAdjudication(); 
14353        case 110549828:  return addTotal(); 
14354        case -786681338:  return getPayment();
14355        case 473181393:  return getFormCode();
14356        case 3148996:  return getForm();
14357        case 202339073:  return addProcessNote(); 
14358        case -407369416:  return getBenefitPeriod();
14359        case 596003397:  return addBenefitBalance(); 
14360        default: return super.makeProperty(hash, name);
14361        }
14362
14363      }
14364
14365      @Override
14366      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
14367        switch (hash) {
14368        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
14369        case -892481550: /*status*/ return new String[] {"code"};
14370        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
14371        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
14372        case 116103: /*use*/ return new String[] {"code"};
14373        case -791418107: /*patient*/ return new String[] {"Reference"};
14374        case -332066046: /*billablePeriod*/ return new String[] {"Period"};
14375        case 1028554472: /*created*/ return new String[] {"dateTime"};
14376        case -1591951995: /*enterer*/ return new String[] {"Reference"};
14377        case 1957615864: /*insurer*/ return new String[] {"Reference"};
14378        case -987494927: /*provider*/ return new String[] {"Reference"};
14379        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
14380        case -1688904576: /*fundsReserveRequested*/ return new String[] {"CodeableConcept"};
14381        case 1314609806: /*fundsReserve*/ return new String[] {"CodeableConcept"};
14382        case 1090493483: /*related*/ return new String[] {};
14383        case 460301338: /*prescription*/ return new String[] {"Reference"};
14384        case -1814015861: /*originalPrescription*/ return new String[] {"Reference"};
14385        case 106443592: /*payee*/ return new String[] {};
14386        case -722568291: /*referral*/ return new String[] {"Reference"};
14387        case 501116579: /*facility*/ return new String[] {"Reference"};
14388        case 94742588: /*claim*/ return new String[] {"Reference"};
14389        case 689513629: /*claimResponse*/ return new String[] {"Reference"};
14390        case -1106507950: /*outcome*/ return new String[] {"code"};
14391        case 583380919: /*disposition*/ return new String[] {"string"};
14392        case 522246568: /*preAuthRef*/ return new String[] {"string"};
14393        case -1262920311: /*preAuthRefPeriod*/ return new String[] {"Period"};
14394        case -7323378: /*careTeam*/ return new String[] {};
14395        case 1922406657: /*supportingInfo*/ return new String[] {};
14396        case 1196993265: /*diagnosis*/ return new String[] {};
14397        case -1095204141: /*procedure*/ return new String[] {};
14398        case 159695370: /*precedence*/ return new String[] {"positiveInt"};
14399        case 73049818: /*insurance*/ return new String[] {};
14400        case -2143202801: /*accident*/ return new String[] {};
14401        case 3242771: /*item*/ return new String[] {};
14402        case -1148899500: /*addItem*/ return new String[] {};
14403        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
14404        case 110549828: /*total*/ return new String[] {};
14405        case -786681338: /*payment*/ return new String[] {};
14406        case 473181393: /*formCode*/ return new String[] {"CodeableConcept"};
14407        case 3148996: /*form*/ return new String[] {"Attachment"};
14408        case 202339073: /*processNote*/ return new String[] {};
14409        case -407369416: /*benefitPeriod*/ return new String[] {"Period"};
14410        case 596003397: /*benefitBalance*/ return new String[] {};
14411        default: return super.getTypesForProperty(hash, name);
14412        }
14413
14414      }
14415
14416      @Override
14417      public Base addChild(String name) throws FHIRException {
14418        if (name.equals("identifier")) {
14419          return addIdentifier();
14420        }
14421        else if (name.equals("status")) {
14422          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.status");
14423        }
14424        else if (name.equals("type")) {
14425          this.type = new CodeableConcept();
14426          return this.type;
14427        }
14428        else if (name.equals("subType")) {
14429          this.subType = new CodeableConcept();
14430          return this.subType;
14431        }
14432        else if (name.equals("use")) {
14433          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.use");
14434        }
14435        else if (name.equals("patient")) {
14436          this.patient = new Reference();
14437          return this.patient;
14438        }
14439        else if (name.equals("billablePeriod")) {
14440          this.billablePeriod = new Period();
14441          return this.billablePeriod;
14442        }
14443        else if (name.equals("created")) {
14444          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.created");
14445        }
14446        else if (name.equals("enterer")) {
14447          this.enterer = new Reference();
14448          return this.enterer;
14449        }
14450        else if (name.equals("insurer")) {
14451          this.insurer = new Reference();
14452          return this.insurer;
14453        }
14454        else if (name.equals("provider")) {
14455          this.provider = new Reference();
14456          return this.provider;
14457        }
14458        else if (name.equals("priority")) {
14459          this.priority = new CodeableConcept();
14460          return this.priority;
14461        }
14462        else if (name.equals("fundsReserveRequested")) {
14463          this.fundsReserveRequested = new CodeableConcept();
14464          return this.fundsReserveRequested;
14465        }
14466        else if (name.equals("fundsReserve")) {
14467          this.fundsReserve = new CodeableConcept();
14468          return this.fundsReserve;
14469        }
14470        else if (name.equals("related")) {
14471          return addRelated();
14472        }
14473        else if (name.equals("prescription")) {
14474          this.prescription = new Reference();
14475          return this.prescription;
14476        }
14477        else if (name.equals("originalPrescription")) {
14478          this.originalPrescription = new Reference();
14479          return this.originalPrescription;
14480        }
14481        else if (name.equals("payee")) {
14482          this.payee = new PayeeComponent();
14483          return this.payee;
14484        }
14485        else if (name.equals("referral")) {
14486          this.referral = new Reference();
14487          return this.referral;
14488        }
14489        else if (name.equals("facility")) {
14490          this.facility = new Reference();
14491          return this.facility;
14492        }
14493        else if (name.equals("claim")) {
14494          this.claim = new Reference();
14495          return this.claim;
14496        }
14497        else if (name.equals("claimResponse")) {
14498          this.claimResponse = new Reference();
14499          return this.claimResponse;
14500        }
14501        else if (name.equals("outcome")) {
14502          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.outcome");
14503        }
14504        else if (name.equals("disposition")) {
14505          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.disposition");
14506        }
14507        else if (name.equals("preAuthRef")) {
14508          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
14509        }
14510        else if (name.equals("preAuthRefPeriod")) {
14511          return addPreAuthRefPeriod();
14512        }
14513        else if (name.equals("careTeam")) {
14514          return addCareTeam();
14515        }
14516        else if (name.equals("supportingInfo")) {
14517          return addSupportingInfo();
14518        }
14519        else if (name.equals("diagnosis")) {
14520          return addDiagnosis();
14521        }
14522        else if (name.equals("procedure")) {
14523          return addProcedure();
14524        }
14525        else if (name.equals("precedence")) {
14526          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.precedence");
14527        }
14528        else if (name.equals("insurance")) {
14529          return addInsurance();
14530        }
14531        else if (name.equals("accident")) {
14532          this.accident = new AccidentComponent();
14533          return this.accident;
14534        }
14535        else if (name.equals("item")) {
14536          return addItem();
14537        }
14538        else if (name.equals("addItem")) {
14539          return addAddItem();
14540        }
14541        else if (name.equals("adjudication")) {
14542          return addAdjudication();
14543        }
14544        else if (name.equals("total")) {
14545          return addTotal();
14546        }
14547        else if (name.equals("payment")) {
14548          this.payment = new PaymentComponent();
14549          return this.payment;
14550        }
14551        else if (name.equals("formCode")) {
14552          this.formCode = new CodeableConcept();
14553          return this.formCode;
14554        }
14555        else if (name.equals("form")) {
14556          this.form = new Attachment();
14557          return this.form;
14558        }
14559        else if (name.equals("processNote")) {
14560          return addProcessNote();
14561        }
14562        else if (name.equals("benefitPeriod")) {
14563          this.benefitPeriod = new Period();
14564          return this.benefitPeriod;
14565        }
14566        else if (name.equals("benefitBalance")) {
14567          return addBenefitBalance();
14568        }
14569        else
14570          return super.addChild(name);
14571      }
14572
14573  public String fhirType() {
14574    return "ExplanationOfBenefit";
14575
14576  }
14577
14578      public ExplanationOfBenefit copy() {
14579        ExplanationOfBenefit dst = new ExplanationOfBenefit();
14580        copyValues(dst);
14581        return dst;
14582      }
14583
14584      public void copyValues(ExplanationOfBenefit dst) {
14585        super.copyValues(dst);
14586        if (identifier != null) {
14587          dst.identifier = new ArrayList<Identifier>();
14588          for (Identifier i : identifier)
14589            dst.identifier.add(i.copy());
14590        };
14591        dst.status = status == null ? null : status.copy();
14592        dst.type = type == null ? null : type.copy();
14593        dst.subType = subType == null ? null : subType.copy();
14594        dst.use = use == null ? null : use.copy();
14595        dst.patient = patient == null ? null : patient.copy();
14596        dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
14597        dst.created = created == null ? null : created.copy();
14598        dst.enterer = enterer == null ? null : enterer.copy();
14599        dst.insurer = insurer == null ? null : insurer.copy();
14600        dst.provider = provider == null ? null : provider.copy();
14601        dst.priority = priority == null ? null : priority.copy();
14602        dst.fundsReserveRequested = fundsReserveRequested == null ? null : fundsReserveRequested.copy();
14603        dst.fundsReserve = fundsReserve == null ? null : fundsReserve.copy();
14604        if (related != null) {
14605          dst.related = new ArrayList<RelatedClaimComponent>();
14606          for (RelatedClaimComponent i : related)
14607            dst.related.add(i.copy());
14608        };
14609        dst.prescription = prescription == null ? null : prescription.copy();
14610        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
14611        dst.payee = payee == null ? null : payee.copy();
14612        dst.referral = referral == null ? null : referral.copy();
14613        dst.facility = facility == null ? null : facility.copy();
14614        dst.claim = claim == null ? null : claim.copy();
14615        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
14616        dst.outcome = outcome == null ? null : outcome.copy();
14617        dst.disposition = disposition == null ? null : disposition.copy();
14618        if (preAuthRef != null) {
14619          dst.preAuthRef = new ArrayList<StringType>();
14620          for (StringType i : preAuthRef)
14621            dst.preAuthRef.add(i.copy());
14622        };
14623        if (preAuthRefPeriod != null) {
14624          dst.preAuthRefPeriod = new ArrayList<Period>();
14625          for (Period i : preAuthRefPeriod)
14626            dst.preAuthRefPeriod.add(i.copy());
14627        };
14628        if (careTeam != null) {
14629          dst.careTeam = new ArrayList<CareTeamComponent>();
14630          for (CareTeamComponent i : careTeam)
14631            dst.careTeam.add(i.copy());
14632        };
14633        if (supportingInfo != null) {
14634          dst.supportingInfo = new ArrayList<SupportingInformationComponent>();
14635          for (SupportingInformationComponent i : supportingInfo)
14636            dst.supportingInfo.add(i.copy());
14637        };
14638        if (diagnosis != null) {
14639          dst.diagnosis = new ArrayList<DiagnosisComponent>();
14640          for (DiagnosisComponent i : diagnosis)
14641            dst.diagnosis.add(i.copy());
14642        };
14643        if (procedure != null) {
14644          dst.procedure = new ArrayList<ProcedureComponent>();
14645          for (ProcedureComponent i : procedure)
14646            dst.procedure.add(i.copy());
14647        };
14648        dst.precedence = precedence == null ? null : precedence.copy();
14649        if (insurance != null) {
14650          dst.insurance = new ArrayList<InsuranceComponent>();
14651          for (InsuranceComponent i : insurance)
14652            dst.insurance.add(i.copy());
14653        };
14654        dst.accident = accident == null ? null : accident.copy();
14655        if (item != null) {
14656          dst.item = new ArrayList<ItemComponent>();
14657          for (ItemComponent i : item)
14658            dst.item.add(i.copy());
14659        };
14660        if (addItem != null) {
14661          dst.addItem = new ArrayList<AddedItemComponent>();
14662          for (AddedItemComponent i : addItem)
14663            dst.addItem.add(i.copy());
14664        };
14665        if (adjudication != null) {
14666          dst.adjudication = new ArrayList<AdjudicationComponent>();
14667          for (AdjudicationComponent i : adjudication)
14668            dst.adjudication.add(i.copy());
14669        };
14670        if (total != null) {
14671          dst.total = new ArrayList<TotalComponent>();
14672          for (TotalComponent i : total)
14673            dst.total.add(i.copy());
14674        };
14675        dst.payment = payment == null ? null : payment.copy();
14676        dst.formCode = formCode == null ? null : formCode.copy();
14677        dst.form = form == null ? null : form.copy();
14678        if (processNote != null) {
14679          dst.processNote = new ArrayList<NoteComponent>();
14680          for (NoteComponent i : processNote)
14681            dst.processNote.add(i.copy());
14682        };
14683        dst.benefitPeriod = benefitPeriod == null ? null : benefitPeriod.copy();
14684        if (benefitBalance != null) {
14685          dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14686          for (BenefitBalanceComponent i : benefitBalance)
14687            dst.benefitBalance.add(i.copy());
14688        };
14689      }
14690
14691      protected ExplanationOfBenefit typedCopy() {
14692        return copy();
14693      }
14694
14695      @Override
14696      public boolean equalsDeep(Base other_) {
14697        if (!super.equalsDeep(other_))
14698          return false;
14699        if (!(other_ instanceof ExplanationOfBenefit))
14700          return false;
14701        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
14702        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
14703           && compareDeep(subType, o.subType, true) && compareDeep(use, o.use, true) && compareDeep(patient, o.patient, true)
14704           && compareDeep(billablePeriod, o.billablePeriod, true) && compareDeep(created, o.created, true)
14705           && compareDeep(enterer, o.enterer, true) && compareDeep(insurer, o.insurer, true) && compareDeep(provider, o.provider, true)
14706           && compareDeep(priority, o.priority, true) && compareDeep(fundsReserveRequested, o.fundsReserveRequested, true)
14707           && compareDeep(fundsReserve, o.fundsReserve, true) && compareDeep(related, o.related, true) && compareDeep(prescription, o.prescription, true)
14708           && compareDeep(originalPrescription, o.originalPrescription, true) && compareDeep(payee, o.payee, true)
14709           && compareDeep(referral, o.referral, true) && compareDeep(facility, o.facility, true) && compareDeep(claim, o.claim, true)
14710           && compareDeep(claimResponse, o.claimResponse, true) && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true)
14711           && compareDeep(preAuthRef, o.preAuthRef, true) && compareDeep(preAuthRefPeriod, o.preAuthRefPeriod, true)
14712           && compareDeep(careTeam, o.careTeam, true) && compareDeep(supportingInfo, o.supportingInfo, true)
14713           && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true) && compareDeep(precedence, o.precedence, true)
14714           && compareDeep(insurance, o.insurance, true) && compareDeep(accident, o.accident, true) && compareDeep(item, o.item, true)
14715           && compareDeep(addItem, o.addItem, true) && compareDeep(adjudication, o.adjudication, true) && compareDeep(total, o.total, true)
14716           && compareDeep(payment, o.payment, true) && compareDeep(formCode, o.formCode, true) && compareDeep(form, o.form, true)
14717           && compareDeep(processNote, o.processNote, true) && compareDeep(benefitPeriod, o.benefitPeriod, true)
14718           && compareDeep(benefitBalance, o.benefitBalance, true);
14719      }
14720
14721      @Override
14722      public boolean equalsShallow(Base other_) {
14723        if (!super.equalsShallow(other_))
14724          return false;
14725        if (!(other_ instanceof ExplanationOfBenefit))
14726          return false;
14727        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
14728        return compareValues(status, o.status, true) && compareValues(use, o.use, true) && compareValues(created, o.created, true)
14729           && compareValues(outcome, o.outcome, true) && compareValues(disposition, o.disposition, true) && compareValues(preAuthRef, o.preAuthRef, true)
14730           && compareValues(precedence, o.precedence, true);
14731      }
14732
14733      public boolean isEmpty() {
14734        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
14735          , subType, use, patient, billablePeriod, created, enterer, insurer, provider
14736          , priority, fundsReserveRequested, fundsReserve, related, prescription, originalPrescription
14737          , payee, referral, facility, claim, claimResponse, outcome, disposition, preAuthRef
14738          , preAuthRefPeriod, careTeam, supportingInfo, diagnosis, procedure, precedence, insurance
14739          , accident, item, addItem, adjudication, total, payment, formCode, form, processNote
14740          , benefitPeriod, benefitBalance);
14741      }
14742
14743  @Override
14744  public ResourceType getResourceType() {
14745    return ResourceType.ExplanationOfBenefit;
14746   }
14747
14748 /**
14749   * Search parameter: <b>care-team</b>
14750   * <p>
14751   * Description: <b>Member of the CareTeam</b><br>
14752   * Type: <b>reference</b><br>
14753   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
14754   * </p>
14755   */
14756  @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 } )
14757  public static final String SP_CARE_TEAM = "care-team";
14758 /**
14759   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
14760   * <p>
14761   * Description: <b>Member of the CareTeam</b><br>
14762   * Type: <b>reference</b><br>
14763   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
14764   * </p>
14765   */
14766  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_TEAM);
14767
14768/**
14769   * Constant for fluent queries to be used to add include statements. Specifies
14770   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
14771   */
14772  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:care-team").toLocked();
14773
14774 /**
14775   * Search parameter: <b>claim</b>
14776   * <p>
14777   * Description: <b>The reference to the claim</b><br>
14778   * Type: <b>reference</b><br>
14779   * Path: <b>ExplanationOfBenefit.claim</b><br>
14780   * </p>
14781   */
14782  @SearchParamDefinition(name="claim", path="ExplanationOfBenefit.claim", description="The reference to the claim", type="reference", target={Claim.class } )
14783  public static final String SP_CLAIM = "claim";
14784 /**
14785   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
14786   * <p>
14787   * Description: <b>The reference to the claim</b><br>
14788   * Type: <b>reference</b><br>
14789   * Path: <b>ExplanationOfBenefit.claim</b><br>
14790   * </p>
14791   */
14792  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CLAIM);
14793
14794/**
14795   * Constant for fluent queries to be used to add include statements. Specifies
14796   * the path value of "<b>ExplanationOfBenefit:claim</b>".
14797   */
14798  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:claim").toLocked();
14799
14800 /**
14801   * Search parameter: <b>coverage</b>
14802   * <p>
14803   * Description: <b>The plan under which the claim was adjudicated</b><br>
14804   * Type: <b>reference</b><br>
14805   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
14806   * </p>
14807   */
14808  @SearchParamDefinition(name="coverage", path="ExplanationOfBenefit.insurance.coverage", description="The plan under which the claim was adjudicated", type="reference", target={Coverage.class } )
14809  public static final String SP_COVERAGE = "coverage";
14810 /**
14811   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
14812   * <p>
14813   * Description: <b>The plan under which the claim was adjudicated</b><br>
14814   * Type: <b>reference</b><br>
14815   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
14816   * </p>
14817   */
14818  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COVERAGE);
14819
14820/**
14821   * Constant for fluent queries to be used to add include statements. Specifies
14822   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
14823   */
14824  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:coverage").toLocked();
14825
14826 /**
14827   * Search parameter: <b>created</b>
14828   * <p>
14829   * Description: <b>The creation date for the EOB</b><br>
14830   * Type: <b>date</b><br>
14831   * Path: <b>ExplanationOfBenefit.created</b><br>
14832   * </p>
14833   */
14834  @SearchParamDefinition(name="created", path="ExplanationOfBenefit.created", description="The creation date for the EOB", type="date" )
14835  public static final String SP_CREATED = "created";
14836 /**
14837   * <b>Fluent Client</b> search parameter constant for <b>created</b>
14838   * <p>
14839   * Description: <b>The creation date for the EOB</b><br>
14840   * Type: <b>date</b><br>
14841   * Path: <b>ExplanationOfBenefit.created</b><br>
14842   * </p>
14843   */
14844  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
14845
14846 /**
14847   * Search parameter: <b>detail-udi</b>
14848   * <p>
14849   * Description: <b>UDI associated with a line item detail product or service</b><br>
14850   * Type: <b>reference</b><br>
14851   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
14852   * </p>
14853   */
14854  @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 } )
14855  public static final String SP_DETAIL_UDI = "detail-udi";
14856 /**
14857   * <b>Fluent Client</b> search parameter constant for <b>detail-udi</b>
14858   * <p>
14859   * Description: <b>UDI associated with a line item detail product or service</b><br>
14860   * Type: <b>reference</b><br>
14861   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
14862   * </p>
14863   */
14864  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DETAIL_UDI);
14865
14866/**
14867   * Constant for fluent queries to be used to add include statements. Specifies
14868   * the path value of "<b>ExplanationOfBenefit:detail-udi</b>".
14869   */
14870  public static final ca.uhn.fhir.model.api.Include INCLUDE_DETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:detail-udi").toLocked();
14871
14872 /**
14873   * Search parameter: <b>disposition</b>
14874   * <p>
14875   * Description: <b>The contents of the disposition message</b><br>
14876   * Type: <b>string</b><br>
14877   * Path: <b>ExplanationOfBenefit.disposition</b><br>
14878   * </p>
14879   */
14880  @SearchParamDefinition(name="disposition", path="ExplanationOfBenefit.disposition", description="The contents of the disposition message", type="string" )
14881  public static final String SP_DISPOSITION = "disposition";
14882 /**
14883   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
14884   * <p>
14885   * Description: <b>The contents of the disposition message</b><br>
14886   * Type: <b>string</b><br>
14887   * Path: <b>ExplanationOfBenefit.disposition</b><br>
14888   * </p>
14889   */
14890  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
14891
14892 /**
14893   * Search parameter: <b>encounter</b>
14894   * <p>
14895   * Description: <b>Encounters associated with a billed line item</b><br>
14896   * Type: <b>reference</b><br>
14897   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
14898   * </p>
14899   */
14900  @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 } )
14901  public static final String SP_ENCOUNTER = "encounter";
14902 /**
14903   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
14904   * <p>
14905   * Description: <b>Encounters associated with a billed line item</b><br>
14906   * Type: <b>reference</b><br>
14907   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
14908   * </p>
14909   */
14910  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
14911
14912/**
14913   * Constant for fluent queries to be used to add include statements. Specifies
14914   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
14915   */
14916  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:encounter").toLocked();
14917
14918 /**
14919   * Search parameter: <b>enterer</b>
14920   * <p>
14921   * Description: <b>The party responsible for the entry of the Claim</b><br>
14922   * Type: <b>reference</b><br>
14923   * Path: <b>ExplanationOfBenefit.enterer</b><br>
14924   * </p>
14925   */
14926  @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 } )
14927  public static final String SP_ENTERER = "enterer";
14928 /**
14929   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
14930   * <p>
14931   * Description: <b>The party responsible for the entry of the Claim</b><br>
14932   * Type: <b>reference</b><br>
14933   * Path: <b>ExplanationOfBenefit.enterer</b><br>
14934   * </p>
14935   */
14936  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
14937
14938/**
14939   * Constant for fluent queries to be used to add include statements. Specifies
14940   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
14941   */
14942  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:enterer").toLocked();
14943
14944 /**
14945   * Search parameter: <b>facility</b>
14946   * <p>
14947   * Description: <b>Facility responsible for the goods and services</b><br>
14948   * Type: <b>reference</b><br>
14949   * Path: <b>ExplanationOfBenefit.facility</b><br>
14950   * </p>
14951   */
14952  @SearchParamDefinition(name="facility", path="ExplanationOfBenefit.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class } )
14953  public static final String SP_FACILITY = "facility";
14954 /**
14955   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
14956   * <p>
14957   * Description: <b>Facility responsible for the goods and services</b><br>
14958   * Type: <b>reference</b><br>
14959   * Path: <b>ExplanationOfBenefit.facility</b><br>
14960   * </p>
14961   */
14962  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
14963
14964/**
14965   * Constant for fluent queries to be used to add include statements. Specifies
14966   * the path value of "<b>ExplanationOfBenefit:facility</b>".
14967   */
14968  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:facility").toLocked();
14969
14970 /**
14971   * Search parameter: <b>identifier</b>
14972   * <p>
14973   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
14974   * Type: <b>token</b><br>
14975   * Path: <b>ExplanationOfBenefit.identifier</b><br>
14976   * </p>
14977   */
14978  @SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
14979  public static final String SP_IDENTIFIER = "identifier";
14980 /**
14981   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
14982   * <p>
14983   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
14984   * Type: <b>token</b><br>
14985   * Path: <b>ExplanationOfBenefit.identifier</b><br>
14986   * </p>
14987   */
14988  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
14989
14990 /**
14991   * Search parameter: <b>item-udi</b>
14992   * <p>
14993   * Description: <b>UDI associated with a line item product or service</b><br>
14994   * Type: <b>reference</b><br>
14995   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
14996   * </p>
14997   */
14998  @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 } )
14999  public static final String SP_ITEM_UDI = "item-udi";
15000 /**
15001   * <b>Fluent Client</b> search parameter constant for <b>item-udi</b>
15002   * <p>
15003   * Description: <b>UDI associated with a line item product or service</b><br>
15004   * Type: <b>reference</b><br>
15005   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
15006   * </p>
15007   */
15008  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ITEM_UDI);
15009
15010/**
15011   * Constant for fluent queries to be used to add include statements. Specifies
15012   * the path value of "<b>ExplanationOfBenefit:item-udi</b>".
15013   */
15014  public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:item-udi").toLocked();
15015
15016 /**
15017   * Search parameter: <b>patient</b>
15018   * <p>
15019   * Description: <b>The reference to the patient</b><br>
15020   * Type: <b>reference</b><br>
15021   * Path: <b>ExplanationOfBenefit.patient</b><br>
15022   * </p>
15023   */
15024  @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 } )
15025  public static final String SP_PATIENT = "patient";
15026 /**
15027   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
15028   * <p>
15029   * Description: <b>The reference to the patient</b><br>
15030   * Type: <b>reference</b><br>
15031   * Path: <b>ExplanationOfBenefit.patient</b><br>
15032   * </p>
15033   */
15034  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
15035
15036/**
15037   * Constant for fluent queries to be used to add include statements. Specifies
15038   * the path value of "<b>ExplanationOfBenefit:patient</b>".
15039   */
15040  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:patient").toLocked();
15041
15042 /**
15043   * Search parameter: <b>payee</b>
15044   * <p>
15045   * Description: <b>The party receiving any payment for the Claim</b><br>
15046   * Type: <b>reference</b><br>
15047   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
15048   * </p>
15049   */
15050  @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 } )
15051  public static final String SP_PAYEE = "payee";
15052 /**
15053   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
15054   * <p>
15055   * Description: <b>The party receiving any payment for the Claim</b><br>
15056   * Type: <b>reference</b><br>
15057   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
15058   * </p>
15059   */
15060  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PAYEE);
15061
15062/**
15063   * Constant for fluent queries to be used to add include statements. Specifies
15064   * the path value of "<b>ExplanationOfBenefit:payee</b>".
15065   */
15066  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:payee").toLocked();
15067
15068 /**
15069   * Search parameter: <b>procedure-udi</b>
15070   * <p>
15071   * Description: <b>UDI associated with a procedure</b><br>
15072   * Type: <b>reference</b><br>
15073   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
15074   * </p>
15075   */
15076  @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 } )
15077  public static final String SP_PROCEDURE_UDI = "procedure-udi";
15078 /**
15079   * <b>Fluent Client</b> search parameter constant for <b>procedure-udi</b>
15080   * <p>
15081   * Description: <b>UDI associated with a procedure</b><br>
15082   * Type: <b>reference</b><br>
15083   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
15084   * </p>
15085   */
15086  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROCEDURE_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROCEDURE_UDI);
15087
15088/**
15089   * Constant for fluent queries to be used to add include statements. Specifies
15090   * the path value of "<b>ExplanationOfBenefit:procedure-udi</b>".
15091   */
15092  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROCEDURE_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:procedure-udi").toLocked();
15093
15094 /**
15095   * Search parameter: <b>provider</b>
15096   * <p>
15097   * Description: <b>The reference to the provider</b><br>
15098   * Type: <b>reference</b><br>
15099   * Path: <b>ExplanationOfBenefit.provider</b><br>
15100   * </p>
15101   */
15102  @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 } )
15103  public static final String SP_PROVIDER = "provider";
15104 /**
15105   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
15106   * <p>
15107   * Description: <b>The reference to the provider</b><br>
15108   * Type: <b>reference</b><br>
15109   * Path: <b>ExplanationOfBenefit.provider</b><br>
15110   * </p>
15111   */
15112  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
15113
15114/**
15115   * Constant for fluent queries to be used to add include statements. Specifies
15116   * the path value of "<b>ExplanationOfBenefit:provider</b>".
15117   */
15118  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:provider").toLocked();
15119
15120 /**
15121   * Search parameter: <b>status</b>
15122   * <p>
15123   * Description: <b>Status of the instance</b><br>
15124   * Type: <b>token</b><br>
15125   * Path: <b>ExplanationOfBenefit.status</b><br>
15126   * </p>
15127   */
15128  @SearchParamDefinition(name="status", path="ExplanationOfBenefit.status", description="Status of the instance", type="token" )
15129  public static final String SP_STATUS = "status";
15130 /**
15131   * <b>Fluent Client</b> search parameter constant for <b>status</b>
15132   * <p>
15133   * Description: <b>Status of the instance</b><br>
15134   * Type: <b>token</b><br>
15135   * Path: <b>ExplanationOfBenefit.status</b><br>
15136   * </p>
15137   */
15138  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
15139
15140 /**
15141   * Search parameter: <b>subdetail-udi</b>
15142   * <p>
15143   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
15144   * Type: <b>reference</b><br>
15145   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
15146   * </p>
15147   */
15148  @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 } )
15149  public static final String SP_SUBDETAIL_UDI = "subdetail-udi";
15150 /**
15151   * <b>Fluent Client</b> search parameter constant for <b>subdetail-udi</b>
15152   * <p>
15153   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
15154   * Type: <b>reference</b><br>
15155   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
15156   * </p>
15157   */
15158  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBDETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBDETAIL_UDI);
15159
15160/**
15161   * Constant for fluent queries to be used to add include statements. Specifies
15162   * the path value of "<b>ExplanationOfBenefit:subdetail-udi</b>".
15163   */
15164  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBDETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:subdetail-udi").toLocked();
15165
15166
15167}
15168